/* Studio: "Modern blocky" (ADR 0129). Tokens come from /shared/brand/tokens.css (generated from brand.json, fonts
   included), loaded before this file. Square corners, 2px borders, block shadows, one accent (accent).
   No inline styles anywhere (CSP style-src 'self'); everything is classes. */
:root { color-scheme: dark; }
/* Inter, Pixelify Sans, Silkscreen and Jersey 15 are Latin(+digits) subsets: for Chinese, Japanese and Russian every
   stack continues with system fonts that have those glyphs (per-language, so Japanese never gets Chinese glyph forms).
   :lang() follows <html lang>, which i18n.js sets to the Studio locale. */
:root:lang(zh-Hans) { --font-script: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", "Noto Sans CJK SC", "Source Han Sans SC"; }
:root:lang(ja) { --font-script: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Yu Gothic", "Meiryo", "Noto Sans JP", "Noto Sans CJK JP"; }
:root:lang(ru) { --font-script: "Segoe UI", Roboto, "Helvetica Neue", Arial; }
:root:lang(zh-Hans), :root:lang(ja), :root:lang(ru) {
  --font-body: "Inter", var(--font-script), ui-sans-serif, system-ui, sans-serif;
  --font-display: "Pixelify Sans", "Inter", var(--font-script), ui-sans-serif, system-ui, sans-serif;
  --font-label: "Silkscreen", var(--font-script), ui-sans-serif, system-ui, sans-serif;
  --font-numeric: "Jersey 15", "Pixelify Sans", var(--font-script), ui-sans-serif, system-ui, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.55 var(--font-body); }
a { color: var(--accent); }
a:hover { color: var(--accent-light); }
h1, h2, h3 { line-height: 1.25; color: var(--text-strong); }
h1 { font-size: 1.75rem; font-weight: 700; margin: 0 0 var(--sp-4); }
h2 { font-size: 1.15rem; font-weight: 700; margin: 0 0 var(--sp-3); }
h3 { font-family: var(--font-display); font-size: 1.25rem; font-weight: 600; margin: 0 0 var(--sp-2); }
p { margin: 0 0 var(--sp-3); }
code, pre, .mono { font-family: var(--font-mono); }
code { background: var(--bg-deep); border: 1px solid var(--border); padding: .1em .35em; font-size: .9em; }
pre { background: var(--bg-deep); border: var(--border-w) solid var(--border); padding: var(--sp-3); overflow: auto; }
pre code { padding: 0; background: none; border: 0; }
blockquote { margin: 0 0 var(--sp-3); padding-left: var(--sp-3); border-left: 4px solid var(--border-strong); color: var(--muted); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); } .grow { flex: 1 1 auto; } .warn { color: var(--accent-light); } .error-text { color: var(--redstone); }
.mono { font-size: .85em; overflow-wrap: anywhere; }
.label-sm { font: 400 .75rem/1 var(--font-label); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

/* Top bar: block shadow, mark + wordmark, accent underline on the active nav */
.top { display: flex; align-items: center; gap: var(--sp-2) var(--sp-4); padding: var(--sp-3) var(--gutter); background: var(--surface); border: var(--border-w) solid var(--border); box-shadow: var(--shadow-block); margin-bottom: var(--sp-1); flex-wrap: wrap; }
.top nav { display: flex; gap: var(--sp-1); flex-wrap: wrap; }
.top nav a { display: inline-flex; align-items: center; min-height: 44px; color: var(--muted); text-decoration: none; font-weight: 600; font-size: .875rem; padding: var(--sp-2) var(--sp-3); border-bottom: 2px solid transparent; }
.top nav a:hover { color: var(--text); }
.top nav a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); }
.brand { display: inline-flex; align-items: center; gap: 10px; font: 600 22px/1 var(--font-display); color: var(--text); text-decoration: none; }
.brand:hover { color: var(--text-strong); }
.brand-mark { width: 26px; height: 26px; flex: none; }
.credits { display: inline-flex; align-items: center; gap: var(--sp-2); background: var(--bg); border: var(--border-w) solid var(--border-strong); color: var(--gold); font: 400 1.125rem/1 var(--font-numeric); padding: var(--sp-2) 10px; text-decoration: none; font-variant-numeric: tabular-nums; }
.credits { min-height: 44px; box-sizing: border-box; cursor: pointer; }
.credits:hover { color: var(--gold-light); border-color: var(--accent); background: var(--surface-2); text-decoration: underline; text-underline-offset: 3px; }
.credits.warn { border-color: var(--accent); }
.credits.low { border-color: var(--redstone); color: var(--redstone); }
.credits.low .num { color: inherit; }
.credits.low:hover { color: var(--redstone); border-color: var(--accent); }
/* Language switch: globe + native select, 44px */
.lang { display: inline-flex; align-items: center; gap: var(--sp-1); }
.lang-globe { position: relative; width: 20px; height: 20px; flex: none; border: 2px solid var(--muted); border-radius: 50%; box-sizing: border-box; }
.lang-globe::before { content: ""; position: absolute; inset: -2px auto -2px 5px; width: 6px; border: 2px solid var(--muted); border-radius: 50%; box-sizing: border-box; }
.lang-globe::after { content: ""; position: absolute; left: -2px; right: -2px; top: 6px; border-top: 2px solid var(--muted); }
.lang:hover .lang-globe, .lang:focus-within .lang-globe, .lang:hover .lang-globe::before, .lang:focus-within .lang-globe::before, .lang:hover .lang-globe::after, .lang:focus-within .lang-globe::after { border-color: var(--accent); }
.lang select { min-height: 44px; max-width: 160px; }
.credits-cube { width: 14px; height: 14px; flex: none; }

/* Buttons: square block shadow; secondary stone (default), primary accent, danger redstone; pressed drops 2px */
.btn { font: 700 .875rem/1.2 var(--font-body); color: var(--text); background: var(--surface-2); border: var(--border-w) solid var(--stone); padding: 10px 16px; min-height: 44px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; box-shadow: var(--shadow-btn-sec); transition: background-color var(--motion-fast) linear, color var(--motion-fast) linear; }
.btn:hover:not(:disabled) { background: var(--surface-3); color: var(--text-strong); }
.btn:active:not(:disabled) { transform: translateY(2px); box-shadow: var(--shadow-pressed); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); box-shadow: var(--shadow-btn-pri); }
.btn.primary:hover:not(:disabled) { background: var(--accent-light); border-color: var(--accent-light); color: var(--accent-ink); }
.btn.danger { border-color: var(--redstone); color: var(--redstone); box-shadow: var(--shadow-btn-danger); }
.btn.ghost { background: none; box-shadow: none; }
.btn.ghost:not(.danger) { border-color: transparent; color: var(--muted); }
.btn.ghost:not(.danger):hover:not(:disabled) { border-color: var(--border-strong); color: var(--text); }
.btn.small { padding: var(--sp-1) var(--sp-3); min-height: 44px; font-size: .8rem; }
.btn:disabled, .btn.disabled { opacity: .5; cursor: default; pointer-events: none; box-shadow: none; }
.btn-group { display: flex; flex-wrap: wrap; gap: var(--sp-3) var(--sp-2); align-items: center; }
.link-btn { min-height: 44px; min-width: 44px; padding: 0 var(--sp-2); background: none; border: 0; color: var(--accent); cursor: pointer; font: inherit; text-decoration: underline; }
.chip-btn { min-height: 44px; min-width: 44px; justify-content: center; font: inherit; background: var(--surface-2); color: var(--muted); border: var(--border-w) solid var(--border-strong); padding: var(--sp-1) var(--sp-3); cursor: pointer; display: inline-flex; align-items: center; gap: var(--sp-2); }
.chip-btn[aria-pressed="true"] { border-color: var(--accent); color: var(--text); }
.seg { display: inline-flex; gap: var(--sp-2); }
.seg .btn[aria-pressed="true"], .seg .btn[aria-selected="true"] { border-color: var(--accent); background: var(--surface); }
.tag { font: 400 .625rem/1.5 var(--font-label); letter-spacing: .06em; text-transform: uppercase; border: var(--border-w) solid var(--border-strong); padding: 0 var(--sp-2); color: var(--muted); margin-left: var(--sp-2); white-space: nowrap; display: inline-block; vertical-align: middle; }
.tag.ok { color: var(--grass); border-color: var(--grass); } .tag.warn { color: var(--accent-light); border-color: var(--accent); }

/* Forms: one rhythm, label above field, 16px between fields */
input[type="text"], input[type="email"], input[type="search"], textarea, select { font: inherit; color: var(--text); background: var(--bg-deep); border: var(--border-w) solid var(--border-strong); padding: var(--sp-2) var(--sp-3); width: 100%; border-radius: 0; }
input::placeholder, textarea::placeholder { color: var(--faint); }
input:focus-visible, textarea:focus-visible, select:focus-visible { outline-color: var(--accent); }
select { width: auto; min-height: 44px; padding: var(--sp-1) var(--sp-2); }
textarea { resize: vertical; }
input[type="range"], input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); }
/* Compact boxes, 44px hit area: the whole label (or the padded control) is the target */
input[type="checkbox"], input[type="radio"] { width: 22px; height: 22px; flex: none; margin: 0; }
input[type="range"] { height: 44px; margin: 0; }
label { display: block; font-weight: 600; margin: var(--sp-4) 0 var(--sp-1); }
label:first-child { margin-top: 0; }
label.check { display: flex; gap: var(--sp-3); align-items: center; min-height: 44px; font-weight: 400; margin: 0; cursor: pointer; }
label.check > span { display: block; min-width: 0; }
.check-text a { display: inline; }
.row { display: flex; gap: var(--sp-2); align-items: center; flex-wrap: wrap; margin-top: var(--sp-3); }
form.row { margin-top: 0; } form.row input { flex: 1 1 220px; width: auto; }
form.card .btn[type="submit"], form.card > .btn { margin-top: var(--sp-4); }

/* Cards, pages, sections */
.card { background: var(--surface); border: var(--border-w) solid var(--border); box-shadow: var(--shadow-block); padding: var(--sp-4); margin-bottom: var(--sp-5); }
.card > :last-child { margin-bottom: 0; }
.card.ok { border-color: var(--grass); }
.narrow { max-width: 460px; width: 100%; }
.center { display: grid; place-items: center; min-height: 70vh; padding: var(--gutter); }
.page:has(.pack-grid) { max-width: 1200px; } /* billing: room for 3 plan and 4 pack cards */
.page { max-width: 960px; margin: 0 auto; padding: var(--sp-5) var(--gutter) var(--sp-6); }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3) var(--sp-4); flex-wrap: wrap; margin-bottom: var(--sp-5); }
.page-head h1 { margin: 0; }
.page-tools { flex: 0 1 320px; min-width: min(100%, 220px); }
.section { margin-bottom: var(--sp-6); }
.section-head { display: flex; align-items: center; gap: var(--sp-2); margin-bottom: var(--sp-3); }
.section-head h2 { margin: 0; display: flex; align-items: center; gap: var(--sp-2); font: 400 .75rem/1 var(--font-label); letter-spacing: .08em; text-transform: uppercase; color: var(--grass); }
.section-head h2::before { content: ""; width: 10px; height: 10px; background: var(--grass); box-shadow: 0 3px 0 var(--dirt); flex: none; }
.section-head .tag { margin-left: 0; }
.page > h1 { margin-bottom: var(--sp-5); }
.page > .tabs, .page > .seg { margin-bottom: var(--sp-4); }
.card h2 { padding-bottom: var(--sp-3); margin-bottom: var(--sp-3); border-bottom: var(--border-w) solid var(--border); }
.card .sec-body > :last-child { margin-bottom: 0; }
.card.list { padding: var(--sp-1) var(--sp-4); }
.empty { margin: var(--sp-3) 0; }
.empty-state { display: flex; flex-direction: column; align-items: center; text-align: center; padding: var(--sp-5) var(--sp-4); }
.empty-art { width: 160px; height: 120px; max-width: 100%; }
.empty-state .empty { margin: var(--sp-2) 0 0; }
.row-item { display: flex; gap: var(--sp-2) var(--sp-3); align-items: center; padding: var(--sp-3) 0; border-bottom: var(--border-w) solid var(--border); flex-wrap: wrap; }
.card .row-item:last-child { border-bottom: 0; }
.row-title { min-width: 0; overflow-wrap: anywhere; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: var(--sp-2) var(--sp-3); border-bottom: var(--border-w) solid var(--border); white-space: nowrap; }
th { font: 400 .7rem/1.2 var(--font-label); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
th:first-child, td:first-child { padding-left: 0; }
tbody tr:last-child td { border-bottom: 0; }
.plans { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--sp-4); margin-bottom: var(--sp-4); }
.plans .card { margin: 0; display: flex; flex-direction: column; align-items: flex-start; position: relative; }
.pack-grid { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.plan-grid { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.sub-card .plan-art { width: 100%; max-width: 168px; height: auto; aspect-ratio: 1; align-self: center; margin-bottom: var(--sp-2); object-fit: contain; }
.sub-card h3 { margin: 0 0 var(--sp-2); }
.plan-price { margin: 0; display: flex; align-items: baseline; gap: var(--sp-1); flex-wrap: wrap; }
.plan-price .per { color: var(--muted); font-size: .85rem; }
.plan-save { margin: var(--sp-2) 0 0; color: var(--grass); font-size: .85rem; line-height: 1.4; }
.plan-facts { list-style: none; padding: 0; margin: var(--sp-3) 0; display: grid; gap: var(--sp-2); font-size: .9rem; line-height: 1.4; }
.plan-facts li::before { content: "+ "; color: var(--grass); }
.sub-card .btn { width: 100%; }
.plan-flag { position: absolute; top: -2px; left: -2px; margin: 0; padding: 6px var(--sp-2); font: 400 .7rem/1 var(--font-label); letter-spacing: .08em; text-transform: uppercase; background: var(--accent); color: var(--accent-ink); }
.sub-card { padding-top: var(--sp-5); }
/* Two highlights, two treatments (ADR 0137, user decision 2026-10-05). Swap by exchanging the .popular / .best rules.
   Builder "Most popular": quiet neutral highlight (stone frame, neutral tag, outlined button). */
.sub-card.popular { border-color: var(--stone); box-shadow: 0 4px 0 var(--stone-dark), 0 0 0 2px rgba(139,144,151,.18); }
.sub-card.popular .plan-flag { background: var(--surface-3); color: var(--text-strong); border: 2px solid var(--stone); border-top: 0; border-left: 0; }
.btn.emph { background: var(--surface-2); border-color: var(--accent); color: var(--accent-light); box-shadow: 0 2px 0 var(--accent-dark), 0 4px 0 var(--shadow); }
.btn.emph:hover:not(:disabled) { background: var(--surface-3); color: var(--text-strong); }
/* Architect: the strongest highlight (copper frame and wash), the real price stays as visible as on the others */
.sub-card.best { border-color: var(--accent); border-width: 3px; box-shadow: 0 0 0 2px var(--accent-dark), var(--shadow-block); background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 14%, var(--surface)), var(--surface) 55%); }
.sub-card.best .plan-flag { background: var(--accent); color: var(--accent-ink); font-size: .8rem; padding: 8px var(--sp-3); }
.interval-toggle { display: inline-flex; align-items: stretch; gap: var(--sp-2); margin: 0 0 var(--sp-4); flex-wrap: wrap; }
.interval-opt { display: inline-flex; align-items: center; min-height: 48px; gap: var(--sp-2); padding: var(--sp-2) var(--sp-3); border: var(--border-w) solid var(--border-strong); cursor: pointer; background: var(--surface); }
.interval-opt.on { border-color: var(--accent); box-shadow: var(--shadow-card-best); }
.interval-opt .tag { margin-left: 0; }
.warn-card { border-color: var(--accent); }
.warn-card .btn { margin-top: var(--sp-2); }
.choice-list { display: grid; gap: var(--sp-1); margin: var(--sp-3) 0; }
.choice input[type="radio"] { width: auto; margin: 0; }
.choice { display: flex; min-height: 44px; align-items: center; gap: var(--sp-2); }
.choice input[type="number"] { width: 7rem; }
.cap-pending { margin-left: 0; white-space: normal; }
.pack-card { align-items: center !important; text-align: center; padding-top: 48px; } /* every pack card reserves the corner-tag room, so art, title, credits, price, chip and Buy line up across the row */
.pack-card.best { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-dark), var(--shadow-block); background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 14%, var(--surface)), var(--surface) 55%); } /* same size and inner layout as the other packs (the highlight is colour only) */
.pack-card .pack-flag { position: absolute; top: -3px; left: -3px; margin: 0; max-width: calc(100% + 6px); width: fit-content; background: var(--accent); border: 0; color: var(--accent-ink); padding: 6px var(--sp-2); font-size: .7rem; line-height: 1.3; text-align: left; text-transform: uppercase; white-space: normal; }
.pack-art { width: 100%; max-width: 168px; height: auto; aspect-ratio: 1; margin: 0 auto var(--sp-2); object-fit: contain; }
.pack-card h3 { margin: 0; font-size: 0.85rem; line-height: 1.25; min-height: 2.5em; display: flex; align-items: center; justify-content: center; text-wrap: balance; } /* fixed 2-line name area: the credit rows align across cards */
.pack-tagline { margin: var(--sp-1) 0 0; font-size: .85rem; line-height: 1.5; min-height: 3em; text-wrap: balance; }
.pack-credits { margin: var(--sp-2) 0 var(--sp-1); font: 400 2rem/1.1 var(--font-numeric); font-variant-numeric: tabular-nums; color: var(--gold); }
.pack-credits small { display: block; margin-top: var(--sp-1); font-size: .8rem; line-height: 1.3; color: var(--muted); }
.pack-save { margin: 0 0 var(--sp-2); }
.pack-card .pack-save.grow { flex: 0 0 auto; align-self: center; margin-bottom: auto; }
.pack-price { margin: 0 0 var(--sp-3); }
.pack-soon { font-size: .75rem; color: var(--muted); border: 1px dashed var(--border-strong); padding: 2px var(--sp-2); }
.pack-card .btn { width: 100%; margin-top: var(--sp-3); }
.page > .tag { display: table; margin: 0 0 var(--sp-4); }
.price { font: 400 1.75rem/1.2 var(--font-numeric); font-variant-numeric: tabular-nums; color: var(--gold); }
/* Numbers (ADR 0137, 2026-10-05; brand README section 3): inline/small figures are the body font, bold, tabular (Jersey 15 made 6/8/0 ambiguous below ~20 px);
   the big gold credit and price figures keep Jersey 15 (.price, .pack-credits, .pack-price, .credits-big). */
.num, .row-item strong { font-family: var(--font-body); font-weight: 700; font-variant-numeric: tabular-nums lining-nums; letter-spacing: 0; }
.price .num, .pack-credits .num, .pack-price, .pack-price .num { font-family: var(--font-numeric); font-weight: 400; font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.toast .num { color: var(--gold); }
.credits .num, .price .num, .pack-credits .num { font-size: inherit; }

/* My builds: card grid with thumbnails */
.build-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--sp-4); }
.build-grid > .empty, .build-grid > .empty-state { grid-column: 1 / -1; }
.build-card { display: flex; flex-direction: column; background: var(--surface); border: var(--border-w) solid var(--border); box-shadow: var(--shadow-block); overflow: hidden; min-width: 0; }
.build-card:hover { border-color: var(--accent); }
.build-thumb-link { display: block; }
.build-body { padding: var(--sp-3) var(--sp-4) 0; flex: 1 1 auto; min-width: 0; }
.build-name { margin: 0 0 var(--sp-1); font-size: 1.05rem; overflow-wrap: anywhere; }
.build-name a { color: var(--text); text-decoration: none; }
.build-name a:hover { color: var(--accent); }
.build-meta { margin: 0; font-size: .85rem; display: flex; align-items: center; flex-wrap: wrap; }
.build-actions { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3) var(--sp-2); padding: var(--sp-3) var(--sp-4) var(--sp-4); }
.build-actions .btn { text-align: center; }
.bthumb { position: relative; display: grid; place-items: center; overflow: hidden; background: var(--bg-deep); }
.bthumb-card { aspect-ratio: 16 / 10; border-bottom: var(--border-w) solid var(--border); }
.bthumb-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.bthumb.is-fallback::before { content: ""; position: absolute; inset: 0; background: url("/shared/brand/mark.svg") center 40% / 24% auto no-repeat; opacity: .6; }
.bthumb-initials { position: absolute; left: 0; right: 0; bottom: var(--sp-3); text-align: center; font: 600 1rem/1 var(--font-display); letter-spacing: .12em; color: var(--muted); }
.bthumb:not(.is-fallback) .bthumb-initials { display: none; }
.bthumb-chip { width: 32px; height: 20px; flex: none; }

/* Studio layout: preview is the main area, chat on the right (stacked on phones) */
/* The Studio fills the viewport (header + page): the chat log scrolls inside the chat, the composer stays pinned. */
body:has(.studio) { display: flex; flex-direction: column; height: 100vh; height: 100dvh; overflow: hidden; }
body:has(.studio) #header { flex: none; }
body:has(.studio) #app { flex: 1 1 auto; min-height: 0; }
.studio { display: grid; grid-template-columns: minmax(0, 1fr) 24px minmax(320px, var(--chat-w, 40%)); grid-template-rows: minmax(0, 1fr); gap: 0; padding: var(--sp-4) var(--gutter); height: 100%; }
.studio-tabs, .view-build { display: none; }
.split-handle { cursor: col-resize; touch-action: none; display: flex; justify-content: center; align-items: center; user-select: none; }
.split-handle .grip { width: 4px; height: 56px; background: var(--border-strong); }
.split-handle:hover .grip, .split-handle.dragging .grip { background: var(--accent); }
.split-handle:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
body:has(.split-handle.dragging) { cursor: col-resize; user-select: none; }
body:has(.split-handle.dragging) .viewer-stage { pointer-events: none; }
.preview > * { flex: none; }
.preview, .chat { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.preview { overflow: auto; gap: var(--sp-3); padding-bottom: var(--sp-1); }
.preview-head { display: flex; align-items: center; gap: var(--sp-3); }
.preview-head h2 { margin: 0; flex: 1; font-size: 1.25rem; overflow-wrap: anywhere; }
.panel { background: var(--surface); border: var(--border-w) solid var(--border); box-shadow: var(--shadow-block); padding: var(--sp-3) var(--sp-4); }
.actions-panel { display: flex; flex-direction: column; gap: var(--sp-3); }
.versions-row { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; }
.toolbar { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-5); align-items: center; padding-top: var(--sp-3); border-top: var(--border-w) solid var(--border); }
.viewer { border: var(--border-w) solid var(--border); box-shadow: var(--shadow-block); overflow: hidden; background: var(--bg-deep); flex: none; }
.viewer-stage { position: relative; height: min(46vh, 520px); min-height: 280px; background: var(--bg-deep); }
.viewer-canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.viewer-msg { position: absolute; inset: 0; margin: 0; display: grid; place-items: center; padding: var(--sp-5); text-align: center; color: var(--muted); }
.viewer-hint { position: absolute; left: 50%; bottom: var(--sp-3); transform: translateX(-50%); margin: 0; padding: var(--sp-1) var(--sp-3); font-size: .8rem; background: var(--surface); border: var(--border-w) solid var(--border); color: var(--muted); opacity: 0; pointer-events: none; transition: opacity var(--motion-base) linear; white-space: nowrap; }
.viewer-hint.is-visible { opacity: 1; }
.viewer-controls { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-4); align-items: center; padding: var(--sp-3); border-top: var(--border-w) solid var(--border); background: var(--surface); }
.ctl { display: flex; align-items: center; gap: var(--sp-2); min-height: 44px; margin: 0; font-weight: 500; font-size: .88rem; }
.ctl input[type="range"] { width: 120px; }
.ctl output { font-variant-numeric: tabular-nums; color: var(--muted); min-width: 4em; }
.versions { display: flex; flex-wrap: wrap; gap: var(--sp-3) var(--sp-2); align-items: center; }
.materials-box summary { cursor: pointer; font-weight: 600; }
.materials-box[open] summary { margin-bottom: var(--sp-3); }
.materials-box p { margin-bottom: var(--sp-2); }
/* materials: room right of the scrollbar, names wrap, the count column stays together */
.materials { list-style: none; margin: 0; padding: 0; max-height: 240px; overflow: auto; scrollbar-gutter: stable; }
.materials li { display: flex; justify-content: space-between; align-items: baseline; gap: var(--sp-4); padding: var(--sp-1) var(--sp-4) var(--sp-1) 0; border-bottom: var(--border-w) solid var(--border); }
.mat-name { min-width: 0; overflow-wrap: anywhere; }
.mat-count { flex: 0 1 auto; text-align: right; font-variant-numeric: tabular-nums; }
.mat-count small { color: var(--muted); margin-left: var(--sp-3); display: inline-block; }

.chat { background: var(--surface); border: var(--border-w) solid var(--border); box-shadow: var(--shadow-block); padding: var(--sp-4); gap: var(--sp-3); }
.chat-head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--sp-2); padding-bottom: var(--sp-3); border-bottom: var(--border-w) solid var(--border); }
.chat-head h2 { margin: 0; }
.log { flex: 1 1 0; overflow: auto; display: flex; flex-direction: column; gap: var(--sp-3); padding: var(--sp-1) 2px; min-height: 120px; }
.msg { padding: var(--sp-2) var(--sp-3); max-width: 100%; overflow-wrap: anywhere; }
.msg p { margin: 0 0 var(--sp-2); } .msg p:last-child { margin: 0; }
.msg.user { background: var(--surface-2); border: var(--border-w) solid var(--border-strong); align-self: flex-end; }
.msg.assistant { background: none; padding-left: 0; }
.msg.system { color: var(--muted); font-size: .88rem; padding: var(--sp-1) 0; } .msg.system.error { color: var(--redstone); }
.steps { list-style: none; padding: 0; margin: 0 0 var(--sp-2); color: var(--muted); font-size: .85rem; } .steps .done { color: var(--text); } .steps .failed { color: var(--redstone); }
.md h3, .md h4, .md h5 { margin: var(--sp-3) 0 var(--sp-1); } .md ul, .md ol { margin: 0 0 var(--sp-2); padding-left: 1.3em; }
.md h3 { font-family: var(--font-body); font-size: 1rem; font-weight: 700; }
.thumb { max-width: 90px; max-height: 70px; border: var(--border-w) solid var(--border); margin: 0 var(--sp-2) var(--sp-2) 0; display: inline-block; vertical-align: middle; }
.card-slot { flex: none; max-height: 45%; overflow: auto; }
.chat > * { flex: none; }
.chat > .log { flex: 1 1 0; }
.card-slot .question { border-color: var(--accent); }
.q { font-weight: 600; } .plan-details { margin-bottom: var(--sp-3); } .scope { color: var(--muted); }
.options { display: flex; flex-direction: column; gap: var(--sp-3); }
.option { display: flex; gap: var(--sp-3); text-align: left; align-items: flex-start; justify-content: flex-start; width: 100%; }
.option .n { color: var(--accent); font-weight: 700; } .option small { display: block; color: var(--muted); }
.option[aria-pressed="true"] { border-color: var(--accent); background: var(--surface); }
.other { display: flex; gap: var(--sp-2); align-items: center; margin-top: var(--sp-3); flex-wrap: wrap; } .other input { flex: 1 1 160px; width: auto; }
.chips { display: flex; gap: var(--sp-2); margin-bottom: var(--sp-2); } .chip { font: 400 .65rem/1.6 var(--font-label); letter-spacing: .05em; text-transform: uppercase; border: var(--border-w) dashed var(--border-strong); background: var(--surface-2); padding: 0 var(--sp-3); color: var(--muted); display: inline-flex; align-items: center; gap: var(--sp-2); }
.chip.on { color: var(--text); border-color: var(--accent); } .x { min-width: 44px; min-height: 44px; margin: -12px -8px -12px 0; background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 1rem; line-height: 1; }
.attach-chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin: var(--sp-2) 0; }
.composer textarea { margin-bottom: var(--sp-1); }
.composer .row { margin-top: var(--sp-2); }
.composer-send { justify-content: flex-end; }
.composer-send { align-items: center; }
.composer-send .grow { flex: 1 1 auto; }
.img-btn { gap: var(--sp-1); }
.chat-head { flex-wrap: wrap; align-items: center; }
.chat-head .tier-pick { margin-left: auto; }
.chat-head .conn { order: 3; flex-basis: 100%; }
.chat-head .conn:empty { display: none; }
@media (max-width: 420px) { .img-btn .lbl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; } .img-btn { min-width: 44px; } }
.subscribe { border-color: var(--accent); }
.subscribe .empty-art { margin-bottom: var(--sp-3); }
.report-form { display: flex; gap: var(--sp-2); margin-top: var(--sp-1); }

.toasts { position: fixed; right: var(--gutter); top: 76px; pointer-events: none; /* top right, never over the composer; never intercepts a tap */ display: flex; flex-direction: column; gap: var(--sp-2); z-index: 50; max-width: min(360px, calc(100vw - 32px)); }
.toast { background: var(--surface); border: var(--border-w) solid var(--border); border-left: 6px solid var(--accent); box-shadow: var(--shadow-block); padding: var(--sp-3); }
.toast.error { border-left-color: var(--redstone); } .toast.ok { border-left-color: var(--grass); }
.dlg { background: var(--surface); color: var(--text); border: var(--border-w) solid var(--border-strong); box-shadow: var(--shadow-block); padding: var(--sp-5); width: min(420px, calc(100vw - 32px)); }
.device-notice-list { list-style: none; padding: 0; margin: var(--sp-3) 0; }
.dlg::backdrop { background: rgb(0 0 0 / .65); }

@media (max-width: 860px) {
  /* Phones and narrow windows: Chat / Build tabs (Chat first), one pane at a time, the composer pinned under the log */
  .split-handle { display: none; }
  .studio { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); gap: var(--sp-3); padding: var(--sp-3) var(--gutter); }
  .view-build { display: block; padding: 0; }
  .studio-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-2); }
  .studio-tabs .btn[aria-selected="true"] { border-color: var(--accent); background: var(--surface); }
  .studio[data-tab="chat"] .preview, .studio[data-tab="build"] .chat { display: none; }
  .viewer-stage { height: 56vw; min-height: 240px; }
  .chat { padding: var(--sp-3); }
}

.signin-about { font-weight: 600; }
.signin-links { display: flex; flex-wrap: wrap; gap: 0 var(--sp-4); margin: var(--sp-3) 0 0; font-size: .85rem; }
.signin-links a { display: inline-flex; align-items: center; min-height: 44px; }
.first-run { max-width: 760px; margin: 0 auto; }
.first-run h1 { margin-bottom: var(--sp-2); }
.fr-steps { list-style: none; padding: 0; margin: var(--sp-4) 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--sp-4); }
.fr-step { text-align: center; display: flex; flex-direction: column; align-items: center; }
.fr-step h3 { margin: var(--sp-1) 0; }
.fr-step p { margin: 0; font-size: .9rem; }
.fr-art { width: 120px; height: 120px; max-width: 100%; object-fit: contain; margin-bottom: var(--sp-2); }
.fr-note { margin: var(--sp-4) 0 0; font-size: .9rem; }
.plan-billed { margin: 0; font-size: .85rem; }
.table-scroll { overflow-x: auto; max-width: 100%; }
.table-scroll table td, .table-scroll table th { white-space: normal; overflow-wrap: anywhere; }
.cost-view { min-width: 0; max-width: 100%; margin-top: var(--sp-4); }
.cost-view h3 { margin: var(--sp-5) 0 var(--sp-2); }
.cost-view h3:first-child { margin-top: var(--sp-4); }
.cost-view .table-scroll { overflow-x: auto; max-width: 100%; }
.cost-table { margin-top: var(--sp-4); max-width: 100%; }
.cost-table table td, .cost-table table th { white-space: nowrap; overflow-wrap: normal; }
.tabs { max-width: 100%; overflow-x: auto; flex-wrap: nowrap; }
.tabs .btn { flex: none; }
@media (max-width: 520px) {
  /* compact header: mark only, credits, language and sign-out on the first row, the nav scrolls on its own row */
  .top { padding: var(--sp-2) var(--gutter); gap: var(--sp-1) var(--sp-2); }
  .brand-text { display: none; }
  .top nav { order: 5; flex: 1 0 100%; flex-wrap: nowrap; overflow-x: auto; }
  .top nav a { flex: none; padding: var(--sp-2); }
  .top select { max-width: 110px; }
  .toasts { top: 112px; }
  .page { padding-top: var(--sp-4); }
  .build-grid { grid-template-columns: 1fr; }
  .toolbar { gap: var(--sp-2); }
  .page-tools { flex-basis: 100%; }
  .row-item .mono { flex-basis: 100%; }
  .ctl input[type="range"] { width: 96px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } .btn:active:not(:disabled) { transform: none; } }

/* Diorama pieces (web/shared/brand/diorama, ADR 0134): icons on buttons, project labels, tier badge, toasts, states */
.dio-icon { width: 20px; height: 20px; object-fit: contain; margin-right: var(--sp-2); vertical-align: -5px; flex: none; }
.btn .dio-icon { image-rendering: auto; }
.label-icon { display: inline-flex; align-items: center; }
.label-icon .dio-icon { width: 16px; height: 16px; margin-right: var(--sp-1); vertical-align: 0; }
.dio-label { object-fit: contain; flex: none; }
.build-name .dio-label { margin-right: var(--sp-2); vertical-align: -6px; }
.row-item > .dio-label { margin-right: calc(-1 * var(--sp-1)); }
.empty-art { object-fit: contain; }
.tier-pick { display: inline-flex; align-items: center; gap: var(--sp-2); }
.tier-badge { width: 32px; height: 32px; object-fit: contain; }
.toast { display: flex; align-items: center; gap: var(--sp-3); }
.toast.warn { border-left-color: var(--accent); }
.toast-icon { width: 32px; height: 32px; object-fit: contain; flex: none; }
.working { display: flex; align-items: center; gap: var(--sp-2); color: var(--muted); padding: var(--sp-1) 0; }
.working[hidden] { display: none; }
.loader-art { width: 40px; height: 40px; object-fit: contain; }
.color-menu { position: relative; }
.color-menu > summary { list-style: none; display: inline-flex; align-items: center; }
.color-menu > summary::-webkit-details-marker { display: none; }
.color-menu > summary .dio-label { margin-right: var(--sp-2); }
.color-pick { position: absolute; z-index: 10; right: 0; margin-top: var(--sp-1); display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-2); padding: var(--sp-3); background: var(--surface); border: var(--border-w) solid var(--border-strong); box-shadow: var(--shadow-block); }
.color-opt { background: var(--surface-2); border: var(--border-w) solid var(--border-strong); padding: var(--sp-1); cursor: pointer; display: grid; place-items: center; min-width: 44px; min-height: 44px; }
.color-opt:hover { background: var(--surface-3); }
.color-opt[aria-checked="true"] { border-color: var(--accent); }

.byok-card h3 { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); margin: 0 0 var(--sp-2); }
.byok-card p { margin: 0 0 var(--sp-2); }

/* Billing: one copper badge per group; the pack price is as big as the credits and gold (a price); names in Inter */
.pack-card h3 { font-family: var(--font-body); font-size: 1rem; font-weight: 700; line-height: 1.25; }
.pack-price { margin: 0 0 var(--sp-2); font: 400 2rem/1.1 var(--font-numeric); font-size: 2rem; color: var(--gold); font-variant-numeric: tabular-nums; }
.pack-price .num { font-size: inherit; }
.byok-card p { margin-bottom: var(--sp-2); }

/* Account: anchors on the left from tablet width up, one column on phones */
.account-layout { display: block; }
.account-toc { display: none; }
@media (min-width: 900px) {
  .account-layout { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: var(--sp-5); align-items: start; }
  .account-toc { display: flex; flex-direction: column; gap: var(--sp-1); position: sticky; top: var(--sp-4); }
  .account-toc a { display: flex; align-items: center; min-height: 44px; padding: 0 var(--sp-3); color: var(--muted); text-decoration: none; font-weight: 600; font-size: .875rem; border-left: 3px solid var(--border); }
  .account-toc a:hover { color: var(--text); border-left-color: var(--accent); background: var(--surface); }
  .page:has(.account-layout) { max-width: 1120px; }
}
/* Account usage: summary, then only the days with activity */
.num-s { font-weight: 700; font-variant-numeric: tabular-nums; }
.num-big { font: 400 2rem/1.1 var(--font-numeric); font-variant-numeric: tabular-nums; color: var(--gold); letter-spacing: .02em; }
.usage-stats { display: flex; gap: var(--sp-6, 32px); flex-wrap: wrap; margin-bottom: var(--sp-2); }
.usage-stat { display: flex; flex-direction: column; gap: var(--sp-1); }
.usage-split, .usage-help { margin: var(--sp-1) 0; }
.usage-help { margin-top: var(--sp-4); }
.usage-days { list-style: none; margin: 0 0 var(--sp-3); padding: 0; }
.usage-day { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr) minmax(60px, 160px); gap: var(--sp-1) var(--sp-3); align-items: center; padding: var(--sp-2) 0; border-bottom: var(--border-w) solid var(--border); }
.usage-day[hidden] { display: none; }
.usage-date { color: var(--muted); }
.usage-bar { display: block; height: 10px; background: var(--bg-deep); border: 1px solid var(--border); }
.usage-bar i { display: block; height: 100%; background: var(--accent); }
@media (max-width: 520px) {
  .usage-day { grid-template-columns: minmax(0, 1fr); }
  .usage-bar { max-width: 200px; }
}
p.help { font-size: .875rem; }
.account-cards { min-width: 0; }
.account-cards section { scroll-margin-top: var(--sp-4); }

/* My builds: Open + Send up front, the rest behind "..." */
.build-actions { grid-template-columns: 1fr 1fr auto; align-items: stretch; }
.more-menu { position: relative; }
.more-menu summary { list-style: none; cursor: pointer; min-width: 44px; padding: 0 var(--sp-2); font-size: 1.1rem; height: 100%; }
.more-menu summary::-webkit-details-marker { display: none; }
.more-list { position: absolute; right: 0; bottom: calc(100% + 4px); z-index: 20; display: grid; gap: var(--sp-1); min-width: 200px; padding: var(--sp-2); background: var(--surface); border: var(--border-w) solid var(--border-strong); box-shadow: var(--shadow-block); }
.more-list .btn { justify-content: flex-start; width: 100%; }

.spend-hint { font-size: .85rem; margin: 0; }

/* ---- Get the mod / Link Minecraft guide (page /link) ---- */
.link-page { max-width: 820px; }
.guide { list-style: none; padding: 0; margin: var(--sp-4) 0; display: grid; gap: var(--sp-4); counter-reset: none; }
.guide-step { display: grid; grid-template-columns: 56px 1fr; gap: var(--sp-4); background: var(--surface); border: var(--border-w) solid var(--border); box-shadow: var(--shadow-block); padding: var(--sp-4); }
.guide-step.done { border-color: var(--grass); }
.guide-step.pending { opacity: .85; }
.guide-art { width: 56px; height: 56px; object-fit: contain; image-rendering: auto; }
.guide-main h2 { display: flex; align-items: center; gap: var(--sp-2); margin: 0 0 var(--sp-2); font-size: 1.25rem; }
.guide-n { display: inline-grid; place-items: center; flex: none; width: 28px; height: 28px; background: var(--accent); color: var(--accent-ink); font: 400 .8rem/1 var(--font-label); box-shadow: 2px 2px 0 var(--accent-dark); }
.guide-main > p { margin: 0 0 var(--sp-2); }
.guide-main code, .guide-main kbd { background: var(--bg-deep); border: var(--border-w) solid var(--border); padding: 1px 6px; color: var(--accent-light); font-family: var(--font-mono, monospace); }
.guide-another { margin: var(--sp-5) 0 0; }
.dl-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--sp-3); margin: var(--sp-3) 0; }
.dl-box { background: var(--bg-deep); border: var(--border-w) solid var(--border); padding: var(--sp-3); }
.dl-box > p { margin: var(--sp-2) 0; }
.dl-box .tag { margin-left: 0; }
.need-list { list-style: none; margin: var(--sp-2) 0 var(--sp-3); padding: 0; display: grid; gap: var(--sp-1); }
.need-list li { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.need-list a { display: inline-flex; align-items: center; min-height: 32px; }
.req-ver { color: var(--muted); font-size: .85rem; word-break: break-all; }
.guide-form { display: grid; gap: var(--sp-2); max-width: 360px; margin-top: var(--sp-3); }
.guide-form .btn { justify-self: start; }
.guide-form input { font-family: var(--font-numeric, monospace); letter-spacing: .12em; }
.link-confirm { margin-top: var(--sp-3); border: var(--border-w) dashed var(--accent); padding: var(--sp-3); }
.link-confirm h3 { margin-top: 0; }
details.help { margin-top: var(--sp-4); padding: var(--sp-3) var(--sp-4); }
details.help summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-weight: 700; }
details.help dt { font-weight: 700; margin-top: var(--sp-3); }
details.help dd { margin: var(--sp-1) 0 0; color: var(--muted); }
.fr-mod { margin: var(--sp-3) 0 0; font-size: .9rem; }
.mod-hint { margin: 0; font-size: .85rem; }
@media (max-width: 560px) {
  .guide-step { grid-template-columns: 1fr; padding: var(--sp-3); }
  .guide-art { width: 44px; height: 44px; }
}
.toast-action { pointer-events: auto; margin-left: auto; } /* the toasts region never intercepts a tap, but its Undo button must */

/* Usage (ADR 0165): the month bar on Billing, extra usage, Details */
.usage-month { margin: var(--sp-3) 0 var(--sp-2); }
.usage-head { margin: 0 0 var(--sp-2); font-size: 1.05rem; }
.usage-head .num { font: 400 1.75rem/1 var(--font-numeric); color: var(--gold); font-variant-numeric: tabular-nums; }
.meter { height: 14px; background: var(--bg-deep); border: 1px solid var(--border-strong); max-width: 520px; }
.meter i { display: block; height: 100%; background: var(--grass); }
.meter.warn i { background: var(--gold); }
.meter.full i { background: var(--redstone); }
.usage-warn { margin: var(--sp-2) 0 0; color: var(--gold-light); }
.usage-warn.full { color: var(--redstone); }
.usage-extra { margin: var(--sp-2) 0 0; }
.usage-details { margin-top: var(--sp-3); }
.usage-details summary { cursor: pointer; color: var(--muted); }
.usage-details-body { padding-top: var(--sp-2); }
