/* ============================================================================
   STATION PLANNER  ·  style.css
   ----------------------------------------------------------------------------
   Design tokens follow pages/home/style.css (glass cards, thin lines, Space
   Grotesk, IBM Plex Mono, Instrument Serif accents).
   grep -n targets
     tokens ............... ":root"
     top bar .............. ".bar"
     side panels .......... ".side"
     palette .............. ".pg" / ".pc"
     stage overlays ....... ".tools" / ".zoom" / ".layers" / ".hint"
     inspector ............ ".ins-"
     summary .............. ".stats" / ".counts"
     dialog ............... ".dlg"
     phone dock + sheets .. "COMPACT" (phone, touch tablet portrait,
                            touch landscape phone)
     landscape rail ....... "LANDSCAPE RAIL"
     touch sizes .......... "TOUCH SIZES"
   ============================================================================ */
:root {
  --bg: #0a0c12; --bg2: #0e1119; --bg3: #131826;
  --ink: #eef3fb; --text: #c3d0e2; --dim: #7f91ad; --faint: #3a4866;
  --line: rgba(150, 200, 255, 0.09); --line2: rgba(150, 200, 255, 0.18);
  --blue: #96c8ff; --gold: #ffc832; --orange: #ff7b00; --red: #ff6a6a; --green: #6fe0a8;
  --glass: rgba(16, 21, 33, 0.72);
  --f-sans: 'Space Grotesk', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --f-mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --f-serif: 'Instrument Serif', 'Iowan Old Style', Georgia, serif;
  --r: 16px; --r-sm: 10px;
  --bar-h: 56px; --side-l: 280px; --side-r: 320px;
  --ease: cubic-bezier(.2, .7, .2, 1);
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; background: var(--bg); color-scheme: dark; }
body { font: 400 14px/1.5 var(--f-sans); color: var(--text); overflow: hidden; -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; -webkit-tap-highlight-color: transparent; }
button:disabled { opacity: .35; cursor: default; }
a { color: inherit; text-decoration: none; }
em { font-family: var(--f-serif); font-style: italic; font-weight: 400; color: var(--gold); }
kbd { font: 500 0.68rem/1 var(--f-mono); padding: 3px 6px; border: 1px solid var(--line2); border-radius: 5px; color: var(--dim); background: rgba(150, 200, 255, 0.05); }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }

#app { position: fixed; inset: 0; display: flex; flex-direction: column; }

/* ---- top bar ---- */
.bar { height: var(--bar-h); flex: none; display: flex; align-items: center; gap: 18px; padding: 0 16px 0 18px; background: rgba(10, 12, 18, .95); border-bottom: 1px solid var(--line); position: relative; z-index: 20; }
.bar::after { content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; background: linear-gradient(90deg, transparent, var(--blue), var(--gold), transparent); opacity: .3; }
.brand { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.brand .mark { color: var(--gold); font-size: 12px; filter: drop-shadow(0 0 6px rgba(255, 200, 50, .6)); }
.brand .t { font-weight: 500; font-size: 15px; letter-spacing: .02em; color: var(--ink); }
.brand em { font-size: 18px; }
.name { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; max-width: 340px; }
.name span { font: 500 11px/1 var(--f-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--dim); }
.name input { flex: 1; min-width: 0; height: 34px; padding: 0 12px; background: rgba(150, 200, 255, .04); border: 1px solid var(--line2); border-radius: 999px; color: var(--ink); outline: none; }
.name input:focus { border-color: rgba(255, 200, 50, .5); }
.bar-act { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.ib { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; color: var(--text); border: 1px solid transparent; }
.ib:hover:not(:disabled) { border-color: var(--line2); background: rgba(150, 200, 255, .05); color: var(--ink); }
.pill { height: 36px; display: inline-flex; align-items: center; gap: 8px; padding: 0 16px; border-radius: 999px; font-weight: 600; font-size: 13px; color: #1a1204; background: linear-gradient(135deg, #ffd65c, #ffb31a); transition: box-shadow .3s, transform .3s var(--ease); }
.pill:hover { box-shadow: 0 6px 24px -6px rgba(255, 190, 40, .8); transform: translateY(-1px); }

/* ---- layout ---- */
.main { flex: 1; min-height: 0; display: grid; grid-template-columns: var(--side-l) 1fr var(--side-r); }
.side { min-height: 0; overflow-y: auto; overscroll-behavior: contain; background: var(--bg2); scrollbar-width: thin; scrollbar-color: var(--faint) transparent; }
#side-l { border-right: 1px solid var(--line); padding: 16px 14px 24px; }
#side-r { border-left: 1px solid var(--line); padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.grab { display: none; }
.side-h { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; }
.side-h h2 { font-size: 16px; font-weight: 600; color: var(--ink); }
.side-h .sub { font: 400 11px/1 var(--f-mono); color: var(--dim); }
.search { position: relative; margin-bottom: 10px; }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--dim); }
.search input { width: 100%; height: 38px; padding: 0 12px 0 34px; border-radius: 12px; background: rgba(150, 200, 255, .04); border: 1px solid var(--line2); outline: none; color: var(--ink); }
.search input:focus { border-color: rgba(150, 200, 255, .45); }
.chk { display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--dim); margin: 0 2px 14px; cursor: pointer; }
.chk input { accent-color: var(--gold); }

/* ---- palette ---- */
.pg { margin-bottom: 16px; }
.pg-h { display: flex; align-items: center; justify-content: space-between; font: 500 11px/1 var(--f-mono); letter-spacing: .16em; text-transform: uppercase; color: var(--dim); padding: 0 2px 8px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.pg-h b { font-weight: 500; color: var(--faint); }
.pg-l { display: flex; flex-direction: column; gap: 6px; }
.pc { display: flex; align-items: center; gap: 10px; padding: 7px 10px 7px 7px; border-radius: 12px; border: 1px solid var(--line); background: rgba(19, 24, 38, .55); text-align: left; transition: border-color .2s, background .2s, transform .2s var(--ease); }
.pc:hover { border-color: var(--line2); background: rgba(26, 33, 52, .8); }
.pc.on { border-color: rgba(255, 200, 50, .6); background: linear-gradient(135deg, rgba(255, 200, 50, .1), rgba(19, 24, 38, .7)); box-shadow: 0 0 0 1px rgba(255, 200, 50, .15), 0 8px 24px -12px rgba(255, 200, 50, .5); }
.th { width: 44px; height: 44px; flex: none; border-radius: 10px; display: grid; place-items: center; background: radial-gradient(circle at 50% 40%, rgba(150, 200, 255, .1), rgba(10, 12, 18, .6)); border: 1px solid var(--line); overflow: hidden; }
.th img { max-width: 84%; max-height: 84%; object-fit: contain; }
.th.sym { color: var(--ac); font-size: 20px; text-shadow: 0 0 12px color-mix(in srgb, var(--ac) 50%, transparent); }
.th.sm { width: 30px; height: 30px; border-radius: 8px; font-size: 14px; }
.pc-t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pc-t b { font-weight: 500; font-size: 13px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-t small { font: 400 10.5px/1.3 var(--f-mono); color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-t .st { font: 400 10.5px/1 var(--f-mono); color: var(--orange); font-style: normal; }
.shape { width: auto; height: auto; max-width: 26px; fill: rgba(150, 200, 255, .35); stroke: none; }
.pc.on .shape { fill: rgba(255, 200, 50, .7); }
.empty { color: var(--dim); font-size: 13px; padding: 12px 2px; }

/* ---- stage ---- */
#stage { position: relative; min-width: 0; min-height: 0; overflow: hidden; background: #07090e; }
#cv { position: absolute; inset: 0; touch-action: none; display: block; }
.tools { position: absolute; left: 14px; top: 14px; display: flex; flex-direction: column; gap: 4px; padding: 6px; border-radius: 14px; background: var(--glass); border: 1px solid var(--line2); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.tb { position: relative; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 10px; color: var(--text); transition: background .15s, color .15s; }
.tb span { display: none; }
.tb:hover { background: rgba(150, 200, 255, .08); color: var(--ink); }
.tb.on { background: rgba(255, 200, 50, .16); color: var(--gold); box-shadow: inset 0 0 0 1px rgba(255, 200, 50, .4); }
.tb:hover span { display: block; position: absolute; left: 48px; top: 50%; transform: translateY(-50%); white-space: nowrap; font: 500 11px/1 var(--f-mono); padding: 6px 8px; border-radius: 6px; background: rgba(8, 11, 18, .92); border: 1px solid var(--line2); color: var(--ink); pointer-events: none; }
.tsep { height: 1px; background: var(--line2); margin: 3px 6px; }
.wallmode { position: absolute; left: 70px; top: 14px; display: flex; padding: 4px; gap: 2px; border-radius: 12px; background: var(--glass); border: 1px solid var(--line2); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.wallmode button { padding: 7px 14px; border-radius: 8px; font: 500 12px/1 var(--f-mono); color: var(--dim); }
.wallmode button.on { background: rgba(150, 200, 255, .14); color: var(--ink); }
.zoom { position: absolute; right: 14px; top: 14px; display: flex; flex-direction: column; gap: 2px; padding: 4px; border-radius: 12px; background: var(--glass); border: 1px solid var(--line2); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.zoom button { width: 36px; height: 36px; border-radius: 8px; font-size: 18px; color: var(--text); display: grid; place-items: center; }
.zoom button:hover { background: rgba(150, 200, 255, .08); color: var(--ink); }
.layers2 { display: none; }
.layers { position: absolute; left: 14px; bottom: 14px; display: flex; gap: 6px; flex-wrap: wrap; max-width: calc(100% - 28px); }
.ly { display: flex; align-items: center; border-radius: 999px; background: var(--glass); border: 1px solid var(--line2); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); font: 500 11px/1 var(--f-mono); color: var(--text); }
.ly.off { color: var(--faint); }
.ly-v { display: flex; align-items: center; gap: 7px; padding: 8px 6px 8px 12px; }
.ly-v svg, .ly-l svg { width: 15px; height: 15px; }
.ly-l { padding: 8px 12px 8px 6px; color: var(--faint); }
.ly-l.on { color: var(--gold); }
.ly.rules { padding: 8px 14px; gap: 8px; }
.ly.rules .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.ly.rules.on .dot { background: var(--green); box-shadow: 0 0 8px var(--green); }
.hint { position: absolute; left: 50%; top: 14px; transform: translateX(-50%); width: max-content; max-width: min(620px, calc(100% - 180px)); text-align: center; font-size: 12.5px; color: var(--text); padding: 8px 16px; border-radius: 999px; background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); pointer-events: none; }
.hint:empty { display: none; }
.hint b { color: var(--ink); font-weight: 500; }
.hint .hl { pointer-events: auto; color: var(--gold); text-decoration: underline; text-underline-offset: 3px; }
.tip { position: absolute; padding: 6px 10px; border-radius: 8px; font: 500 11px/1.2 var(--f-mono); color: #ffd1d1; background: rgba(40, 10, 14, .92); border: 1px solid rgba(255, 106, 106, .5); pointer-events: none; white-space: nowrap; }
.toast { position: absolute; left: 50%; bottom: 64px; transform: translate(-50%, 12px); opacity: 0; padding: 9px 16px; border-radius: 999px; font-size: 13px; color: var(--ink); background: rgba(16, 21, 33, .94); border: 1px solid var(--line2); transition: opacity .2s, transform .25s var(--ease); pointer-events: none; white-space: nowrap; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { border-color: rgba(255, 106, 106, .5); color: #ffd1d1; }

/* ---- right panel cards ---- */
.card { border-radius: var(--r); padding: 16px; background: linear-gradient(180deg, rgba(22, 28, 44, .75), rgba(14, 18, 28, .75)); border: 1px solid var(--line); }
.card h3 { font-size: 15px; font-weight: 600; color: var(--ink); margin-bottom: 10px; display: flex; align-items: baseline; gap: 8px; }
.h-sub { font: 400 11px/1 var(--f-mono); color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lead { color: var(--text); font-size: 13px; margin-bottom: 12px; }
.keys { list-style: none; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; font-size: 12px; color: var(--dim); }
.fine { font-size: 11.5px; color: var(--dim); margin-top: 10px; }
.ins-top { display: flex; gap: 14px; align-items: center; margin-bottom: 12px; }
.ins-art { width: 84px; height: 84px; flex: none; border-radius: 14px; display: grid; place-items: center; background: radial-gradient(circle at 50% 35%, rgba(150, 200, 255, .14), rgba(10, 12, 18, .7)); border: 1px solid var(--line2); }
.ins-art img { max-width: 80%; max-height: 80%; object-fit: contain; filter: drop-shadow(0 6px 14px rgba(0, 0, 0, .5)); }
.ins-art.sym { font-size: 38px; color: var(--ac); text-shadow: 0 0 18px color-mix(in srgb, var(--ac) 55%, transparent); }
.kick { font: 500 11px/1 var(--f-mono); letter-spacing: .16em; text-transform: uppercase; color: var(--dim); margin-bottom: 6px; }
.ins-name { margin: 0 0 6px !important; font-size: 19px !important; }
.wiki { font-size: 12.5px; color: var(--blue); }
.wiki:hover { color: var(--gold); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.chip { font: 500 11px/1 var(--f-mono); padding: 6px 9px; border-radius: 999px; border: 1px solid var(--line2); color: var(--text); }
.chip.ok { color: var(--green); border-color: rgba(111, 224, 168, .35); }
.chip.dim { color: var(--orange); border-color: rgba(255, 123, 0, .35); }
.chip.lay { color: var(--blue); }
.chip.tag { color: var(--gold); border-color: rgba(255, 200, 50, .28); }
.io { display: flex; align-items: center; gap: 10px; font: 400 12px/1.3 var(--f-mono); color: var(--ink); padding: 10px 12px; border-radius: 12px; background: rgba(150, 200, 255, .05); border: 1px solid var(--line); margin-bottom: 12px; }
.io span { flex: 1; }
.io span:last-child { text-align: right; }
.io svg { width: 26px; height: 13px; color: var(--gold); }
.ins-state { font-size: 12px; padding: 8px 12px; border-radius: 10px; margin-bottom: 12px; }
.ins-state.good { color: var(--green); background: rgba(111, 224, 168, .07); }
.ins-state.bad { color: #ffb3b3; background: rgba(255, 106, 106, .09); }
.ins-sec { margin-bottom: 12px; }
.ins-sec h4 { font: 500 11px/1 var(--f-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--dim); margin-bottom: 8px; }
.links { display: flex; flex-wrap: wrap; gap: 6px; }
.lk { display: inline-flex; align-items: center; gap: 7px; padding: 4px 10px 4px 4px; border-radius: 999px; border: 1px solid var(--line2); font-size: 12px; color: var(--text); transition: border-color .2s, color .2s; }
.lk:hover { border-color: rgba(150, 200, 255, .5); color: var(--ink); }
.lk img, .lk i { width: 22px; height: 22px; border-radius: 50%; object-fit: contain; background: rgba(150, 200, 255, .08); display: grid; place-items: center; font-style: normal; font-size: 11px; }
.ins-act { display: flex; gap: 8px; }
.btns { display: flex; flex-wrap: wrap; gap: 8px; }
.btn { height: 34px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line2); background: rgba(150, 200, 255, .04); font-size: 12.5px; color: var(--ink); transition: border-color .2s, background .2s; }
.btn:hover:not(:disabled) { border-color: rgba(150, 200, 255, .45); background: rgba(150, 200, 255, .08); }
.btn.warn { color: #ffb3b3; border-color: rgba(255, 106, 106, .3); }
.btn.pri { color: #1a1204; background: linear-gradient(135deg, #ffd65c, #ffb31a); border: 0; font-weight: 600; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 12px; }
.stats div { padding: 10px 6px; border-radius: 12px; background: rgba(150, 200, 255, .04); border: 1px solid var(--line); text-align: center; }
.stats b { display: block; font: 500 18px/1.1 var(--f-sans); color: var(--ink); }
.stats span { font: 400 11px/1 var(--f-mono); color: var(--dim); }
.stats .bad b { color: var(--red); }
.probs { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.prob { text-align: left; padding: 8px 10px; border-radius: 10px; border: 1px solid rgba(255, 106, 106, .25); background: rgba(255, 106, 106, .05); display: flex; flex-direction: column; }
.prob b { font-weight: 500; font-size: 12.5px; color: var(--ink); }
.prob span { font-size: 11.5px; color: #ffb3b3; }
.counts { display: flex; flex-direction: column; gap: 4px; }
.cnt { display: flex; align-items: center; gap: 10px; padding: 4px 6px; border-radius: 10px; font-size: 13px; }
.cnt:hover { background: rgba(150, 200, 255, .06); color: var(--ink); }
.cnt > span:not(.th) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cnt b { font: 500 12px/1 var(--f-mono); color: var(--gold); }

/* ---- dialog ---- */
.dlg { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px; background: rgba(4, 6, 10, .6); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.dlg-card { width: min(520px, 100%); border-radius: var(--r); padding: 20px; background: linear-gradient(180deg, #161c2c, #0e1119); border: 1px solid var(--line2); box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .8); }
.dlg-card h3 { color: var(--ink); font-size: 17px; font-weight: 600; }
.dlg-card textarea { width: 100%; margin: 12px 0; padding: 10px 12px; border-radius: 10px; background: rgba(0, 0, 0, .3); border: 1px solid var(--line2); font: 400 11.5px/1.5 var(--f-mono); color: var(--text); resize: vertical; word-break: break-all; }

/* ---- dock and sheets (phone) ---- */
.dock, .scrim { display: none; }
@media (max-width: 1280px) { :root { --side-l: 236px; --side-r: 276px; } }
/* COMPACT: keep this query the same as COMPACT_Q in main.js. */
@media (max-width: 760px), (pointer: coarse) and (max-height: 500px), (pointer: coarse) and (max-width: 900px) and (orientation: portrait) {
  :root { --bar-h: 52px; }
  .bar { gap: 8px; padding: 0 8px 0 14px; }
  .bar-act { gap: 0; }
  .brand .t { font-size: 14px; }
  .name span { display: none; }
  .name input { height: 32px; font-size: 13px; }
  .pill span { display: none; }
  .pill { width: 36px; padding: 0; justify-content: center; }
  .main { display: block; position: relative; }
  #stage { position: absolute; inset: 0; }
  .side { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; max-height: 72vh; max-height: 72dvh; border: 1px solid var(--line2) !important; border-bottom: 0 !important; border-radius: 20px 20px 0 0; background: rgba(14, 17, 25, .97); transform: translateY(105%); transition: transform .32s var(--ease); padding-bottom: calc(24px + env(safe-area-inset-bottom)) !important; box-shadow: 0 -20px 60px -20px rgba(0, 0, 0, .8); }
  .side.open { transform: none; }
  .grab { display: block; width: 100%; height: 22px; position: sticky; top: -16px; margin: -10px 0 4px; z-index: 2; cursor: pointer; }
  .grab::before { content: ''; position: absolute; left: 50%; top: 10px; width: 44px; height: 4px; border-radius: 4px; background: var(--faint); transform: translateX(-50%); }
  #side-r .grab { top: -14px; margin: -8px 0 -6px; }
  .scrim { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(4, 6, 10, .5); opacity: 0; pointer-events: none; transition: opacity .25s; }
  .scrim.on { opacity: 1; pointer-events: auto; }
  .pc { padding: 9px 10px 9px 8px; }
  .tools { display: none; }
  .wallmode { left: 12px; top: 12px; }
  .zoom { right: 10px; top: auto; bottom: calc(80px + env(safe-area-inset-bottom)); }
  .zoom button { width: 40px; height: 40px; }
  #layers { display: none; }
  .layers2 { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; }
  .layers2 .ly { backdrop-filter: none; -webkit-backdrop-filter: none; background: rgba(150, 200, 255, .04); }
  .ly-v { padding: 9px 4px 9px 10px; }
  .ly-l { padding: 9px 10px 9px 4px; }
  .ly.rules { padding: 9px 12px; }
  .hint { top: 12px; max-width: calc(100% - 24px); font-size: 12px; padding: 7px 14px; }
  .wallmode:not([hidden]) ~ .hint { top: 60px; }
  .toast { bottom: calc(132px + env(safe-area-inset-bottom)); }
  .dock { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); background: rgba(10, 12, 18, .96); border-top: 1px solid var(--line2); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }
  .dock button { flex: 1; min-width: 0; min-height: 48px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding: 6px 0; border-radius: 10px; color: var(--dim); font: 500 10.5px/1 var(--f-mono); letter-spacing: 0; }
  .dock button svg { width: 21px; height: 21px; }
  .dock button.on { color: var(--gold); background: rgba(255, 200, 50, .1); }
  .stats b { font-size: 16px; }
  /* Wide sheets (touch tablet) stay a readable column in the middle. */
  .side { left: max(0px, calc(50% - 320px)); right: max(0px, calc(50% - 320px)); }
  .zoom button { width: 44px; height: 44px; }
  .lead, .empty, .cnt, .pc-t b { font-size: 14px; }
  .prob b { font-size: 14px; }
  .prob span, .ins-state, .keys { font-size: 13px; }
  .fine { font-size: 14px; }
  .hint { font-size: 14px; }
  .hint .hl { display: inline-block; padding: 12px 6px; margin: -12px -6px; }
  .grab { height: 30px; margin: -12px 0 2px; }
}
/* Narrow phone: drop the brand mark so the name field keeps room. */
@media (max-width: 420px) { .brand .mark { display: none; } }
@media (max-width: 380px) { .brand .t { font-size: 0; } .brand em { font-size: 19px; } }
/* LANDSCAPE RAIL: a touch phone on its side. The dock becomes a rail on the
   right edge and the sheets become full-height drawers, so the canvas keeps
   the full height under the bar. */
@media (pointer: coarse) and (max-height: 500px) {
  :root { --bar-h: 48px; --rail: calc(66px + env(safe-area-inset-right)); }
  .bar { padding-left: calc(14px + env(safe-area-inset-left)); padding-right: calc(10px + env(safe-area-inset-right)); }
  #stage { inset: 0 var(--rail) 0 0; }
  .wallmode { left: calc(12px + env(safe-area-inset-left)); }
  .zoom { right: 10px; bottom: calc(12px + env(safe-area-inset-bottom)); }
  .zoom button { width: 44px; height: 44px; }
  .toast { bottom: calc(16px + env(safe-area-inset-bottom)); }
  .dock { top: var(--bar-h); left: auto; width: var(--rail); flex-direction: column; justify-content: center; gap: 2px; padding: 4px calc(4px + env(safe-area-inset-right)) calc(4px + env(safe-area-inset-bottom)) 4px; border-top: 0; border-left: 1px solid var(--line2); }
  .dock button { flex: 1 1 0; min-height: 40px; max-height: 56px; }
  .side { top: 0; bottom: 0; max-height: none; width: min(420px, 58vw); background: var(--bg2); border-radius: 0 20px 20px 0; border-bottom: 1px solid var(--line2) !important; padding-top: 14px !important; transform: translateX(-105%); }
  #side-l { left: 0; right: auto; padding-left: calc(14px + env(safe-area-inset-left)); }
  #side-r { left: auto; right: 0; border-radius: 20px 0 0 20px; transform: translateX(105%); padding-right: calc(14px + env(safe-area-inset-right)); }
  #side-l.open, #side-r.open { transform: none; }
  .grab { display: none; }
}
/* TOUCH SIZES: hit areas and no focus zoom in iOS Safari. */
@media (pointer: coarse) {
  input, textarea, select { font-size: 16px !important; }
  .name input { height: 44px; }
  .ib, .pill { min-width: 44px; height: 44px; }
  .chk { min-height: 44px; margin-bottom: 8px; }
  .chk input { width: 20px; height: 20px; flex: none; }
  .wallmode button { min-height: 40px; }
  .ly-v, .ly-l { min-height: 44px; }
  .ly-l { min-width: 40px; justify-content: center; display: flex; align-items: center; }
  .ly.rules { min-height: 44px; }
}
@media (hover: none) {
  .pc, .btn, .lk { min-height: 44px; }
  .cnt { min-height: 40px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
.layers2-card { display: none; }
@media (max-width: 760px), (pointer: coarse) and (max-height: 500px), (pointer: coarse) and (max-width: 900px) and (orientation: portrait) { .layers2-card { display: block; } }
@media (hover: none) { .keys { display: none; } }
@media (max-width: 1280px) and (min-width: 761px) { .side-h .sub { display: none; } }
