:root {
  color-scheme: dark;
  --bg: #0c111a;
  --panel: #141c28;
  --panel-2: #1b2636;
  --line: rgba(255,255,255,.14);
  --text: #eef4ff;
  --muted: #9aa8bc;
  --accent: #b9d3ff;
  --bad: #ffb5b5;
  --ok: #bdf2c9;
  --shadow: 0 24px 80px rgba(0,0,0,.38);
  --radius: 28px;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: radial-gradient(circle at 50% -20%, #22314a, var(--bg) 62%); color: var(--text); }
body { overflow: hidden; -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; }
.app-shell { min-height: 100dvh; padding: calc(env(safe-area-inset-top) + 12px) max(14px, env(safe-area-inset-right)) calc(env(safe-area-inset-bottom) + 14px) max(14px, env(safe-area-inset-left)); display: grid; grid-template-rows: auto minmax(0, 1fr); gap: 14px; }
.app-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; max-width: 1180px; width: 100%; margin: 0 auto; }
.brand-block { min-width: 0; }
.app-title { font-weight: 750; letter-spacing: -.02em; font-size: clamp(1rem, 2.4vw, 1.35rem); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-subtitle { color: var(--muted); font-size: .86rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.control-row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.ghost, .primary, .view-pill { border: 1px solid var(--line); background: rgba(255,255,255,.07); border-radius: 999px; padding: .62rem .82rem; cursor: pointer; min-height: 40px; }
.primary { background: #dbe8ff; color: #0e1724; border-color: transparent; font-weight: 700; }
button:disabled { opacity: .42; cursor: default; }
.stage { min-height: 0; display: grid; place-items: center; overflow: hidden; }
.card-shell { position: relative; width: min(94vw, 940px); height: min(78dvh, 720px); min-height: min(520px, calc(100dvh - 104px)); max-height: 100%; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; background: linear-gradient(180deg, rgba(255,255,255,.08), rgba(255,255,255,.035)), var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; user-select: none; touch-action: manipulation; outline: none; }
.card-shell:focus-visible { box-shadow: var(--shadow), 0 0 0 4px rgba(185,211,255,.25); }
.card-header { z-index: 2; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; align-items: center; padding: clamp(16px, 2.5vw, 28px); border-bottom: 1px solid var(--line); background: rgba(20,28,40,.93); }
.card-kicker { grid-column: 1 / -1; color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .1em; }
.card-header h1 { margin: 0; font-size: clamp(1.3rem, 4vw, 2.4rem); line-height: 1.02; letter-spacing: -.045em; }
.view-pill { align-self: center; white-space: nowrap; }
.card-body { min-height: 0; display: grid; place-items: center; padding: clamp(18px, 4vw, 46px); background: radial-gradient(circle at 50% 30%, rgba(185,211,255,.09), transparent 58%); }
.icon-view { display: grid; place-items: center; gap: 18px; text-align: center; max-width: 560px; }
.symbol { width: clamp(120px, 24vmin, 230px); aspect-ratio: 1; display: grid; place-items: center; border-radius: 32%; background: rgba(255,255,255,.07); border: 1px solid var(--line); }
.symbol svg { width: 68%; height: 68%; stroke: currentColor; fill: none; stroke-width: 7; stroke-linecap: round; stroke-linejoin: round; }
.symbol .emoji { font-size: clamp(4rem, 14vmin, 9rem); line-height: 1; }
.visual-label { color: var(--accent); font-size: clamp(1.08rem, 3vw, 1.65rem); font-weight: 760; letter-spacing: -.025em; }
.text-view { width: min(100%, 720px); max-height: 100%; overflow: auto; user-select: text; -webkit-overflow-scrolling: touch; padding-right: .25rem; }
.text-view p { margin: 0; color: #d9e3f2; font-size: clamp(1rem, 2.5vw, 1.22rem); line-height: 1.58; }
.hit-zone { position: absolute; top: 0; bottom: 0; width: 50%; z-index: 1; cursor: pointer; }
.hit-left { left: 0; }
.hit-right { right: 0; }
.card-header, .card-footer, .text-view, .view-pill { position: relative; z-index: 3; }
.card-footer { z-index: 3; display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--line); background: rgba(20,28,40,.95); }
.choice { min-height: clamp(76px, 13dvh, 112px); border: 0; background: transparent; padding: 16px clamp(14px, 3vw, 26px); cursor: pointer; display: grid; gap: 5px; align-content: center; }
.choice-left { text-align: left; border-right: 1px solid var(--line); }
.choice-right { text-align: right; }
.choice .target { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; }
.choice .label { font-size: clamp(.98rem, 2.2vw, 1.22rem); font-weight: 720; }
.choice.disabled { opacity: .42; cursor: default; }
.choice:not(.disabled):hover { background: rgba(255,255,255,.055); }
.editor-screen { position: fixed; inset: 0; min-height: 100dvh; overflow: auto; padding: calc(env(safe-area-inset-top) + 14px) max(14px, env(safe-area-inset-right)) calc(env(safe-area-inset-bottom) + 18px) max(14px, env(safe-area-inset-left)); background: var(--bg); z-index: 10; }
.editor-header { max-width: 980px; margin: 0 auto 16px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.editor-panel { max-width: 980px; margin: 0 auto; background: var(--panel); border: 1px solid var(--line); border-radius: 24px; padding: clamp(18px, 4vw, 34px); box-shadow: var(--shadow); }
.upload-box { display: grid; gap: 12px; border: 1px dashed rgba(255,255,255,.28); padding: 22px; border-radius: 18px; background: rgba(255,255,255,.04); }
.upload-box span { font-weight: 720; }
.fixture-block h2 { font-size: 1rem; color: var(--muted); margin: 24px 0 10px; }
.fixture-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; }
.fixture-list button { text-align: left; border: 1px solid var(--line); border-radius: 16px; padding: 14px; background: var(--panel-2); cursor: pointer; }
.fixture-list small { display: block; color: var(--muted); margin-top: 5px; }
.validation-box { margin-top: 18px; border-radius: 16px; padding: 14px; background: rgba(255,255,255,.045); color: var(--muted); white-space: pre-wrap; }
.validation-box.error { color: var(--bad); }
.validation-box.ok { color: var(--ok); }
.schema-help { margin-top: 18px; color: var(--muted); }
.schema-help pre { overflow: auto; white-space: pre-wrap; color: #dce7f6; }
@media (orientation: landscape) and (max-height: 560px) {
  .app-shell { gap: 8px; padding-top: max(8px, env(safe-area-inset-top)); }
  .card-shell { height: calc(100dvh - 78px); min-height: 0; }
  .card-header { padding: 12px 18px; }
  .card-body { padding: 14px 24px; }
  .choice { min-height: 62px; }
  .symbol { width: clamp(86px, 20vmin, 150px); }
}
@media (max-width: 620px) {
  .app-header, .editor-header { align-items: flex-start; }
  .control-row { gap: 6px; }
  .ghost, .primary, .view-pill { padding: .54rem .68rem; }
  .card-shell { width: 100%; border-radius: 22px; }
}
