:root {
  color-scheme: dark;
  --ink: #f4f7ff;
  --muted: #bccce4;
  --edge: #6a7898;
  --gold: #f8d47f;
  --accent: #67e9d4;
  font-family:
    ui-sans-serif,
    system-ui,
    -apple-system,
    Segoe UI,
    sans-serif;
}
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}
body {
  background: radial-gradient(ellipse at 50% 0%, #2d3c62, #0a1121 70%);
  color: var(--ink);
  user-select: none;
}
button,
select,
input {
  font: inherit;
}
button {
  cursor: pointer;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid #fff0a7;
  outline-offset: 2px;
}
.hidden {
  display: none !important;
}
#game {
  height: 100%;
  display: grid;
  place-items: center;
  min-width: 0;
  padding: 4px;
}
.stage {
  --gutter: clamp(3px, 0.5vw, 8px);
  width: min(100%, calc((100dvh - 88px) * 3));
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: start;
  gap: var(--gutter);
  min-width: 0;
}
.play-panel {
  display: grid;
  grid-template-rows: clamp(48px, 5.4vw, 72px) auto;
  gap: 3px;
  min-width: 0;
}
.status-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 3px;
  min-width: 0;
  padding: 2px 4px;
  background: #30343a;
  border: 1px solid #626a72;
  border-radius: 3px;
  color: #f5f5ef;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  font-size: clamp(14px, 1.8vw, 24px);
}
#hearts {
  white-space: nowrap;
  color: #ff5662;
  letter-spacing: 0;
  font-size: clamp(17px, 2.5vw, 34px);
}
.mini-controls {
  display: flex;
  gap: 2px;
}
.hud-button {
  border: 1px solid #717982;
  background: #41484e;
  color: white;
  padding: 0;
  width: 21px;
  height: 21px;
  border-radius: 3px;
  font-size: 13px;
  line-height: 1;
}
#clock {
  font-size: clamp(12px, 1.3vw, 18px);
}
#chess-clock {
  margin-inline: auto;
  font-size: clamp(22px, 3.1vw, 42px);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
#chess-clock.urgent {
  color: #ff9292;
}
#total {
  color: #f8d47f;
  font-size: clamp(12px, 1.3vw, 18px);
}
.survival-strip,
.chess-strip,
.mine-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: 1fr auto;
  justify-items: center;
  gap: 2px;
}
#hearts,
.mini-controls,
#chess-clock,
#mine-time {
  grid-column: 1 / -1;
}
#chess-clock,
#mine-time {
  grid-row: 1;
}
#clock,
#total,
#mine-counter,
.mine-face {
  grid-row: 2;
}
#mine-time {
  font-size: clamp(22px, 3.1vw, 42px);
  line-height: 1;
}
#mine-time.urgent {
  color: #fff;
  background: #a60000;
}
.mine-strip {
  background: #bdbdbd;
  color: #111;
  border: 2px inset #eee;
  border-radius: 0;
}
.digital {
  font-family: monospace;
  font-size: clamp(14px, 1.8vw, 24px);
  font-weight: 900;
  color: #ff3131;
  background: #180707;
  padding: 0 3px;
  line-height: 1.1;
  box-shadow: inset 0 0 0 1px #777;
}
.mine-face {
  width: 22px;
  height: 22px;
  border: 2px outset #eee;
  background: #c0c0c0;
  color: #171717;
  font-size: 17px;
  line-height: 1;
  padding: 0;
  font-weight: 900;
  text-shadow: 0 0 2px #ffe500;
}
.mine-face[aria-pressed='true'] {
  background: #ffe45c;
  border-style: inset;
}
.tile-grid,
#disc-arena {
  width: 100%;
  aspect-ratio: 1;
  min-width: 0;
  display: grid;
  overflow: hidden;
}
.tile-grid {
  grid-template-columns: repeat(8, minmax(0, 1fr));
  grid-template-rows: repeat(8, minmax(0, 1fr));
}
.cell {
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  position: relative;
  touch-action: manipulation;
  font-size: clamp(9px, 2vw, 28px);
  line-height: 1;
}
.chess-cell.light {
  background: #eeeed2;
}
.chess-cell.dark {
  background: #769656;
}
.chess-cell.selected,
.chess-cell.last {
  box-shadow: inset 0 0 0 100px #f7f26977;
}
.chess-cell.legal::after {
  content: '';
  position: absolute;
  inset: 36%;
  border-radius: 50%;
  background: #15241955;
  pointer-events: none;
}
.chess-cell.legal:has(img)::after {
  inset: 4%;
  border: 4px solid #15241966;
  background: transparent;
}
.chess-piece {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}
.mine-board {
  background: #c0c0c0;
  border: 2px inset #eee;
}
.mine-cell {
  background: #c0c0c0;
  border: clamp(1px, 0.22vw, 3px) outset #e6e6e6;
  color: #111;
  font-family: Arial, sans-serif;
  font-weight: 900;
}
.mine-cell.open {
  border: 1px solid #929292;
}
.mine-cell.boom {
  background: #ff3333;
}
.mine-cell.hint-1 {
  color: #0000ee;
}
.mine-cell.hint-2 {
  color: #008000;
}
.mine-cell.hint-3 {
  color: #e00000;
}
.mine-cell.hint-4 {
  color: #000080;
}
.mine-cell.hint-5 {
  color: #800000;
}
.mine-cell.hint-6 {
  color: #008080;
}
.mine-cell.hint-7 {
  color: #000;
}
.mine-cell.hint-8 {
  color: #595959;
}
#disc-arena {
  display: block;
  height: auto;
  background: #383c40;
  touch-action: none;
  cursor: crosshair;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.dialog {
  position: fixed;
  inset: 0;
  padding: 12px;
  display: none;
  justify-content: center;
  align-items: center;
  background: #060a14d9;
  backdrop-filter: blur(7px);
  overflow: auto;
  z-index: 10;
}
.dialog.visible {
  display: flex;
}
.dialog-card {
  width: min(620px, 100%);
  max-height: min(94dvh, 850px);
  overflow: auto;
  padding: clamp(12px, 2vw, 20px);
  border: 1px solid #a1b2df;
  border-radius: 19px;
  background: linear-gradient(135deg, #25395a, #17182c 72%);
  box-shadow: 0 15px 55px #000a;
}
.dialog-hero {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  height: clamp(45px, 11dvh, 93px);
  gap: 5px;
  overflow: hidden;
  border-radius: 11px;
}
.dialog-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.dialog header {
  text-align: center;
  padding: 9px 0 12px;
}
.dialog-kicker {
  color: var(--accent);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.23em;
}
h1 {
  margin: 4px 0;
  font-size: clamp(19px, 3.8vw, 34px);
  letter-spacing: -0.05em;
  line-height: 1.07;
}
h1 em {
  color: var(--gold);
  font-style: normal;
}
.dialog header p {
  color: #d7e2f2;
  margin: 6px 0 0;
  font-size: 12px;
}
.options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 11px;
}
.options label,
.name-label {
  display: grid;
  gap: 5px;
  color: #d3e4f8;
  font-size: 12px;
  font-weight: 800;
}
select,
input {
  width: 100%;
  border-radius: 9px;
  padding: 9px;
  background: #0e1b2e;
  color: #f7fcff;
  border: 1px solid #7d98b4;
  font-size: 13px;
}
.name-label {
  max-width: 180px;
  margin: 0 auto;
  text-align: center;
}
.name-label input {
  text-align: center;
  font-size: 19px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 4px;
}
.help,
.dialog-view p {
  color: #d3e3f5;
  line-height: 1.45;
  font-size: 12px;
}
.buttons {
  display: flex;
  gap: 8px;
  margin-top: 13px;
  align-items: stretch;
  flex-wrap: wrap;
}
.buttons > * {
  flex: 1;
  min-width: 145px;
}
.buttons.compact > * {
  min-width: 80px;
}
.primary,
.secondary {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  border: 1px solid #99adcf;
  border-radius: 11px;
  padding: 11px 9px;
  font-weight: 900;
  font-size: 12px;
  text-decoration: none;
  color: white;
}
.primary {
  color: #10172b;
  background: linear-gradient(100deg, #80f7db, #f8d280);
  border-color: #e3ffed;
}
.secondary {
  background: #34425c;
}
.secondary.on {
  border-color: #f8d280;
  color: #fff1c3;
}
.audio-settings {
  margin: 12px 0 0;
  display: flex;
  justify-content: center;
  gap: 19px;
  color: #dfedfa;
  font-size: 12px;
  font-weight: 800;
}
.audio-settings label {
  display: inline-flex;
  gap: 7px;
  align-items: center;
}
.audio-settings input {
  width: 17px;
  height: 17px;
  accent-color: #83f9df;
}
.link-action {
  width: 100%;
  background: transparent;
  border: 0;
  padding: 13px 0 2px;
  color: #bed1ff;
  font-weight: 850;
  font-size: 12px;
}
.score-difficulty-label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  color: #dfedfa;
  font-size: 12px;
  font-weight: 800;
}
.score-difficulty-label select {
  max-width: 195px;
}
.difficulty-hint {
  border: 1px solid #7a8fab;
  border-radius: 9px;
  background: #172944;
  color: #fff0c0;
  padding: 8px 11px;
  font-size: 12px;
}
.score-list {
  margin: 9px 0;
  padding: 0;
  counter-reset: rank;
  list-style: none;
  max-height: 26dvh;
  min-height: 70px;
  overflow: auto;
}
.score-list li {
  display: flex;
  justify-content: space-between;
  padding: 5px 9px;
  border-bottom: 1px solid #607088;
  font-size: 12px;
}
.score-list strong {
  color: #fcde97;
  font-variant-numeric: tabular-nums;
}
.result {
  font-size: 18px !important;
  text-align: center;
  font-weight: 900;
  color: #fff1be !important;
}
.breakdown {
  text-align: center;
}
.soft {
  color: #d2a9af !important;
}
@media (max-width: 420px) {
  .stage {
    --gutter: 3px;
  }
  .status-strip {
    padding-inline: 2px;
  }
  .hud-button {
    width: 19px;
    height: 21px;
  }
  .options {
    grid-template-columns: 1fr;
    gap: 7px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}
