@font-face { font-family: Oxanium; src: url("assets/fonts/oxanium_regular.ttf") format("truetype"); font-weight: 400; }
@font-face { font-family: Oxanium; src: url("assets/fonts/oxanium_medium.ttf") format("truetype"); font-weight: 500; }
@font-face { font-family: Oxanium; src: url("assets/fonts/oxanium_semibold.ttf") format("truetype"); font-weight: 600; }
@font-face { font-family: Oxanium; src: url("assets/fonts/oxanium_bold.ttf") format("truetype"); font-weight: 700 900; }

:root {
  --ink: #EEF1F8;
  --ink-2: #A9B1C6;
  --ink-3: #727B93;
  --bg: #0B0D14;
  --panel: #12151F;
  --panel-2: #181C28;
  --panel-3: #202535;
  --line: #262B3B;
  --line-2: #333A50;
  --accent: #FFD18A;
  --accent-ink: #241A11;
  --good: #4FD18B;
  --warn: #FFC857;
  --bad: #FF7A7A;
  --radius: 14px;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --ink: #161A24; --ink-2: #4A5266; --ink-3: #7A8296; --bg: #EEF0F5; --panel: #FFFFFF; --panel-2: #F5F6FA;
  --panel-3: #EAECF3; --line: #DFE2EA; --line-2: #CDD2DE; --accent: #B86E00; --accent-ink: #FFFFFF; color-scheme: light;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --ink: #161A24; --ink-2: #4A5266; --ink-3: #7A8296; --bg: #EEF0F5; --panel: #FFFFFF; --panel-2: #F5F6FA;
    --panel-3: #EAECF3; --line: #DFE2EA; --line-2: #CDD2DE; --accent: #B86E00; --accent-ink: #FFFFFF; color-scheme: light;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font: 14px/1.45 "Inter", "Source Sans 3", system-ui, -apple-system, sans-serif; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
code { font-family: ui-monospace, Menlo, monospace; font-size: .9em; background: var(--panel-3); padding: 1px 5px; border-radius: 5px; }
a { color: var(--accent); }
.hidden { display: none !important; }

/* ---------- app shell ---------- */
.app { display: grid; grid-template-rows: 60px 1fr; height: 100vh; }
.bar { display: flex; align-items: center; gap: 14px; padding: 0 18px; border-bottom: 1px solid var(--line); background: var(--panel); }
.brand { display: flex; align-items: center; gap: 10px; font-family: Oxanium, sans-serif; font-weight: 700; font-size: 17px; letter-spacing: .3px; white-space: nowrap; }
.brand .mark { width: 32px; height: 32px; border-radius: 9px; display: block; box-shadow: 0 0 0 1px #ffffff14; }
.brand small { color: var(--ink-3); font-weight: 500; font-family: inherit; }
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 11px; background: var(--panel-3); }
.seg button { border: 0; background: none; padding: 6px 14px; border-radius: 8px; color: var(--ink-2); font-weight: 600; white-space: nowrap; }
.seg button.on { background: var(--panel); color: var(--ink); box-shadow: 0 1px 3px #0003; }
.spacer { flex: 1; }
.btn { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line-2); background: var(--panel-2); padding: 8px 14px; border-radius: 10px; font-weight: 600; white-space: nowrap; }
.btn:hover { border-color: var(--ink-3); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.primary:disabled { opacity: .45; cursor: not-allowed; }
.btn.small { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn.ghost { background: none; }
.btn.danger { background: var(--bad); color: #fff; border-color: transparent; }
.btn svg { width: 18px; height: 18px; }
.iconbtn { border: 0; background: none; color: var(--ink-2); padding: 6px; border-radius: 8px; display: inline-grid; place-items: center; }
.iconbtn:hover { background: var(--panel-3); color: var(--ink); }

.work { display: grid; grid-template-columns: 64px 380px 1fr; min-height: 0; }
.nav { border-right: 1px solid var(--line); background: var(--panel); display: flex; flex-direction: column; align-items: center; padding: 10px 0; gap: 4px; }
.nav button { width: 48px; height: 48px; border: 0; border-radius: 12px; background: none; color: var(--ink-3); display: grid; place-items: center; position: relative; }
.nav button:hover { color: var(--ink); background: var(--panel-3); }
.nav button.on { color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.nav button .dot { position: absolute; top: 9px; right: 9px; width: 7px; height: 7px; border-radius: 50%; background: var(--good); }
.nav button[data-tip]:hover::after { content: attr(data-tip); position: absolute; left: 54px; background: var(--panel-3); color: var(--ink); padding: 4px 9px; border-radius: 7px; font-size: 12px; white-space: nowrap; z-index: 20; border: 1px solid var(--line-2); }

.editor { border-right: 1px solid var(--line); background: var(--panel); overflow-y: auto; padding: 20px 20px 80px; }
.editor h2 { font-family: Oxanium, sans-serif; font-size: 20px; margin: 0 0 4px; }
.editor .lede { color: var(--ink-2); margin: 0 0 18px; }
.editor h3 { font-size: 12px; text-transform: uppercase; letter-spacing: 1.2px; color: var(--ink-3); margin: 22px 0 10px; }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > span { font-weight: 600; font-size: 13px; }
.field small, .hint { color: var(--ink-3); font-size: 12px; }
.input, select.input { width: 100%; padding: 9px 11px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--panel-2); outline: none; }
.input:focus { border-color: var(--accent); }
.input.bad { border-color: var(--bad); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line-2); background: var(--panel-2); padding: 6px 11px; border-radius: 999px; font-weight: 600; font-size: 13px; color: var(--ink-2); }
.chip.on { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.toggle:last-child { border-bottom: 0; }
.switch { appearance: none; width: 40px; height: 22px; border-radius: 99px; background: var(--line-2); position: relative; cursor: pointer; flex: none; transition: background .15s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch:checked { background: var(--accent); }
.switch:checked::after { transform: translateX(18px); }
.slider { display: grid; grid-template-columns: 1fr 44px; align-items: center; gap: 10px; }
.slider input { accent-color: var(--accent); width: 100%; }
.slider output { text-align: right; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.note { background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; color: var(--ink-2); font-size: 13px; }
.note.warn { border-color: color-mix(in srgb, var(--warn) 50%, var(--line)); }
.bad-text { color: var(--bad); font-size: 12px; }

/* colors */
.seedrow { display: grid; grid-template-columns: 54px 1fr; gap: 12px; align-items: center; }
.bigswatch { width: 54px; height: 54px; border-radius: 14px; border: 1px solid var(--line-2); position: relative; overflow: hidden; }
.bigswatch input { position: absolute; inset: -10px; width: 80px; height: 80px; opacity: 0; cursor: pointer; }
.picks { display: flex; gap: 6px; flex-wrap: wrap; }
.pick { width: 26px; height: 26px; border-radius: 8px; border: 2px solid transparent; outline: 1px solid var(--line-2); }
.pick:hover { transform: scale(1.1); }
.colorlist { display: grid; gap: 4px; }
.crow { display: grid; grid-template-columns: 34px 1fr 96px; gap: 10px; align-items: center; padding: 5px 6px; border-radius: 10px; }
.crow:hover, .crow.flash { background: var(--panel-2); }
.crow.flash { outline: 2px solid var(--accent); }
.crow .sw { width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--line-2); position: relative; overflow: hidden; background-image: linear-gradient(45deg, #8884 25%, transparent 25%, transparent 75%, #8884 75%), linear-gradient(45deg, #8884 25%, transparent 25%, transparent 75%, #8884 75%); background-size: 10px 10px; background-position: 0 0, 5px 5px; }
.crow .sw i { position: absolute; inset: 0; }
.crow .sw input { position: absolute; inset: -8px; width: 60px; height: 60px; opacity: 0; cursor: pointer; }
.crow b { display: block; font-size: 13px; }
.crow small { color: var(--ink-3); font-size: 12px; }
.crow .input { padding: 6px 8px; font-family: ui-monospace, Menlo, monospace; font-size: 12px; }
.crow.unset .input { color: var(--ink-3); }

/* drops */
.drop { position: relative; border: 1.5px dashed var(--line-2); border-radius: 12px; padding: 12px; background: var(--panel-2); display: grid; grid-template-columns: 56px 1fr auto; gap: 12px; align-items: center; min-height: 72px; transition: border-color .15s, background .15s; }
.drop.over { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--panel-2)); }
.drop .thumb { width: 56px; height: 48px; border-radius: 8px; background: var(--panel-3); display: grid; place-items: center; overflow: hidden; color: var(--ink-3); }
.drop .thumb img, .drop .thumb video { width: 100%; height: 100%; object-fit: cover; }
.drop .thumb.contain img { object-fit: contain; }
.drop b { display: block; font-size: 13px; }
.drop small { color: var(--ink-3); font-size: 12px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 190px; }
.drop .warn { color: var(--warn); font-size: 12px; }
.drop input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop .tools { display: flex; gap: 2px; position: relative; z-index: 2; }
.stack { display: grid; gap: 8px; }

.sysgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.sys { position: relative; aspect-ratio: 1; border-radius: 12px; border: 1.5px dashed var(--line-2); background: var(--panel-2); display: grid; place-items: center; overflow: hidden; }
.sys.has { border-style: solid; border-color: var(--line); }
.sys.over { border-color: var(--accent); }
.sys img, .sys video { width: 74%; height: 74%; object-fit: contain; }
.sys.bgcell img, .sys.bgcell video { width: 100%; height: 100%; object-fit: cover; }
.sys .lbl { position: absolute; left: 0; right: 0; bottom: 0; font-size: 10px; text-align: center; padding: 3px; background: linear-gradient(transparent, #000a); color: #fff; font-weight: 600; }
.sys .badge { position: absolute; top: 4px; right: 4px; font-size: 9px; background: #000a; color: #fff; padding: 1px 5px; border-radius: 6px; }
.sys .ghost { color: var(--ink-3); font-size: 11px; text-align: center; padding: 6px; }
.sys input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.sys .x { position: absolute; top: 3px; left: 3px; z-index: 2; background: #000a; color: #fff; border: 0; border-radius: 6px; width: 20px; height: 20px; display: none; padding: 0; line-height: 20px; }
.sys:hover .x { display: block; }
.sys.focus { outline: 2px solid var(--accent); outline-offset: 2px; }

.soundgrid { display: grid; gap: 6px; }
.sound { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; padding: 8px 10px; border: 1.5px dashed var(--line-2); border-radius: 11px; background: var(--panel-2); position: relative; }
.sound.has { border-style: solid; border-color: var(--line); }
.sound.over { border-color: var(--accent); }
.sound .play { width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--panel-3); display: grid; place-items: center; color: var(--ink); position: relative; z-index: 2; }
.sound.has .play { background: var(--accent); color: var(--accent-ink); }
.sound b { font-size: 13px; }
.sound small { color: var(--ink-3); font-size: 12px; display: block; }
.sound input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.sound .tools { position: relative; z-index: 2; display: flex; align-items: center; gap: 4px; }

/* ---------- stage ---------- */
.stage { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr auto; background:
  radial-gradient(1200px 600px at 50% 40%, color-mix(in srgb, var(--stage-glow, #7C9CFF) 14%, transparent), transparent 70%), var(--bg); }
.stagebar { display: flex; align-items: center; gap: 10px; padding: 14px 20px 0; flex-wrap: wrap; }
.stagebar .seg button { padding: 6px 12px; }
.viewport { position: relative; min-height: 0; min-width: 0; display: grid; place-items: center; padding: 18px; overflow: hidden; }
/* Handheld: a rounded-rectangle body with shoulder buttons, recessed sticks with lights, D-pad, face buttons,
   Start/Select and speaker grilles. Grips are flex columns, so the parts scale with the device. */
.hh { --hh-light-l: #FFB84D; --hh-light-r: #FF795D; position: relative; isolation: isolate; border-radius: 46px;
  background: linear-gradient(180deg, #3B4253 0%, #232833 38%, #181B23 100%);
  box-shadow: 0 40px 80px #000a, inset 0 2px 0 #ffffff26, inset 0 -4px 0 #0008, inset 0 0 0 1px #ffffff0d; }
.hh::before, .hh::after { content: ""; position: absolute; top: -13px; width: 24%; height: 20px; z-index: -1; border-radius: 14px 14px 4px 4px;
  background: linear-gradient(180deg, #4A5265, #262B36); box-shadow: inset 0 1px 0 #ffffff30; }
.hh::before { left: 7%; } .hh::after { right: 7%; }
.hh .hh-screen { background: #05070A; border-radius: 16px; padding: 10px; box-shadow: inset 0 0 0 1px #ffffff14, 0 0 0 2px #0006; position: relative; z-index: 1; }
.hh .grip { display: flex; flex-direction: column; align-items: center; justify-content: space-evenly; }
.hh .well { width: 74%; aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; background: radial-gradient(circle, #0B0D12 58%, #1E222C 72%); box-shadow: inset 0 3px 6px #000c, 0 1px 0 #ffffff14; }
.hh .stick { width: 76%; aspect-ratio: 1; border-radius: 50%; position: relative;
  background: repeating-radial-gradient(circle at 50% 50%, #2C313D 0 3px, #262A35 3px 6px);
  box-shadow: 0 0 0 3px var(--hh-light-l), 0 0 18px 4px color-mix(in srgb, var(--hh-light-l) 70%, transparent), 0 6px 10px #000b, inset 0 2px 0 #ffffff22; }
.hh .grip.r .stick { box-shadow: 0 0 0 3px var(--hh-light-r), 0 0 18px 4px color-mix(in srgb, var(--hh-light-r) 70%, transparent), 0 6px 10px #000b, inset 0 2px 0 #ffffff22; }
.hh .stick::after { content: ""; position: absolute; inset: 30%; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #3A404E, #1C2029); box-shadow: inset 0 1px 0 #ffffff1a; }
.hh .dpad { width: 62%; aspect-ratio: 1; position: relative; }
.hh .dpad i { position: absolute; background: linear-gradient(180deg, #2B303B, #171A21); box-shadow: inset 0 1px 0 #ffffff1f, 0 3px 4px #0009; border-radius: 6px; }
.hh .dpad i:nth-child(1) { left: 34%; right: 34%; top: 2%; bottom: 2%; }
.hh .dpad i:nth-child(2) { top: 34%; bottom: 34%; left: 2%; right: 2%; }
.hh .dpad i:nth-child(3) { left: 44%; top: 44%; width: 12%; height: 12%; border-radius: 50%; background: #11141A; box-shadow: inset 0 1px 2px #000; }
.hh .face { width: 74%; aspect-ratio: 1; position: relative; }
.hh .face b { position: absolute; width: 33%; aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle at 45% 35%, #333948, #191C24); box-shadow: inset 0 1px 0 #ffffff26, 0 3px 4px #000a;
  font: 800 clamp(7px, 0.85vw, 12px)/1 system-ui, sans-serif; }
.hh .face b:nth-child(1) { left: 33.5%; top: 0; color: #F5C518; }
.hh .face b:nth-child(2) { left: 0; top: 33.5%; color: #4D9BFF; }
.hh .face b:nth-child(3) { right: 0; top: 33.5%; color: #FF5E63; }
.hh .face b:nth-child(4) { left: 33.5%; bottom: 0; color: #4FD18B; }
.hh .hh-sys { display: flex; gap: 10%; width: 70%; justify-content: center; }
.hh .hh-sys i { width: 30%; height: 7px; border-radius: 5px; background: #0E1016; box-shadow: inset 0 1px 1px #000, 0 1px 0 #ffffff12; }
.hh .grille { display: grid; grid-template-columns: repeat(4, 4px); gap: 4px; opacity: .7; }
.hh .grille i { width: 4px; height: 4px; border-radius: 50%; background: #0A0C10; box-shadow: 0 1px 0 #ffffff10; }
.device { padding: 46px 118px; transform-origin: center; }
.device .grip { position: absolute; top: 24px; bottom: 24px; width: 118px; }
.device .grip.l { left: 0; } .device .grip.r { right: 0; }
.device .well { width: 64%; } .device .dpad { width: 54%; } .device .face { width: 66%; }
.device.flat { padding: 10px; border-radius: 22px; }
.device.flat::before, .device.flat::after, .device.flat .grip { display: none; }
.screen { position: relative; overflow: hidden; border-radius: 10px; background: #000; z-index: 1; box-shadow: 0 0 0 10px #05070A, 0 0 0 11px #ffffff14; }
.device.flat .screen { box-shadow: none; }
.screen-inner { transform-origin: 0 0; position: absolute; left: 0; top: 0; }
.stagefoot { display: flex; align-items: center; gap: 14px; padding: 0 20px 16px; flex-wrap: wrap; justify-content: center; }
.paletteStrip { display: flex; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); }
.paletteStrip button { width: 26px; height: 26px; border: 0; }
.checks { display: flex; gap: 8px; flex-wrap: wrap; }
.check { font-size: 12px; padding: 4px 10px; border-radius: 99px; background: var(--panel); border: 1px solid var(--line); color: var(--ink-2); display: inline-flex; gap: 6px; align-items: center; }
.check b { font-variant-numeric: tabular-nums; }
.check.good b { color: var(--good); }
.check.low b { color: var(--warn); }
.check.bad b { color: var(--bad); }
.tip { color: var(--ink-3); font-size: 12px; }

/* ---------- start screen ---------- */
.start { position: fixed; inset: 60px 0 0; background: var(--bg); overflow-y: auto; z-index: 30; padding: 40px 32px 60px; }
.start-in { max-width: 1180px; margin: 0 auto; }
.start h1 { font-family: Oxanium, sans-serif; font-size: 40px; margin: 0 0 8px; letter-spacing: -.5px; }
.start .lede { color: var(--ink-2); font-size: 16px; max-width: 640px; margin: 0 0 28px; }
.ways { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 34px; }
.way { position: relative; text-align: left; border: 1px solid var(--line); background: var(--panel); border-radius: 16px; padding: 18px; display: grid; gap: 6px; transition: transform .15s, border-color .15s; }
.way:hover { transform: translateY(-2px); border-color: var(--accent); }
.way .ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); margin-bottom: 6px; }
.way b { font-size: 15px; }
.way span { color: var(--ink-2); font-size: 13px; }
.way input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.start h2 { font-size: 13px; text-transform: uppercase; letter-spacing: 1.4px; color: var(--ink-3); margin: 0 0 12px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.tpl { border: 1px solid var(--line); background: var(--panel); border-radius: 16px; padding: 0; overflow: hidden; text-align: left; transition: transform .15s, border-color .15s; }
.tpl:hover { transform: translateY(-3px); border-color: var(--accent); }
.tpl .mini { height: 118px; position: relative; overflow: hidden; }
.tpl .meta { padding: 10px 12px; display: flex; align-items: center; justify-content: space-between; }
.tpl .meta b { font-size: 14px; }
.tpl .meta small { color: var(--ink-3); }
.mini .mbg { position: absolute; inset: 0; background-size: cover; background-position: center; }
.mini .mtabs { position: absolute; left: 10px; top: 10px; display: flex; gap: 4px; }
.mini .mtabs i { height: 12px; width: 26px; border-radius: 9px; }
.mini .mname { position: absolute; left: 12px; top: 34px; font-weight: 800; font-size: 15px; }
.mini .mtiles { position: absolute; left: 50%; bottom: 14px; display: flex; gap: 6px; transform: translateX(-30%); }
.mini .mtiles i { width: 40px; height: 48px; display: block; }

.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--panel-3); color: var(--ink); border: 1px solid var(--line-2); padding: 10px 16px; border-radius: 12px; z-index: 60; box-shadow: 0 10px 30px #0006; transition: opacity .2s; }
.dropzone { position: fixed; inset: 0; z-index: 50; background: color-mix(in srgb, var(--bg) 80%, transparent); display: grid; place-items: center; pointer-events: none; }
.dropzone div { border: 2px dashed var(--accent); border-radius: 24px; padding: 40px 60px; font-size: 18px; font-weight: 600; background: var(--panel); text-align: center; }
.dropzone small { display: block; color: var(--ink-3); font-weight: 400; font-size: 14px; margin-top: 6px; }

dialog { border: 1px solid var(--line-2); background: var(--panel); color: var(--ink); border-radius: 18px; padding: 22px; max-width: 560px; width: calc(100% - 32px); }
dialog::backdrop { background: #0009; }
dialog h2 { margin: 0 0 6px; font-family: Oxanium, sans-serif; }
.filelist { max-height: 240px; overflow: auto; font-family: ui-monospace, Menlo, monospace; font-size: 12px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; color: var(--ink-2); margin: 10px 0; }

@media (max-width: 1100px) {
  .work { grid-template-columns: 56px minmax(0, 1fr); grid-template-rows: auto auto; }
  .stage { grid-column: 1 / -1; grid-row: 1; min-height: 420px; }
  .nav { grid-row: 2; }
  .editor { grid-row: 2; }
  .app { height: auto; }
  .ways { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .bar { gap: 8px; padding: 0 12px; }
  .brand small, .bar .hide-sm { display: none; }
  .work { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto auto; }
  .app { grid-template-columns: minmax(0, 1fr); }
  .brand { font-size: 0; gap: 0; }
  .bar .seg button { padding: 6px 10px; }
  #newBtn { padding: 5px 8px; }
  #downloadTop { font-size: 0; gap: 0; padding: 7px 9px; }
  body { overflow-x: hidden; }
  .stage { grid-row: 1; min-height: 0; }
  .nav { grid-row: 2; flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 4px 8px; justify-content: flex-start; position: sticky; top: 0; z-index: 10; }
  .editor { grid-row: 3; }
  .nav button[data-tip]:hover::after { display: none; }
  .device { padding: 8px; border-radius: 18px; }
  .device::before, .device::after, .device .grip { display: none; }
  .device .screen { box-shadow: none; }
  .viewport { padding: 10px; }
  .stagebar { padding: 10px 12px 0; }
  .stagebar .seg { max-width: 100%; overflow-x: auto; }
  .stagebar .spacer { display: none; }
  .stagefoot { padding: 0 12px 12px; }
  .stagefoot .tip { display: none; }
  #frame { display: none; }
  .editor { padding: 16px; }
  .ways { grid-template-columns: 1fr; }
  .start { padding: 24px 16px; }
  .start h1 { font-size: 30px; }
  .sysgrid { grid-template-columns: repeat(3, 1fr); }
}

/* ======================================================================
   The mock: Mirmire's screens. Values are dp from the app's Compose code.
   ====================================================================== */
.mock { position: relative; overflow: hidden; font-size: 16px; line-height: 1.25; letter-spacing: .15px; user-select: none; }
.mock * { box-sizing: border-box; }
.mock :where(button) { border: 0; background: none; color: inherit; font: inherit; padding: 0; text-align: left; letter-spacing: inherit; cursor: pointer; }
.m-wall { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.m-content { position: absolute; inset: 0; display: flex; flex-direction: column; }
.mock.with-rail .m-content { left: 72px; }
.m-status { height: 24px; flex: none; display: flex; justify-content: space-between; align-items: center; padding: 0 16px; font-size: 13px; font-weight: 500; color: var(--on-bg); font-family: Roboto, system-ui, sans-serif; }
.m-status-r { display: flex; gap: 5px; align-items: center; }
.m-body { flex: 1; min-height: 0; position: relative; padding: 4px 16px 10px; display: flex; flex-direction: column; }
.mock.with-rail .m-body { padding: 4px 24px 10px; }
.m-muted { color: var(--on-sv); }
.m-label-m { font-size: 12px; font-weight: 500; letter-spacing: .5px; }
.m-body-s { font-size: 12px; }
.m-body-m { font-size: 14px; }
.m-title-s { font-size: 14px; font-weight: 600; }
.m-title-l { font-size: 22px; font-weight: 700; color: var(--on-bg); }
.m-headline-s { font-size: 24px; font-weight: 700; color: var(--on-bg); }

/* FocusTile */
.m-tile { position: relative; background: color-mix(in srgb, var(--sc) 92%, transparent); border: var(--rest-border) !important; border-radius: var(--radius); color: var(--on-surface); transition: transform .18s cubic-bezier(.3,1.4,.6,1), background .15s, box-shadow .15s; }
.m-tile.sel { background: color-mix(in srgb, var(--pc) 85%, transparent); border: 2px solid color-mix(in srgb, var(--primary) 80%, transparent) !important; }
.m-tile.foc { background: var(--sch) !important; border: var(--focus-w) solid var(--primary) !important; box-shadow: 0 6px 16px color-mix(in srgb, var(--primary) 45%, transparent); transform: scale(1.04); z-index: 2; }
.mock.cut .m-tile:not(.m-pill):not(.m-round), .mock.cut .m-panel { border-radius: 0; clip-path: polygon(var(--radius) 0, calc(100% - var(--radius)) 0, 100% var(--radius), 100% calc(100% - var(--radius)), calc(100% - var(--radius)) 100%, var(--radius) 100%, 0 calc(100% - var(--radius)), 0 var(--radius)); }
@supports (corner-shape: bevel) {
  .mock.cut .m-tile:not(.m-pill):not(.m-round), .mock.cut .m-panel { clip-path: none; border-radius: var(--radius); corner-shape: bevel; }
}

/* top bar */
.m-topbar { display: flex; align-items: center; gap: 8px; padding: 6px 16px 0; height: 56px; flex: none; }
.m-tabs { display: flex; gap: 6px; flex: 1; align-items: center; padding: 0 8px; }
.m-pill { border-radius: 999px !important; }
.m-tab { display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; background: color-mix(in srgb, var(--surface) 55%, transparent); font-weight: 500; }
.m-tab.on { background: var(--primary); color: var(--on-primary); font-weight: 700; }
.m-round { width: 44px; height: 44px; border-radius: 50% !important; display: inline-grid !important; place-items: center; background: var(--sch); flex: none; }

/* side rail */
.m-rail { position: absolute; left: 0; top: 0; bottom: 0; width: 72px; background: var(--surface); display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 30px 0 14px; z-index: 3; }
.m-rail-item { width: 52px; height: 44px; border-radius: 14px; display: grid !important; place-items: center; color: var(--on-sv); }
.m-rail-item.on { background: color-mix(in srgb, var(--primary) 14%, transparent); color: var(--primary); }

/* consoles */
.m-hero { padding: 6px 8px 0; }
.m-kicker { font-size: 14px; font-weight: 700; letter-spacing: 2px; display: flex; gap: 6px; align-items: center; }
.m-hero-name { font-size: 36px; font-weight: 800; color: var(--on-bg); line-height: 1.15; white-space: nowrap; }
.m-count { display: flex; align-items: center; gap: 4px; color: var(--on-sv); font-size: 12px; font-weight: 500; margin-top: 4px; }
.m-wheel { flex: 1; position: relative; display: flex; align-items: center; overflow: visible; }
.m-wheel-track { display: flex; align-items: center; gap: 4px; transition: transform .35s cubic-bezier(.2,.8,.2,1); width: max-content; position: absolute; }
.m-console { display: block; overflow: hidden; flex: none; transition: transform .25s, opacity .25s; }
.m-console.far { transform: scale(.8); opacity: .55; }
.m-console.sel.foc { transform: scale(1); }
/* Theme focus styles and plain bezel cards (MirmireStyle.focusLook / cardBezel). */
.mock .m-tile.foc { border-color: var(--focus) !important; }
.mock.bezel .m-tile:not(.m-play):not(.sel):not(.on) { background: var(--surface) !important; box-shadow: 0 2px 6px rgba(0,0,0,.18); }
.mock.bezel .m-console-tint { display: none; }
.mock.bezel .m-console .m-console-icon { inset: 6%; }
.mock.bezel .m-card .m-art, .mock.bezel .m-card svg { margin: 6px; width: calc(100% - 12px); border-radius: 10px; }
.mock.f-frame .m-tile.foc:not(.m-play) { border-width: calc(var(--focus-w) + 3px) !important; background: color-mix(in srgb, var(--focus) 28%, var(--surface)) !important; box-shadow: 0 6px 16px color-mix(in srgb, var(--focus) 40%, transparent); }
.mock.f-corners .m-tile.foc:not(.m-play) { border: var(--rest-border) !important; box-shadow: 0 4px 12px color-mix(in srgb, var(--focus) 30%, transparent); overflow: visible; }
.mock.f-corners.bezel .m-tile.foc:not(.m-play) { background: var(--surface) !important; }
.mock.f-corners .m-tile.foc::after { content: ""; position: absolute; inset: -8px; border: 3.5px solid var(--focus); border-radius: calc(var(--radius) + 8px); pointer-events: none;
  -webkit-mask: linear-gradient(90deg, #000 0 28%, transparent 28% 72%, #000 72%), linear-gradient(180deg, #000 0 28%, transparent 28% 72%, #000 72%);
  -webkit-mask-composite: source-in; mask: linear-gradient(90deg, #000 0 28%, transparent 28% 72%, #000 72%), linear-gradient(180deg, #000 0 28%, transparent 28% 72%, #000 72%); mask-composite: intersect; }
.m-console-tint { position: absolute; inset: 0; }
.m-console-icon { position: absolute; inset: 14%; display: grid; place-items: center; }
.m-console-icon img { max-width: 100%; max-height: 100%; object-fit: contain; filter: drop-shadow(0 4px 8px #0006); }
.m-noicon { color: var(--on-sv); opacity: .6; }

/* games */
.m-games-head { display: flex; align-items: center; gap: 8px; padding: 6px 4px 10px; }
.m-games-title { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.m-games-title .m-title-l { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-sysicon { width: 36px; height: 36px; display: grid; place-items: center; flex: none; }
.m-sysicon.sm { width: 18px; height: 18px; }
.m-sysicon img { max-width: 100%; max-height: 100%; object-fit: contain; }
.m-sysicon svg { width: 100%; height: 100%; }
.m-switcher { display: flex; gap: 6px; padding: 3px 10px; border-radius: 999px; background: color-mix(in srgb, var(--sch) 90%, transparent); }
.m-seg { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; font-size: 14px; font-weight: 700; color: var(--on-surface); }
.m-seg.on { background: var(--primary); color: var(--on-primary); }
.m-chip { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 999px; background: color-mix(in srgb, var(--sch) 90%, transparent); font-size: 14px; font-weight: 500; white-space: nowrap; border: var(--rest-border); }
.m-split { flex: 1; min-height: 0; display: flex; gap: 16px; }
.m-panel { background: color-mix(in srgb, var(--surface) 82%, transparent); border-radius: var(--radius); }
.m-list { flex: .45; padding: 8px; display: flex; flex-direction: column; gap: 4px; overflow: hidden; min-width: 0; }
.m-row { display: flex !important; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px !important; background: transparent; flex: none; }
.mock.cut .m-row { clip-path: none !important; }
.m-row.foc { transform: scale(1.02); }
.m-thumb { width: 36px; height: 36px; border-radius: 6px; overflow: hidden; flex: none; }
.m-thumb svg { width: 100%; height: 100%; }
.m-row-text { flex: 1; min-width: 0; display: grid; }
.m-row-text b { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-row.sel b, .m-row.foc b { font-weight: 700; }
.m-row-text small { font-size: 11px; color: var(--on-sv); font-weight: 500; }
.m-stage { flex: .55; padding: 14px; display: flex; flex-direction: column; gap: 10px; min-width: 0; overflow: hidden; }
.m-stage-media { display: flex; gap: 10px; flex: 1; min-height: 0; }
.m-media { flex: 1.7; border-radius: 14px; background: #000; overflow: hidden; }
.m-media svg, .m-box svg, .m-cover svg, .m-game-art svg, .m-card-art svg, .m-thumb svg { width: 100%; height: 100%; display: block; }
.m-art { width: 100%; height: 100%; object-fit: cover; display: block; }
.m-art.pixel { image-rendering: pixelated; }
.m-box .m-art, .m-media .m-art { object-fit: contain; position: absolute; inset: 0; }
.m-media, .m-box { position: relative; }
.m-stage-media { min-height: 34%; }
.m-box { flex: 1; border-radius: 6px; overflow: hidden; }
.m-stage-meta { display: flex; align-items: center; gap: 6px; }
.m-stage-title { font-size: 26px; font-weight: 800; line-height: 30px; color: var(--on-surface); }
.m-info { display: flex; align-items: center; gap: 4px; color: var(--on-sv); font-size: 12px; font-weight: 500; }
.m-actions { display: flex; align-items: center; gap: 10px; }
.m-status-pill { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; margin-left: auto; white-space: nowrap; }
.m-play { display: inline-flex !important; align-items: center; gap: 8px; min-height: 48px; padding: 12px 22px !important; border-radius: 12px; background: linear-gradient(135deg, var(--play-1), var(--play-2)) !important; color: var(--on-primary) !important; font-weight: 800; letter-spacing: .5px; box-shadow: 0 6px 6px color-mix(in srgb, var(--play-1) 30%, transparent); transition: transform .15s; white-space: nowrap; }
.m-play.foc { border: 2px solid rgba(255,255,255,.9) !important; transform: scale(1.05); box-shadow: 0 8px 18px color-mix(in srgb, var(--play-1) 55%, transparent); }
.mock .m-play:hover { transform: scale(1.03); }

/* game page */
.mock.scene-game .m-body { padding: 0; }
.m-game-art { position: absolute; inset: -20px; opacity: .15; filter: blur(6px); }
.m-iconbtn { position: absolute; left: 4px; top: 4px; width: 48px; height: 48px; display: grid !important; place-items: center; color: var(--on-surface); z-index: 2; }
.m-game { position: absolute; inset: 52px 24px 16px; display: flex; gap: 24px; align-items: flex-start; }
.m-cover { width: 260px; flex: none; aspect-ratio: 16 / 15; border-radius: 16px; overflow: hidden; background: #000; max-height: 100%; }
.m-game-col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.m-headline { font-size: 32px; font-weight: 700; color: var(--on-bg); line-height: 1.1; }
.m-pills { display: flex; gap: 8px; flex-wrap: wrap; }
.m-pills .m-status-pill { margin-left: 0; }
.m-info-pill { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 999px; background: var(--sch); font-size: 12px; font-weight: 500; white-space: nowrap; }
.m-action { display: inline-flex !important; align-items: center; gap: 8px; padding: 12px 20px; border-radius: 14px !important; background: var(--sch); font-weight: 700; letter-spacing: .5px; white-space: nowrap; }
.m-action.primary { background: var(--primary); color: var(--on-primary); }
.mock.cut .m-action, .mock.cut .m-setrow { clip-path: none !important; }

/* spotlight */
.m-spot { overflow: hidden; display: flex; flex-direction: column; gap: 4px; }
.m-weekly { display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-radius: var(--radius); background: color-mix(in srgb, var(--surface) 82%, transparent); border: var(--rest-border); }
.m-weekly-badge { width: 56px; height: 56px; border-radius: 10px; display: grid; place-items: center; background: color-mix(in srgb, var(--tertiary) 18%, transparent); color: var(--tertiary); flex: none; }
.m-weekly .m-kicker { font-size: 12px; letter-spacing: 1px; }
.m-weekly .m-title-l { font-size: 18px; }
.m-section { font-size: 22px; font-weight: 700; color: var(--on-bg); padding: 12px 24px 8px; position: relative; }
.m-section.under::after { content: ""; position: absolute; left: 24px; bottom: 2px; width: 40px; height: 2px; background: var(--primary); }
.m-shelf { display: flex; gap: 12px; padding: 0 4px; }
.m-card { width: 112px; flex: none; overflow: hidden; display: flex !important; flex-direction: column; }
.m-card.foc { transform: scale(1.06); }
.m-card-art { height: 120px; background: var(--sv); display: block; }
.m-card-foot { padding: 8px 10px; display: grid; }
.m-card-foot b { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-card-foot small { font-size: 11px; color: var(--on-sv); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* settings */
.mock.scene-settings .m-body { padding: 4px 16px 16px; }
.m-settings { display: flex; gap: 20px; flex: 1; min-height: 0; }
.m-setrail { width: 230px; flex: none; display: flex; flex-direction: column; gap: 6px; overflow: hidden; padding: 0 4px; margin: 0 -4px; }
.m-sethead { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.m-cat { display: flex !important; align-items: center; gap: 14px; padding: 11px 14px; border-radius: 14px !important; background: color-mix(in srgb, var(--sc) 40%, transparent); font-weight: 500; flex: none; }
.m-cat.sel { font-weight: 700; }
.mock.cut .m-cat { clip-path: none !important; }
.m-pane { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 12px; overflow: hidden; padding: 4px 8px 0; margin: -4px -8px 0; }
.m-panetitle { display: flex; align-items: center; gap: 12px; }
.m-group { text-transform: uppercase; font-size: 12px; font-weight: 700; letter-spacing: 1.5px; color: var(--primary); padding: 8px 0 0 4px; }
.m-setrow { display: flex !important; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 16px !important; flex: none; }
.m-setrow.foc { transform: scale(1.02); }
.m-rowicon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: var(--primary); background: color-mix(in srgb, var(--primary) 15%, transparent); flex: none; }
.m-switch { width: 50px; height: 28px; border-radius: 99px; padding: 3px; background: color-mix(in srgb, var(--outline) 60%, transparent); display: flex; flex: none; }
.m-switch span { width: 22px; height: 22px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; color: var(--primary); }
.m-switch.on { background: var(--primary); justify-content: flex-end; }
.m-switch.on span { background: var(--on-primary); }

/* hints */
.m-hints { position: absolute; right: 12px; bottom: 12px; display: flex; gap: 16px; padding: 6px 14px; border-radius: 99px; background: rgba(0,0,0,.55); color: #fff; font-size: 12px; font-weight: 500; z-index: 5; font-family: Roboto, system-ui, sans-serif; }
.m-hints > span { display: inline-flex; align-items: center; gap: 6px; }
.m-glyph { border-radius: 50%; display: inline-grid; place-items: center; font-weight: 900; line-height: 1; flex: none; }
.m-glyph.sq { background: rgba(255,255,255,.9); color: #15171C; display: inline-flex; align-items: center; justify-content: center; }
.m-glyph.sq b { font-weight: 900; }

/* ---------- plugin mode ---------- */
.tplrow { text-align: left; border: 1px solid var(--line); background: var(--panel-2); border-radius: 11px; padding: 10px 12px; display: grid; gap: 2px; }
.tplrow:hover { border-color: var(--ink-3); }
.tplrow.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--panel-2)); }
.tplrow b { font-size: 13px; }
.tplrow span { font-size: 12px; color: var(--ink-3); }
textarea.code { width: 100%; min-height: 340px; resize: vertical; border-radius: 10px; border: 1px solid var(--line-2); background: #0B0E15; color: #D7DEEF; padding: 12px;
  font: 12.5px/1.5 ui-monospace, Menlo, Consolas, monospace; tab-size: 2; outline: none; white-space: pre; }
textarea.code:focus { border-color: var(--accent); }
.pm { position: absolute; inset: 0; font-family: Oxanium, system-ui, sans-serif; color: var(--on); }
.pm-wall { position: absolute; inset: 0; background-size: cover; background-position: center; }
.pm-top { position: relative; display: flex; align-items: center; gap: 6px; padding: 30px 18px 8px; }
.pm-tab { display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 12px; border-radius: 99px; background: color-mix(in srgb, var(--sf) 55%, transparent); font-weight: 700; font-size: 15px; }
.pm-tab.on { background: var(--p); color: var(--op); }
.pm-round { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--sv); }
.pm-grid { position: relative; display: grid; grid-template-columns: repeat(4, 1fr); grid-auto-rows: 118px; gap: 12px; padding: 4px 18px; }
.pm-card { position: relative; border-radius: var(--r); background: color-mix(in srgb, var(--sf) 85%, transparent); border: 1px solid color-mix(in srgb, var(--mut) 30%, transparent); overflow: hidden; }
.pm-card.plugin { outline: 2px dashed color-mix(in srgb, var(--p) 70%, transparent); outline-offset: 3px; cursor: pointer; }
body.mode-plugin #scenes, body.mode-plugin #pickBtn, body.mode-plugin #soundBtn, body.mode-plugin #musicBtn, body.mode-plugin #glyphs { display: none; }
/* Same color scheme as the plugin's page, so the browser leaves its background transparent. */
.pm-card iframe { color-scheme: normal; position: absolute; inset: 3px; width: calc(100% - 6px); height: calc(100% - 6px); border: 0; background: transparent; border-radius: calc(var(--r) - 3px); }
.pm-in { padding: 14px; height: 100%; box-sizing: border-box; display: flex; flex-direction: column; justify-content: center; gap: 4px; }
.pm-big { font-size: 34px; font-weight: 800; line-height: 1; }
.pm-k { font-size: 11px; font-weight: 800; letter-spacing: 1.3px; color: var(--p); text-transform: uppercase; }
.pm-mut { font-size: 13px; color: var(--mut); }
.pm-strip { display: flex; gap: 6px; height: 70px; }
.pm-strip img { height: 100%; aspect-ratio: 3/4; object-fit: cover; border-radius: 6px; }

/* Dual-screen handheld: the main screen above, the second screen below, like the AYN Thor. */
.screen2 { display: none; }
.device.dual { display: flex; flex-direction: column; align-items: center; gap: 26px; padding: 18px 22px; border-radius: 26px; }
.device.dual::before, .device.dual::after, .device.dual .grip { display: none; }
.device.dual .screen2 { display: block; }
.device.dual .screen { box-shadow: 0 0 0 8px #05070A, 0 0 0 9px #ffffff14; }
.s2-content { position: absolute; inset: 0; }
.s2-pad { position: absolute; inset: 0; padding: 22px; display: flex; flex-direction: column; }
.s2-blur { overflow: hidden; }
.s2-blur > * { width: 100%; height: 100%; object-fit: cover; filter: blur(28px); transform: scale(1.15); opacity: .55; }
.s2-title { font-size: 26px; font-weight: 800; color: var(--on-bg); line-height: 1.15; margin: 2px 0 4px; }
.s2-sys { display: flex; gap: 18px; align-items: center; }
.s2-sysicon { width: 96px; height: 96px; display: grid; place-items: center; flex: none; }
.s2-sysicon img { width: 100%; height: 100%; object-fit: contain; }
.s2-covers { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.s2-cover { aspect-ratio: .75; border-radius: 10px; overflow: hidden; display: block; }
.s2-game { gap: 14px; }
.s2-box { flex: 0 0 40%; min-height: 0; display: flex; justify-content: center; overflow: hidden; }
.s2-box > * { height: 100% !important; width: auto !important; max-width: 100%; aspect-ratio: .72; border-radius: var(--radius); object-fit: cover; }
.s2-text { flex: 1; min-height: 0; overflow: hidden; }
.s2-bar { height: 6px; border-radius: 3px; background: var(--sv); margin-top: 10px; overflow: hidden; }
.s2-bar span { display: block; height: 100%; background: var(--tertiary); }
.s2-idle { gap: 20px; }
.s2-clock { font-size: 64px; font-weight: 800; color: var(--on-bg); line-height: 1; }
.s2-continue { flex: 1; position: relative; border-radius: 18px; overflow: hidden; background: var(--sc); }
.s2-continue-art > * { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.s2-continue::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent, #000c); }
.s2-continue-foot { position: absolute; left: 14px; right: 14px; bottom: 14px; z-index: 1; display: flex; align-items: center; gap: 12px; }
.s2-continue-foot > div { flex: 1; min-width: 0; }
.s2-continue-title { font-size: 22px; font-weight: 800; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Keep the stage to the window so the preview scales down instead of growing past it (the dual frame is tall). */
@media (min-width: 1101px) { .stage { min-height: 0; grid-template-rows: auto minmax(0, 1fr) auto; } }
.s2-game.wide { flex-direction: row; gap: 22px; }
.s2-game.wide .s2-box { flex: 0 0 36%; align-items: center; }
.s2-game.wide .s2-box > * { height: auto !important; width: 100% !important; }
