@font-face {
  font-family: "Lemon Milk";
  src: url("/assets/fonts/LEMONMILK-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Lemon Milk";
  src: url("/assets/fonts/LEMONMILK-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Louis George Cafe";
  src: url("/assets/fonts/Louis-George-Cafe.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Louis George Cafe";
  src: url("/assets/fonts/Louis-George-Cafe-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --dcts-green: #145c35;
  --dcts-green-dark: #0b3a24;
  --dcts-green-deep: #062417;
  --dcts-gold: #f2b705;
  --dcts-black: #020403;
  --dcts-white: #ffffff;
  --dcts-cream: #f7f5ee;
  --dcts-green-light: #e8f3ed;
  --dcts-line: #d9ded6;
  --dcts-text: #17231d;
  --dcts-muted: #5f6f67;
  --red: #d83a32;
  --yellow: #f2c94c;
  --panel: rgba(255, 255, 255, 0.96);
  --shadow: 0 18px 38px rgba(6, 36, 23, 0.13);
  --font-heading: "Lemon Milk", Arial, Helvetica, sans-serif;
  --font-body: "Louis George Cafe", Arial, Helvetica, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(242, 183, 5, 0.24), transparent 32rem),
    linear-gradient(135deg, #f7f5ee 0%, #edf4ef 44%, #dfece5 100%);
  color: var(--dcts-text);
  font-family: var(--font-body);
  font-size: 17px;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgba(20, 92, 53, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(20, 92, 53, 0.05) 1px, transparent 1px);
  background-size: 36px 36px;
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 44px;
  border: 0;
  border-radius: 6px;
  background: var(--dcts-green);
  color: var(--dcts-white);
  font-family: var(--font-heading);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 8px 16px rgba(20, 92, 53, 0.18);
}

button:hover {
  background: var(--dcts-green-dark);
}

button:disabled {
  background: #9aa8a0;
  box-shadow: none;
  cursor: not-allowed;
}

.secondary {
  border: 1px solid var(--dcts-line);
  background: var(--dcts-white);
  color: var(--dcts-green);
}

.secondary:hover {
  background: var(--dcts-green-light);
}

.shell {
  width: min(1500px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--dcts-line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.setup-panel {
  display: grid;
  grid-template-columns: 1.08fr 0.92fr;
  gap: 30px;
  align-items: center;
  min-height: calc(100vh - 56px);
  padding: clamp(24px, 5vw, 54px);
  overflow: hidden;
  position: relative;
}

.setup-panel::before {
  content: "";
  position: absolute;
  right: 28px;
  top: 28px;
  width: 96px;
  height: 96px;
  background: url("/assets/img/Logo_Dauphin-County-Technical-School.png") center / contain no-repeat;
  opacity: 0.12;
}

h1,
h2,
h3,
.eyebrow {
  font-family: var(--font-heading);
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 10px;
  color: var(--dcts-green);
  font-size: clamp(2.4rem, 5vw, 4rem);
  line-height: 1.05;
}

h2 {
  margin-bottom: 16px;
  color: var(--dcts-green);
  font-size: 22px;
}

.eyebrow {
  margin-bottom: 8px;
  color: var(--dcts-green-dark);
  font-size: 13px;
  font-weight: 800;
}

.lede {
  max-width: 540px;
  color: var(--dcts-muted);
  font-size: 19px;
  line-height: 1.45;
}

.subtle {
  color: var(--dcts-muted);
}

.form-grid,
.stack {
  display: grid;
  gap: 14px;
}

label span,
legend {
  display: block;
  margin-bottom: 6px;
  color: var(--dcts-muted);
  font-size: 14px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--dcts-line);
  border-radius: 6px;
  padding: 9px 11px;
  background: var(--dcts-white);
  color: var(--dcts-text);
}

input:focus,
select:focus {
  outline: 3px solid rgba(242, 183, 5, 0.32);
  border-color: var(--dcts-green);
}

fieldset {
  margin: 0;
  border: 1px solid var(--dcts-line);
  border-radius: 6px;
  padding: 12px;
  background: #fbfcf8;
}

.choice {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0;
}

.choice input {
  flex: 0 0 auto;
  width: auto;
  min-height: auto;
}

.choice-label {
  flex: 1;
  margin: 0;
  color: var(--dcts-text);
  font-size: 1rem;
  font-weight: 700;
}

.help-bubble {
  position: relative;
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1px solid rgba(20, 92, 53, 0.24);
  border-radius: 999px;
  background: #ffffff;
  color: var(--dcts-green);
  font-family: var(--font-heading);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1;
  cursor: help;
}

.help-bubble::after {
  content: attr(aria-label);
  position: absolute;
  left: calc(100% + 9px);
  top: 50%;
  z-index: 5;
  width: min(250px, 64vw);
  border: 1px solid var(--dcts-line);
  border-left: 4px solid var(--dcts-gold);
  border-radius: 6px;
  background: #ffffff;
  box-shadow: 0 12px 24px rgba(6, 36, 23, 0.18);
  padding: 9px 10px;
  color: var(--dcts-text);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.25;
  opacity: 0;
  pointer-events: none;
  text-transform: none;
  transform: translateY(-50%) translateX(-4px);
  transition: opacity 140ms ease, transform 140ms ease;
}

.help-bubble:hover::after,
.help-bubble:focus::after {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

.help-bubble:focus {
  outline: 3px solid rgba(242, 183, 5, 0.32);
  outline-offset: 2px;
}

.hidden {
  display: none !important;
}

.audio-toggle {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 9;
  min-height: 38px;
  border: 1px solid rgba(20, 92, 53, 0.28);
  border-radius: 999px;
  background: var(--dcts-white);
  box-shadow: 0 10px 24px rgba(6, 36, 23, 0.18);
  color: var(--dcts-green);
  padding: 8px 13px;
  font-size: 0.72rem;
}

.audio-toggle:hover {
  background: var(--dcts-green-light);
}

.audio-toggle[aria-pressed="true"] {
  border-color: rgba(216, 58, 50, 0.36);
  color: var(--red);
}

.error {
  min-height: 20px;
  margin: 0;
  color: #b3261e;
  font-weight: 700;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 18px;
  border-bottom: 4px solid var(--dcts-gold);
  padding-bottom: 14px;
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.topbar h1 {
  margin-bottom: 4px;
  font-size: clamp(1.9rem, 4vw, 2.7rem);
}

.lobby-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 18px;
  align-items: start;
}

.game-layout {
  display: grid;
  grid-template-columns: minmax(660px, 820px) minmax(420px, 1fr);
  gap: 24px;
  align-items: start;
}

.match-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  padding: 12px 14px;
}

.create-panel,
.rooms-panel,
.turn-panel,
.rules-panel {
  padding: 20px;
}

.rules-panel {
  margin-top: 18px;
}

.rules-panel h2 {
  margin-bottom: 12px;
  font-size: 18px;
}

.rules-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 22px;
}

.rules-list li {
  margin: 0;
  padding-left: 2px;
  color: var(--dcts-muted);
  font-weight: 700;
  line-height: 1.35;
}

.credit-panel {
  margin-top: 12px;
  border-left: 6px solid var(--dcts-gold);
  color: var(--dcts-green);
  font-weight: 900;
  text-align: center;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
}

.section-head select {
  width: 180px;
}

.rooms-list {
  display: grid;
  gap: 10px;
}

.room-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: center;
  border: 1px solid var(--dcts-line);
  border-left: 5px solid var(--dcts-gold);
  border-radius: 8px;
  padding: 14px;
  background: #fbfcf8;
}

.room-card h3 {
  margin: 0 0 6px;
  color: var(--dcts-green);
  font-family: var(--font-heading);
  font-size: 18px;
  text-transform: uppercase;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.badge {
  border: 1px solid rgba(20, 92, 53, 0.14);
  border-radius: 999px;
  background: var(--dcts-green-light);
  padding: 4px 8px;
  color: var(--dcts-green-dark);
  font-size: 12px;
  font-weight: 700;
}

.board-panel {
  display: grid;
  justify-items: center;
  gap: 10px;
}

.board {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  aspect-ratio: 7 / 6;
  width: min(100%, 820px);
  border: 6px solid var(--dcts-green-deep);
  border-radius: 8px;
  padding: 12px;
  background: linear-gradient(180deg, var(--dcts-green), var(--dcts-green-dark));
  box-shadow: var(--shadow);
}

.cell {
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #edf3ed;
  box-shadow: inset 0 4px 8px rgba(6, 36, 23, 0.24);
}

.disc {
  width: 82%;
  height: 82%;
  border-radius: 999px;
  border: 3px solid rgba(2, 4, 3, 0.16);
}

.disc.p1 {
  background: var(--red);
}

.disc.p2 {
  background: var(--yellow);
}

.disc.p3 {
  background: #2f6fd6;
}

.disc.p4 {
  background: #23a455;
}

.column-controls {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  width: min(100%, 820px);
}

.column-controls button {
  min-height: 38px;
  background: var(--dcts-gold);
  color: var(--dcts-black);
}

.column-controls button:hover {
  background: #dca604;
}

.box-battle-board {
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  grid-template-rows: repeat(9, minmax(0, 1fr));
  gap: 4px;
  aspect-ratio: 1;
  width: min(100%, 760px);
  border: 6px solid var(--dcts-green-deep);
  border-radius: 8px;
  padding: 18px;
  background:
    linear-gradient(135deg, rgba(242, 183, 5, 0.16), transparent 36%),
    #f9fbf5;
  box-shadow: var(--shadow);
}

.box-dot {
  align-self: center;
  justify-self: center;
  width: clamp(13px, 2vw, 22px);
  height: clamp(13px, 2vw, 22px);
  border-radius: 999px;
  background: var(--dcts-green-deep);
  box-shadow: 0 2px 5px rgba(6, 36, 23, 0.22);
}

.box-edge {
  align-self: stretch;
  justify-self: stretch;
  min-height: 0;
  border: 0;
  border-radius: 6px;
  background: rgba(20, 92, 53, 0.12);
  box-shadow: none;
  padding: 0;
}

.box-edge.h {
  align-self: center;
  height: clamp(10px, 1.7vw, 18px);
}

.box-edge.v {
  justify-self: center;
  width: clamp(10px, 1.7vw, 18px);
}

.box-edge:not(:disabled) {
  cursor: pointer;
  outline: 3px solid rgba(242, 183, 5, 0.34);
}

.box-edge:not(:disabled):hover {
  background: var(--dcts-gold);
}

.box-edge.claimed.p1 {
  background: var(--red);
}

.box-edge.claimed.p2 {
  background: var(--yellow);
}

.box-cell {
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.68);
  color: var(--dcts-text);
  font-family: var(--font-heading);
  font-size: clamp(0.82rem, 1.8vw, 1.25rem);
  font-weight: 900;
}

.box-cell.p1 {
  background: rgba(216, 58, 50, 0.22);
  color: #9b221c;
}

.box-cell.p2 {
  background: rgba(242, 201, 76, 0.36);
  color: #765500;
}

.battleship-board {
  display: grid;
  grid-template-columns: repeat(2, minmax(280px, 1fr));
  gap: 18px;
  width: min(100%, 820px);
}

.battleship-grid-wrap {
  display: grid;
  gap: 8px;
}

.battleship-grid-wrap h3 {
  margin: 0;
  color: var(--dcts-green);
  font-size: 16px;
}

.battleship-grid {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  grid-template-rows: repeat(10, minmax(0, 1fr));
  gap: 3px;
  aspect-ratio: 1;
  border: 6px solid var(--dcts-green-deep);
  border-radius: 8px;
  padding: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.14), transparent),
    #1f6b8d;
  box-shadow: var(--shadow);
}

.battleship-cell {
  min-height: 0;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.22);
  box-shadow: none;
  padding: 0;
}

.battleship-cell:disabled {
  background: rgba(255, 255, 255, 0.22);
}

.battleship-cell.ship {
  background: #6d7c86;
}

.battleship-cell.hit {
  background: #d83a32;
}

.battleship-cell.miss {
  background: rgba(255, 255, 255, 0.82);
}

.battleship-grid.enemy .battleship-cell:not(:disabled):hover,
.battleship-grid.own .battleship-cell:not(:disabled):hover {
  background: var(--dcts-gold);
}

.battleship-ship {
  z-index: 2;
  display: grid;
  place-items: center;
  align-self: stretch;
  justify-self: stretch;
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: #123c5a;
  padding: 0;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
  overflow: visible;
}

.battleship-ship-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
  pointer-events: none;
  user-select: none;
  filter: drop-shadow(0 3px 5px rgba(2, 4, 3, 0.24));
}

.battleship-ship.v .battleship-ship-img {
  width: calc(var(--ship-length) * 100%);
  height: calc(100% / var(--ship-length));
  transform: rotate(90deg);
  transform-origin: center;
}

.battleship-ship.selected {
  outline: 4px solid rgba(242, 183, 5, 0.95);
  outline-offset: 2px;
  border-radius: 8px;
}

.battleship-shot-marker {
  z-index: 4;
  align-self: center;
  justify-self: center;
  width: 58%;
  aspect-ratio: 1;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.86);
  box-shadow: 0 2px 6px rgba(2, 4, 3, 0.28);
  pointer-events: none;
}

.battleship-shot-marker.hit {
  background: #d83a32;
}

.battleship-shot-marker.miss {
  background: rgba(255, 255, 255, 0.88);
}

.fleet-controls {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.battleship-ready-status {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  border: 1px solid var(--dcts-line);
  border-radius: 999px;
  background: #ffffff;
  padding: 7px 12px;
  color: var(--dcts-muted);
  font-weight: 700;
}

.battleship-setup-hint,
.battleship-selected-info {
  grid-column: 1 / -1;
  margin: 0;
  border-left: 4px solid var(--dcts-gold);
  padding-left: 10px;
  color: var(--dcts-muted);
  font-weight: 700;
}

.battleship-selected-info {
  border-left-color: var(--dcts-green);
  color: var(--dcts-green-deep);
}

.battleship-placement-controls {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, 48px);
  grid-template-areas:
    "ccw up cw"
    "left down right";
  gap: 7px;
  align-items: center;
}

.battleship-placement-controls button {
  min-height: 42px;
  border-radius: 8px;
  padding: 0;
  background: var(--dcts-green-light);
  color: var(--dcts-green-deep);
  font-size: 1.1rem;
}

.battleship-placement-controls .rotate-ccw { grid-area: ccw; }
.battleship-placement-controls .move-up { grid-area: up; }
.battleship-placement-controls .rotate-cw { grid-area: cw; }
.battleship-placement-controls .move-left { grid-area: left; }
.battleship-placement-controls .move-down { grid-area: down; }
.battleship-placement-controls .move-right { grid-area: right; }

.fleet-controls .selected {
  border-color: var(--dcts-gold);
  background: var(--dcts-green-light);
}

.players {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 0;
}

.player-row {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--dcts-line);
  border-radius: 6px;
  padding: 10px;
  background: #fbfcf8;
}

.player-text {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.player-class {
  color: var(--dcts-muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.1;
}

.player-dot {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--red);
}

.player-dot.p2 {
  background: var(--yellow);
}

.player-dot.p3 {
  background: #2f6fd6;
}

.player-dot.p4 {
  background: #23a455;
}

.player-dot.p5 { background: #9333ea; }
.player-dot.p6 { background: #dc2626; }
.player-dot.p7 { background: #0891b2; }
.player-dot.p8 { background: #ea580c; }

.trouble-board {
  display: grid;
  grid-template-columns: repeat(15, minmax(0, 1fr));
  grid-template-rows: repeat(15, minmax(0, 1fr));
  gap: 7px;
  aspect-ratio: 1;
  width: min(100%, 820px);
  border: 6px solid var(--dcts-green-deep);
  border-radius: 8px;
  padding: 16px;
  background:
    radial-gradient(circle at center, rgba(20, 92, 53, 0.11) 0 17%, transparent 18%),
    linear-gradient(45deg, rgba(242, 183, 5, 0.18), transparent 42%),
    #f9fbf5;
  box-shadow: var(--shadow);
}

.trouble-slot,
.trouble-home,
.trouble-yard {
  display: flex;
  flex-wrap: wrap;
  align-content: center;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 0;
  min-height: 0;
  border: 1px solid rgba(20, 92, 53, 0.24);
  border-radius: 999px;
  background: #ffffff;
  box-shadow: inset 0 2px 5px rgba(6, 36, 23, 0.12);
}

.trouble-slot {
  position: relative;
  z-index: 1;
}

.trouble-slot.start-space,
.trouble-slot.home-entry {
  border-width: 3px;
  box-shadow:
    inset 0 2px 5px rgba(6, 36, 23, 0.12),
    0 0 0 4px rgba(255, 255, 255, 0.72);
}

.trouble-slot.start-space {
  border-style: solid;
}

.trouble-slot.home-entry {
  border-style: dashed;
}

.trouble-slot.start-space::before,
.trouble-slot.home-entry::before {
  content: attr(data-arrow);
  display: grid;
  place-items: center;
  position: absolute;
  inset: 0;
  color: currentColor;
  font-family: var(--font-heading);
  font-size: clamp(1rem, 2vw, 1.45rem);
  font-weight: 900;
  line-height: 1;
  pointer-events: none;
  z-index: 0;
}

.trouble-slot > .trouble-pawn {
  position: relative;
  z-index: 1;
}

.trouble-slot.p1 {
  border-color: var(--red);
  color: var(--red);
}

.trouble-slot.p2 {
  border-color: var(--yellow);
  color: #8a6500;
}

.trouble-slot.p3 {
  border-color: #2f6fd6;
  color: #2f6fd6;
}

.trouble-slot.p4 {
  border-color: #23a455;
  color: #147640;
}

.trouble-yard {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  position: relative;
  border-radius: 8px;
  border-width: 3px;
  padding: 22px 10px 10px;
  background: rgba(255, 255, 255, 0.82);
}

.trouble-yard::before {
  content: attr(data-label);
  position: absolute;
  top: 6px;
  left: 8px;
  color: var(--dcts-muted);
  font-family: var(--font-heading);
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1;
  text-transform: uppercase;
}

.trouble-home {
  border-width: 3px;
  border-style: dashed;
  background: rgba(255, 255, 255, 0.7);
  box-shadow:
    inset 0 2px 5px rgba(6, 36, 23, 0.12),
    0 0 0 4px rgba(255, 255, 255, 0.72);
}

.trouble-label {
  align-self: center;
  justify-self: center;
  min-width: 58px;
  border: 1px solid rgba(20, 92, 53, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  padding: 4px 8px;
  color: var(--dcts-muted);
  font-family: var(--font-heading);
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1;
  text-align: center;
  text-transform: uppercase;
  pointer-events: none;
  z-index: 1;
}

.trouble-label.p1 {
  border-color: rgba(216, 58, 50, 0.36);
  color: var(--red);
}

.trouble-label.p2 {
  border-color: rgba(242, 201, 76, 0.75);
  color: #8a6500;
}

.trouble-label.p3 {
  border-color: rgba(47, 111, 214, 0.36);
  color: #2f6fd6;
}

.trouble-label.p4 {
  border-color: rgba(35, 164, 85, 0.36);
  color: #147640;
}

.trouble-yard.p1,
.trouble-home.p1 {
  border-color: var(--red);
}

.trouble-yard.p2,
.trouble-home.p2 {
  border-color: var(--yellow);
}

.trouble-yard.p3,
.trouble-home.p3 {
  border-color: #2f6fd6;
}

.trouble-yard.p4,
.trouble-home.p4 {
  border-color: #23a455;
}

.trouble-pawn {
  display: inline-grid;
  place-items: center;
  width: clamp(28px, 3.4vw, 42px);
  min-height: 0;
  height: clamp(28px, 3.4vw, 42px);
  border: 2px solid rgba(2, 4, 3, 0.18);
  border-radius: 999px;
  padding: 0;
  color: #ffffff;
  font-family: var(--font-heading);
  font-size: 0.78rem;
  line-height: 1;
  box-shadow: 0 4px 10px rgba(2, 4, 3, 0.2);
}

.trouble-pawn.p1,
.color-choice.p1 {
  background: var(--red);
}

.trouble-pawn.p2,
.color-choice.p2 {
  background: var(--yellow);
  color: var(--dcts-black);
}

.trouble-pawn.p3,
.color-choice.p3 {
  background: #2f6fd6;
  color: #ffffff;
}

.trouble-pawn.p4,
.color-choice.p4 {
  background: #23a455;
}

.trouble-pawn:disabled {
  opacity: 0.86;
  cursor: default;
}

.trouble-pawn:not(:disabled) {
  outline: 3px solid rgba(242, 183, 5, 0.58);
  transform: translateY(-1px);
}

.trouble-arrow {
  display: grid;
  place-items: center;
  align-self: center;
  justify-self: center;
  width: clamp(28px, 3vw, 38px);
  aspect-ratio: 1;
  border: 1px solid rgba(20, 92, 53, 0.2);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--dcts-green);
  font-family: var(--font-heading);
  font-size: clamp(1rem, 2vw, 1.35rem);
  font-weight: 700;
  line-height: 1;
  pointer-events: none;
  z-index: 1;
}

.trouble-die {
  display: grid;
  place-items: center;
  align-self: center;
  justify-self: center;
  width: clamp(78px, 8vw, 112px);
  aspect-ratio: 1;
  border: 4px solid var(--dcts-green-deep);
  border-radius: 18px;
  background:
    radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.86), transparent 34%),
    linear-gradient(145deg, #ffffff, #f3f6ee);
  color: var(--dcts-green);
  font-family: var(--font-heading);
  font-size: clamp(1.45rem, 2.4vw, 2.2rem);
  font-weight: 700;
  text-align: center;
  text-transform: uppercase;
  box-shadow:
    inset 0 -8px 16px rgba(6, 36, 23, 0.12),
    0 12px 24px rgba(6, 36, 23, 0.18);
  z-index: 1;
}

.trouble-die[role="button"] {
  cursor: pointer;
}

.trouble-die[role="button"]:hover {
  transform: translateY(-2px);
}

.trouble-die[role="button"]:focus {
  outline: 4px solid rgba(242, 183, 5, 0.42);
  outline-offset: 4px;
}

.trouble-die.rolling {
  animation: die-pop 720ms ease-out;
}

@keyframes die-pop {
  0% {
    transform: rotate(-12deg) scale(0.82);
  }
  28% {
    transform: rotate(10deg) scale(1.08);
  }
  56% {
    transform: rotate(-6deg) scale(0.96);
  }
  100% {
    transform: rotate(0deg) scale(1);
  }
}

.color-choice {
  min-width: 104px;
}

.question-box {
  display: grid;
  gap: 10px;
  border: 1px solid var(--dcts-line);
  border-radius: 8px;
  background: #ffffff;
  padding: 14px;
}

.question-box > p:first-child {
  border-left: 4px solid var(--dcts-gold);
  margin-bottom: 4px;
  padding-left: 12px;
  color: var(--dcts-text);
  font-weight: 700;
  line-height: 1.45;
}

.answer-button {
  min-height: 46px;
  border: 1px solid var(--dcts-line);
  background: #ffffff;
  color: var(--dcts-text);
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 700;
  text-align: left;
  text-transform: none;
  padding: 10px 12px;
  box-shadow: none;
}

.answer-button:hover {
  background: var(--dcts-green-light);
}

.answer-button:disabled {
  border-color: var(--dcts-line);
  background: #f8faf7;
  color: var(--dcts-text);
  opacity: 1;
}

.timer-box {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  border: 1px solid var(--dcts-line);
  border-radius: 999px;
  background: #ffffff;
  padding: 7px 12px;
  color: var(--dcts-green);
  white-space: nowrap;
}

.timer-box:empty {
  display: none;
}

.timer-label {
  color: var(--dcts-muted);
  font-size: 0.9rem;
}

.timer-box strong {
  font-family: var(--font-heading);
}

.timer-warning {
  border-color: var(--red);
  color: var(--red);
}

.question-box > p,
.answer-result p {
  font-family: var(--font-body);
}

.answer-result {
  margin-top: 14px;
  border-left: 4px solid var(--dcts-line);
  padding-left: 12px;
  color: var(--dcts-muted);
  line-height: 1.45;
}

.answer-result.correct {
  border-color: var(--dcts-green);
}

.answer-result.wrong {
  border-color: var(--red);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(6, 36, 23, 0.58);
}

.modal-panel {
  width: min(460px, 100%);
  border: 1px solid var(--dcts-line);
  border-top: 6px solid var(--dcts-gold);
  border-radius: 8px;
  background: var(--dcts-white);
  box-shadow: 0 24px 60px rgba(2, 4, 3, 0.32);
  padding: 24px;
}

.modal-message {
  color: var(--dcts-muted);
  line-height: 1.45;
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 18px;
}

.modal-actions button {
  min-width: 130px;
}

.system-message {
  min-height: 24px;
  margin-top: 10px;
  color: var(--dcts-green);
  font-weight: 700;
  opacity: 0;
  transition: opacity 160ms ease;
}

.system-message.visible {
  opacity: 1;
}

.chutes-board {
  position: relative;
  width: min(820px, 100%);
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  border: 5px solid #000000;
  border-radius: 14px;
  background-image: url("/assets/img/chutesandladders.png");
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.18);
  overflow: hidden;
}

.chutes-pawn {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 2;
  display: grid;
  place-items: center;
  width: clamp(22px, 3vw, 34px);
  height: clamp(22px, 3vw, 34px);
  border-radius: 999px;
  border: 2px solid #ffffff;
  background: var(--dcts-green);
  color: white;
  font-size: clamp(0.68rem, 1.3vw, 0.92rem);
  font-weight: 900;
  transform: translate(calc(-50% + var(--pawn-offset-x, 0px)), calc(-50% + var(--pawn-offset-y, 0px)));
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.34);
  transition: left 320ms ease, top 320ms ease, transform 320ms ease;
}

.chutes-roll-overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-items: center;
  pointer-events: none;
  background: rgba(255, 255, 255, 0.16);
}

.chutes-roll-die {
  display: grid;
  place-items: center;
  width: clamp(62px, 10vw, 98px);
  height: clamp(62px, 10vw, 98px);
  border: 4px solid #000000;
  border-radius: 18px;
  background: #ffffff;
  color: #000000;
  font-size: clamp(2rem, 4vw, 3.4rem);
  font-weight: 900;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.28);
}

.chutes-roll-die.rolling {
  animation: chutes-die-roll 450ms ease-in-out infinite;
}

.chutes-roll-caption {
  margin-top: 12px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.78);
  color: #ffffff;
  font-weight: 900;
  text-align: center;
}

@keyframes chutes-die-roll {
  0% { transform: rotate(-10deg) scale(0.96); }
  50% { transform: rotate(12deg) scale(1.08); }
  100% { transform: rotate(-10deg) scale(0.96); }
}

.chutes-pawn.p2 { background: #c79a15; }
.chutes-pawn.p3 { background: #2563eb; }
.chutes-pawn.p4 { background: #16a34a; }
.chutes-pawn.p5 { background: #9333ea; }
.chutes-pawn.p6 { background: #dc2626; }
.chutes-pawn.p7 { background: #0891b2; }
.chutes-pawn.p8 { background: #ea580c; }

@media (max-width: 860px) {
  .setup-panel,
  .lobby-layout,
  .game-layout {
    grid-template-columns: 1fr;
  }

  .setup-panel {
    min-height: auto;
    padding: 24px;
  }

  .topbar,
  .section-head,
  .match-strip {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions {
    justify-content: stretch;
  }

  .topbar-actions button {
    flex: 1;
  }

  .section-head select {
    width: 100%;
  }

  .battleship-board {
    grid-template-columns: 1fr;
  }

}
