:root {
  color-scheme: dark;
  --bg: #090f19;
  --ink: #edf3f1;
  --muted: #a2afbf;
  --subtle: #8192a9;
  --panel: #101b29;
  --panel-deep: #0e1724;
  --panel-lift: #152337;
  --line: #28374b;
  --lime: #b7f28c;
  --mint: #84dfaf;
  --gold: #f7cf79;
  --danger: #ff9d9d;
  --shadow: 0 20px 80px #0508127a;
  --display: "Arial Black", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  --body: "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", system-ui, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { min-width: 300px; }
body {
  margin: 0;
  background: radial-gradient(ellipse at 46% 0, #142336 0, transparent 63%), var(--bg);
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  min-height: 100vh;
}
[hidden] { display: none !important; }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--lime); outline-offset: 4px; }
h1, h2, h3, p { margin: 0; }
canvas, img { display: block; max-width: 100%; }
canvas, .pixel { image-rendering: pixelated; }
.mono { font-family: var(--mono); }
.eyebrow {
  color: var(--muted);
  text-transform: uppercase;
  font: 700 .76rem/1.25 var(--mono);
  letter-spacing: .105em;
}
.signal {
  display: inline-block;
  flex: none;
  width: 7px;
  height: 7px;
  background: var(--mint);
  box-shadow: 0 0 10px #84dfaf85, 0 0 0 4px #84dfaf1b;
}
.coin { color: var(--gold); font-family: var(--mono); font-weight: 800; }
.coin-dot {
  display: inline-block;
  width: .9em;
  height: .9em;
  margin-inline-end: .45rem;
  border: 2px solid #f9d686;
  border-radius: 50%;
  vertical-align: -.07em;
  background: #bf8550;
  box-shadow: inset 0 0 0 1px #f8c76d;
}
.row { display: flex; align-items: center; gap: .6rem; }
.spread { justify-content: space-between; }
.stack { display: grid; gap: 1rem; }
.muted { color: var(--muted); }
.small { font-size: .875rem; line-height: 1.45; }
.right { text-align: right; }
.badge {
  display: inline-flex;
  align-items: center;
  width: max-content;
  gap: .35rem;
  padding: .34rem .53rem;
  border-radius: .34rem;
  border: 1px solid #40634e;
  color: #c7efaf;
  background: #182d2b;
  font: 700 .75rem/1.2 var(--mono);
  white-space: nowrap;
}
.badge.boss { color: #ffd1a7; border-color: #6a433f; background: #352333; }
.badge.quiet { color: var(--muted); background: #142236; border-color: var(--line); }
.button {
  min-height: 43px;
  padding: .62rem .9rem;
  border: 1px solid #384d63;
  border-radius: .5rem;
  background: #213145;
  color: var(--ink);
  font-weight: 760;
  line-height: 1.25;
  text-align: center;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: .55rem;
  transition: background .16s, transform .16s, border-color .16s;
  text-decoration: none;
}
.button:not(:disabled):hover { background: #2b425a; border-color: #60819c; }
.button:not(:disabled):active { transform: translateY(1px); }
.button.primary { background: var(--lime); color: #13271b; border-color: #b9f993; box-shadow: 0 3px 0 #568a54, 0 0 23px #b7f28c1a; }
.button.primary:not(:disabled):hover { background: #c9ffaa; border-color: #c9ffaa; }
.button.danger { color: #ffd8d8; border-color: #81494d; background: #482a34; }
.button.ghost { background: #0e172345; border-color: #344358; color: #d5e2ec; }
.button.mini { min-height: 35px; padding: .4rem .59rem; font-size: .87rem; }
.button.full { width: 100%; justify-content: space-between; }
.button:disabled { opacity: .54; box-shadow: none; }
.icon-button { min-height: 42px; min-width: 42px; padding: .48rem; }
.button .hint-key, kbd { font: 600 .72rem/1.2 var(--mono); padding: .16rem .32rem; border: 1px solid #7990a165; border-radius: .25rem; opacity: .8; }
.field { display: grid; gap: .44rem; font-size: .94rem; font-weight: 720; }
input {
  width: 100%;
  min-width: 0;
  border: 1px solid #3b4d63;
  background: #0b1421;
  color: var(--ink);
  outline: none;
  border-radius: .5rem;
  padding: .72rem .86rem;
  min-height: 45px;
}
input:focus { border-color: var(--mint); box-shadow: 0 0 0 3px #84dfaf21; }
input::placeholder { color: var(--subtle); opacity: 1; }
.field-note, .field-error { font-size: .85rem; line-height: 1.45; }
.field-note { color: var(--muted); }
.field-error { color: var(--danger); }
.brand { display: inline-flex; align-items: center; gap: .65rem; text-decoration: none; white-space: nowrap; }
.brand-mark {
  width: 37px;
  height: 37px;
  display: grid;
  place-items: center;
  position: relative;
  background: #b7f28c;
  color: #153428;
  font: 900 1.45rem/1 var(--display);
  border-radius: .44rem;
  box-shadow: inset 0 -3px 0 #5e9b63, 0 0 22px #b9f98822;
}
.brand-mark::before, .brand-mark::after { content: ""; position: absolute; top: 5px; background: #68a866; width: 4px; height: 4px; border-radius: 1px; }
.brand-mark::before { left: 5px; }
.brand-mark::after { right: 5px; }
.brand-type { display: grid; gap: .12rem; }
.brand-type strong { font-size: 1.06rem; font-weight: 900; letter-spacing: -.035em; }
.brand-type small { font: 700 .63rem/1 var(--mono); color: #aac4c8; letter-spacing: .11em; }

.join-page { width: min(100% - 3rem, 1260px); margin-inline: auto; padding: min(4vw, 3rem) 0 2rem; }
.join-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: clamp(1.4rem, 4vw, 4rem); }
.join-grid { display: grid; grid-template-columns: minmax(310px, .93fr) minmax(0, 1.6fr); gap: clamp(1.7rem, 6vw, 6.5rem); align-items: center; }
.join-form-wrap { max-width: 465px; }
.join-kicker { display: flex; gap: .7rem; align-items: center; color: var(--mint); margin-bottom: 1.1rem; }
.join-form-wrap h1 { color: #f2f9ee; font: 950 clamp(3.65rem, 8vw, 7.35rem)/.98 var(--display); letter-spacing: -.085em; margin: 0 0 1.35rem; text-wrap: balance; }
html[lang="en"] .join-form-wrap h1 { font-size: clamp(3.4rem, 7.6vw, 6.5rem); }
.join-form-wrap > p { max-width: 34rem; color: #c1cbd6; font-size: clamp(1rem, 1.65vw, 1.18rem); line-height: 1.65; margin: 0 0 1.65rem; }
.join-form-wrap form { display: grid; gap: .82rem; max-width: 405px; }
.language-field { margin: 0; padding: 0; border: 0; }
.language-field legend { margin-bottom: .5rem; font-size: .94rem; font-weight: 720; }
.language-switch { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.language-switch button {
  border: 1px solid #3a4b5c;
  padding: .72rem .82rem;
  border-radius: .5rem;
  min-height: 44px;
  color: #c1ced8;
  background: #142032;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 780;
}
.language-switch button span { opacity: 0; color: var(--mint); }
.language-switch button[aria-pressed="true"] { border-color: #75c99d; background: #172e30; color: #d6f3df; }
.language-switch button[aria-pressed="true"] span { opacity: 1; }
.input-wrap { position: relative; }
.input-wrap input { padding-inline-end: 4.65rem; }
.input-wrap .mono { position: absolute; inset-inline-end: .82rem; top: 50%; transform: translateY(-50%); pointer-events: none; color: var(--muted); font-size: .83rem; }
.join-form-wrap button[type="submit"] { min-height: 53px; margin-top: .25rem; font-size: 1.05rem; }
.join-visual { border: 1px solid #334d54; background: #10232a; box-shadow: var(--shadow); border-radius: .85rem; overflow: hidden; position: relative; display: grid; isolation: isolate; }
.cover-caption { display: flex; gap: .67rem; align-items: center; padding: .93rem 1rem; font: 750 .78rem/1.2 var(--mono); letter-spacing: .04em; color: #bfdccd; }
.cover-line { height: 1px; background: #36535a; flex: 1; }
.join-visual canvas { width: 100%; height: clamp(260px, 39vw, 495px); object-fit: cover; image-rendering: pixelated; border-block: 1px solid #263b48; }
.cover-footer { display: flex; justify-content: space-between; gap: 1rem; align-items: center; padding: 1rem 1.25rem 1.2rem; }
.cover-footer div { display: grid; gap: .43rem; }
.cover-footer strong { font-size: clamp(1.26rem, 2.7vw, 2.15rem); letter-spacing: -.045em; }
.cover-footer .eyebrow, .cover-sigma { color: var(--mint); }
.cover-sigma { font: 900 2.25rem/1 var(--display); opacity: .8; }

.topbar {
  min-height: 68px;
  padding: .71rem max(1.25rem, calc((100vw - 1390px) / 2));
  display: flex;
  justify-content: space-between;
  gap: 1.2rem;
  align-items: center;
  background: #0c1623;
  border-bottom: 1px solid #263649;
}
.topbar .brand { margin-right: auto; }
.topbar-stats, .topbar-tools { display: flex; align-items: center; gap: .66rem; }
.wallet, .rank-pill {
  display: flex;
  align-items: center;
  gap: .43rem;
  padding: .48rem .68rem;
  border: 1px solid #334154;
  border-radius: .43rem;
  background: #161f2d;
  white-space: nowrap;
  min-height: 40px;
}
.rank-pill { gap: .55rem; border-color: #315044; background: #122825; }
.rank-pill b { color: var(--lime); font: 800 .9rem/1.1 var(--mono); }
.rank-detail { display: grid; gap: .25rem; font: 600 .68rem/1 var(--mono); color: #a9c3b5; min-width: 55px; }
.track { height: .38rem; background: #26394a; border-radius: 99px; overflow: hidden; min-width: 0; }
.track > span { display: block; height: 100%; border-radius: inherit; background: var(--bar, var(--mint)); transition: width .17s; }
.avatar { width: 30px; height: 30px; border: 1px solid #556285; background: #2b3150; color: #efddff; border-radius: .46rem; display: grid; place-items: center; font-weight: 850; flex: none; }
.player-short { display: flex; align-items: center; gap: .4rem; font-size: .85rem; font-weight: 700; min-width: 0; }
.player-short > span:last-child { max-width: 7rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#chat-toggle[data-unread="true"] { border-color: #9de7b6; box-shadow: 0 0 14px #a3f2b332; }
#chat-dot { background: var(--lime); width: 7px; height: 7px; display: inline-block; border-radius: 50%; }
.app-frame { max-width: 1390px; margin-inline: auto; padding: 0 1.25rem 2.5rem; }
.game-nav {
  min-height: 61px;
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid #344456;
  margin-bottom: 1.35rem;
  gap: clamp(.2rem, 1.2vw, .95rem);
  overflow-x: auto;
  scrollbar-width: thin;
}
.nav-tab {
  appearance: none;
  background: transparent;
  color: #a9b9ca;
  border: 0;
  border-bottom: 2px solid transparent;
  padding: .66rem .82rem;
  min-height: 51px;
  font-size: .94rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: .48rem;
  white-space: nowrap;
}
.nav-tab:hover { color: var(--ink); background: #1b2a3a; }
.nav-tab[aria-current="page"] { border-color: var(--lime); color: #e8fbd7; background: linear-gradient(0deg, #213932 0%, transparent 97%); }
.nav-glyph { color: var(--mint); font-family: var(--mono); font-size: 1.08rem; width: 1.1em; display: inline-block; text-align: center; }
.view-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; margin-bottom: 1.1rem; }
.view-heading h1 { font: 900 clamp(1.9rem, 4vw, 3.1rem)/1.07 var(--display); letter-spacing: -.065em; margin: .3rem 0 0; }
.view-heading p { color: var(--muted); margin: .46rem 0 0; line-height: 1.45; }
.battle-grid { display: grid; grid-template-columns: minmax(0, 2.24fr) minmax(280px, 1fr); gap: 1rem; align-items: start; }
.panel { border: 1px solid var(--line); border-radius: .64rem; background: var(--panel); min-width: 0; overflow: hidden; }
.panel.pad { padding: clamp(.92rem, 1.65vw, 1.23rem); }
.panel-head { padding: .8rem .93rem; display: flex; gap: .6rem; justify-content: space-between; align-items: center; border-bottom: 1px solid #26364a; min-height: 51px; }
.panel-title { font-weight: 850; font-size: 1.07rem; letter-spacing: -.025em; }
.panel-head .small { color: var(--muted); }
.arena-panel { box-shadow: 0 13px 38px #040b1370; border-color: #34545d; }
.arena-stage { position: relative; isolation: isolate; overflow: hidden; background: #0b1d27; container-type: inline-size; }
.arena-stage canvas { width: 100%; aspect-ratio: 512/262; }
.arena-hud {
  position: absolute;
  top: 1rem;
  right: 1rem;
  max-width: 40%;
  min-width: 150px;
  background: #0a1721de;
  border: 1px solid #63838075;
  border-radius: .5rem;
  padding: .55rem .7rem;
  display: grid;
  gap: .26rem;
  box-shadow: 0 8px 20px #0b142d35;
  backdrop-filter: blur(5px);
}
.arena-hud .row { font: 800 .77rem/1.1 var(--mono); }
.arena-hud .track { height: .43rem; }
.arena-hud small { font-size: .76rem; color: #bad3cf; }
.arena-stage.drop-hover { box-shadow: inset 0 0 0 3px var(--lime); }
.arena-stage.drop-hover::after { content: ""; position: absolute; inset: 0; border: 3px solid var(--lime); pointer-events: none; }
.slot-target {
  position: absolute;
  transform: translate(-50%, -50%);
  width: clamp(29px, 7%, 64px);
  height: clamp(28px, 12%, 58px);
  border: 1px dashed #9adacb50;
  border-radius: .35rem;
  background: #9dfbc910;
  color: #cbf9dc;
  padding: 0;
  font: 800 .68rem/1 var(--mono);
  display: grid;
  place-items: center;
}
.slot-target:hover, .slot-target.drop-hover, .slot-target:focus-visible { background: #9dfbc939; border-color: var(--lime); }
.slot-target.has-gear { border-color: transparent; background: transparent; color: transparent; }
.slot-target.has-gear:hover, .slot-target.has-gear:focus-visible { border-color: #9adacb87; color: var(--lime); }
.arena-footer { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .65rem; padding: .78rem .87rem; border-top: 1px solid #375256; }
.arena-tools { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.arena-status { flex: 1; min-width: min(10rem, 100%); color: var(--muted); font-size: .84rem; line-height: 1.45; }
.arena-status strong { color: #dcefe5; }
.battle-progress { display: grid; gap: .5rem; }
.battle-progress .row { align-items: baseline; }
.milestones { display: flex; justify-content: space-between; align-items: center; gap: .3rem; margin-top: .32rem; }
.milestones i { flex: 1; height: 4px; background: #304155; border-radius: 4px; }
.milestones i.done { background: var(--mint); box-shadow: 0 0 8px #83e8ae4f; }
.quick-slot {
  display: grid;
  grid-template-columns: 1.55rem 2.45rem minmax(0, 1fr) auto;
  align-items: center;
  gap: .52rem;
  padding: .46rem .57rem;
  border: 1px solid #324557;
  border-radius: .46rem;
  background: #142133;
  margin-bottom: .46rem;
}
.quick-slot.empty { border-style: dashed; background: #0e1826; }
.quick-slot.drop-hover { border-color: var(--lime); background: #20352e; }
.quick-slot > b:first-child { color: var(--subtle); font: 760 .82rem/1 var(--mono); }
.quick-slot .slot-name { font-size: .91rem; font-weight: 770; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.quick-slot img, .gear-icon { width: 56px; height: 44px; object-fit: contain; }
.quick-slot img { width: 38px; height: 31px; }
.quick-slot .slot-empty { color: #7895a7; text-align: center; font: 800 1.05rem/1 var(--mono); }
.inventory-label { margin: 1rem 0 .48rem; }
.inventory { display: flex; flex-wrap: wrap; gap: .42rem; }
.inventory-card {
  position: relative;
  border: 1px solid #426075;
  background: #122435;
  color: var(--ink);
  border-radius: .46rem;
  min-width: 58px;
  min-height: 43px;
  padding: 0;
}
.inventory-card:hover, .inventory-card[aria-pressed="true"] { border-color: var(--lime); background: #1f3d3a; }
.inventory-card span { position: absolute; bottom: .11rem; right: .13rem; font: 800 .61rem/1.1 var(--mono); color: var(--lime); padding: .1rem .19rem; border-radius: .2rem; background: #162831; }
.quest-card { display: flex; gap: .65rem; align-items: start; }
.quest-card .token, .topic-card .token {
  flex: none;
  border-radius: .43rem;
  width: 37px;
  height: 37px;
  display: grid;
  place-items: center;
  color: var(--mint);
  background: #1e3a37;
  border: 1px solid #345b53;
  font: 900 1.14rem/1 var(--mono);
}
.quest-card.lava .token { background: #412b37; border-color: #7b4b4d; color: #ffc291; }
.quest-card .quest-copy { min-width: 0; display: grid; gap: .38rem; flex: 1; }
.quest-card .quest-copy .button { width: max-content; max-width: 100%; margin-top: .11rem; }
.bottom-panels { display: grid; grid-template-columns: 1.08fr 1fr; gap: 1rem; }
.new-stamp { color: var(--gold); letter-spacing: .02em; }
.armory-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; }
.armory-gear { display: grid; gap: .82rem; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.gear-card { display: grid; gap: .66rem; align-content: start; padding: .83rem; position: relative; background: linear-gradient(150deg, #1b314054, transparent 55%), var(--panel); }
.gear-card.is-locked { opacity: .72; }
.gear-card .card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: .5rem; }
.gear-card .gear-icon {
  border: 1px solid #354b63;
  border-radius: .42rem;
  background: #152436;
  width: 65px;
  height: 51px;
  padding: .18rem;
}
.gear-card h2 { font-size: 1.05rem; }
.gear-card p { min-height: 2.65rem; }
.gear-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .34rem; margin: 0; }
.gear-stats div { background: #0f1928; border: 1px solid #253a4b; padding: .42rem .36rem; border-radius: .36rem; }
.gear-stats dt { color: var(--muted); font-size: .74rem; line-height: 1.25; overflow-wrap: anywhere; }
.gear-stats dd { margin: .24rem 0 0; font: 800 .95rem/1 var(--mono); color: #edf4ef; }
.gear-controls { display: grid; grid-template-columns: 1fr auto; gap: .42rem; align-items: start; }
.gear-controls .wide { grid-column: 1/-1; }
.tune-note { font-size: .82rem; line-height: 1.38; color: var(--muted); }
.topic-strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .7rem; margin-bottom: 1rem; }
.topic-card {
  min-height: 76px;
  width: 100%;
  border: 1px solid #33495d;
  border-radius: .58rem;
  background: #132234;
  color: var(--ink);
  display: flex;
  gap: .67rem;
  align-items: center;
  text-align: left;
  padding: .65rem;
}
.topic-card:hover, .topic-card[aria-pressed="true"] { background: #1a3737; border-color: #78cfaa; }
.topic-card strong { display: block; line-height: 1.3; font-size: .96rem; }
.topic-card small { color: #a0bcba; font-size: .81rem; }
.math-grid { display: grid; grid-template-columns: minmax(0, 1.9fr) minmax(230px, 1fr); gap: 1rem; align-items: start; }
.problem-card { background: radial-gradient(circle at 84% 8%, #22483f63, transparent 44%), #112131; }
.problem-card .problem { font-size: clamp(1.2rem, 3.2vw, 1.95rem); line-height: 1.5; font-weight: 780; letter-spacing: -.025em; margin: .85rem 0 1.16rem; overflow-wrap: anywhere; }
.problem-card form { display: grid; gap: .55rem; }
.problem-card .answer-row { display: flex; align-items: stretch; gap: .57rem; }
.problem-card .answer-row > input { font-family: var(--mono); flex: 1; max-width: 29rem; }
.problem-card .explanation {
  padding: .75rem;
  line-height: 1.55;
  background: #203032;
  border: 1px solid #3b6558;
  border-radius: .48rem;
  color: #def2e6;
  margin-top: .64rem;
}
.problem-card .explanation.wrong { border-color: #6c4a4a; background: #382e3c; color: #f2d3d0; }
.problem-card .answer-actions { margin-top: .7rem; flex-wrap: wrap; }
.math-status { display: grid; gap: .75rem; padding: .86rem; background: #0d1724; border: 1px solid #304458; border-radius: .5rem; }
.math-status strong { color: var(--mint); font: 850 1.27rem/1 var(--mono); }

.worlds { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .8rem; }
.world-card { display: flex; flex-direction: column; min-height: 100%; }
.world-card.active { border-color: var(--world-accent); }
.world-card.locked canvas { filter: saturate(.62) brightness(.69); }
.world-card canvas { width: 100%; aspect-ratio: 1.9; object-fit: cover; }
.world-card .world-info { padding: .84rem; display: flex; flex: 1; flex-direction: column; gap: .54rem; }
.world-card h2 { font-size: 1.2rem; letter-spacing: -.03em; }
.world-card p { color: var(--muted); line-height: 1.45; font-size: .88rem; }
.world-foot { margin-top: auto; padding-top: .3rem; }
.home-top { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(230px, 1fr); gap: .95rem; align-items: start; }
.room-wrap { background: #261e3f; position: relative; }
.room-wrap canvas { width: 100%; }
.room-slot {
  position: absolute;
  transform: translate(-50%, -100%);
  min-width: 11%;
  height: 18%;
  border: 1px dashed transparent;
  border-radius: .35rem;
  background: transparent;
  color: transparent;
  padding: .1rem;
  font: 800 .78rem/1 var(--mono);
}
.room-slot:hover, .room-slot[aria-pressed="true"], .room-slot:focus-visible, .room-slot.drop-hover {
  color: #eaf6e9;
  border-color: #b0e8d793;
  background: #b0e8d721;
}
.room-inventory {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(55px, 1fr));
  gap: .44rem;
  max-height: 210px;
  overflow-y: auto;
  scrollbar-width: thin;
}
.decor-catalog { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .59rem; }
.decor-card { padding: .55rem; background: #171e35; display: grid; gap: .42rem; align-content: start; }
.decor-card img { width: 56px; height: 56px; margin-inline: auto; }
.decor-card h3 { font-size: .89rem; line-height: 1.3; min-height: 2.3em; text-align: center; }
.decor-card .button { padding-inline: .36rem; font-size: .82rem; overflow-wrap: anywhere; }
.series-input { width: 05.75rem; min-height: 36px; text-align: center; padding: .38rem .45rem; }
.series-label { color: var(--muted); font-size: .83rem; }
.lava-panel { border-color: #704d58; }
.lava-panel canvas { width: 100%; aspect-ratio: 720/344; object-fit: cover; background: #28192d; }
.lava-controls { display: flex; align-items: center; justify-content: space-between; gap: .65rem; flex-wrap: wrap; padding: .72rem; }
.lava-pad { display: flex; gap: .38rem; }
.lava-pad button { min-width: 47px; min-height: 47px; touch-action: none; user-select: none; }
.lava-pad button.pressed { background: #67444a; border-color: #dcab8d; }
.lava-meter { display: flex; flex-wrap: wrap; justify-content: end; gap: .45rem; }
.chat-drawer {
  position: fixed;
  z-index: 5;
  inset: auto 1rem 1rem auto;
  width: min(410px, calc(100vw - 2rem));
  height: min(630px, calc(100dvh - 2rem));
  min-height: 280px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background: #111c2a;
  border: 1px solid #4f697a;
  border-radius: .75rem;
  box-shadow: 0 18px 100px #03070dd0;
  overflow: hidden;
}
.chat-drawer .panel-head { background: #18283a; }
.chat-messages { margin: 0; padding: .75rem .65rem; list-style: none; overflow-y: auto; display: flex; flex-direction: column; gap: .55rem; overscroll-behavior: contain; scrollbar-width: thin; }
.chat-empty { color: var(--muted); padding: .55rem; line-height: 1.5; }
.chat-line { padding: .48rem .55rem; display: grid; gap: .25rem; background: #182336; border: 1px solid #2f4055; border-radius: .45rem; }
.chat-line.own { background: #15302c; border-color: #335747; }
.chat-line.pinged { border-color: #8ec99b; }
.chat-line .author { color: #d5f1c5; font-size: .86rem; font-weight: 820; max-width: 72%; overflow-wrap: anywhere; }
.chat-line time { color: var(--subtle); font: 600 .72rem/1 var(--mono); margin-right: auto; }
.chat-line .reply-btn { min-width: 0; min-height: 27px; padding: .15rem .28rem; }
.chat-text { font-size: .94rem; line-height: 1.5; overflow-wrap: anywhere; }
.chat-text mark { color: #dcf9b8; background: #2e4c37; border-radius: .2rem; padding: .08rem .18rem; }
.chat-quote, #reply-context { border-left: 2px solid #748eb0; padding: .22rem .45rem; font-size: .79rem; color: #b9c8d8; overflow-wrap: anywhere; }
.quote-preview { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.chat-form { display: grid; gap: .43rem; padding: .64rem; border-top: 1px solid #304257; }
.chat-form .compose { display: flex; gap: .38rem; }
.chat-form .compose input { flex: 1; padding: .55rem .6rem; }
.chat-form .compose button { padding-inline: .57rem; min-width: 4rem; }
.chat-form .compose-note { font-size: .75rem; color: var(--muted); }
.game-dialog {
  width: min(530px, calc(100% - 1.75rem));
  max-height: calc(100dvh - 2rem);
  overflow-y: auto;
  color: var(--ink);
  margin: auto;
  padding: 0;
  border: 1px solid #4b6878;
  background: #152234;
  border-radius: .72rem;
  box-shadow: 0 20px 90px #000a;
}
.game-dialog.wide-dialog { width: min(790px, calc(100% - 1.75rem)); }
.game-dialog::backdrop { background: #050b15cc; backdrop-filter: blur(4px); }
.dialog-content { display: grid; gap: .84rem; padding: 1rem; }
.dialog-content p { line-height: 1.5; }
.dialog-content .actions { display: flex; flex-wrap: wrap; gap: .55rem; }
.dialog-banner { padding: 1.1rem 1rem .97rem; background: radial-gradient(ellipse at 65% 15%, #2d5144, #192935); border-bottom: 1px solid #466858; }
.dialog-banner.loss { background: radial-gradient(ellipse at 65% 15%, #4f344e, #272736); border-color: #684c63; }
.dialog-banner h2 { color: #e6facd; font: 900 1.85rem/1.1 var(--display); letter-spacing: -.055em; margin-top: .37rem; }
.dialog-banner.loss h2 { color: #ffd1c9; }
.result-points, .stat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .46rem; }
.result-points > div, .stat-grid > div { background: #0e1b2b; border: 1px solid #2d4658; padding: .55rem; border-radius: .42rem; min-width: 0; }
.result-points span, .stat-grid span { display: block; margin-bottom: .26rem; color: var(--muted); font-size: .78rem; line-height: 1.28; }
.result-points b, .stat-grid b { font: 800 1.06rem/1.18 var(--mono); overflow-wrap: anywhere; }
.share-preview { width: 100%; height: auto; background: #101d2a; border: 1px solid #45636f; border-radius: .48rem; }
.people-list { display: grid; gap: .4rem; max-height: 198px; overflow-y: auto; }
.person { min-height: 39px; display: flex; gap: .55rem; align-items: center; text-align: left; padding: .34rem .64rem; }
.person[aria-pressed="true"] { border-color: var(--mint); background: #23413d; }
.toast-stack {
  position: fixed;
  z-index: 9;
  top: .9rem;
  right: .95rem;
  width: min(340px, calc(100% - 1.9rem));
  display: grid;
  gap: .42rem;
  pointer-events: none;
}
.toast {
  border: 1px solid #496e63;
  border-left: 3px solid var(--mint);
  background: #172b37;
  color: #edf8f1;
  padding: .55rem .68rem;
  border-radius: .42rem;
  box-shadow: 0 8px 35px #0209168c;
  font-size: .87rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
  animation: enter .18s ease-out;
}
.toast.ping { border-left-color: #f7cf79; background: #233344; }
.toast.error { border-left-color: #ff9d9d; }
@keyframes enter { from { transform: translateY(-6px); opacity: .25; } to { transform: translateY(0); opacity: 1; } }

@media (max-width: 1020px) {
  .topbar { padding-inline: .9rem; }
  .app-frame { padding-inline: .9rem; }
  .topbar .player-short > span:last-child { display: none; }
  .battle-grid { grid-template-columns: minmax(0, 2fr) minmax(230px, 1fr); }
  .worlds { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .armory-gear { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .decor-catalog { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 740px) {
  .join-page { width: min(100% - 2rem, 530px); }
  .join-grid { grid-template-columns: 1fr; gap: 1.45rem; }
  .join-form-wrap h1, html[lang="en"] .join-form-wrap h1 { font-size: clamp(3rem, 11.2vw, 5.1rem); }
  .join-form-wrap h1 br { display: none; }
  .join-form-wrap > p { margin-bottom: 1rem; }
  .join-visual canvas { height: auto; }
  .join-top { margin-bottom: 1.22rem; }
  .join-form-wrap form { max-width: 100%; }
  .topbar { gap: .54rem; flex-wrap: wrap; }
  .topbar-stats, .topbar-tools { gap: .35rem; }
  .topbar .player-short { display: none; }
  .rank-detail { display: none; }
  .topbar .brand-type small, .nav-glyph { display: none; }
  .topbar .brand-mark { width: 32px; height: 32px; }
  .topbar .wallet, .topbar .rank-pill { padding: .43rem; min-height: 35px; font-size: .85rem; }
  .topbar .icon-button { min-height: 37px; min-width: 37px; }
  .game-nav { gap: .12rem; min-height: 46px; margin-bottom: .92rem; }
  .nav-tab { padding-inline: .52rem; font-size: .85rem; min-height: 46px; }
  .view-heading { align-items: flex-start; flex-wrap: wrap; gap: .6rem; }
  .battle-grid, .math-grid, .home-top { grid-template-columns: 1fr; }
  .bottom-panels { gap: .65rem; }
  .panel.pad { padding: .73rem; }
  .topic-strip { gap: .36rem; }
  .topic-card { flex-direction: column; align-items: start; gap: .38rem; padding: .5rem; min-height: 78px; }
  .topic-card .token { width: 28px; height: 28px; font-size: .92rem; }
  .topic-card small { display: none; }
  .arena-hud { min-width: 119px; top: .5rem; right: .5rem; padding: .35rem .4rem; }
  .arena-hud small, .arena-hud .row { font-size: .68rem; }
  .arena-footer { padding: .6rem; justify-content: flex-start; }
  .arena-tools .button { padding-inline: .51rem; }
  .arena-tools kbd { display: none; }
  .hud-hint { display: none; }
  .decor-catalog { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 430px) {
  .topbar .brand-type strong { font-size: .86rem; }
  .topbar { padding-inline: .57rem; }
  .topbar .brand { gap: .4rem; }
  .topbar .tool-secondary { display: none; }
  .app-frame { padding-inline: .57rem; }
  .bottom-panels, .armory-gear { grid-template-columns: 1fr; }
  .chat-drawer { inset: auto .45rem .45rem; width: auto; height: min(620px, calc(100dvh - .9rem)); }
  .world-card .world-info { padding: .57rem; }
  .world-card h2 { font-size: 1rem; }
  .result-points { gap: .3rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

.brand-button { background: none; border: 0; color: inherit; padding: 0; text-align: start; }
.small-settings { display: none; }
.gutter { padding: .82rem .9rem .91rem; }
.loadout-hint { margin-top: .65rem; }
.slot-action { min-width: 33px; min-height: 34px; }
.gear-card:hover { border-color: color-mix(in srgb, var(--gear-color) 65%, #41516c); }
.lava-help { margin-top: .72rem; }
@media (max-width: 430px) {
  .topbar .small-settings { display: inline-flex; }
  .topbar .small-settings { min-width: 34px; }
  .topbar .topbar-tools .icon-button { padding-inline: .42rem; }
}

html[lang="ko"] .join-intro, html[lang="ko"] p, html[lang="ko"] h2 { word-break: keep-all; }
input { font-size: max(1rem, 16px); }
#join-submit { justify-content: center; }
.inventory-card[data-drag-weapon], .inventory-card[data-drag-decor] { user-select: none; cursor: grab; touch-action: none; }
.inventory-card[data-drag-weapon]:active, .inventory-card[data-drag-decor]:active { cursor: grabbing; }
.inventory-card:disabled { cursor: default; }
.inventory-card img { pointer-events: none; }
.inventory-card.drag-ghost {
  transform: translate(-50%, -50%) rotate(-8deg) scale(1.13);
  position: fixed;
  z-index: 8;
  pointer-events: none;
  opacity: .88;
  box-shadow: 0 7px 28px #060a13aa;
  border-color: var(--mint);
}
@media (max-width: 740px) {
  .slot-target { height: min(11%, 35px); }
}
