:root {
  color-scheme: dark;
  --bg: #101827;
  --panel: #131e30;
  --ink: #f3f1ec;
  --muted: #acb8cc;
  --edge: #485775;
  --orange: #ffa94e;
  font-family: "Malgun Gothic", "Apple SD Gothic Neo", "Noto Sans KR", system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
[hidden] { display: none !important; }
button, input { font: inherit; border-radius: 3px; }
button {
  min-height: 48px; border: 1px solid var(--edge); background: #202d43; color: var(--ink);
  padding: .72rem 1.05rem; font-weight: 800; cursor: pointer;
}
button:hover { background: #2b3b55; }
button:disabled { opacity: .45; cursor: default; }
button:focus-visible, input:focus-visible { outline: 2px solid #ffe2b5; outline-offset: 4px; }
button.primary { color: #1a1820; background: var(--orange); border-color: var(--orange); }
button.primary:hover:not(:disabled) { background: #ffc481; }
button.quiet { border: 0; background: transparent; color: var(--muted); }
input {
  width: 100%; min-height: 53px; color: var(--ink); background: #0d1625; border: 1px solid var(--edge);
  padding: 0 .88rem; font-weight: 650;
}
input::placeholder { color: #8999b3; opacity: 1; }
.screen { min-height: 100svh; }
.landing {
  display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(320px, .7fr);
  overflow: hidden; background: radial-gradient(ellipse at 22% 55%, #202d46 0, var(--bg) 61%);
  align-items: center; gap: clamp(2rem, 6vw, 7rem);
  padding: 3rem max(4vw, calc((100vw - 1440px) / 2));
}
.hero { min-height: 640px; position: relative; isolation: isolate; overflow: hidden; }
.hero-title { position: relative; margin: 1.6rem 0 0 2.1rem; z-index: 2; }
.game-mode {
  display: flex; align-items: center; gap: .55rem; margin: 0 0 .4rem;
  font-size: .95rem; font-weight: 800; letter-spacing: .14em; color: var(--orange);
}
.game-mode span { width: 8px; height: 8px; background: currentColor; transform: rotate(45deg); }
h1 { margin: 0; font-size: clamp(3.3rem, 7.8vw, 8rem); line-height: 1.05; font-weight: 950; letter-spacing: -.09em; }
.stage-floor {
  position: absolute; left: 6%; right: 4%; height: 57%; bottom: -9%; transform: perspective(360px) rotateX(28deg);
  transform-origin: bottom;
  background: repeating-linear-gradient(90deg, transparent 0 73px, #283650 74px 75px),
    repeating-linear-gradient(0deg, transparent 0 62px, #283650 63px 64px), #394765;
  border: 12px solid #566582; box-shadow: 0 -3px #8793ad, inset 0 0 50px #222c44;
}
.stage-ring {
  position: absolute; width: 45%; height: 11%; left: 27.5%; bottom: 10%;
  border: 4px solid var(--orange); border-radius: 50%; transform: rotate(-5deg);
  background: #0f15285a; box-shadow: 0 0 31px #ffa94e50;
}
.hero-bear {
  position: absolute; display: block; height: 540px; width: auto;
  left: 50%; bottom: 4%; transform: translateX(-50%);
  filter: contrast(1.06) brightness(1.13);
}
.entry-panel {
  max-width: 495px; width: 100%; padding: clamp(1.35rem, 3vw, 2.65rem);
  border: 1px solid var(--edge); border-top: 3px solid var(--orange);
  background: #141f31; box-shadow: 0 18px 56px #070c1680;
  display: grid; gap: .75rem;
}
.entry-panel h2 { margin: 0 0 .75rem; font-size: 1.55rem; letter-spacing: -.045em; }
label { color: #d5dceb; font-size: .9rem; font-weight: 800; }
.entry-panel .primary { display: flex; justify-content: center; gap: .85rem; }
.code-input { text-transform: uppercase; letter-spacing: .13em; }
.code-input::placeholder { letter-spacing: 0; }
.form-rule { margin: .55rem 0 .4rem; height: 1px; background: #354560; }
.status { margin: 0; min-height: 1.25rem; font-size: .85rem; color: var(--muted); }
.status.error { color: #ffbd8c; }
.keys { margin: 0; display: flex; align-items: center; gap: 1.15rem; flex-wrap: wrap; color: var(--muted); font-size: .83rem; font-weight: 700; }
kbd {
  display: inline-block; border: 1px solid #59708d; border-bottom-width: 2px; border-radius: 3px;
  padding: .18rem .42rem; margin-right: .18rem; color: #f2f0e9; background: #25354d;
  font-family: ui-monospace, monospace; font-size: .8rem; font-weight: 800;
}
.lobby { background: radial-gradient(ellipse at 50% 48%, #25344d, var(--bg) 68%); }
.lobby-head, .match-head {
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid #42536e; background: #111b2c; padding: .8rem clamp(1rem, 3vw, 3rem);
}
.small-brand { font-weight: 900; font-size: clamp(1.05rem, 2vw, 1.55rem); letter-spacing: -.055em; margin: 0; }
.room-count { font: 800 1rem ui-monospace, monospace; color: var(--muted); }
.lobby-body { max-width: 1310px; margin: 0 auto; padding: clamp(2rem, 6vh, 5rem) 1.5rem 2rem; }
.invite-group { margin-bottom: 1.6rem; text-align: center; }
.invite-group > span { display: block; font-size: .92rem; font-weight: 850; color: var(--muted); }
#room-code {
  margin: .5rem 0 .55rem; background: #111929; color: var(--ink); border-color: var(--orange);
  border-left-width: 4px; border-right-width: 4px; font: 900 clamp(2.2rem, 6vw, 4rem) ui-monospace, monospace;
  letter-spacing: .14em; padding: .3rem .45em .3rem .6em;
}
.roster { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(.55rem, 2vw, 1.25rem); }
.seat {
  position: relative; min-width: 0; overflow: hidden; text-align: center; border: 1px solid #455573;
  border-top: 4px solid var(--player, #455573); background: #162135; padding: 0 0 1rem;
}
.seat-art { display: grid; place-items: center; overflow: hidden; height: clamp(100px, 23vh, 225px); background: #0e1728; color: #8593aa; }
.seat-art img { width: 165%; height: auto; align-self: start; translate: 0 -14%; }
.seat p { margin: .72rem .25rem .3rem; font-weight: 900; font-size: clamp(.85rem, 2vw, 1.25rem); overflow-wrap: anywhere; }
.seat .seat-state { font-weight: 750; font-size: .78rem; color: var(--player, var(--muted)); }
.lobby-actions { display: grid; justify-items: center; gap: .55rem; padding-top: 1.7rem; }
.lobby-actions .primary { width: min(100%, 290px); }
.game {
  display: grid; grid-template-rows: auto 1fr auto; height: 100svh; background: #0a1020;
}
.match-head { gap: 1rem; min-height: 66px; }
.goal { flex-shrink: 0; border: 1px solid #506282; border-radius: 3px; padding: .4rem .6rem; font-size: .8rem; font-weight: 900; }
.scores { display: flex; gap: clamp(.35rem, 2vw, 1.6rem); align-items: center; }
.score { display: flex; gap: .4rem; align-items: center; color: var(--player); font-size: .83rem; font-weight: 800; }
.score::before { content: ""; width: 9px; height: 9px; flex: 0 0 9px; background: var(--player); }
.score strong { font: 800 1.3rem ui-monospace, monospace; color: var(--ink); }
.score span { max-width: 9ch; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.field { position: relative; min-height: 0; display: grid; place-items: center; overflow: hidden; }
#arena { display: block; width: 100%; height: 100%; min-height: 0; object-fit: contain; }
#minimap {
  position: absolute; right: 1rem; top: 1rem; width: min(23vw, 232px); height: auto;
  border: 1px solid #7d8eab; border-radius: 4px; background: #111b2d; box-shadow: 0 6px 20px #0a102070;
}
.match-foot { justify-content: center; padding: .5rem .75rem; border-top: 1px solid #3b4d6e; background: #111b2c; }
.dash-label { color: #ffd098; min-width: 6rem; }
.notice {
  position: absolute; bottom: 13%; text-align: center;
  padding: .65rem 1.05rem; border: 1px solid #7084a6; border-radius: 3px; background: #111929ed; font-weight: 850;
}
.end {
  position: absolute; z-index: 2; width: min(92vw, 400px); padding: 1.55rem; display: grid; gap: .65rem;
  text-align: center; border: 1px solid var(--edge); border-top: 3px solid var(--orange); background: #131e30;
  box-shadow: 0 0 0 100vmax #080e1ab0;
}
.end h2, .end p { margin: 0; }
.end h2 { margin-bottom: .5rem; overflow-wrap: anywhere; font-size: 2rem; }
.end > p:first-child { color: var(--orange); font-weight: 900; }
@media (max-width: 860px) {
  .landing { gap: 1rem; padding: 1.7rem; }
  .hero { min-height: 500px; }
  .hero-bear { height: 465px; }
  .hero-title { margin-left: .4rem; }
}
@media (max-width: 660px) {
  .landing { grid-template-columns: 1fr; justify-items: center; padding: .9rem 1rem 2rem; }
  .hero { width: min(100%, 470px); min-height: 255px; }
  .hero-title { margin-top: .9rem; }
  .hero-bear { height: 305px; left: 74%; bottom: 0; }
  .stage-ring { left: 59%; width: 30%; }
  h1 { max-width: 4ch; font-size: 3.15rem; }
  .roster { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .score span, .match-head .small-brand { display: none; }
  .match-foot { gap: .45rem .65rem; }
  #minimap { right: .4rem; top: .4rem; width: 28vw; }
}
