/* Sovasta Mind — 잉크 종이 #F6F2EB · 블루 #0F4C81. 한 열 폴백, 버튼 최소 48px, 가로 스크롤 없음. */
:root {
  --paper: #f6f2eb; --card: #fffdf9; --ink: #1b1b1b; --muted: #5d5850; --line: #e4ddd0;
  --blue: #0f4c81; --blue-2: #e3ecf6; --ok: #2e7d4f; --no: #b5452f; --warn: #8a5a00; --wood: #8a5a2b;
  --r: 18px; --gap: 16px;
  --font: Pretendard, "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
html[data-contrast="high"] { --paper: #ffffff; --card: #ffffff; --ink: #000; --muted: #222; --line: #000; --blue: #003a70; --blue-2: #d6e6ff; }
html[data-band="LL"] { --gap: 22px; }
html[data-band="LL"] body { font-size: 1.125rem; }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--font); line-height: 1.55; overflow-x: hidden; }
a { color: var(--blue); }
img, svg { max-width: 100%; }
.skip { position: absolute; left: 8px; top: -60px; background: var(--blue); color: #fff; padding: 8px 12px; border-radius: 8px; z-index: 50; }
.skip:focus { top: 8px; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }

/* ---------- 머리 */
.top { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--paper) 92%, transparent); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); }
.top-row { display: flex; align-items: center; gap: 10px; padding: 10px 16px; flex-wrap: wrap; max-width: 1100px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; color: var(--ink); text-decoration: none; font-size: 1.05rem; }
.brand img { border-radius: 8px; }
.top-right { margin-left: auto; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.views { display: flex; gap: 2px; overflow-x: auto; padding: 0 10px; max-width: 1100px; margin: 0 auto; scrollbar-width: none; }
.views a { padding: 10px 12px; text-decoration: none; color: var(--muted); border-bottom: 3px solid transparent; white-space: nowrap; font-weight: 600; min-height: 44px; display: flex; align-items: center; }
.views a[aria-current] { color: var(--blue); border-bottom-color: var(--blue); }
select { min-height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--ink); padding: 0 8px; font: inherit; }

main { max-width: 1100px; margin: 0 auto; padding: 20px 16px 60px; outline: none; }
.foot { text-align: center; color: var(--muted); font-size: 0.85rem; padding: 24px 16px 40px; }
h1 { font-size: clamp(1.5rem, 4vw, 2.1rem); line-height: 1.2; margin: 8px 0 8px; letter-spacing: -0.01em; }
h2 { font-size: 1.15rem; margin: 0 0 10px; }
h3 { font-size: 0.95rem; margin: 14px 0 8px; color: var(--muted); }
.lede { color: var(--muted); max-width: 70ch; margin: 0 0 var(--gap); }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.mono, .hash { font-family: var(--mono); font-size: 0.85rem; }
.warn { color: var(--warn); font-weight: 600; }
.eyebrow { font-family: var(--mono); color: var(--blue); font-size: 0.8rem; margin: 0; letter-spacing: 0.04em; }
.big { font-size: 1.25rem; font-weight: 700; margin: 4px 0; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; margin: 0 0 var(--gap); box-shadow: 0 1px 0 rgba(0,0,0,.03), 0 8px 24px -18px rgba(15,76,129,.35); min-width: 0; }
.grid2 { display: grid; grid-template-columns: 1fr; gap: var(--gap); }
.grid2 > .card { margin: 0; }
.grid2 { margin-bottom: var(--gap); }
@media (min-width: 760px) { .grid2 { grid-template-columns: 1fr 1fr; } }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.rowsp { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.hero { padding: 18px 0 8px; }
.hero h1 { font-size: clamp(1.7rem, 5vw, 2.6rem); max-width: 22ch; }

/* ---------- 버튼 */
button, .btn { font: inherit; min-height: 48px; padding: 0 18px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; font-weight: 600; }
button:hover, .btn:hover { border-color: var(--blue); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.primary:hover { filter: brightness(1.1); }
.danger { border-color: var(--no); color: var(--no); }
button.big, .btn.big { min-height: 56px; font-size: 1.1rem; padding: 0 26px; }
.btn.small, button.small { min-height: 40px; padding: 0 12px; font-size: 0.9rem; }
.chip { display: inline-flex; align-items: center; min-height: 34px; padding: 0 12px; border-radius: 999px; background: var(--blue-2); color: var(--blue); font-weight: 600; font-size: 0.85rem; text-decoration: none; border: 0; }
.chip.strong { background: var(--blue); color: #fff; }
.chip.on { background: var(--blue); color: #fff; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 var(--gap); }
.filters .chip { min-height: 40px; cursor: pointer; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; flex-wrap: wrap; }
.seg button { border: 0; border-radius: 0; min-height: 44px; }
.seg button.on { background: var(--blue); color: #fff; }

/* ---------- 밴드 */
.bandrow { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.band { flex-direction: column; min-height: 64px; padding: 6px; gap: 0; }
.band small { font-family: var(--mono); font-size: 0.72rem; color: var(--muted); font-weight: 500; }
.band em { font-style: normal; font-size: 0.7rem; color: var(--ok); }
.band.on { background: var(--blue); color: #fff; border-color: var(--blue); }
.band.on small, .band.on em { color: #dfe9f5; }

/* ---------- 게임 목록 */
.gtiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.gtile { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; padding: 14px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); text-decoration: none; color: var(--ink); min-height: 120px; }
.gtile:hover { border-color: var(--blue); }
.gnum { grid-row: span 3; font-family: var(--mono); font-weight: 700; color: var(--blue); font-size: 1.3rem; }
.gname { font-weight: 800; }
.ggoal { color: var(--muted); font-size: 0.9rem; }
.gmeta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.gmeta i { font-style: normal; font-size: 0.75rem; background: var(--blue-2); color: var(--blue); padding: 2px 8px; border-radius: 999px; }

/* ---------- 판 */
.ghead .back { display: inline-flex; min-height: 44px; align-items: center; text-decoration: none; font-weight: 600; }
.reaLine { font-size: 0.9rem; color: var(--muted); margin: 0 0 10px; }
.reaLine b { font-family: var(--mono); color: var(--blue); }
.playarea { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; margin-top: 12px; }
.hud { display: flex; align-items: center; gap: 12px; min-height: 22px; }
.prog { font-family: var(--mono); font-size: 0.85rem; color: var(--muted); min-width: 4ch; }
.timebar { flex: 1; height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; }
.timebar i { display: block; height: 100%; background: var(--blue); width: 100%; transition: width .2s linear; }
.board { min-height: 300px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 14px 0; text-align: center; }
.trial { display: flex; flex-direction: column; align-items: center; gap: 14px; width: 100%; }
.startbox { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.feedback { min-height: 1.6em; text-align: center; font-weight: 600; }
.feedback.ok { color: var(--ok); }
.feedback.no { color: var(--no); }
.pulse-ok { animation: pok .35s; } .pulse-no { animation: pno .35s; }
@keyframes pok { 50% { box-shadow: inset 0 0 0 4px color-mix(in srgb, var(--ok) 40%, transparent); } }
@keyframes pno { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
html[data-motion="reduce"] *, html[data-motion="reduce"] *::before { animation: none !important; transition: none !important; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
.quit { margin-top: 12px; }
.hint { color: var(--muted); margin: 0; }
.task { font-weight: 700; font-size: 1.05rem; margin: 0; max-width: 60ch; }
.task.big { font-size: 1.25rem; min-height: 3.2em; }
.stage { min-height: 150px; display: flex; align-items: center; justify-content: center; }
.relative { position: relative; width: 100%; }
.q { font-size: 2rem; font-weight: 800; color: var(--blue); display: inline-flex; width: 56px; height: 56px; align-items: center; justify-content: center; border: 2px dashed var(--blue); border-radius: 12px; }
.choices { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; width: 100%; }
.choices.two .choice { flex: 1 1 140px; max-width: 260px; min-height: 64px; font-size: 1.05rem; }
.choices.stack { flex-direction: column; align-items: stretch; max-width: 520px; }
.choices.tiles .choice { min-width: 72px; min-height: 72px; padding: 6px; }
.choice.on, .choice[aria-pressed="true"] { border-color: var(--blue); box-shadow: inset 0 0 0 2px var(--blue); }
.cue { font-size: 1.4rem; font-weight: 800; padding: 6px 20px; border-radius: 999px; background: var(--blue-2); color: var(--blue); }
.cue.shape { background: #f3e6d6; color: var(--wood); }

/* 행렬 */
.matrix { display: grid; gap: 6px; background: var(--line); padding: 6px; border-radius: 14px; width: min(100%, 300px); }
.mcell { background: var(--card); border-radius: 10px; aspect-ratio: 1; display: flex; align-items: center; justify-content: center; }
.mcell svg { width: 85%; height: auto; }
.pair { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; }
.balls { gap: 6px; justify-content: center; }
.views .view, .row.views figure { margin: 0; }
figure.view { margin: 0; text-align: center; } figure.view figcaption { font-size: 0.8rem; color: var(--muted); }
.row.views { justify-content: center; }
.hgrid { display: grid; gap: 6px; }
.hcell { position: relative; width: 56px; height: 56px; padding: 0; overflow: hidden; }
.hcell i { position: absolute; left: 0; right: 0; bottom: 0; background: color-mix(in srgb, var(--blue) 35%, transparent); }
.hcell span { position: relative; font-family: var(--mono); font-weight: 800; }
.over { color: var(--no); }
/* 아치 */
.arch { display: grid; gap: 3px; width: min(100%, 420px); background: #e9e2d4; padding: 6px; border-radius: 12px; border-bottom: 6px solid var(--wood); }
.acell { min-height: 0; aspect-ratio: 1; padding: 0; border-radius: 6px; border: 1px dashed #cfc5b2; background: transparent; }
.acell.cube { background: var(--blue); border: 1px solid #0b3963; }
.acell.beam { background: var(--wood); border: 1px solid #5f3d1d; border-radius: 2px; }
.acell.gap { background: repeating-linear-gradient(45deg, #fff 0 6px, #f1c9c0 6px 12px); border: 0; }
.acell.wobble { animation: wob .6s infinite; outline: 2px solid var(--no); }
@keyframes wob { 50% { transform: rotate(4deg); } }
/* 대칭 */
.sym { display: grid; gap: 3px; width: min(100%, 340px); }
.scell { aspect-ratio: 1; min-height: 0; padding: 0; border-radius: 5px; background: #fff; }
.scell:disabled { opacity: 1; cursor: default; background: #efe9de; }
.scell.on:disabled { opacity: 1; }
.sym.v .scell.axis { box-shadow: -3px 0 0 var(--ink); }
.sym.h .scell.axis { box-shadow: 0 -3px 0 var(--ink); }
html[data-cb="marks"] .scell.on::after { content: "●"; color: #fff; font-size: 0.7rem; }
/* 막대 글자 */
.target { display: flex; gap: 12px; align-items: center; justify-content: center; flex-wrap: wrap; }
.target.hidden > * { visibility: hidden; }
.target.hidden::after { content: "?"; font-size: 2.5rem; color: var(--muted); }
.glyph { font-size: 3rem; font-weight: 800; }
.stick svg { width: 220px; }
/* 고리 */
.rings { display: grid; gap: 4px; }
.ring { padding: 0; min-height: 64px; width: 64px; border-radius: 10px; }
.ring:disabled { opacity: 1; }
.const svg { width: 280px; }
/* 탑 */
.towerwrap { align-items: flex-end; justify-content: center; }
.tower { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; min-height: 200px; min-width: 160px; border-bottom: 4px solid var(--wood); padding-bottom: 2px; }
.tcube { background: #e7a3b0; border: 1px solid #a45464; border-radius: 3px; }
.tower .tcube { margin-top: 1px; }
.tower.shake { animation: wob .5s 2; }
.tray { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; align-items: flex-end; }
.tcube.pick { min-height: 0; padding: 0; background: #e7a3b0; border-color: #a45464; }
.meter { width: 120px; height: 10px; background: var(--line); border-radius: 99px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--no); width: 0; }
.story { text-align: left; max-width: 52ch; font-size: 1.1rem; }
.story li { margin: 4px 0; }
.flash { position: absolute; right: 8px; top: 0; font-size: 2rem; color: var(--line); }
.flash.on { color: #e2b23a; }
.taccount { display: grid; grid-template-columns: 1fr 1fr; width: min(100%, 420px); border-top: 3px solid var(--ink); }
.taccount > div { padding: 6px 10px; min-height: 90px; }
.taccount > div:first-child { border-right: 3px solid var(--ink); }
.tcol { list-style: none; padding: 0; margin: 6px 0 0; font-family: var(--mono); font-size: 1.1rem; }
.tcol .fix { color: var(--no); text-decoration: line-through; }
.inv { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; align-items: center; }
.inv small { color: var(--muted); width: 100%; }
.inv.target .res { background: #f3e6d6; color: var(--wood); }
.res { background: var(--blue-2); color: var(--blue); padding: 6px 12px; border-radius: 999px; font-weight: 600; }
.coop { gap: 4px; justify-content: center; }
.blk { display: inline-flex; width: 34px; height: 34px; border-radius: 6px; align-items: center; justify-content: center; color: #fff; font-size: 0.8rem; border: 1px solid rgba(0,0,0,.25); }
.blk.small { width: 24px; height: 24px; vertical-align: middle; margin: 0 2px; }
.blk.empty { background: transparent; border: 1px dashed var(--line); }
.blk.partner { outline: 2px dotted var(--ink); outline-offset: 1px; }
.blk.bad { outline: 3px solid var(--no); }
.bars { display: flex; gap: 8px; align-items: flex-end; justify-content: center; flex-wrap: wrap; }
.bar { min-height: 90px; height: 90px; padding: 0; background: #8a5a2b; border: 1px solid #5f3d1d; border-radius: 4px; }
.bar.sel { outline: 4px solid var(--blue); }
.rods { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; width: 100%; max-width: 280px; }
.rodbtn { padding: 4px; min-height: 0; border-radius: 8px; max-width: 100%; }
.rod { display: inline-flex; height: 22px; position: relative; max-width: 100%; }
.rod i { flex: 1; } .rod i.a { background: #c8443a; } .rod i.b { background: #2f62a8; }
.rod b { position: absolute; left: calc(100% + 6px); font-family: var(--mono); }
.rod.sel { outline: 3px solid var(--blue); }
.bag { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.tokens { display: flex; gap: 4px; flex-wrap: wrap; }
.tokens i { font-style: normal; font-family: var(--mono); width: 28px; height: 28px; border-radius: 50%; background: var(--blue-2); display: inline-flex; align-items: center; justify-content: center; }
.clay { color: #b98a5a; letter-spacing: 1px; word-break: break-all; }
.searchgrid { display: grid; gap: 4px; width: min(100%, 380px); }
.sitem { padding: 0; min-height: 0; aspect-ratio: 1; border-radius: 8px; }
.field { position: relative; width: min(100%, 320px); aspect-ratio: 1; border: 1px solid var(--line); border-radius: 50%; }
.spot { position: absolute; width: 44px; height: 44px; min-height: 44px; padding: 0; border-radius: 50%; transform: translate(-50%, -50%); font-size: 1.3rem; color: #e2b23a; }
.spot:disabled { opacity: 1; }
.mid { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); }
.mask { font-size: 3rem; color: var(--muted); }
.word { font-size: clamp(2rem, 7vw, 3rem); font-weight: 800; min-height: 1.4em; }
.word.glyph { font-family: var(--mono); }
.keytbl { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.keytbl span { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 8px; min-width: 42px; text-align: center; }
.keytbl b { font-family: var(--mono); font-size: 1.3rem; } .keytbl i { font-style: normal; background: var(--blue-2); }
.pad { display: grid; grid-template-columns: repeat(5, 56px); gap: 6px; justify-content: center; }
.maze { display: grid; width: min(100%, 360px); gap: 1px; background: var(--line); border: 2px solid var(--ink); }
.mz { aspect-ratio: 1; background: #fff; display: flex; align-items: center; justify-content: center; font-size: 0.8rem; color: var(--wood); }
.mz.wall { background: #3b3a36; }
.mz.me { color: var(--blue); background: var(--blue-2); }
.dpad { display: grid; grid-template-columns: repeat(3, 56px); grid-template-areas: ". u ." "l d r"; gap: 6px; }
.dpad button:nth-child(1) { grid-area: u; } .dpad button:nth-child(2) { grid-area: l; } .dpad button:nth-child(3) { grid-area: d; } .dpad button:nth-child(4) { grid-area: r; }

/* 결과 */
.result { width: 100%; max-width: 560px; text-align: left; }
.result h2 small { color: var(--muted); font-weight: 500; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0; }
.stats > div { background: var(--blue-2); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; }
.stats b { font-size: 1.6rem; font-family: var(--mono); color: var(--blue); }
.stats small, .stats span { color: var(--muted); font-size: 0.8rem; }
.evlist { columns: 2; font-size: 0.85rem; color: var(--muted); padding-left: 18px; }

/* 추세 */
.bars4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; align-items: end; height: 150px; }
.b4 { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 2px; }
.b4 i { width: 60%; background: var(--blue); border-radius: 6px 6px 0 0; min-height: 3px; }
.b4 small { font-size: 0.75rem; color: var(--muted); } .b4 b { font-family: var(--mono); font-size: 0.85rem; }
.crow { display: grid; grid-template-columns: minmax(110px, 1.2fr) 2fr auto; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }
.cbar { height: 10px; background: var(--line); border-radius: 99px; overflow: hidden; } .cbar i { display: block; height: 100%; background: var(--blue); }
.spark { display: flex; gap: 2px; align-items: flex-end; height: 28px; } .spark i { flex: 1; max-width: 10px; background: var(--blue); border-radius: 2px; }
.crow span { font-size: 0.85rem; color: var(--muted); text-align: right; }

/* 지갑 */
.balance { font-size: 2.4rem; font-weight: 800; font-family: var(--mono); color: var(--blue); margin: 0; }
.balance small { font-size: 1rem; color: var(--muted); font-family: var(--font); }
.pkgs { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.pkg { flex-direction: column; min-height: 84px; gap: 0; padding: 8px; }
.pkg b { font-size: 1.2rem; font-family: var(--mono); } .pkg span { font-size: 0.8rem; color: var(--muted); } .pkg em { font-style: normal; font-size: 0.75rem; color: var(--ok); }
.pkg.on { border-color: var(--blue); box-shadow: inset 0 0 0 2px var(--blue); }
.custom { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.custom input, .row input[type="number"], .toggle input[type="number"] { min-height: 48px; width: 140px; font: inherit; font-family: var(--mono); padding: 0 12px; border-radius: 12px; border: 1px solid var(--line); background: #fff; }
.ack { display: flex; gap: 10px; align-items: flex-start; margin: 10px 0; font-size: 0.92rem; }
.ack input { width: 22px; height: 22px; margin-top: 2px; flex: none; }
.notice { background: var(--blue-2); color: var(--blue); border-radius: 12px; padding: 10px 14px; font-weight: 600; margin: 0 0 var(--gap); }
.notice:empty { display: none; }
.notice.ok { background: #dff1e6; color: var(--ok); }
.rules { padding-left: 20px; } .rules li { margin: 4px 0; }
.tablewrap { overflow-x: auto; max-width: 100%; }
table { border-collapse: collapse; width: 100%; font-size: 0.88rem; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; }
td.pos { color: var(--ok); font-family: var(--mono); } td.neg { color: var(--no); font-family: var(--mono); }
.toggle { display: flex; gap: 12px; align-items: center; min-height: 48px; justify-content: space-between; border-bottom: 1px solid var(--line); }
.toggle input[type="checkbox"] { width: 24px; height: 24px; }

/* 모달 */
.modal { position: fixed; inset: 0; background: rgba(20,20,20,.45); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 40; }
.mbox { background: var(--card); border-radius: var(--r); padding: 22px; max-width: 480px; width: 100%; box-shadow: 0 20px 60px -20px rgba(0,0,0,.5); }
.mbox p { color: var(--muted); }
.mbox .row { justify-content: flex-end; }

@media (max-width: 520px) {
  .top-right .chip#mode-chip { display: none; }
  .stats b { font-size: 1.2rem; }
  .pad { grid-template-columns: repeat(3, 56px); }
  .crow { grid-template-columns: 1fr; }
  .crow span { text-align: left; }
}
@media (max-width: 560px) { .views { flex-wrap: wrap; overflow-x: visible; } }
