/* UGC creators deck: shared scene styles. Tokens come from /assets/tokens.css, runtime from /deck/deck.css.
 * Chapter styles live in ch-*.css and prefix every selector with their own class prefix (oa-, ob-, oc-, od-).
 * Shared prefix here: ug- (shell, copy, labels, stack). The UI kit (ugc.css) uses uk-. Chapters: ua- (open), ub- (levers 1-3), uc- (4-6), ud- (7-8), ue- (close).
 * Layouts (FORMAT section 7): desktop by default; compact = (max-width: 959px), (max-height: 599px);
 * phone = (max-width: 759px) and (orientation: portrait). No monospace anywhere; every text is at least 14 px. */

/* ---------- extra worlds ---------- */
.theme-meta { --s-bg: #F0F2F5; --s-fg: #1C2B33; --s-muted: #5B6B75; --s-line: #DADDE1; --s-accent: #0866FF; background: var(--s-bg); color: var(--s-fg); }
.theme-social { --s-bg: #F3F1EE; --s-fg: #111; --s-muted: #5f5d59; --s-line: #E2DED8; --s-accent: #FF7F32; background: var(--s-bg); color: var(--s-fg); }
.theme-discord { --s-bg: #1E1F22; --s-fg: #F2F3F5; --s-muted: #B5BAC1; --s-line: #3F4147; --s-accent: #5865F2; background: var(--s-bg); color: var(--s-fg); }
.theme-editor { --s-bg: #111214; --s-fg: #F4F4F5; --s-muted: #A1A1AA; --s-line: #2A2B30; --s-accent: #FF7F32; background: var(--s-bg); color: var(--s-fg); }
.theme-claude { --s-bg: #F5F4EE; --s-fg: #1f1e1d; --s-muted: #6b6a66; --s-line: #E3E0D6; --s-accent: #D97757; background: var(--s-bg); color: var(--s-fg); }
.theme-paper { --s-muted: var(--ink-2, #555); }
.deck[data-theme="meta"], .deck[data-theme="social"], .deck[data-theme="claude"] { --hud-fg: #111; }
.deck[data-theme="discord"], .deck[data-theme="editor"] { --hud-fg: #fff; }
/* dark custom themes read like night for the shared copy blocks */
.theme-discord .ug-note, .theme-editor .ug-note { color: rgb(255 255 255 / .78); }
.theme-discord .ug-src, .theme-editor .ug-src { color: rgb(255 255 255 / .62); opacity: 1; }
.theme-discord .ug-example, .theme-editor .ug-example { color: rgb(255 255 255 / .72); background: rgb(255 255 255 / .06); box-shadow: inset 0 0 0 1px rgb(255 255 255 / .16); }
.theme-discord .ug-pit, .theme-editor .ug-pit { color: #F2C9BD; }

/* ---------- the shell: every scene is built with shell() ---------- */
.scene .rm { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto minmax(0, 1fr); row-gap: clamp(14px, 2.6vh, 32px); align-items: start;
  padding: calc(var(--hud-top, 64px) + clamp(8px, 2.6vh, 36px)) clamp(24px, 5.5vw, 104px) calc(var(--hud-bottom, 100px) + clamp(4px, 1.4vh, 18px)); }
.ug-t { grid-column: 1 / -1; grid-row: 1; max-width: min(100%, 23em); font-size: clamp(28px, 2.9vw, 48px); line-height: 1.08; letter-spacing: -.028em; font-weight: 500; color: var(--s-fg); text-wrap: balance; position: relative; z-index: 2; margin: 0; }
.ug-vis { position: relative; min-width: 0; min-height: 0; }
.ug-side { position: relative; z-index: 2; display: grid; gap: 16px; align-content: start; min-width: 0; }

/* split: side text left, visual right */
.scene .ug--split { grid-template-columns: minmax(0, .36fr) minmax(0, .64fr); grid-template-rows: auto minmax(0, 1fr); column-gap: clamp(24px, 4vw, 72px); }
.ug--split .ug-t { grid-row: 1; }
.ug--split .ug-side { grid-column: 1; grid-row: 2; align-self: start; max-width: 25em; }
.ug--split .ug-vis { grid-column: 2; grid-row: 2; align-self: stretch; height: 100%; }
/* stage: side text directly under the title, the visual full width below it */
.ug--stage .ug-vis { grid-row: 3; align-self: stretch; height: 100%; }
.ug--stage .ug-side { grid-row: 2; grid-auto-flow: row; gap: 8px; align-items: start; max-width: 46em; }
/* full and right: the visual is a full-bleed layer behind the text (3D worlds) */
.scene > .ug-vis { position: absolute; inset: 0; z-index: 0; }
.scene .ug--full, .scene .ug--right { pointer-events: none; z-index: 1; }
.ug--full > *, .ug--right > * { pointer-events: auto; }
.ug--full .ug-t, .ug--right .ug-t { max-width: min(100%, 18.5em); }
.ug--full .ug-side { grid-row: 2; max-width: min(27em, 100%); align-self: start; }
.scene .ug--right { grid-template-columns: minmax(0, 1fr) minmax(0, 24em); }
.ug--right .ug-side { grid-column: 2; grid-row: 2 / 4; align-self: start; }

/* scrim so text stays readable over 3D (append with scrim(vis) after the canvas) */
.ug-scrim { position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--s-bg) 86%, transparent) 0, color-mix(in srgb, var(--s-bg) 55%, transparent) 30%, transparent 50%),
    linear-gradient(0deg, color-mix(in srgb, var(--s-bg) 70%, transparent) 0, transparent 22%),
    linear-gradient(90deg, color-mix(in srgb, var(--s-bg) 62%, transparent) 0, transparent 42%); }
.ug-gl { position: absolute; inset: 0; width: 100%; height: 100%; display: block; z-index: 0; }
.scene canvas { display: block; }
/* a DOM label over 3D, positioned with place(); never in perspective */
.ug-label { position: absolute; left: 0; top: 0; z-index: 3; pointer-events: none; white-space: nowrap; font-size: 15px; font-weight: 500; line-height: 1.25; color: var(--s-fg);
  text-shadow: 0 1px 2px rgb(0 0 0 / .55), 0 0 14px rgb(0 0 0 / .45); will-change: transform; }
.ug-label--pill { padding: 5px 10px; border-radius: 6px; background: rgb(8 8 10 / .72); box-shadow: inset 0 0 0 1px rgb(255 255 255 / .12); text-shadow: none; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.ug-label--orange { color: #FFB07A; }
.ug-label--rose { color: #F2C9BD; }
.ug-label--muted { color: rgb(255 255 255 / .72); }

/* ---------- copy blocks ---------- */
.scene .ug-note { font-size: clamp(16px, 1.3vw, 20px); line-height: 1.48; color: var(--s-muted); max-width: 30em; margin: 0; }
.theme-night .ug-note, .theme-ink .ug-note { color: rgb(255 255 255 / .78); }
.ug-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.ug-steps li { position: relative; padding-left: 22px; font-size: clamp(16px, 1.26vw, 19px); line-height: 1.4; color: var(--s-fg); }
.ug-steps li::before { content: ""; position: absolute; left: 2px; top: .52em; width: 8px; height: 8px; border-radius: 50%; background: var(--cta, #FF7F32); }
.scene .ug-pit { display: flex; gap: 10px; align-items: flex-start; font-size: clamp(15px, 1.18vw, 18px); line-height: 1.45; color: var(--c-rose-t, #85503F); max-width: 30em; margin: 0; }
.ug-pit__i { flex: none; display: grid; place-items: center; width: 26px; height: 26px; margin-top: -1px; border-radius: 4px; background: color-mix(in srgb, var(--c-rose, #E1B5A8) 45%, transparent); color: var(--c-rose-t, #85503F); }
.theme-ink .ug-pit, .theme-night .ug-pit { color: #F2C9BD; }
.theme-ink .ug-pit__i, .theme-night .ug-pit__i { background: rgb(225 181 168 / .16); color: #F2C9BD; }
.ug-src { display: inline-block; font-size: 14px; line-height: 1.4; font-weight: 500; color: var(--s-muted); opacity: .86; }
.theme-night .ug-src, .theme-ink .ug-src { color: rgb(255 255 255 / .62); opacity: 1; }
.ug-src--line { display: block; margin-top: 4px; }
.ug-stat { display: grid; gap: 4px; align-content: start; }
.ug-stat__v { font-size: clamp(36px, 4.4vw, 76px); line-height: 1; letter-spacing: -.035em; font-weight: 500; font-variant-numeric: tabular-nums; color: var(--s-fg); }
.ug-stat--sm .ug-stat__v { font-size: clamp(28px, 2.7vw, 44px); }
.ug-stat--xl .ug-stat__v { font-size: clamp(52px, 7.6vw, 132px); }
.ug-stat--orange .ug-stat__v { color: var(--cta, #FF7F32); }
.ug-stat--rose .ug-stat__v { color: var(--c-rose-t, #85503F); }
.theme-ink .ug-stat--rose .ug-stat__v, .theme-night .ug-stat--rose .ug-stat__v { color: #F2C9BD; }
.ug-stat__l { font-size: clamp(15px, 1.12vw, 18px); line-height: 1.4; color: var(--s-fg); max-width: 26em; }
.ug-tag { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 4px; font-size: 14px; font-weight: 500; white-space: nowrap; }
.ug-tag--line { box-shadow: inset 0 0 0 1px var(--s-line); color: var(--s-fg); }
.ug-tag--orange { background: var(--cta, #FF7F32); color: #fff; }
.ug-tag--rose { background: var(--c-rose, #E1B5A8); color: var(--c-rose-t, #85503F); }
.ug-tag--aqua { background: var(--c-aqua, #9CE7DD); color: var(--c-aqua-t, #1C6A60); }
.ug-tag--ink { background: #111; color: #fff; }
/* the Example tag on every illustrative mock */
.ug-example { display: inline-flex; align-items: center; height: 24px; padding: 0 9px; border-radius: 999px; font-size: 14px; font-weight: 500; line-height: 1; color: #576F76; background: rgb(255 255 255 / .86); box-shadow: inset 0 0 0 1px #DFE4E7; white-space: nowrap; }
.theme-night .ug-example, .theme-ink .ug-example { color: rgb(255 255 255 / .72); background: rgb(255 255 255 / .06); box-shadow: inset 0 0 0 1px rgb(255 255 255 / .16); }
.ug-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* surfaces */
.ug-card { position: relative; background: #fff; border-radius: 8px; color: var(--ink, #111); box-shadow: inset 0 0 0 1px var(--ll-line, #E4E2DD), 0 1px 2px rgba(17,17,17,.04), 0 8px 22px -14px rgba(17,17,17,.12); }
.ug-dark { position: relative; background: #111; color: #fff; border-radius: 8px; box-shadow: 0 18px 40px -26px rgba(28,106,96,.4); }
.ug-stroke::after { content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 2px; pointer-events: none; background: var(--accent-stroke);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); mask-composite: exclude; }

/* halftone bars: --v from 0 to 1 */
.ug-ht { position: relative; height: 18px; border-radius: 3px; box-shadow: inset 0 0 0 1px var(--s-line); overflow: hidden; --dot: #A9A6A0; }
.ug-ht i { position: absolute; left: 3px; top: 3px; bottom: 3px; width: calc(100% - 6px); background: radial-gradient(circle, var(--dot) 1.5px, transparent 1.9px) 0 0 / 5px 5px; clip-path: inset(0 calc((1 - var(--v, 0)) * 100%) 0 0); transition: clip-path 1.2s var(--ease, cubic-bezier(.2,.8,.2,1)); }
.ug-ht--v { width: 22px; height: auto; }
.ug-ht--v i { left: 3px; right: 3px; top: 3px; bottom: 3px; width: auto; clip-path: inset(calc((1 - var(--v, 0)) * 100%) 0 0 0); }
.ug-ht--orange { --dot: var(--cta, #FF7F32); }
.ug-ht--rose { --dot: var(--c-rose-d, #C79586); }
.ug-ht--aqua { --dot: var(--c-aqua-d, #66CDBF); }
.ug-ht--lilac { --dot: #A996D8; }
.ug-ht--grey { --dot: #A9A6A0; }
.theme-ink .ug-ht--grey, .theme-night .ug-ht--grey { --dot: rgb(255 255 255 / .42); }

/* departure board: Satoshi with tabular numbers (no monospace) */
.flap { display: inline-flex; gap: 2px; font: 600 clamp(18px, 1.8vw, 28px)/1 var(--font-sans); font-variant-numeric: tabular-nums; }
.flap__c { position: relative; display: inline-block; width: .74em; height: 1.32em; overflow: hidden; background: #0a0a0b; color: #fff; border-radius: 3px; text-align: center; box-shadow: inset 0 -1px 0 rgb(255 255 255 / .05); }
.flap__c::after { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: rgb(0 0 0 / .7); }
.flap__s { display: flex; flex-direction: column; transition: transform 1.3s cubic-bezier(.2, .8, .2, 1); }
.flap__s span { display: block; height: 1.32em; line-height: 1.32em; }

/* typing caret */
.ug-typing::after { content: ""; display: inline-block; width: 2px; height: 1em; margin-left: 2px; vertical-align: -0.12em; background: currentColor; animation: ug-blink 1s steps(1) infinite; }
@keyframes ug-blink { 50% { opacity: 0; } }

/* sliders */
.scene input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 28px; margin: 0; background: transparent; cursor: pointer; --trk: rgb(0 0 0 / .16); }
.theme-ink input[type="range"], .theme-night input[type="range"] { --trk: rgb(255 255 255 / .3); }
.scene input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: var(--trk); }
.scene input[type="range"]::-moz-range-track { height: 4px; border-radius: 2px; background: var(--trk); }
.scene input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; margin-top: -9px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 2px var(--cta, #FF7F32), 0 4px 10px rgb(0 0 0 / .25); }
.scene input[type="range"]::-moz-range-thumb { width: 22px; height: 22px; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 0 0 2px var(--cta, #FF7F32), 0 4px 10px rgb(0 0 0 / .25); }
.scene input[type="range"]:focus-visible { outline: 2px solid var(--cta, #FF7F32); outline-offset: 4px; border-radius: 4px; }

.scene [data-show]:not(.is-on), .scene [data-hide]:not(.is-on) { pointer-events: none; }
/* round 5: supporting text that belongs to another beat takes no room, so the current beat's text sits right under the title */
.scene .ug-side [data-show]:not(.is-on), .scene .ug-side [data-hide]:not(.is-on) { display: none; }
/* beat texts stacked in one cell start at its top edge */
.scene .ug-side [data-show], .scene .ug-side [data-hide] { align-self: start; }

/* ---------- compact: short or narrow landscape ---------- */
@media (max-width: 959px), (max-height: 599px) {
  .scene .rm { row-gap: 10px; padding-left: clamp(20px, 4vw, 40px); padding-right: clamp(20px, 4vw, 40px); padding-top: calc(var(--hud-top, 52px) + 6px); padding-bottom: calc(var(--hud-bottom, 80px) + 2px); }
  .ug-t { font-size: clamp(22px, 3.1vw, 30px); line-height: 1.12; letter-spacing: -.02em; }
  .ug--full .ug-t, .ug--right .ug-t { max-width: min(100%, 20em); }
  .ug-side { gap: 10px; }
  .scene .ug-note { font-size: 15px; line-height: 1.42; }
  .ug-steps li { font-size: 15px; }
  .scene .ug-pit { font-size: 14px; }
  .ug-stat__v { font-size: clamp(28px, 4.4vw, 44px); }
  .ug-stat--xl .ug-stat__v { font-size: clamp(40px, 7vw, 64px); }
  .ug-stat__l { font-size: 14px; }
  .ug-label { font-size: 14px; }
  .flap { font-size: 18px; }
}

/* ---------- phone: portrait and narrower than 760 ---------- */
@media (max-width: 759px) and (orientation: portrait) {
  .scene .rm { padding-left: 16px; padding-right: 16px; row-gap: 12px; padding-top: calc(var(--hud-top, 56px) + 10px); padding-bottom: calc(var(--hud-bottom, 96px) + 4px); }
  .ug-t { font-size: clamp(22px, 6.2vw, 27px); line-height: 1.15; letter-spacing: -.02em; }
  .scene .ug--split { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto minmax(0, 1fr); row-gap: 12px; }
  .ug--split .ug-side { grid-column: 1; grid-row: 2; align-self: start; }
  .ug--split .ug-vis { grid-column: 1; grid-row: 3; }
  .ug--stage .ug-side { grid-auto-flow: row; gap: 10px; }
  .scene .ug--right { grid-template-columns: minmax(0, 1fr); }
  .ug--right .ug-side { grid-column: 1; grid-row: 2; align-self: start; }
  .ug--full .ug-side { max-width: 100%; }
  .ug-side { gap: 10px; }
  .scene .ug-note { font-size: 15px; }
  .ug-steps { gap: 8px; }
  .ug-steps li { font-size: 15px; padding-left: 18px; }
  .scene .ug-pit { font-size: 14px; }
  .ug-pit__i { width: 22px; height: 22px; }
  .ug-stat__v { font-size: clamp(30px, 9vw, 40px); }
  .ug-stat__l { font-size: 14px; }
  .ug-label { font-size: 14px; }
  .flap { font-size: 16px; }
}
/* round 5: a later beat's text never holds space in the column, even where a chapter rule forces its display */
.scene .ug-side [data-show]:not(.is-on) { display: none !important; }

/* a beat-driven word block: several texts in one grid cell (stack() in lib.js) */
.ug-stack { display: grid; }
.ug-stack > * { grid-area: 1 / 1; }
