:root {
  --gd-cyan: #00cccc;
  --gd-bright: #6ffff8;
  --gd-bone: #e8ddc4;
  --gd-ink: #030608;
  --gd-panel: #071114;
  --gd-orange: #ff7b36;
}

[hidden] { display: none !important; }

.back-link {
  display: block;
  width: fit-content;
  margin: 0 auto 16px;
}

.delver-cabinet {
  width: min(100%, 980px);
  margin: .5rem auto 0;
  padding: 14px;
  border: 2px solid #008b8b;
  outline: 1px solid rgba(111,255,248,.25);
  outline-offset: -7px;
  background:
    linear-gradient(180deg, rgba(14,28,31,.99), rgba(2,5,7,.99)),
    repeating-linear-gradient(90deg, transparent 0 5px, rgba(255,255,255,.015) 5px 6px);
  box-shadow:
    0 0 36px rgba(0,204,204,.24),
    inset 0 0 32px #000;
  box-sizing: border-box;
}

.delver-hud {
  display: grid;
  grid-template-columns: minmax(210px, 1.55fr) repeat(4, minmax(110px, .72fr));
  gap: 7px;
  margin-bottom: 8px;
}

.delver-hud > div,
.keeper-field {
  display: flex;
  min-height: 56px;
  padding: 6px 10px;
  flex-direction: column;
  justify-content: center;
  border: 1px solid #0b6f74;
  background:
    linear-gradient(180deg, rgba(8,20,23,.96), rgba(1,6,8,.98));
  color: #7eaaad;
  text-align: center;
  text-transform: uppercase;
  font-size: .67rem;
  letter-spacing: .11em;
  box-sizing: border-box;
}

.delver-hud strong {
  overflow: hidden;
  color: var(--gd-bright);
  font-size: 1.12rem;
  text-overflow: ellipsis;
  text-shadow: 0 0 10px rgba(0,255,255,.8);
}

.keeper-field input {
  width: 100%;
  min-width: 0;
  padding: 3px;
  border: 0;
  border-bottom: 1px solid var(--gd-cyan);
  border-radius: 0;
  background: transparent;
  color: #fff;
  text-align: center;
  font: inherit;
  text-transform: none;
  box-sizing: border-box;
}

.keeper-field input[aria-invalid="true"] {
  border-color: #ff7469;
  box-shadow: 0 2px 0 rgba(255,60,50,.35);
}

.cabinet-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  margin: 0 0 8px;
}

.cabinet-controls button,
.game-overlay button {
  min-height: 34px;
  padding: .4rem .78rem;
  border: 1px solid var(--gd-cyan);
  background: #061315;
  color: #dcffff;
  font: 700 .7rem Cinzel, serif;
  letter-spacing: .06em;
  cursor:
    url('/images/cursors/hover.cur') 11 0,
    url('/images/cursors/hover.png') 11 0,
    pointer;
}

.cabinet-controls button:hover,
.game-overlay button:hover {
  background: #0b292c;
  box-shadow: 0 0 11px rgba(0,255,255,.32);
}

.cabinet-controls label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 2px;
  color: #8eb7b8;
  font-size: .65rem;
  text-transform: uppercase;
}

.cabinet-controls input[type="range"] {
  width: 96px;
  accent-color: var(--gd-cyan);
}

.delver-screen {
  position: relative;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 4 / 3;
  border: 4px solid #172125;
  background: #030608;
  box-shadow:
    inset 0 0 26px #000,
    0 0 0 1px rgba(0,204,204,.28);
  box-sizing: border-box;
}

.delver-screen::after {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  content: "";
  background:
    linear-gradient(rgba(255,255,255,.018) 50%, rgba(0,0,0,.025) 50%);
  background-size: 100% 4px;
  mix-blend-mode: screen;
}

#delverCanvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}

.game-overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 14px;
  padding: 2rem;
  background:
    radial-gradient(circle at center, rgba(9,44,48,.66), rgba(1,3,5,.94) 68%),
    repeating-linear-gradient(0deg, transparent 0 3px, rgba(0,255,255,.025) 3px 4px);
  text-align: center;
  box-sizing: border-box;
}

.game-overlay > strong {
  max-width: 96%;
  color: var(--gd-bright);
  font-size: clamp(2rem, 5.2vw, 4rem);
  line-height: 1;
  letter-spacing: .13em;
  text-shadow: 5px 5px #003b3b, 0 0 24px #00cccc;
}

.game-overlay p {
  max-width: 620px;
  margin: 0;
  color: var(--gd-bone);
  font-size: 1rem;
  line-height: 1.55;
}

#overlayActions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 9px;
}

.game-overlay button {
  padding: .75rem 1.25rem;
  font-size: .78rem;
}

.desktop-required {
  margin: .72rem 0 0;
  color: #7ea1a3;
  text-align: center;
  font-size: .7rem;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.game-status {
  min-height: 1.4em;
  margin: .35rem 0 0;
  color: #b7d8d7;
  text-align: center;
  font-size: .83rem;
}

.game-divider {
  margin: 2rem 0 1.25rem;
  border: 0;
  border-top: 1px solid rgba(0,204,204,.4);
}

.leaderboard h2 {
  color: #aefefe;
  text-align: center;
}

#lbTable {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid #008b8b;
  background: rgba(1,8,10,.82);
}

#lbTable th,
#lbTable td {
  padding: .58rem;
  border: 1px solid #008b8b;
  text-align: left;
}

#lbTable th {
  background: rgba(0,204,204,.14);
  color: #aefefe;
}

#lbTable td:first-child {
  width: 2.6rem;
  text-align: center;
}

#lbTable td:nth-child(n+3) {
  text-align: right;
}

.empty-cell {
  color: #78999a;
  font-style: italic;
  text-align: center !important;
}

@media (max-width: 820px) {
  .game-shell {
    overflow-x: auto;
  }

  .delver-cabinet {
    min-width: 920px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .delver-cabinet,
  .game-overlay {
    scroll-behavior: auto;
  }
}
