/* The play layer never contains account data and never intercepts code controls. */
#playground-canvas { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; display: none; }
:root[data-interactive="true"] #playground-canvas { display: block; }
:root[data-interactive="true"] .scene-art { display: none; }
:root[data-interactive="true"] .display-page { display: flex; flex-direction: column; min-height: 100dvh; }
:root[data-interactive="true"] .display-shell { flex: 1; display: grid; min-height: 450px; }
:root[data-interactive="true"] :is(.code-stage, .auth-panel, .center-state) { min-height: 0; padding-block: 46px; }
:root[data-interactive="true"] .code-grid[data-count="1"] { max-width: 740px; }
:root[data-interactive="true"] .code-card { backdrop-filter: blur(8px); }
:root[data-interactive="true"] .code-card::after { display: none; }
:root[data-interactive="true"] .code-name { letter-spacing: .02em; }
:root[data-interactive="true"] .code-countdown { color: var(--card-ink); }
:root[data-interactive="true"] .style-footer { margin-top: auto; }
.style-control, .style-controls select { min-height: 44px; }
.world-controls { position: relative; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 24px; margin: 30px clamp(18px, 4vw, 54px) 0; color: var(--scene-ink); }
.world-controls[hidden] { display: none; }
.world-caption { display: flex; align-items: center; gap: 16px; min-width: 0; }
.world-mark { flex: none; display: grid; place-items: center; font-size: 32px; width: 52px; height: 52px; border: 1px solid var(--scene-line); border-radius: var(--scene-radius); color: var(--scene-accent); }
.world-caption h2 { margin: 0 0 6px; font-size: clamp(1.15rem, 2.5vw, 1.75rem); letter-spacing: -.045em; font-family: var(--world-font, var(--font-sans)); }
.world-caption p { margin: 0; max-width: 52ch; font-size: .73rem; line-height: 1.6; }
.world-actions { display: flex; align-items: center; gap: 10px; flex: none; }
.world-play, .world-reset { font: 600 .72rem var(--font-mono); min-height: 44px; padding: 10px 16px; border-radius: 30px; border: 1px solid var(--scene-ink); box-shadow: none; }
.world-play { background: var(--scene-ink); color: var(--scene-bg); }
.world-reset { background: var(--scene-bg); color: var(--scene-ink); border-color: var(--scene-line); }
.world-actions button:hover:not(:disabled) { transform: translateY(-2px); }
.world-actions button:active:not(:disabled) { transform: translateY(1px); }
.world-actions button:disabled { opacity: .45; cursor: default; }
/* The login and empty states belong to the selected world too. */
:root[data-interactive="true"] .auth-form { width: min(100%, 440px); padding: 34px; background: var(--card-bg); color: var(--card-ink); border: 2px solid var(--card-border); border-radius: var(--scene-radius); box-shadow: var(--scene-shadow); }
:root[data-interactive="true"] .auth-form::before, :root[data-interactive="true"] .auth-form::after { display: none; }
:root[data-interactive="true"] .auth-form h1 { margin: 0 0 8px; padding: 0; background: none; border: 0; box-shadow: none; color: var(--card-ink); font: 600 1.8rem var(--world-font, var(--font-sans)); text-shadow: none; letter-spacing: -.04em; }
:root[data-interactive="true"] .auth-form label { color: var(--card-ink); }
:root[data-interactive="true"] .auth-form input { background: var(--screen-bg); color: var(--screen-ink); border: 1px solid var(--scene-line); border-radius: 6px; box-shadow: none; }
:root[data-interactive="true"] .auth-form .primary { background: var(--scene-ink); border: 1px solid var(--scene-ink); color: var(--scene-bg); border-radius: 6px; box-shadow: none; text-shadow: none; }
:root[data-interactive="true"] .auth-form :is(.field-error, .form-error) { background: var(--card-bg); color: var(--card-ink); border-color: var(--scene-accent); }
:root[data-interactive="true"] .center-state :is(a, button) { color: var(--scene-ink); }
/* 01 / Weight, paper, hard edges. */
:root[data-display-style="gravity"][data-interactive="true"] { --scene-bg: #eeeae2; --scene-ink: #22364c; --scene-line: #b7bcc1; --scene-accent: #244bdb; --card-bg: #faf8f0f2; --card-ink: #22364c; --card-border: #22364c; --screen-bg: #244bdb; --screen-ink: #fffaf0; --scene-radius: 3px; --scene-shadow: 8px 8px 0 #22364c; --world-font: "Arial Black", sans-serif; }
:root[data-display-style="gravity"][data-interactive="true"] .display-page { background-image: linear-gradient(#22364c09 1px, transparent 1px), linear-gradient(90deg, #22364c09 1px, transparent 1px); background-size: 44px 44px; }
:root[data-display-style="gravity"][data-interactive="true"] .card-code-value { letter-spacing: -.05em; font-weight: 900; }
:root[data-display-style="gravity"][data-interactive="true"] .world-mark { background: var(--scene-accent); color: #fff; border: 0; border-radius: 50%; }
/* 02 / Glazed, soft, almost weightless. */
:root[data-display-style="bubble"][data-interactive="true"] { --scene-bg: #f7e7ef; --scene-ink: #753258; --scene-line: #c89db5; --scene-accent: #ad4480; --card-bg: #fff9fbdc; --card-ink: #753258; --card-border: #ffffff; --screen-bg: #f3dce9; --screen-ink: #753258; --scene-radius: 38px; --scene-shadow: 0 18px 60px #9b598d25, inset 0 2px 0 #fff; --world-font: "Trebuchet MS", sans-serif; }
:root[data-display-style="bubble"][data-interactive="true"] .display-page { background-image: radial-gradient(ellipse at 10% 80%, #b9e9e6b3, transparent 50%), radial-gradient(ellipse at 95% 20%, #ffd8bfb3, transparent 45%); }
:root[data-display-style="bubble"][data-interactive="true"] .card-code-value { font-family: "Trebuchet MS", sans-serif; font-weight: 700; }
:root[data-display-style="bubble"][data-interactive="true"] .code-card { border-width: 3px; }
/* 03 / Night at the arcade. */
:root[data-display-style="pinball"][data-interactive="true"] { --scene-bg: #201835; --scene-ink: #ffcc70; --scene-line: #746080; --scene-accent: #f786ae; --card-bg: #30213ef2; --card-ink: #ffdeb3; --card-border: #f786ae; --screen-bg: #181222; --screen-ink: #ffcc70; --scene-radius: 22px; --scene-shadow: 0 0 0 5px #201835, 0 0 0 7px #856b86, 0 18px 50px #09041466; --world-font: "Arial Black", sans-serif; }
:root[data-display-style="pinball"][data-interactive="true"] .display-page { background-image: repeating-linear-gradient(135deg, transparent 0 74px, #f786ae08 74px 76px); }
:root[data-display-style="pinball"][data-interactive="true"] .card-code-value { background-image: radial-gradient(#ffcc701a 1px, transparent 1px); background-size: 6px 6px; text-shadow: 0 0 15px #ffcc7045; }
:root[data-display-style="pinball"][data-interactive="true"] .world-mark { border-radius: 50%; box-shadow: 0 0 0 4px #f786ae22; }
:root[data-display-style="pinball"][data-interactive="true"] .code-index { color: #201835 !important; }
/* 04 / Record sleeves and warm analogue ink. */
:root[data-display-style="vinyl"][data-interactive="true"] { --scene-bg: #efe2ca; --scene-ink: #593428; --scene-line: #b49b7a; --scene-accent: #a34127; --card-bg: #e6b279f5; --card-ink: #593428; --card-border: #593428; --screen-bg: #f5e8d0; --screen-ink: #593428; --scene-radius: 2px; --scene-shadow: 6px 7px 0 #5934282b; --world-font: Georgia, serif; }
:root[data-display-style="vinyl"][data-interactive="true"] .display-page { background-image: repeating-linear-gradient(0deg, transparent 0 3px, #59342804 3px 4px); }
:root[data-display-style="vinyl"][data-interactive="true"] .code-card { border-top-width: 12px; }
:root[data-display-style="vinyl"][data-interactive="true"] .code-name { font-family: Georgia, serif; font-weight: 700; }
:root[data-display-style="vinyl"][data-interactive="true"] .card-code-value { font-family: Georgia, serif; font-variant-numeric: lining-nums tabular-nums; }
:root[data-display-style="vinyl"][data-interactive="true"] .world-mark { border-radius: 50%; background: #593428; color: #e6b279; }
/* 05 / A quiet celestial instrument. */
:root[data-display-style="stargazer"][data-interactive="true"] { --scene-bg: #111d31; --scene-ink: #b9cce7; --scene-line: #506079; --scene-accent: #eacb88; --card-bg: #182740e8; --card-ink: #c9d9ee; --card-border: #617591; --screen-bg: #142238; --screen-ink: #f4deb0; --scene-radius: 3px; --scene-shadow: 0 20px 80px #070d1870; --world-font: Georgia, serif; }
:root[data-display-style="stargazer"][data-interactive="true"] .display-page { background-image: radial-gradient(ellipse at 50% 85%, #34476d80, transparent 70%), radial-gradient(#b9cce72b .8px, transparent .8px); background-size: auto, 53px 53px; }
:root[data-display-style="stargazer"][data-interactive="true"] .code-card { border-width: 1px; outline: 1px solid #61759140; outline-offset: 7px; }
:root[data-display-style="stargazer"][data-interactive="true"] .card-code-value { font-weight: 400; letter-spacing: .035em; }
:root[data-display-style="stargazer"][data-interactive="true"] .code-index { color: #111d31 !important; }
:root[data-display-style="stargazer"][data-interactive="true"] .world-mark { border: 0; font-size: 44px; }
/* 06 / Pebbles beneath shallow water. */
:root[data-display-style="tidepool"][data-interactive="true"] { --scene-bg: #d9eee6; --scene-ink: #245d58; --scene-line: #8eb7ab; --scene-accent: #30746b; --card-bg: #f0f8eaf0; --card-ink: #245d58; --card-border: #83b0a3; --screen-bg: #c9e3d7; --screen-ink: #245d58; --scene-radius: 44px 12px 44px 12px; --scene-shadow: 0 12px 0 #9ec8ba55, 0 24px 60px #245d5815; --world-font: Georgia, serif; }
:root[data-display-style="tidepool"][data-interactive="true"] .display-page { background-image: radial-gradient(ellipse at 20% 20%, #fbf5d780, transparent 55%), radial-gradient(ellipse at 90% 80%, #8bc9bd66, transparent 55%); }
:root[data-display-style="tidepool"][data-interactive="true"] .card-code-value { border-radius: 28px 8px 28px 8px !important; }
:root[data-display-style="tidepool"][data-interactive="true"] .code-card { border-style: double; border-width: 5px; }
/* 07 / Peel, stick, scatter. */
:root[data-display-style="sticker"][data-interactive="true"] { --scene-bg: #edddfb; --scene-ink: #392849; --scene-line: #b4a0c4; --scene-accent: #6f398b; --card-bg: #fffaf0; --card-ink: #392849; --card-border: #392849; --screen-bg: #daf084; --screen-ink: #392849; --scene-radius: 24px; --scene-shadow: 8px 8px 0 #392849; --world-font: "Arial Black", sans-serif; }
:root[data-display-style="sticker"][data-interactive="true"] .display-page { background-image: radial-gradient(#9370b13b 1px, transparent 1px); background-size: 20px 20px; }
:root[data-display-style="sticker"][data-interactive="true"] .code-card { border-width: 3px; }
:root[data-display-style="sticker"][data-interactive="true"] .card-code-value { font-weight: 900; letter-spacing: -.05em; border: 2px solid #392849 !important; }
:root[data-display-style="sticker"][data-interactive="true"] .world-mark { background: #ee906f; border: 2px solid #392849; border-radius: 16px; transform: rotate(-9deg); box-shadow: 3px 3px 0 #392849; }
/* 08 / A small, living desktop. */
:root[data-display-style="terrarium"][data-interactive="true"] { --scene-bg: #e8ebda; --scene-ink: #3d604a; --scene-line: #9aaf8c; --scene-accent: #8f5030; --card-bg: #f7f5e9f5; --card-ink: #3d604a; --card-border: #8a9e7e; --screen-bg: #e2e8cf; --screen-ink: #3d604a; --scene-radius: 60px 60px 10px 10px; --scene-shadow: 0 8px 0 #bbc5a680, 0 18px 45px #3d604a17; --world-font: Georgia, serif; }
:root[data-display-style="terrarium"][data-interactive="true"] .display-page { background-image: radial-gradient(#3d604a12 .65px, transparent .65px); background-size: 5px 5px; }
:root[data-display-style="terrarium"][data-interactive="true"] .code-card { border-width: 1px; }
:root[data-display-style="terrarium"][data-interactive="true"] .card-code-value { border-radius: 36px 36px 4px 4px !important; font-family: Georgia, serif; }
:root[data-display-style="terrarium"][data-interactive="true"] .world-mark { border-radius: 50% 50% 6px 6px; background: #d5dec3; }
/* Smaller frames keep labels clear of curved corners in large vaults. */
:root[data-interactive="true"] .code-grid:is(.is-dense, .is-packed, .is-ultra, .is-extreme) .code-card { border-radius: 16px; }
:root[data-interactive="true"] .code-grid:is(.is-dense, .is-packed, .is-ultra, .is-extreme) .card-code-value { border-radius: 8px !important; }
/* An editorial specimen drawer, with self-contained palette previews. */
.theme-library-open { overflow: hidden; }
.dialog.theme-library { color-scheme: light; width: min(1040px, calc(100% - 40px)); max-height: 88dvh; margin: auto; padding: clamp(20px, 3.5vw, 40px); border: 1px solid #c4c0b5; border-radius: 20px; color: #242722; background: #f8f7f2; box-shadow: 0 30px 100px #0005; font-family: Arial, sans-serif; }
.theme-library::backdrop { background: #131a255f; backdrop-filter: blur(10px); }
.library-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; }
.library-kicker { margin: 0 0 12px; color: #62675c; font: 700 .65rem var(--font-mono); letter-spacing: .16em; }
.library-heading h2 { margin: 0 0 10px; font: 500 clamp(1.9rem, 5vw, 2.8rem) Georgia, serif; letter-spacing: -.055em; }
#theme-library-description { font-size: .85rem; color: #62675c; margin: 0; line-height: 1.5; }
.library-close { display: grid; place-items: center; flex: none; border: 1px solid #c4c0b5; background: transparent; color: #242722; width: 44px; height: 44px; min-height: 44px; padding: 0; border-radius: 50%; box-shadow: none; font: 24px Arial, sans-serif; }
.library-filters { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; padding-block: 24px 20px; }
.library-filters button { min-height: 44px; padding: 9px 16px; font: 600 .75rem Arial, sans-serif; border: 1px solid #c4c0b5; border-radius: 24px; box-shadow: none; background: transparent; color: #444b3d; }
.library-filters button[aria-pressed="true"] { background: #30372b; color: #f8f7f2; border-color: #30372b; }
#theme-library-count { margin-left: auto; color: #62675c; font: .65rem var(--font-mono); }
.theme-library-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.theme-tile { position: relative; display: flex; flex-direction: column; min-width: 0; padding: 8px 8px 14px; color: #242722; text-align: left; border: 1px solid #d5d4c9; border-radius: 12px; background: #fffefa; box-shadow: none; transition: border-color 160ms, transform 160ms; }
.theme-tile:hover { transform: translateY(-3px); border-color: #737e66; }
.theme-tile[aria-pressed="true"] { outline: 2px solid #546b42; outline-offset: 1px; }
.theme-tile-title { font-size: .82rem; font-weight: 700; padding: 12px 5px 6px; }
.theme-tile-detail { font-size: .68rem; font-weight: 400; line-height: 1.5; padding: 0 5px 12px; color: #62675c; }
.theme-tile-badge { align-self: flex-start; margin: auto 5px 0; font: .58rem var(--font-mono); text-transform: uppercase; letter-spacing: .065em; color: #62675c; }
.theme-tile[aria-pressed="true"] .theme-tile-badge { color: #365324; }
.theme-preview { display: flex; align-items: center; justify-content: center; position: relative; width: 100%; aspect-ratio: 1.5; min-height: 105px; overflow: hidden; border-radius: 6px; background: var(--preview-0); color: var(--preview-1); }
.theme-preview::before, .theme-preview::after { content: ""; position: absolute; width: 54px; height: 54px; border: 1px solid var(--preview-1); border-radius: 50%; left: -18px; top: -17px; opacity: .4; }
.theme-preview::after { top: auto; left: auto; bottom: -20px; right: -16px; background: var(--preview-2); border: 0; width: 76px; height: 76px; opacity: .8; }
.preview-mark { position: absolute; top: 10px; right: 13px; font-size: 22px; }
.preview-digits { position: relative; z-index: 1; padding: 12px 10px; font: 700 clamp(.9rem, 2vw, 1.2rem) var(--font-mono); border: 1px solid var(--preview-1); background: var(--preview-0); box-shadow: 3px 3px 0 var(--preview-2); border-radius: 4px; }
.preview-gravity { background-image: linear-gradient(#244bdb10 1px, transparent 1px), linear-gradient(90deg, #244bdb10 1px, transparent 1px); background-size: 16px 16px; }
.preview-gravity .preview-digits { background: #244bdb; color: #fff; box-shadow: 4px 4px 0 #22364c; }
.preview-bubble .preview-digits { border: 2px solid #fff; border-radius: 25px; box-shadow: 0 6px 18px #ad448030; }
.preview-pinball .preview-digits { color: #ffcc70; border: 2px solid #f786ae; border-radius: 14px; box-shadow: 0 0 14px #f786ae30; }
.preview-vinyl .preview-digits { font-family: Georgia, serif; border-top-width: 6px; border-radius: 0; background: #e6b279; }
.preview-vinyl::after { background: repeating-radial-gradient(circle, #593428 0 3px, #744c3b 4px 5px); opacity: 1; }
.preview-stargazer { background-image: radial-gradient(#b9cce788 .6px, transparent .6px); background-size: 13px 13px; }
.preview-stargazer .preview-digits { color: #eacb88; font-weight: 400; box-shadow: none; outline: 1px solid #b9cce740; outline-offset: 4px; }
.preview-tidepool .preview-digits { border-radius: 24px 5px; background: #f0f8ea; }
.preview-sticker .preview-digits { border: 2px solid #392849; background: #daf084; border-radius: 12px; transform: rotate(-5deg); box-shadow: 4px 4px 0 #392849; }
.preview-terrarium .preview-digits { font-family: Georgia, serif; border-radius: 26px 26px 4px 4px; background: #f7f5e9; }
.preview-pixel .preview-digits, .preview-blockcraft .preview-digits, .preview-blueprint .preview-digits { border-radius: 0; border-width: 3px; }
.preview-paper .preview-digits, .preview-manga .preview-digits { font-family: Georgia, serif; transform: rotate(-3deg); }
.preview-candy .preview-digits, .preview-ocean .preview-digits, .preview-orbit .preview-digits { border-radius: 25px; }
.preview-pocket .preview-digits { border: 8px solid #bc3945; background: #c5cca2; color: #493a34; }
.library-footnote { margin: 22px 0 0; color: #62675c; font: .65rem/1.5 var(--font-mono); }
.theme-library :focus-visible { outline: 3px solid #546b42; outline-offset: 4px; }
@media (max-width: 850px) { .theme-library-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } .world-controls { align-items: flex-start; } .world-actions { flex-direction: column; align-items: stretch; gap: 5px; } }
@media (max-width: 620px) {
  .style-toolbar { align-items: flex-start; flex-direction: column; gap: 14px; padding-block: 18px; }
  .style-controls { width: 100%; display: grid; grid-template-columns: 1fr 1fr; }
  .style-controls select { max-width: none; width: 100%; grid-column: auto; }
  .world-controls { margin-top: 24px; gap: 20px; flex-direction: column; }
  .world-caption { gap: 12px; }
  .world-caption p { font-size: .69rem; }
  .world-mark { width: 44px; height: 44px; }
  .world-actions { flex-direction: row; margin-left: 56px; }
  :root[data-interactive="true"] .display-shell { min-height: 390px; }
  :root[data-interactive="true"] :is(.code-stage, .auth-panel, .center-state) { padding: 32px 20px; }
  :root[data-interactive="true"] .auth-form { padding: 28px 22px; }
  .theme-library-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .dialog.theme-library { width: calc(100% - 20px); max-height: 94dvh; padding: 22px 16px; border-radius: 16px; }
  .preview-digits { font-size: 1rem; }
  .library-filters { gap: 5px; }
  .library-filters button { padding-inline: 12px; }
  #theme-library-count { width: 100%; margin-top: 7px; }
}
@media (prefers-reduced-motion: reduce) { .theme-tile, .world-actions button, .theme-library { animation: none !important; transition: none !important; } :root[data-interactive="true"] .code-card:hover, .theme-tile:hover, .world-actions button:hover { transform: none; } }
:root[data-motion="off"] :is(.theme-tile, .world-actions button, .theme-library) { animation: none !important; transition: none !important; }
:root[data-motion="off"][data-interactive="true"] .code-card:hover, :root[data-motion="off"] .theme-tile:hover, :root[data-motion="off"] .world-actions button:hover { transform: none; }
