@font-face {
  font-family: Arena;
  src: local("Bahnschrift");
  font-display: swap;
}
:root {
  color-scheme: dark;
  --base: #0c1116;
  --ink: #e8f0ee;
  --muted: #a0b1b2;
  --line: #2a353c;
  --teal: #67f3cd;
  --amber: #ffae67;
  --display: Arena, "Arial Narrow", system-ui, sans-serif;
  font-family: system-ui, sans-serif;
  background: var(--base);
  color: var(--ink);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-height: 100svh;
  background: radial-gradient(ellipse at 74% 23%, #17252c 0%, #10191e 38%, #0c1116 75%);
}
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; cursor: pointer; }
a { color: inherit; }
button:focus-visible, a:focus-visible { outline: 2px solid #f2f8f6; outline-offset: 4px; }
button:disabled { cursor: default; opacity: .6; }
.shell { display: flow-root; width: min(1320px, calc(100% - 96px)); margin: 0 auto; }
.topbar {
  height: 87px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
.wordmark { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; font: 700 20px var(--display); letter-spacing: .12em; }
.mark { width: 26px; height: 26px; background: var(--teal); clip-path: polygon(16% 0, 100% 0, 55% 45%, 87% 45%, 30% 100%, 42% 56%, 0 56%); }
.top-right { display: flex; gap: 23px; align-items: center; }
.mode { font: 600 14px var(--display); letter-spacing: .15em; color: var(--muted); }
.stage {
  position: relative;
  user-select: none;
  margin: 0 auto;
}
.eyebrow { display: inline-flex; gap: 9px; align-items: center; color: #a9c5c1; font: 640 14px var(--display); letter-spacing: .2em; }
.eyebrow > span { width: 18px; height: 2px; background: var(--teal); }
.primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 11px;
  min-height: 49px; padding: 0 23px; border: 1px solid #adfce5; border-radius: 5px;
  background: var(--teal); color: #09211b; font-weight: 750; font-size: 15px;
  box-shadow: 0 5px 25px #49e7bc20; transition: background .15s, transform .15s;
}
.primary:hover:not(:disabled) { background: #a1fae4; transform: translateY(-1px); }
.primary:active:not(:disabled) { transform: none; }
.quiet {
  min-height: 37px; padding: 5px 12px; border: 1px solid #415359; border-radius: 4px;
  color: #d4dedc; background: #142028; font-size: 14px;
}
.quiet:hover { background: #1e3038; }
.field {
  overflow: hidden; position: relative; border-radius: 9px;
  border: 1px solid #415258; background: #121f25; isolation: isolate;
  box-shadow: 0 26px 70px #0007, 0 1px 0 #ffffff10;
}
#arena { touch-action: none; width: 100%; height: auto; display: block; aspect-ratio: 7/4; }
.bottom {
  display: flex; align-items: center; flex-wrap: wrap; gap: 14px 30px;
  border-top: 1px solid var(--line); padding: 21px 0 25px;
}
.control { display: inline-flex; align-items: center; gap: 9px; font-size: 14px; color: var(--muted); }
.keys { display: inline-flex; gap: 3px; }
kbd {
  display: inline-grid; min-width: 23px; height: 23px; padding: 0 4px; place-items: center;
  border: 1px solid #3b4c53; border-bottom-width: 2px; border-radius: 4px;
  background: #172128; color: #d9e5e1; font: 650 12px var(--display);
}
kbd.space { padding: 0 8px; letter-spacing: .09em; }
.mouse { width: 15px; height: 21px; border: 1px solid #617879; border-radius: 7px; position: relative; }
.mouse::before { content: ""; position: absolute; left: 2px; top: 2px; width: 4px; height: 6px; background: var(--teal); border-radius: 4px 0 2px 1px; }
.connection { margin-left: auto; display: inline-flex; gap: 7px; align-items: center; color: var(--muted); font-size: 14px; white-space: nowrap; }
.connection > span:first-child { width: 7px; height: 7px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 10px #5dfaab70; }
.connection[data-offline] > span:first-child { background: var(--amber); }
body:is(.in-room, .in-tutorial) .stage { display: block; margin: 22px auto 14px; max-width: min(1120px, calc((100svh - 226px) * 1.75)); min-width: min(100%, 500px); }
body:is(.in-room, .in-tutorial) .topbar { height: 64px; }
body:is(.in-room, .in-tutorial) .intro { display: none; }
body:is(.in-room, .in-tutorial) .bottom { max-width: min(1120px, calc((100svh - 226px) * 1.75)); min-width: min(100%, 500px); margin: 0 auto; padding-block: 13px; }
body.playing #arena { cursor: none; }
.scoreboard {
  display: grid; grid-template-columns: 1fr minmax(100px, .38fr) 1fr; align-items: stretch;
  min-height: 60px; margin-bottom: 12px; border: 1px solid #35494e; border-radius: 6px; background: #111c22;
}
.side { display: flex; align-items: center; gap: 14px; padding: 7px 18px; }
.side-you { color: var(--local-tint, var(--teal)); }
.side-rival { color: var(--rival-tint, var(--amber)); justify-content: flex-end; }
.side-label { font: 700 13px var(--display); letter-spacing: .06em; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; min-width: 0; }
.side strong { margin-left: auto; font: 700 31px var(--display); }
.side-rival strong { margin-left: 0; margin-right: auto; }
.indicator { width: 8px; height: 8px; background: currentColor; transform: rotate(45deg); box-shadow: 0 0 12px currentColor; }
.clockbox { display: flex; flex-direction: column; justify-content: center; align-items: center; border-inline: 1px solid #35494e; padding: 4px; gap: 2px; }
.clockbox span { font: 600 11px var(--display); color: #a2b8b7; letter-spacing: .12em; }
.clockbox strong { font: 700 22px var(--display); font-variant-numeric: tabular-nums; }
.scrim {
  position: absolute; display: grid; place-items: center; inset: 0; z-index: 2;
  padding: 14px; background: #07111880; backdrop-filter: blur(3px);
}
.dialog {
  text-align: center; width: min(98%, 385px); padding: clamp(15px, 4vw, 34px);
  background: #101c23f2; border: 1px solid #416068; border-radius: 9px;
  box-shadow: 0 18px 65px #0009;
}
.dialog h2 { margin: 0.32em 0 0; font: 750 clamp(24px, 4vw, 38px)/1.07 var(--display); letter-spacing: -.04em; }
.dialog p { margin: .75em 0 1.15em; color: #b6c6c6; font-size: 15px; }
.round-call {
  position: absolute; inset: 0; display: grid; place-content: center; text-align: center; gap: 3px;
  z-index: 2; pointer-events: none; background: radial-gradient(ellipse at center, #071218b8, transparent 57%);
}
.round-call strong { color: #f2faf7; font: 800 clamp(39px, 8vw, 90px)/1 var(--display); letter-spacing: -.05em; text-shadow: 0 3px 12px #000; }
.round-call span { text-transform: uppercase; font: 700 clamp(12px, 2vw, 16px) var(--display); letter-spacing: .23em; color: var(--teal); text-shadow: 0 2px 3px #000; }
@media (max-width: 850px) {
  .shell { width: calc(100% - 44px); }
  .topbar { height: 63px; }
}
@media (max-width: 500px) {
  .shell { width: calc(100% - 24px); }
  .wordmark { font-size: 16px; gap: 7px; }
  .mark { width: 21px; height: 21px; }
  .top-right, .side { gap: 8px; }
  .side { padding-inline: 9px; }
  .bottom { gap: 10px 15px; }
  .mode { font-size: 11px; }
  .dialog .eyebrow { font-size: 10px; }
  .dialog p { font-size: 12px; margin: 5px 0 8px; }
  .dialog .primary { min-height: 34px; padding-inline: 10px; font-size: 12px; }
}

body:not(.in-room):not(.in-tutorial) .topbar,
body:not(.in-room):not(.in-tutorial) .bottom { display: none; }
body:not(.in-room):not(.in-tutorial) .stage {
  display: grid;
  min-height: clamp(535px, calc(100svh - 68px), 785px);
  margin: 34px auto;
  max-width: 1120px;
  overflow: hidden;
  border: 1px solid #405257;
  border-radius: 12px;
  box-shadow: 0 22px 90px #0008;
  background: #0b161b;
}
body:not(.in-room):not(.in-tutorial) .field {
  position: absolute;
  inset: 0;
  border: 0;
  border-radius: 0;
  opacity: .8;
}
body:not(.in-room):not(.in-tutorial) .field canvas {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.intro {
  z-index: 2;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  text-align: center;
  padding: clamp(45px, 9vh, 94px) 20px clamp(31px, 6vh, 65px);
  background: linear-gradient(180deg, #080f14 0%, #0a1318c7 23%, #0b161b18 50%, #080f14bc 75%, #080f14 100%);
}
.menu-title .mark { display: block; width: 32px; height: 32px; margin: 0 auto 17px; filter: drop-shadow(0 0 16px #67f3cd55); }
h1 {
  margin: 0;
  color: #eafbf5;
  font: 800 clamp(48px, 11vw, 144px)/.9 var(--display);
  letter-spacing: -.037em;
  text-transform: uppercase;
  text-shadow: 0 1px 1px #b3f5e8, 0 3px 28px #02090bcc;
}
.menu-actions { display: grid; gap: 16px; justify-items: center; width: min(100%, 455px); }
.profile-controls { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 16px; }
#color-swatch { width: 12px; height: 12px; border-radius: 50%; }
#menu-color { padding: 6px; border: 1px solid #42575e; border-radius: 4px; background: #091419; color: var(--ink); font: inherit; }
.nickname-label { display: flex; align-items: center; gap: 10px; color: #b4c9c7; font-size: 14px; }
.nickname-label input { width: min(45vw, 160px); border: 1px solid #42575e; border-radius: 4px; padding: 7px 9px; background: #091419; color: var(--ink); font: inherit; }
.map-setting { margin-top: 16px; }
.seed-label { overflow-wrap: anywhere; color: var(--muted); font-size: 13px; user-select: all; }
.menu-row { display: grid; grid-template-columns: 1fr 1fr; width: 100%; gap: 12px; }
.menu-row button { min-height: 59px; font-size: 17px; padding-inline: 10px; }
.menu-join { border-color: #8ba5a6; background: #142129e8; }
.tutorial-button {
  padding-inline: 24px;
  min-height: 45px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  background: #071116;
}
.tutorial-button span { color: #71ebd1; font-size: 20px; line-height: 1; }
.setup {
  width: min(430px, calc(100% - 30px));
  padding: 27px;
  border-radius: 10px;
  border: 1px solid #527578;
  color: var(--ink);
  background: #101d24;
  box-shadow: 0 18px 65px #000b;
}
.setup::backdrop { background: #061015b8; backdrop-filter: blur(5px); }
.setup h2 { margin: 0 0 22px; font: 750 34px/1.1 var(--display); letter-spacing: -.035em; }
.settings { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.setup label { display: block; font-size: 14px; color: #d5e4e1; }
.setup label span { color: #9eb5b5; font-size: 10px; letter-spacing: .08em; }
.setup input {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 10px 12px;
  min-height: 43px;
  font: 650 18px var(--display);
  color: var(--ink);
  background: #091419;
  border: 1px solid #42575e;
  border-radius: 5px;
}
.setup input:focus { outline: 1px solid var(--teal); outline-offset: 1px; }
.setup .code-input { letter-spacing: .28em; text-transform: uppercase; font-size: 25px; }
.setup-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.setup-actions .quiet { padding-inline: 16px; }
.alert { color: #ffbc97; margin: 10px 0 0; font-size: 14px; }
.lobby-id { display: grid; justify-items: center; gap: 4px; margin: 11px 0 15px; }
.lobby-id > span { color: #a9c5c1; font: 600 11px var(--display); letter-spacing: .17em; }
.lobby-id output {
  user-select: all;
  padding: 6px 13px 6px 18px;
  border: 1px solid #456264;
  border-radius: 5px;
  color: var(--teal);
  background: #09151b;
  font: 750 clamp(22px, 4.2vw, 34px)/1 var(--display);
  letter-spacing: .19em;
}
.tutorial-banner {
  display: flex;
  gap: 7px 16px;
  flex-wrap: wrap;
  align-items: center;
  min-height: 60px;
  padding: 8px 16px;
  margin-bottom: 12px;
  border: 1px solid #35494e;
  border-radius: 6px;
  background: #111c22;
  color: var(--muted);
}
.tutorial-banner strong { color: var(--teal); }
body.in-tutorial #arena { cursor: none; }
@media (max-width: 550px) {
  body:not(.in-room):not(.in-tutorial) .stage { margin: 12px auto; min-height: max(490px, calc(100svh - 24px)); }
  .menu-title .mark { width: 26px; height: 26px; }
  .menu-row button { font-size: 15px; min-height: 49px; }
  .lobby-id { margin-block: 5px 7px; }
  .lobby-id output { padding-block: 4px; }
}
@media(prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
