@font-face { font-family: 'Nunito'; src: url(fonts/Nunito-latin.woff2) format('woff2'); font-weight: 200 1000; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Nunito'; src: url(fonts/Nunito-latin-ext.woff2) format('woff2'); font-weight: 200 1000; font-display: swap; unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Nunito'; src: url(fonts/Nunito-cyrillic.woff2) format('woff2'); font-weight: 200 1000; font-display: swap; unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Nunito'; src: url(fonts/Nunito-cyrillic-ext.woff2) format('woff2'); font-weight: 200 1000; font-display: swap; unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; }
@font-face { font-family: 'Pretendard'; src: url(fonts/PretendardVariable.woff2) format('woff2-variations'); font-weight: 45 920; font-display: swap; }
@font-face { font-family: 'Black Han Sans'; src: url(fonts/BlackHanSans-Regular.ttf) format('truetype'); font-display: swap; }

:root { --ink: #f4ead6; --dim: #b4a78f; --gold: #f2c14e; --panel: rgba(22, 17, 20, .88); --line: rgba(214, 170, 92, .38); --u: min(1vw, 1.7778vh); }
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #0b0c14; color: var(--ink); font-family: Nunito, Pretendard, 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif; user-select: none; }
html[data-lang=ja] body { font-family: Nunito, 'Yu Gothic UI', 'Meiryo', sans-serif; }
html[data-lang=zhs] body { font-family: Nunito, 'Microsoft YaHei UI', sans-serif; }
html[data-lang=zht] body { font-family: Nunito, 'Microsoft JhengHei UI', sans-serif; }
#frame { position: fixed; inset: 0; }
canvas#stage, canvas#overlayfx { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
canvas#overlayfx { pointer-events: none; }
body[data-screen=play] #stage { cursor: crosshair; }
.screen { position: absolute; inset: 0; pointer-events: none; display: none; }
body[data-screen=title] #title, body[data-screen=play] #play { display: block; }
button, .linkbtn, select { pointer-events: auto; font: inherit; font-weight: 800; color: var(--ink); background: linear-gradient(#40323a, #2a2027); border: 1px solid var(--line); border-radius: 10px; padding: .6em 1.1em; cursor: pointer; text-decoration: none; text-align: center; }
button:hover, .linkbtn:hover { border-color: var(--gold); filter: brightness(1.15); }
button:focus-visible, select:focus-visible, a:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
button.primary { background: linear-gradient(#f7cd62, #c98a27); color: #231505; border-color: #ffe29a; }
button.big { font-size: clamp(17px, 1.5vw, 24px); padding: .75em 1.2em; }
button.ghost { background: transparent; border-color: rgba(214, 170, 92, .22); color: var(--dim); }

#title { background: linear-gradient(90deg, rgba(8, 7, 12, .9) 0, rgba(8, 7, 12, .7) 26%, rgba(8, 7, 12, 0) 48%), linear-gradient(0deg, rgba(8, 7, 12, .45) 0, rgba(8, 7, 12, 0) 24%); }
#titleVeil { position: absolute; inset: 0; background: #07060c; opacity: 0; pointer-events: none; }
#title .panel { --t: min(1vw, 1.7778vh); position: absolute; left: calc(var(--t) * 3.4); top: 50%; transform: translateY(-50%); width: calc(var(--t) * 29); min-width: 380px; display: flex; flex-direction: column; gap: calc(var(--t) * .62); font-size: max(13px, calc(var(--t) * .98)); }
#title .brand { display: flex; align-items: center; gap: calc(var(--t) * 1.1); }
#title .emblem { flex: none; width: calc(var(--t) * 7.6); height: calc(var(--t) * 7.6); filter: drop-shadow(0 .5em .9em rgba(0, 0, 0, .65)); }
#title .logo { flex: 1; min-width: 0; font-family: 'Black Han Sans', Nunito, Pretendard, sans-serif; font-weight: 400; font-synthesis: none; font-size: 96px; line-height: 1.04; word-break: keep-all; color: transparent; background: linear-gradient(#fff6c8 8%, #ffd34f 48%, #ee9a1c 92%); -webkit-background-clip: text; background-clip: text; filter: drop-shadow(0 .045em 0 #5a2a04) drop-shadow(0 .035em 0 #3a1a02) drop-shadow(0 .1em .22em rgba(0, 0, 0, .75)); padding-bottom: .06em; }
html:not([data-lang=ko]) #title .logo { font-family: Nunito, 'Yu Gothic UI', 'Microsoft YaHei UI', sans-serif; font-weight: 1000; font-synthesis: weight; }
#title .tagline { font-size: 1.08em; line-height: 1.45; word-break: keep-all; overflow-wrap: anywhere; text-shadow: 0 1px 4px #000; }
html[data-lang=ja] #title .tagline, html[data-lang^=zh] #title .tagline { word-break: normal; }
#btnStory { display: flex; flex-direction: column; align-items: center; line-height: 1.25; padding: .6em 1em .65em; font-size: 1.55em; border-width: 2px; box-shadow: 0 .22em 0 #6c4208, 0 .5em 1.2em rgba(0, 0, 0, .5), 0 0 1.4em rgba(247, 205, 98, .28); }
#storyNote { font-size: .62em; font-weight: 800; opacity: .78; }
#storyNote:empty { display: none; }
#title .tiles { display: grid; grid-template-columns: 1fr 1fr; gap: calc(var(--t) * .55); }
#title .tile { display: grid; grid-template-columns: 2.35em 1fr auto; align-content: center; align-items: center; column-gap: .55em; text-align: left; min-height: 3.55em; padding: .4em .75em; line-height: 1.22; }
#title .tile .ic { grid-row: 1 / span 2; grid-column: 1; width: 2.1em; height: 2.1em; color: var(--gold); }
#title .tile span { grid-column: 2; min-width: 0; }
#title .tile small, #title .tile .readyLabel { grid-column: 2 / span 2; font-size: .78em; font-weight: 700; color: var(--dim); }
#title .tile small:empty { display: none; }
#title .tile:has(small:empty) span, #title .tile:has(.readyLabel:empty) span { grid-row: 1 / span 2; }
#title .tile .badgeN { grid-column: 3; grid-row: 1; margin: 0; }
#title .tile.t-nick { grid-template-columns: 1fr; text-align: center; }
#title .tile.t-nick span { grid-column: 1; }
#title .tile.can { border-color: var(--gold); box-shadow: 0 0 14px rgba(242, 193, 78, .4); }
#title .tile.can small { color: #ffe39a; }
#title .tile[data-treebtn].ready .readyLabel { color: #fff3b0; }
#title .tiles.demo { grid-template-columns: 1fr; }
#title .row button { flex: 1 1 0; }
#titleStats { --t: min(1vw, 1.7778vh); position: absolute; right: calc(var(--t) * 1.4); top: calc(var(--t) * 1.4); width: calc(var(--t) * 19); min-width: 250px; font-size: max(13px, calc(var(--t) * .95)); }
#titleStats .purse { display: flex; flex-wrap: wrap; gap: .3em 1em; margin: .5em 0; }
#titleStats .missions ul { list-style: none; padding: 0; margin: .35em 0; }
#titleStats .missions li { display: flex; justify-content: space-between; gap: .6em; }
#titleStats .missions li.done { color: #9fe6a0; }
#titleStats[hidden] { display: none; }
#best { color: var(--dim); font-size: 14px; }
#best:empty { display: none; }
.links { display: flex; gap: 8px; flex-wrap: wrap; }
.links button { background: none; border: 0; color: var(--dim); padding: .3em .2em; font-size: 14px; text-decoration: underline; }
.badge { position: absolute; right: 18px; bottom: 14px; font-size: 13px; color: var(--dim); background: var(--panel); border: 1px solid var(--line); padding: 6px 12px; border-radius: 999px; }

/* ── 전투 화면 ── */
.side { position: absolute; top: calc(var(--u) * 1.2); width: calc(var(--u) * 14); display: flex; flex-direction: column; gap: calc(var(--u) * .8); font-size: calc(var(--u) * 1.02); }
#left { left: calc(var(--u) * 1.2); }
#right { right: calc(var(--u) * 1.2); top: calc(var(--u) * 4.8); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: calc(var(--u) * .8); padding: calc(var(--u) * .75) calc(var(--u) * .9); box-shadow: 0 6px 20px rgba(0,0,0,.35); }
.head { display: flex; justify-content: space-between; align-items: baseline; gap: .5em; color: var(--dim); font-weight: 800; }
.head b { color: var(--ink); font-size: 1.55em; font-variant-numeric: tabular-nums; }
#waveState { margin-top: .3em; font-weight: 800; min-height: 1.4em; }
.bar { height: calc(var(--u) * .75); border-radius: 99px; background: #100c10; overflow: hidden; margin-top: .5em; border: 1px solid rgba(255,255,255,.07); }
.bar i { display: block; height: 100%; width: 100%; transform-origin: left; }
.bar.wall i { background: linear-gradient(#8be08a, #3f9a55); }
#wallCard.low .bar.wall i { background: linear-gradient(#ff9a72, #c7362b); }
#wallCard.hit { animation: hit .28s; }
@keyframes hit { 30% { transform: translateX(-5px); border-color: #ff6a50; } 65% { transform: translateX(4px); } }
.bar.mint i { background: linear-gradient(#ffe29a, #b9801f); }
.bar.mint { height: calc(var(--u) * .4); }
.bar.hammer { height: calc(var(--u) * 1.1); }
.bar.hammer i { background: linear-gradient(#9cc8ff, #3a6fc4); }
#hammerCard.ready { border-color: var(--gold); box-shadow: 0 0 22px rgba(242,193,78,.45); }
#hammerCard.ready .bar.hammer i { background: linear-gradient(#fff0b0, #f0a020); animation: glow .9s infinite alternate; }
@keyframes glow { to { filter: brightness(1.35); } }
#hammerCount { display: flex; gap: .35em; margin-top: .4em; }
#hammerCount i { width: 1.1em; height: 1.1em; border-radius: 4px; background: #171117; border: 1px solid var(--line); }
#hammerCount i.on { background: var(--gold); }
.next { text-align: center; }
#nextIcon { width: calc(var(--u) * 7); height: calc(var(--u) * 7); margin: .35em auto 0; display: block; filter: drop-shadow(0 5px 8px rgba(0,0,0,.6)); }
#nextName { display: block; min-height: 2.6em; line-height: 1.3; }
#queue { display: flex; justify-content: center; gap: .45em; }
#queue img { width: calc(var(--u) * 3); height: calc(var(--u) * 3); opacity: .9; }
#pips { display: flex; flex-wrap: wrap; gap: .3em; margin-top: .45em; }
#pips i { width: .95em; height: .95em; border-radius: 50%; background: #171117; border: 1px solid #6a5830; }
#pips i.on { background: radial-gradient(circle at 35% 30%, #fff0b8, #d99b28 70%); border-color: #ffe29a; }
.beat canvas { display: block; width: calc(var(--u) * 6.5); height: calc(var(--u) * 6.5); margin: .3em auto 0; }
#top { position: absolute; right: calc(var(--u) * 1.2); top: calc(var(--u) * 1.1); display: flex; gap: calc(var(--u) * .5); font-size: calc(var(--u) * 1); }
#top button { padding: .45em .65em; }
#speed { display: flex; gap: calc(var(--u) * .25); }
#speed button.on { background: linear-gradient(#f7cd62, #c98a27); color: #231505; }
#speed button.locked { opacity: .55; }
#chain { position: absolute; left: 21%; top: 36%; transform: translate(-50%, -50%); text-align: center; pointer-events: none; text-shadow: 0 3px 0 #3a1c02, 0 0 24px rgba(0,0,0,.8); }
#chain b { display: block; font-size: calc(var(--u) * 5.4); font-weight: 1000; color: #ffe08a; line-height: 1; }
#chain span { font-size: calc(var(--u) * 1.5); font-weight: 900; }
#chain.pop b { animation: pop .22s; }
@keyframes pop { 0% { transform: scale(1.55); } 100% { transform: scale(1); } }
#banner { position: absolute; left: 50%; top: 53.5%; transform: translate(-50%, -50%); width: 70vw; text-align: center; font-family: 'Black Han Sans', Nunito, Pretendard, sans-serif; font-size: calc(var(--u) * 3.7); font-weight: 900; color: #fff2cc; text-shadow: 0 3px 0 #5a300a, 0 0 30px rgba(0,0,0,.85); pointer-events: none; opacity: 0; }
html[data-lang=ko] #banner { font-weight: 400; font-synthesis: none; }
html:not([data-lang=ko]) #banner { font-family: Nunito, 'Yu Gothic UI', 'Microsoft YaHei UI', sans-serif; font-weight: 1000; }
#banner.show { animation: banner 1.7s forwards; }
#banner.warn { color: #ff9c7e; }
#banner.gold { color: #ffd45e; }
@keyframes banner { 0% { opacity: 0; transform: translate(-50%, -50%) scale(1.5); } 12% { opacity: 1; transform: translate(-50%, -50%) scale(1); } 75% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -64%) scale(.98); } }
body.calm #banner.show, body.calm #chain.pop b, body.calm #wallCard.hit, body.calm #hammerCard.ready .bar.hammer i { animation-name: fade; }
body.calm #hammerCard.ready .bar.hammer i { animation: none; }
@keyframes fade { 0% { opacity: 0; } 15%, 75% { opacity: 1; } 100% { opacity: 0; } }
#tip { position: absolute; left: 50%; bottom: calc(var(--u) * 1); transform: translateX(-50%); width: max-content; max-width: 62vw; text-align: center; background: var(--panel); border: 1px solid var(--gold); border-radius: 999px; padding: .5em 1.3em; font-size: calc(var(--u) * 1.15); font-weight: 800; }

/* ── 창 ── */
.overlay { position: fixed; inset: 0; z-index: 10; background: rgba(6, 5, 9, .66); display: flex; align-items: center; justify-content: center; padding: 16px; }
.sheet { display: none; flex-direction: column; gap: 11px; width: min(430px, 94vw); max-height: 94vh; overflow: auto; background: linear-gradient(#2b2129, #1a1419); border: 1px solid var(--line); border-radius: 18px; padding: 22px 24px; box-shadow: 0 24px 70px rgba(0,0,0,.6); font-size: 15px; line-height: 1.5; }
.sheet.on { display: flex; }
.sheet h2 { font-size: 23px; color: #ffd978; text-align: center; }
.sheet h3 { font-size: 14px; color: var(--dim); margin-top: 4px; }
.sheet.wide { width: min(640px, 94vw); }
.sheet ol { padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.row button { flex: 1 1 auto; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.small { font-size: 12px; color: var(--dim); }
.keys { width: 100%; border-collapse: collapse; }
.keys td { padding: 3px 0; border-bottom: 1px solid rgba(255,255,255,.07); }
.keys td:last-child { text-align: right; }
kbd { font: inherit; font-size: .85em; font-weight: 800; background: #120e12; border: 1px solid var(--line); border-radius: 6px; padding: 1px 7px; }
#coinGuide { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; }
#coinGuide div { display: flex; gap: 9px; align-items: center; font-size: 13px; line-height: 1.35; }
#coinGuide img { width: 40px; height: 40px; flex: none; }
#coinGuide b { display: block; }
.opt { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.seg { display: flex; gap: 4px; }
.seg button { padding: .35em .8em; font-size: 14px; }
.seg button.on { background: linear-gradient(#f7cd62, #c98a27); color: #231505; }
.studio { text-align: center; font-weight: 900; font-size: 18px; }
.lic { list-style: none; display: flex; flex-direction: column; gap: 4px; }
.lic li { display: flex; justify-content: space-between; gap: 12px; }
.lic a, #mobile a { color: var(--gold); }
.sheet.choice { width: min(880px, 96vw); text-align: center; }
#cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 4px; }
#cards button { display: flex; flex-direction: column; align-items: center; gap: 9px; padding: 20px 14px; min-height: 230px; position: relative; font-weight: 600; line-height: 1.4; }
#cards button:hover { transform: translateY(-4px); }
#cards img { width: 92px; height: 92px; filter: drop-shadow(0 6px 9px rgba(0,0,0,.6)); }
#cards .glyph { width: 92px; height: 92px; border-radius: 50%; display: grid; place-items: center; font-size: 46px; background: radial-gradient(circle at 35% 30%, #5a4650, #241b22); border: 2px solid var(--line); }
#cards b { font-size: 17px; font-weight: 900; }
#cards span { font-size: 13px; color: var(--dim); }
#cards em { position: absolute; top: 8px; right: 10px; font-style: normal; font-size: 11px; font-weight: 900; color: #231505; background: var(--gold); border-radius: 99px; padding: 1px 8px; }
#cards kbd { margin-top: auto; }
.sheet.end { width: min(520px, 94vw); text-align: center; }
#stats { display: grid; grid-template-columns: 1fr auto; gap: 4px 18px; text-align: left; background: rgba(0,0,0,.25); border-radius: 12px; padding: 12px 16px; }
#stats dd { text-align: right; font-weight: 900; font-variant-numeric: tabular-nums; }
#mobile, #nogl { position: fixed; inset: 0; z-index: 30; display: flex; flex-direction: column; gap: 16px; align-items: center; justify-content: center; text-align: center; padding: 32px; background: radial-gradient(circle at 50% 30%, #33243a, #0b0c14 70%); line-height: 1.6; }
#mobile h1 { font-size: 34px; color: #ffd978; }
#mobile .badge { position: static; }
@media (max-height: 640px) { .beat { display: none; } .sheet { font-size: 13px; gap: 8px; } }

/* ── 지휘 레벨·트리 단추 ── */
.small { font-size: 12px; color: var(--dim); }
.side .small { font-size: .92em; }
.bar.xp i { background: linear-gradient(#c9a8ff, #7a4bd0); }
#btnTree { width: 100%; margin-top: .55em; padding: .35em .5em; font-size: 1em; position: relative; }
#btnTree.glow { border-color: #d6b0ff; box-shadow: 0 0 18px rgba(190,140,255,.6); animation: glow .9s infinite alternate; }
body.calm #btnTree.glow { animation: none; }
.badgeN { font-style: normal; font-weight: 900; font-size: .82em; background: #8b5cd6; color: #fff; border-radius: 99px; padding: 0 .5em; margin-left: .45em; }
.badgeN:empty { display: none; }
button:disabled { opacity: .45; cursor: default; }
button:disabled:hover { border-color: var(--line); filter: none; }

/* ── 세계 지도 ── */
body[data-screen=world] #world { display: flex; }
#world { pointer-events: auto; background: radial-gradient(circle at 40% 40%, #20304a, #0a0d16 75%); align-items: center; justify-content: center; gap: 1.2vw; padding: 1vw; }
#mapbox { position: relative; flex: none; }
#map { width: 100%; height: 100%; display: block; border-radius: 16px; border: 2px solid #6b5531; box-shadow: 0 18px 60px rgba(0,0,0,.6); }
#nodes { position: absolute; inset: 0; }
.node { position: absolute; transform: translate(-50%, -50%); width: calc(var(--u) * 3.3); height: calc(var(--u) * 3.3); min-width: 34px; min-height: 34px; border-radius: 50%; padding: 0; font-size: calc(var(--u) * 1.3); border: 3px solid #fff0c0; background: radial-gradient(circle at 35% 30%, #ffd978, #b8761c); color: #231505; box-shadow: 0 5px 14px rgba(0,0,0,.55); }
.node span { position: absolute; left: 50%; top: 100%; transform: translateX(-50%); white-space: nowrap; font-size: .82em; color: #ffe27a; text-shadow: 0 1px 3px #000, 0 0 4px #000; }
.node.done { background: radial-gradient(circle at 35% 30%, #bfe8a0, #4c8a34); }
.node.locked { background: #4a4048; border-color: #8a7c80; color: #ddd; }
.node.sel { outline: 4px solid #fff; outline-offset: 3px; }
.node:hover { filter: brightness(1.2); }
#worldside { width: clamp(250px, 24vw, 360px); max-height: 96vh; overflow: auto; padding: 12px 8px; display: flex; flex-direction: column; gap: 9px; font-size: clamp(13px, 1vw, 16px); }
#worldside .top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
#worldside h2 { color: #ffd978; font-size: 1.35em; }
#worldside .info { display: flex; flex-direction: column; gap: 7px; line-height: 1.45; }
#worldside h3 { font-size: 1.25em; }
.stars { color: #ffd45e; letter-spacing: .12em; font-weight: 900; }
.stars.big { font-size: 40px; text-shadow: 0 0 22px rgba(255,200,60,.55); }

/* ── 이야기 ── */
.overlay.low { align-items: flex-end; background: linear-gradient(transparent 40%, rgba(6,5,9,.75)); padding-bottom: 4vh; }
.sheet.story { width: min(780px, 94vw); }
.talk { display: flex; gap: 18px; align-items: center; }
.talk canvas { width: 130px; height: 130px; border-radius: 14px; border: 2px solid var(--line); flex: none; }
.talk b { color: #ffd978; font-size: 17px; }
.talk p { font-size: 19px; line-height: 1.55; min-height: 3.1em; }

/* ── 트리·성 강화·무한 ── */
.sheet.tree { width: min(1040px, 96vw); text-align: center; }
#treeHead, #castleHead { font-weight: 900; text-align: center; font-size: 17px; }
#branches { display: grid; grid-template-columns: repeat(3, 1fr) .9fr; gap: 10px; }
.branch { display: flex; flex-direction: column; align-items: center; gap: 4px; background: rgba(0,0,0,.22); border-radius: 12px; padding: 8px; }
.tier { display: flex; gap: 6px; justify-content: center; width: 100%; }
.link { width: 2px; height: 10px; background: var(--line); }
.tnode { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 7px 5px; flex: 1 1 0; min-width: 0; font-weight: 700; line-height: 1.25; font-size: 13px; }
.tnode img { width: 46px; height: 46px; }
.tnode span { font-size: 11px; color: var(--dim); font-weight: 600; }
.tnode.root { flex: none; border: 1px solid var(--line); border-radius: 10px; width: 62%; }
.tnode.owned { border-color: var(--gold); background: linear-gradient(#5a4522, #36280f); }
.tnode.owned span { color: var(--gold); }
.tnode.can { border-color: #d6b0ff; box-shadow: 0 0 14px rgba(190,140,255,.55); }
.tnode.can span { color: #e4ccff; }
.tnode.locked img { filter: grayscale(.85) brightness(.7); }
#treeDesc { min-height: 3em; font-size: 14px; }
.sheet.castle { width: min(560px, 94vw); }
.up { display: grid; grid-template-columns: 1fr auto 84px; gap: 10px; align-items: center; background: rgba(0,0,0,.22); border-radius: 10px; padding: 8px 12px; margin-bottom: 6px; }
.up div { display: flex; flex-direction: column; }
.up div span { font-size: 12.5px; color: var(--dim); }
.pips { display: flex; gap: 4px; }
.pips i { width: 13px; height: 13px; border-radius: 3px; background: #171117; border: 1px solid var(--line); }
.pips i.on { background: var(--gold); }
#regions { display: flex; flex-direction: column; gap: 6px; }
.region { display: grid; grid-template-columns: 22px auto 1fr; gap: 10px; align-items: center; text-align: left; }
.region i { width: 20px; height: 20px; border-radius: 50%; border: 2px solid rgba(255,255,255,.5); }
.region span { font-size: 12px; color: var(--dim); font-weight: 600; text-align: right; line-height: 1.35; }

/* ── 트리 업그레이드 가능 알림 ── */
.readyLabel { display: block; font-size: .9em; font-weight: 900; color: #fff3b0; letter-spacing: .01em; text-shadow: 0 1px 3px #2a0a52; }
.readyLabel:empty { display: none; }
[data-treebtn].ready { position: relative; background: linear-gradient(#9a5cf0, #5a24a8); border: 2px solid #ffe27a; color: #fff; box-shadow: 0 0 0 3px rgba(176,120,255,.45), 0 0 22px rgba(190,130,255,.85); animation: treeReady .75s ease-in-out infinite alternate; }
[data-treebtn].ready::after { content: '!'; position: absolute; top: -11px; right: 5px; width: 25px; height: 25px; border-radius: 50%; background: #ff4d3d; border: 2px solid #fff; color: #fff; font-weight: 1000; font-size: 15px; line-height: 21px; text-align: center; }
[data-treebtn].ready .badgeN { background: #ffe27a; color: #33104f; }
#levelCard.ready { border-color: #ffe27a; }
#btnTree.ready { padding: .55em .5em; font-size: 1.08em; }
#btnChoiceTree, #btnEndTree { align-self: center; min-width: 240px; }
/* 크기는 바꾸지 않고 빛만 커졌다 작아진다(옆으로 넘치지 않게) */
@keyframes treeReady { from { box-shadow: 0 0 0 1px rgba(176,120,255,.35), 0 0 10px rgba(190,130,255,.5); filter: brightness(1); } to { box-shadow: 0 0 0 5px rgba(206,160,255,.6), 0 0 30px rgba(206,150,255,1); filter: brightness(1.24); } }
body.calm [data-treebtn].ready { animation: none; }
.tnode { position: relative; }
.tnode.can em { position: absolute; top: -9px; left: 2px; right: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-style: normal; font-size: 10.5px; font-weight: 900; background: #ffe27a; color: #33104f; border-radius: 99px; padding: 1px 8px; box-shadow: 0 2px 6px rgba(0,0,0,.5); }
.tnode.can { border-width: 2px; animation: treeReady .75s ease-in-out infinite alternate; }
body.calm .tnode.can { animation: none; }
.tier { padding-top: 4px; }
/* 긴 낱말(독일어 등)이 칸을 넘지 않게 */
.tnode b, .tnode span { max-width: 100%; overflow-wrap: anywhere; hyphens: auto; }
.side .head span { min-width: 0; overflow-wrap: anywhere; }
/* 펼친 선택 목록: 기본 흰 바탕에 밝은 글자라 안 보이던 것을 고친다 */
select { color-scheme: dark; }
select option { background: #2b2129; color: #f4ead6; }
select option:checked { background: #c98a27; color: #231505; }

/* ── PC판 안내·랭킹·닉네임 ── */
a.get { display: block; }
.get, button.get { background: linear-gradient(#6fd08a, #2f8f55); color: #07210f; border-color: #bff0cc; font-weight: 900; }
.linkbtn.primary.get { color: #07210f; }
.feats { padding-left: 20px; display: flex; flex-direction: column; gap: 5px; }
body.demo #levelCard .head, body.demo #levelCard .bar { display: none; }
body.demo #btnTree::before { content: '🔒 '; }
#rankTabs { display: flex; flex-wrap: wrap; gap: 5px; justify-content: center; }
#rankTabs button { padding: .3em .7em; font-size: 13px; }
#rankTabs button.on { background: linear-gradient(#f7cd62, #c98a27); color: #231505; }
#rankBody { min-height: 220px; max-height: 42vh; overflow: auto; background: rgba(0,0,0,.25); border-radius: 10px; padding: 4px 10px; }
#rankTable { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
#rankTable th { font-size: 12px; color: var(--dim); text-align: left; padding: 4px 6px; }
#rankTable td { padding: 4px 6px; border-top: 1px solid rgba(255,255,255,.07); overflow-wrap: anywhere; }
#rankTable th:nth-child(n+3), #rankTable td:nth-child(n+3) { text-align: right; width: 22%; }
#rankTable tr.me td { color: #ffe27a; font-weight: 900; }
#rankMsg { text-align: center; padding: 20px 0; color: var(--dim); }
#rankMsg:empty { display: none; }
.field { display: flex; flex-direction: column; gap: 6px; font-weight: 800; }
.field input { font: inherit; font-size: 18px; color: var(--ink); background: #120e12; border: 1px solid var(--line); border-radius: 10px; padding: .55em .8em; user-select: text; }
.field input:focus-visible { outline: 2px solid var(--gold); }
#rankStatus { font-weight: 900; color: #ffe27a; min-height: 1.5em; }

/* ── 0.4.0: 숙련·성·전리품·임무·재앙 ── */
.tnode.root { width: 66%; }
.tnode .ranks { display: flex; gap: 3px; }
.tnode .ranks u { width: 9px; height: 9px; border-radius: 2px; background: #100c10; border: 1px solid #6a5830; }
.tnode .ranks u.on { background: var(--gold); border-color: #ffe29a; }
.tnode.owned.can span { color: #e4ccff; }
.tnode.can { border-color: #d6b0ff; }
.supgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; width: 100%; }
.sheet.tree img { width: 40px; height: 40px; }
.sheet.tree { gap: 8px; }
.purse { display: flex; flex-wrap: wrap; gap: .3em 1.1em; margin-top: .5em; font-weight: 800; }
.purse b { font-variant-numeric: tabular-nums; color: #ffe27a; }
.purse i { display: inline-block; width: .85em; height: .85em; margin-right: .35em; vertical-align: -.05em; }
.purse i.medal { border-radius: 50%; background: radial-gradient(circle at 35% 30%, #ffe9a8, #c98a27 75%); }
.purse i.rock { border-radius: 3px; background: linear-gradient(135deg, #cfd2dc, #6f7488); }
#btnCastle { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; column-gap: .3em; }
#btnCastle small { flex-basis: 100%; font-size: .78em; font-weight: 600; color: var(--dim); }
#btnCastle.can { border-color: #ffe27a; box-shadow: 0 0 16px rgba(255, 214, 90, .55); }
.missions b { color: #ffd978; }
.missions ul { list-style: none; margin: .35em 0; }
.missions li { display: flex; justify-content: space-between; gap: .6em; padding: .12em 0; }
.missions li b { color: var(--ink); font-variant-numeric: tabular-nums; }
.missions li.done { color: #9fe0a0; }
.missions li.done b { color: #9fe0a0; }
#mutators { display: flex; flex-wrap: wrap; gap: .3em; margin-top: .35em; }
#mutators i { font-style: normal; font-weight: 900; font-size: .86em; padding: .05em .55em; border-radius: 99px; background: #7a2230; border: 1px solid #ff8a7a; color: #ffe3dc; }
#banner.sub { font-size: calc(var(--u) * 2.1); }
.keep { display: flex; flex-direction: column; align-items: center; gap: 5px; background: rgba(0,0,0,.25); border-radius: 12px; padding: 12px; text-align: center; }
.keep h4 { font-size: 21px; color: #ffe08a; }
.keep .bar { width: 100%; height: 10px; margin-top: 0; }
#castleMsg { font-weight: 900; color: #ffe27a; }
#castleMsg:empty { display: none; }
#perks { list-style: none; display: grid; grid-template-columns: 1fr 1fr; gap: 5px 12px; font-size: 13px; }
#perks li { display: flex; flex-direction: column; color: var(--dim); opacity: .7; }
#perks li.on { color: var(--ink); opacity: 1; }
#perks li.on b { color: #ffe27a; }
.sheet.castle h3 { text-align: center; }
#relics { display: flex; flex-direction: column; gap: 6px; }
.relic { display: grid; grid-template-columns: 24px 1fr auto; gap: 12px; align-items: center; background: rgba(0,0,0,.24); border-radius: 10px; padding: 8px 12px; }
.relic > i { width: 22px; height: 22px; border-radius: 50%; border: 2px solid rgba(255,255,255,.5); }
.relic div { display: flex; flex-direction: column; }
.relic span { font-size: 12.5px; color: var(--dim); }
.relic em { font-style: normal; font-weight: 800; color: var(--dim); font-size: 13px; }
.relic.on em { color: #9fe0a0; }
.rside { align-items: flex-end; gap: 3px; }
.rside .pips { display: flex; }
.rside small { font-size: 11.5px; color: var(--dim); }
.regionRow { display: flex; gap: 6px; align-items: stretch; }
.regionRow .region { flex: 1; }
.tierpick { display: flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 800; white-space: nowrap; }
.tierpick button { padding: .2em .55em; }
#endReward { display: flex; flex-direction: column; gap: 2px; font-weight: 800; }
#endReward b { color: #ffe27a; }
#endReward span { font-size: 13px; color: #cdb6ff; }
#endGoal { font-size: 14px; color: #bfe8a0; font-weight: 800; }
#endGoal:empty { display: none; }
@media (max-height: 760px) { #worldside { gap: 6px; } .sheet.end #stats { font-size: 13px; gap: 2px 18px; } }
.menu2 { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.menu2 button { padding: .45em .4em; overflow-wrap: anywhere; }
#worldside { gap: 7px; }
#worldside .info p { line-height: 1.35; }
#worldside .info button.big { padding: .5em 1em; }
#worldside .card { padding: .6em .8em; }
.missions li { padding: 0; font-size: .95em; }
.tnode.train { border-color: var(--gold); border-width: 2px; }
.tnode.train span { color: #fff0b0; }
.tnode.train span::before { content: '▲ '; color: #9fe08a; }
.tnode .ranks s { text-decoration: none; font-style: normal; font-size: 10px; line-height: 9px; font-weight: 900; color: #ffb4f0; }
