/* Sovasta Odyssey — 설계 §8: 버튼 48px, 둥근 카드, 모바일 390px 가로 스크롤 0. */
:root {
  --bg: #f5f1e8; --card: #ffffff; --fg: #1f2433; --muted: #5d6475; --line: rgba(20,30,50,.12);
  --accent: #2f6bff; --accent-fg: #fff; --gold: #c58b12; --good: #1a7f45; --bad: #b3261e;
  --hp: #e0524a; --mp: #3a7bf0; --xp: #9a6bf0; --trust: #2ba57a;
  --sky: linear-gradient(180deg, #bfe3ff 0%, #f5f1e8 60%);
  --radius: 16px; --shadow: 0 2px 10px rgba(20,30,60,.06);
  --mono: ui-monospace, "JetBrains Mono", SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --bg: #121725; --card: #1b2234; --fg: #e9ecf4; --muted: #a2a9ba; --line: rgba(255,255,255,.12); --accent: #7aa2ff; --accent-fg: #0d1222; --gold: #f3c55a; --good: #5cc98a; --bad: #ff8a80; --sky: linear-gradient(180deg, #1b2a4a 0%, #121725 60%); --shadow: none; color-scheme: dark; }
}
:root[data-night="1"] { --sky: linear-gradient(180deg, #23305a 0%, var(--bg) 60%); }
* { box-sizing: border-box; }
html, body { margin: 0; overflow-x: hidden; }
body { background: var(--bg); color: var(--fg); font: 16px/1.5 "Pretendard", "Inter", system-ui, -apple-system, "Segoe UI", "Noto Sans", sans-serif; min-height: 100vh; }
a { color: var(--accent); }
button, input, select { font: inherit; color: inherit; }
.boot { padding: 40px; text-align: center; color: var(--muted); }
.skip { position: absolute; inset-inline-start: 16px; top: 8px; transform: translateY(-200%); z-index: 100; background: var(--card); padding: 8px 12px; border-radius: 8px; } .skip:focus { transform: none; }
.muted { color: var(--muted); } .small, small { font-size: .85em; }
.good { color: var(--good); } .bad { color: var(--bad); } .err { color: var(--bad); }

.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 8px 16px; background: color-mix(in srgb, var(--card) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; white-space: nowrap; }
.logo { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: #1f2a44; color: #f3c55a; font-weight: 900; }
.tabs { display: flex; gap: 4px; background: var(--bg); padding: 4px; border-radius: 12px; }
.tab { min-height: 40px; padding: 0 14px; border: 0; border-radius: 9px; background: transparent; cursor: pointer; font-weight: 600; }
.tab.on { background: var(--card); box-shadow: var(--shadow); color: var(--accent); }
.res { margin-inline-start: auto; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-variant-numeric: tabular-nums; }
.res b { font-weight: 700; }

.banner { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 10px 16px 0; padding: 10px 14px; border-radius: 12px; background: #fff3cd; color: #4a3800; }
.banner.soft { background: color-mix(in srgb, var(--accent) 12%, var(--card)); color: var(--fg); }
.banner.gold { background: #ffe8a3; } .banner.break { background: #d9f2ff; color: #0b3b57; }
.banner span { flex: 1 1 200px; }

.grid { display: grid; gap: 16px; padding: 16px; max-width: 1320px; margin: 0 auto; grid-template-columns: 1fr; }
@media (min-width: 900px) { .grid { grid-template-columns: 300px minmax(0, 1fr); } .right { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; align-items: start; } }
@media (min-width: 1240px) { .grid { grid-template-columns: 300px minmax(0, 640px) 300px; justify-content: center; } .right { grid-column: auto; display: block; } }
.left, .right { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.world { min-width: 0; display: flex; flex-direction: column; gap: 16px; outline: none; border-radius: var(--radius); background: var(--sky); padding: 12px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); min-width: 0; }
.card h2, .card h3 { margin: 0 0 8px; } .card h3 { font-size: 1rem; }
.center { text-align: center; }

.btn { min-height: 48px; padding: 0 16px; border-radius: 12px; border: 0; background: var(--accent); color: var(--accent-fg); font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; transition: transform .08s ease, filter .15s; }
.btn:active { transform: scale(.97); } .btn:hover { filter: brightness(1.05); }
.btn:disabled { opacity: .45; cursor: default; transform: none; }
.btn.ghost { background: transparent; color: var(--fg); border: 1px solid var(--line); }
.btn.small { min-height: 40px; padding: 0 12px; font-size: .92em; } .btn.tiny { min-height: 32px; padding: 0 10px; font-size: .85em; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.badge { display: inline-block; font-size: .72em; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: var(--line); vertical-align: middle; }
.badge.ai { background: #e9e1ff; color: #4b2aa8; } .badge.good { background: #d8f5e3; color: #11663a; }
.chip { font-size: .78em; padding: 2px 8px; border-radius: 999px; background: color-mix(in srgb, var(--accent-fg) 25%, transparent); }

.bar { position: relative; height: 22px; border-radius: 999px; background: var(--line); overflow: hidden; margin: 6px 0; }
.bar i { position: absolute; inset: 0 auto 0 0; background: var(--accent); border-radius: inherit; transition: width .35s ease; }
.bar span { position: relative; z-index: 1; display: block; padding: 0 10px; font-size: .78em; line-height: 22px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar.hp i { background: var(--hp); } .bar.mp i { background: var(--mp); } .bar.xp i { background: var(--xp); } .bar.store i { background: linear-gradient(90deg, #f3c55a, #f08a3c); }
.bar.trust i { background: var(--trust); } .bar.trust.neg i { background: var(--bad); } .bar.ehp i { background: var(--hp); }
.bar.hp span, .bar.mp span, .bar.xp span, .bar.ehp span { color: var(--fg); }

.companion { text-align: center; }
.avatar { width: 140px; height: 140px; margin: 0 auto; cursor: pointer; border-radius: 50%; }
.sova { width: 100%; height: 100%; }
.sova .shadow { fill: rgba(0,0,0,.12); }
.sova .bob { animation: bob 2.4s ease-in-out infinite; transform-origin: 60px 100px; }
.sova .eyes { animation: blink 4.2s infinite; transform-origin: 60px 64px; }
.pupils { transition: transform .12s ease-out; }
@keyframes bob { 50% { transform: translateY(-5px); } }
@keyframes blink { 0%, 94%, 100% { transform: scaleY(1); } 96% { transform: scaleY(.1); } }
.who { margin: 4px 0; } .lv { color: var(--muted); font-weight: 700; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 8px 0; }
.stats div { background: var(--bg); border-radius: 10px; padding: 6px 0; } .stats dt { font-size: .72em; color: var(--muted); } .stats dd { margin: 0; font-weight: 800; }
.memory { text-align: start; background: var(--bg); border-radius: 12px; padding: 8px 12px; margin: 8px 0; } .memory p { margin: 4px 0 0; font-style: italic; }
.field { display: flex; flex-direction: column; gap: 4px; text-align: start; margin-top: 8px; } .field select, .join input { min-height: 44px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); padding: 0 10px; }

.weather { display: flex; align-items: center; gap: 12px; } .weather p { margin: 0; } .w-icon { font-size: 2rem; } .daynight { margin-inline-start: auto; font-weight: 700; }
.buildings { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.building header { display: flex; gap: 10px; align-items: center; } .b-icon { font-size: 1.8rem; }
.b-actions { display: flex; gap: 8px; flex-wrap: wrap; } .b-actions .btn { flex: 1 1 auto; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.sync ul, .npcs, .prod, .shop, .blog { list-style: none; margin: 0; padding: 0; }
.sync li, .prod li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.sync li.done span { opacity: .7; }
.tiers { list-style: none; display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; padding: 0; margin: 8px 0; }
.tiers li { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; border-radius: 10px; background: var(--bg); font-weight: 700; }
.tiers li.got { background: #d8f5e3; color: #11663a; } .tiers li.ready { outline: 2px solid var(--gold); }
.accel-on { color: var(--gold); font-weight: 700; }

.scenarios { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; margin: 10px 0; }
.sc.locked { opacity: .7; }
.scene-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.disclose { background: #f1ebff; color: #3a2380; border-radius: 10px; padding: 8px 10px; font-size: .9em; }
.gm { background: var(--bg); border-radius: 14px; padding: 12px 14px; font-size: 1.05em; }
.gm p { margin: 0 0 8px; white-space: pre-wrap; min-height: 3em; }
.wave { display: inline-flex; gap: 3px; height: 18px; align-items: end; vertical-align: middle; margin-inline-start: 8px; }
.wave i { width: 3px; height: 4px; background: var(--accent); border-radius: 2px; }
.wave.on i { animation: wave .9s ease-in-out infinite; } .wave.on i:nth-child(2) { animation-delay: .1s; } .wave.on i:nth-child(3) { animation-delay: .2s; } .wave.on i:nth-child(4) { animation-delay: .3s; } .wave.on i:nth-child(5) { animation-delay: .4s; }
@keyframes wave { 50% { height: 18px; } }
.choices { display: grid; gap: 8px; margin: 12px 0; } .choice { justify-content: flex-start; text-align: start; padding: 10px 14px; height: auto; }
.why summary, .story-log summary, .reactions-help summary { cursor: pointer; color: var(--muted); }
.story-log ol { padding-inline-start: 18px; } .story-log li.you { color: var(--accent); }
.npcs li { padding: 6px 0; } .npcs li.left { opacity: .6; }

.forests { display: flex; gap: 8px; flex-wrap: wrap; }
.map-wrap { display: flex; justify-content: center; }
#forest-canvas { max-width: 100%; border-radius: 14px; touch-action: manipulation; image-rendering: auto; }
.pad { display: grid; grid-template-columns: repeat(3, 64px); grid-template-areas: ". up ." "left gust right" ". down ."; gap: 6px; justify-content: center; }
.pad .btn { padding: 0; } .pad-up { grid-area: up; } .pad-down { grid-area: down; } .pad-left { grid-area: left; } .pad-right { grid-area: right; } .pad-gust { grid-area: gust; font-size: .78em; }
.legend { text-align: center; }
.battle .enemies { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.enemy { background: var(--bg); border-radius: 14px; padding: 10px; text-align: center; transition: opacity .3s; }
.enemy.down { opacity: .35; filter: grayscale(1); } .enemy.boss { outline: 2px solid var(--gold); }
.e-face { font-size: 2.2rem; animation: bob 2s ease-in-out infinite; } .aura { min-height: 1.4em; }
.elements { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 10px 0; }
.el { flex-direction: column; height: auto; padding: 8px 4px; gap: 0; min-height: 76px; }
.el-i { font-size: 1.6rem; } .el small { font-weight: 500; opacity: .85; font-size: .72em; }
.el-wind { background: #2aa79b; } .el-fire { background: #e2553b; } .el-water { background: #3a8de0; } .el-grass { background: #46a85a; }
.el, .reso { color: #fff; }
.reso { background: linear-gradient(90deg, #8a63d2, #d063b5); }
.reso.pressing { animation: pulse .6s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 8px rgba(160,100,220,.25); } }
.blog li { font-size: .9em; padding: 2px 0; border-bottom: 1px dashed var(--line); }
.coach { border: 2px solid var(--trust); }
.coop .code { font-family: var(--mono); font-size: 1.2em; letter-spacing: .12em; padding: 2px 8px; background: var(--bg); border-radius: 8px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: #9aa; vertical-align: middle; } .dot.on { background: #2ecc71; box-shadow: 0 0 0 3px rgba(46,204,113,.25); }
.join { display: flex; gap: 6px; margin-top: 8px; } .join input { flex: 1; min-width: 0; text-transform: uppercase; font-family: var(--mono); }
.ers { background: var(--bg); border-radius: 10px; padding: 8px 10px; }

.progress { position: sticky; bottom: 0; z-index: 15; display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; padding: 8px 16px; background: color-mix(in srgb, var(--card) 94%, transparent); border-top: 1px solid var(--line); font-size: .9em; }
.foot { text-align: center; color: var(--muted); font-size: .82em; padding: 12px 16px 70px; }

.table-wrap { overflow-x: auto; } .audit { width: 100%; border-collapse: collapse; font-size: .82em; } .audit th, .audit td { text-align: start; padding: 4px; border-bottom: 1px solid var(--line); white-space: nowrap; } .audit code { font-family: var(--mono); }
.settings { display: flex; flex-direction: column; gap: 8px; } .toggle { display: flex; gap: 8px; align-items: center; min-height: 36px; }
.age { border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; } .age label { display: flex; gap: 8px; align-items: center; min-height: 36px; }

.sheet-bg { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.45); display: flex; align-items: flex-end; justify-content: center; padding: 16px; }
@media (min-width: 640px) { .sheet-bg { align-items: center; } }
.sheet { width: min(520px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--card); border-radius: 18px; padding: 18px; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; } .sheet-head h2 { margin: 0; }
.x { border: 0; background: none; font-size: 1.6rem; cursor: pointer; min-width: 44px; min-height: 44px; }
.shop-item { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); } .shop-item p { margin: 2px 0 0; font-size: .88em; }

.toast { position: fixed; left: 50%; bottom: 70px; transform: translate(-50%, 20px); opacity: 0; z-index: 60; background: var(--fg); color: var(--bg); padding: 10px 16px; border-radius: 12px; max-width: calc(100vw - 32px); transition: opacity .2s, transform .2s; pointer-events: none; }
.toast.show { opacity: 1; transform: translate(-50%, 0); } .toast.good { background: var(--good); color: #fff; } .toast.bad { background: var(--bad); color: #fff; }
.float { position: fixed; z-index: 70; pointer-events: none; font-weight: 900; font-size: 1.15rem; transform: translate(-50%, 0); animation: floatUp 1.1s ease-out forwards; text-shadow: 0 1px 0 #fff, 0 0 6px rgba(255,255,255,.7); white-space: nowrap; }
.float.gain { color: var(--gold); } .float.dmg { color: #d33; } .float.hurt { color: #a11; } .float.react { font-size: 1.6rem; color: #6b3fd1; } .float.combo { font-size: 2rem; color: #e26b00; }
@keyframes floatUp { from { opacity: 1; transform: translate(-50%, 0) scale(1.1); } to { opacity: 0; transform: translate(-50%, -60px) scale(1); } }
.particle { position: fixed; z-index: 65; pointer-events: none; animation: burst .9s ease-out forwards; }
@keyframes burst { to { transform: translate(var(--dx), var(--dy)) rotate(40deg); opacity: 0; } }
.flash { position: fixed; inset: 0; z-index: 64; pointer-events: none; animation: flash .26s ease-out forwards; }
@keyframes flash { from { opacity: 1; } to { opacity: 0; } }
body.shake { animation: shake .2s linear; }
@keyframes shake { 25% { transform: translate(3px, -2px); } 50% { transform: translate(-3px, 2px); } 75% { transform: translate(2px, 1px); } }
.dice-pop { position: fixed; left: 50%; top: 40%; transform: translate(-50%, -50%); z-index: 70; background: var(--card); border: 2px solid var(--accent); border-radius: 18px; padding: 16px 22px; text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.die { font-size: 2.4rem; animation: roll .6s ease-out; } .die-n { font-size: 2.4rem; font-weight: 900; } .die-res.ok { color: var(--good); font-weight: 800; } .die-res.no { color: var(--muted); font-weight: 800; }
@keyframes roll { from { transform: rotate(-360deg) scale(.4); } to { transform: none; } }

[data-motion="reduce"] *, [data-motion="reduce"] *::before { animation: none !important; transition: none !important; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

.legal-body { max-width: 860px; margin: 0 auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
@media (max-width: 480px) { .top { padding: 8px 12px; } .grid { padding: 12px; } .tab { padding: 0 10px; } .elements { grid-template-columns: repeat(2, 1fr); } .res { gap: 8px; font-size: .92em; } }
@media (min-width: 1240px) { .right { display: flex; flex-direction: column; } .right > * { width: 100%; } }
.sync .btn, .tiers .btn { white-space: nowrap; }
@media (max-width: 899px) { .world { order: -1; } }
