:root {
  color-scheme: dark;
  font-family: "Trebuchet MS", system-ui, sans-serif;
  background: #10070a;
  color: #fff0df;
}
* { box-sizing: border-box; }
body { margin: 0; background: radial-gradient(ellipse at 50% 5%, #421318, #10070a 70%); min-height: 100dvh; }
[hidden] { display: none !important; }
.cabinet { width: min(100% - 28px, 1150px); margin: auto; padding: 14px 0 10px; }
.top, .settings, .deck, .mode-group { display: flex; align-items: center; gap: 8px; }
.top { justify-content: space-between; padding: 0 0 10px; }
.top > a { color: #ffbd8f; font-size: .85rem; text-decoration: none; }
.top > a:hover { text-decoration: underline; }
h1, h2, .scoreboard, .announcement, .mode-group strong { font-family: Impact, "Arial Black", system-ui, sans-serif; }
h1, h2 { margin: 0; text-transform: uppercase; font-weight: 950; line-height: 1; }
h1 { font-size: clamp(1.4rem, 3.6vw, 3.1rem); font-style: italic; color: #fff2aa; text-shadow: 2px 3px #9e3020, 4px 5px #2a080d; }
h1 em { color: #ff8c42; }
button {
  color: inherit; border: 1px solid #884134; background: linear-gradient(#391920, #210e14);
  border-radius: 6px; padding: 7px 10px; font: inherit; font-size: .82rem; font-weight: 800;
  cursor: pointer; min-height: 38px;
}
button:hover:not(:disabled) { border-color: #ffc073; }
button:disabled { opacity: .55; cursor: default; }
:focus-visible { outline: 2px solid #ffe16e; outline-offset: 3px; }
.arcade-chat-link{display:inline-flex;align-items:center;justify-content:center;min-height:38px;padding:7px 10px;border:1px solid #bc7a61;border-radius:6px;background:linear-gradient(140deg,#5e2c39,#26121b);color:#ffe1b8!important;font-size:.78rem;font-weight:850;white-space:nowrap;text-decoration:none!important}
.arcade-chat-link[data-kf-chat-ready="true"]{border-color:#d9a968;box-shadow:inset 0 1px #f5ce9944}
.arcade-chat-link[aria-expanded="true"]{background:#60304a;box-shadow:0 0 18px #e49e7866}
@media(max-width:590px){.settings{flex-wrap:wrap;justify-content:flex-end}.arcade-chat-link{min-height:34px;padding:5px 7px}}
.bezel {
  background: #241015; border: 1px solid #9a4631; border-radius: 13px; padding: 5px;
  box-shadow: 0 12px 35px #070203b3, inset 0 1px #f98d67;
}
.scoreboard {
  margin: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  text-align: center; background: #18090f; border-radius: 8px 8px 0 0;
}
.scoreboard > div { padding: 7px 1px; border-right: 1px solid #44202a; }
.scoreboard > div:last-child { border: 0; }
dt { color: #fac4a2; letter-spacing: .09em; text-transform: uppercase; font-size: .66rem; }
dd { margin: 2px 0 0; color: #ffe285; font-size: clamp(.9rem, 2.2vw, 1.35rem); font-variant-numeric: tabular-nums; }
.arena {
  position: relative; overflow: hidden; isolation: isolate;
  height: clamp(330px, 68dvh, 580px);
  background: radial-gradient(ellipse at 50% 72%, #7a2719, #230b15 68%, #12050a);
  border: 1px solid #713127; border-bottom-left-radius: 8px; border-bottom-right-radius: 8px;
}
#table { width: 100%; height: 100%; display: block; touch-action: none; cursor: crosshair; }
#table:focus-visible { outline-offset: -3px; }
.overlay {
  position: absolute; inset: 0; display: grid; place-items: center; padding: 12px;
  background: radial-gradient(ellipse at center, #1808113d, #0c030ac7);
}
.plate {
  width: min(100%, 470px); text-align: center; padding: 22px 18px;
  border: 1px solid #a74837; border-top: 3px solid #ffaf56; border-radius: 10px;
  background: linear-gradient(155deg, #4d1e24f5, #1b0c15f5 65%);
  box-shadow: 0 11px 34px #0a0208b8, inset 0 0 18px #fa64131f;
}
.plate > p { margin: 12px auto; max-width: 36ch; font-size: .93rem; line-height: 1.45; }
.plate #eyebrow { margin-top: 0; letter-spacing: .15em; color: #ffae73; font-size: .72rem; font-weight: 850; text-transform: uppercase; }
h2 { font-size: clamp(1.65rem, 5.5vw, 3.4rem); color: #ffe4a6; text-shadow: 3px 3px #8e2923; }
.primary { background: linear-gradient(#ffca70, #f37837); border-color: #ffe4a6; color: #2e0a0e; min-width: 140px; font-size: .95rem; }
.announcement {
  position: absolute; left: 50%; top: 12px; transform: translateX(-50%);
  pointer-events: none; white-space: nowrap; color: #ffe49c; text-align: center;
  text-transform: uppercase; letter-spacing: .08em; font-size: clamp(.7rem, 2vw, 1.1rem);
  text-shadow: 0 2px #140610, 0 0 11px #ff4b22;
  background: #200d15dc; border: 1px solid #9a4631; padding: 5px 10px; border-radius: 4px;
}
.deck { justify-content: space-between; padding-top: 8px; }
.mode-group, .fire-controls { display: flex; align-items: center; gap: 5px; }
.mode-group button { min-width: 42px; font-variant-numeric: tabular-nums; }
.deck button[aria-pressed="true"] { background: linear-gradient(#8c3827, #391624); border-color: #ffbd6a; color: #fff1b7; }
.catch-guide { margin: 7px auto 0; text-align: center; color: #ffd3a5; font-size: .76rem; }
.catch-guide summary { cursor: pointer; }
.catch-guide p { margin: 4px auto; }
.controls { margin: 8px 0 0; font-size: .75rem; color: #ebbcab; text-align: center; }
.cabinet:fullscreen {
  width: 100%; padding: 6px 14px; background: #170a0f; display: flex; flex-direction: column;
}
.cabinet:fullscreen .bezel { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.cabinet:fullscreen .arena { height: auto; flex: 1; min-height: 0; }
@media (max-width: 590px) {
  .cabinet { width: calc(100% - 12px); padding-top: 7px; }
  .top { flex-wrap: wrap; gap: 5px; }
  .top > a { width: 100%; }
  .arena { height: clamp(330px, 58dvh, 520px); }
  .deck { gap: 5px; flex-wrap: wrap; }
  .mode-group, .fire-controls { gap: 4px; }
  .mode-group button, .fire-controls button { min-width: 32px; padding: 5px 6px; }
  .controls { margin-top: 5px; }

}
@media (orientation: landscape) and (max-height: 560px) {
  .cabinet { padding-top: 5px; }
  h1 { font-size: 1.4rem; }
  .top { padding-bottom: 4px; }
  .arena { height: max(200px, calc(100dvh - 126px)); }
  .plate { padding: 10px; }
  .plate > p { margin: 7px auto; }
  .controls { display: none; }
}

.weapon {
  position: absolute; left: 50%; bottom: 53px; transform: translateX(-50%);
  pointer-events: none; white-space: nowrap; padding: 6px 10px;
  border: 1px solid #ffb665; border-radius: 6px;
  color: #fff1bb; background: #321019f5; box-shadow: 0 0 14px #ff924b66;
  font-size: .78rem; font-weight: 800;
}

.second-seat {
  display: flex; align-items: baseline; justify-content: center; flex-wrap: wrap;
  gap: 4px 12px; margin-top: 8px; padding: 6px 8px;
  border: 1px solid #9b426b; border-radius: 6px; color: #ffd6eb;
  background: #2e1321; font-size: .82rem;
}
.second-seat strong { color: #ff90c7; }

.join-room { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 10px; }
.join-room label { flex-basis: 100%; font-size: .78rem; }
.join-room input, #room-invite { width: 155px; min-height: 40px; padding: 4px 8px; color: inherit; background: #271119; border: 1px solid #9b426b; border-radius: 6px; }
#online-bar { align-items: center; }
.cabinet.online .arena { height: auto; aspect-ratio: 9 / 5; max-height: 70dvh; }
.cabinet.online canvas { position: absolute; inset: 0; }
.cabinet.online:fullscreen .arena { aspect-ratio: auto; max-height: none; }

@media (max-width: 630px) {
  .mode-group { width: 100%; justify-content: center; }
  .mode-group button { flex: 1; max-width: 52px; }
}

/* Boss arrival: high-contrast warning without obscuring the playable field. */
#tide-warning[data-encounter="king"] {
  color: #fff6be;
  border: 2px solid #ffbc57;
  background: linear-gradient(105deg, #351023eb, #9f321af0, #351023eb);
  box-shadow: 0 0 16px #ff6b386e, inset 0 0 8px #ffd78133;
  font-weight: 950;
  letter-spacing: .12em;
}
@media (prefers-reduced-motion: no-preference) {
  #tide-warning[data-encounter="king"] { animation: king-flare .75s ease-in-out infinite alternate; }
  @keyframes king-flare { to { box-shadow: 0 0 25px #ffbc5799, inset 0 0 12px #ffe9a54d; } }
}
