@import url("./tokens.css");
:root {
  color-scheme: dark;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: #0a101b;
  color: #e5edf3;
  font-family: var(--sans);
  min-height: 100dvh;
  background-image:
    radial-gradient(ellipse at 10% 15%, #162c45, transparent 55%),
    radial-gradient(ellipse at 90% 90%, #302343, transparent 50%);
}
a {
  color: inherit;
  text-decoration: none;
}
button,
select {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid #425064;
  border-radius: 9px;
  background: #1b283a;
  touch-action: manipulation;
}
button:hover {
  background: #2c3d54;
}
button:disabled {
  opacity: 0.35;
  cursor: default;
}
button:focus-visible,
a:focus-visible,
select:focus-visible {
  outline: 2px solid #a6daf7;
  outline-offset: 3px;
}
select {
  background: #142132;
  border: 1px solid #455268;
  border-radius: 8px;
  min-height: 44px;
  padding: 9px;
}
header {
  max-width: 1180px;
  margin: auto;
  display: flex;
  justify-content: space-between;
  padding: 20px 30px;
  align-items: center;
  font-size: 12px;
  color: #96aabe;
}
header span {
  font: 10px var(--mono);
  letter-spacing: 0.18em;
}
main {
  max-width: 1080px;
  padding: 20px 30px 50px;
  margin: auto;
}
.classic-title {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 30px;
}
.classic-title h1 {
  font-size: 44px;
  letter-spacing: -0.05em;
  margin: 12px 0 0;
  font-weight: 550;
}
.classic-title > div > span {
  font: 10px var(--mono);
  letter-spacing: 0.2em;
  color: #94c2db;
}
.classic-title p {
  font-size: 13px;
  line-height: 1.8;
  color: #90a9ba;
  max-width: 320px;
  margin: 0;
}
.classic-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 20px 0;
}
.classic-controls button {
  font-size: 12px;
}
.classic-help {
  font-size: 12px;
  color: #92a6b8;
  line-height: 1.9;
  margin-top: 25px;
  max-width: 800px;
}
summary {
  cursor: pointer;
}
.classic-help p {
  margin: 12px 0;
}
.tetris-layout {
  display: grid;
  grid-template-columns: 150px minmax(0, 300px) 150px;
  gap: 25px;
  justify-content: center;
  align-items: start;
}
.piece-box {
  background: #111e2e;
  border: 1px solid #31435a;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 18px;
}
.piece-box h3 {
  font: 10px var(--mono);
  letter-spacing: 0.15em;
  color: #8da6bb;
  margin: 0 0 10px;
}
.piece-box canvas {
  display: block;
  width: 100%;
  height: auto;
}
.tetris-side dl {
  margin: 0;
}
.tetris-side dt {
  font: 10px var(--mono);
  color: #8fa5b9;
  margin-top: 18px;
}
.tetris-side dd {
  font: 25px var(--mono);
  margin: 6px 0;
  color: #e6eff9;
}
.matrix-wrap {
  position: relative;
  width: 100%;
  box-shadow:
    0 0 0 1px #4c627c,
    0 0 0 7px #0f1b2a,
    0 20px 65px #0008;
  border-radius: 6px;
  overflow: hidden;
  background: #091420;
}
.matrix-wrap canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1/2;
  touch-action: none;
}
.matrix-wrap:focus-visible {
  outline: 2px solid #c5e7f6;
  outline-offset: 10px;
}
.classic-overlay {
  position: absolute;
  inset: 0;
  background: #0a1528e8;
  backdrop-filter: blur(7px);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  text-align: center;
  padding: 22px;
  z-index: 4;
}
.classic-overlay h2 {
  font-size: 28px;
  margin: 10px 0;
}
.classic-overlay p {
  font-size: 12px;
  line-height: 1.8;
  color: #a7bdce;
}
.classic-overlay button {
  background: #b7dcf0;
  color: #122033;
  font-weight: 600;
  margin: 10px 0;
}
.classic-overlay select {
  max-width: 100%;
  width: 100%;
  margin: 12px 0;
}
.tetris-touch {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 7px;
  max-width: 560px;
  margin: 23px auto 0;
}
.tetris-touch button {
  padding: 9px 2px;
  font-size: 18px;
  touch-action: none;
  user-select: none;
}
.tetris-touch button small {
  display: block;
  font-size: 9px;
  margin-top: 4px;
  color: #9eb7c9;
}
.tetris-touch button[data-action="drop"] {
  background: #33536a;
}
.classic-status {
  min-height: 28px;
  text-align: center;
  color: #bedceb;
  font: 12px var(--mono);
  margin: 16px 0;
}
.mobile-score {
  display: none;
}
.mode-note {
  font-size: 11px;
  line-height: 1.8;
  color: #8fa7bc;
}
.mines-page {
  background: #101a1b;
  background-image: radial-gradient(
    ellipse at 30% 10%,
    #263c37,
    transparent 70%
  );
}
.mines-page main {
  max-width: 1200px;
}
.mine-console {
  border: 1px solid #546a60;
  background: linear-gradient(135deg, #2c4038, #182e28);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 25px 60px #0005;
}
.mine-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}
.counter {
  padding: 10px 16px;
  background: #0c1915;
  border: 1px solid #496354;
  border-radius: 7px;
  color: #c8e6af;
  font: 28px var(--mono);
  min-width: 105px;
  text-align: center;
}
.counter small {
  display: block;
  color: #8aa98f;
  font: 9px var(--mono);
  letter-spacing: 0.12em;
  margin-bottom: 5px;
}
.mine-face {
  border-radius: 50%;
  width: 56px;
  height: 56px;
  font-size: 27px;
  background: #3d5842;
  border-color: #718a68;
  padding: 0;
}
.mine-scroll {
  overflow: auto;
  max-width: 100%;
  overscroll-behavior: contain;
  border: 1px solid #587065;
  border-radius: 5px;
  background: #101e1a;
  padding: 6px;
  scrollbar-color: #627d69 #172920;
}
.mine-board {
  display: grid;
  width: max-content;
  margin: auto;
  gap: 2px;
  touch-action: pan-x pan-y;
}
.mine-cell {
  width: 34px;
  height: 34px;
  min-height: 0;
  padding: 0;
  border-radius: 3px;
  display: grid;
  place-items: center;
  font: 700 20px var(--mono);
  background: linear-gradient(#4c6554, #334f40);
  border: 1px solid #789078;
  box-shadow:
    inset 1px 1px 0 #b0c69844,
    inset -1px -2px 0 #101b2166;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}
.mine-cell:hover {
  filter: brightness(1.16);
}
.mine-cell.open {
  background: #182b25;
  border-color: #30493b;
  box-shadow: none;
  color: var(--number);
}
.mine-cell.open[data-number="0"] {
  color: transparent;
}
.mine-cell.flagged {
  color: #ffd48c;
}
.mine-cell.exploded {
  background: #994d3d;
  color: #ffe0b5;
}
.mine-cell.wrong {
  color: #ec8f75;
}
.mine-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 16px;
  gap: 15px;
  color: #b5c5b4;
  font-size: 12px;
}
.mine-bottom button[aria-pressed="true"] {
  background: #a1bd91;
  color: #1c2d21;
  border-color: #c1d5b2;
}
.mines-page .classic-controls {
  align-items: center;
}
.mines-page select,
.mines-page .classic-controls button {
  background: #273d32;
  border-color: #5a7561;
}
.mine-result {
  margin: 18px 0 0;
  padding: 15px;
  background: #14261d;
  border-left: 3px solid #b5d698;
  color: #cde8b6;
  font-size: 14px;
  line-height: 1.8;
}
.mine-instructions {
  font-size: 11px;
  color: #9caf9b;
  margin: 12px 0;
}
.classic-dialog {
  color: #e3eef5;
  background: #142437;
  border: 1px solid #668095;
  border-radius: 14px;
  padding: 25px;
  max-width: 90vw;
}
.classic-dialog::backdrop {
  background: #000b;
}
.classic-dialog p {
  font-size: 13px;
  line-height: 1.8;
  color: #a1bacb;
}
.classic-dialog button {
  margin-right: 8px;
}
.number-help {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 12px;
  color: #9aae9f;
  margin-top: 18px;
}
.number-help b {
  color: #bfd6af;
}
[hidden] {
  display: none !important;
}
@media (max-width: 700px) {
  header {
    padding: 14px 16px;
    min-height: 54px;
  }
  header span {
    display: none;
  }
  main {
    padding: 10px 16px 30px;
  }
  .classic-title {
    margin-bottom: 24px;
    align-items: start;
  }
  .classic-title h1 {
    font-size: 32px;
  }
  .classic-title p {
    display: none;
  }
  .tetris-layout {
    grid-template-columns: 64px minmax(0, 250px) 64px;
    gap: 10px;
    margin-inline: 0;
  }
  .tetris-side .piece-box {
    padding: 7px;
    border-radius: 6px;
    margin-bottom: 10px;
  }
  .piece-box h3 {
    font-size: 8px;
  }
  .tetris-side dt {
    font-size: 8px;
    margin-top: 13px;
  }
  .tetris-side dd {
    font-size: 15px;
  }
  .tetris-side .mode-note {
    display: none;
  }
  .matrix-wrap {
    box-shadow:
      0 0 0 1px #496176,
      0 0 0 4px #101d2b;
  }
  .tetris-touch {
    gap: 5px;
    margin-top: 16px;
  }
  .tetris-touch button {
    min-height: 50px;
    font-size: 17px;
  }
  .classic-controls {
    gap: 6px;
  }
  .classic-controls button {
    font-size: 11px;
    padding: 9px 11px;
  }
  .classic-status {
    font-size: 10px;
    margin: 12px 0;
    min-height: 24px;
  }
  .classic-overlay {
    padding: 10px;
  }
  .classic-overlay h2 {
    font-size: 20px;
  }
  .classic-overlay p {
    font-size: 10px;
  }
  .classic-overlay button {
    font-size: 12px;
    min-height: 40px;
    padding: 9px 12px;
  }
  .classic-overlay select {
    font-size: 11px;
    min-height: 40px;
  }
  .mine-console {
    padding: 12px;
    border-radius: 12px;
  }
  .counter {
    min-width: 85px;
    font-size: 24px;
    padding: 8px 10px;
  }
  .mine-bar {
    margin-bottom: 13px;
  }
  .mine-face {
    width: 47px;
    height: 47px;
    font-size: 24px;
  }
  .mine-scroll {
    padding: 4px;
  }
  .mine-cell {
    width: 30px;
    height: 30px;
    font-size: 18px;
  }
  .mine-bottom {
    font-size: 11px;
    gap: 8px;
  }
  .mine-bottom button {
    font-size: 12px;
    padding: 8px 12px;
  }
  .classic-title > div > span {
    font-size: 9px;
  }
  .mine-instructions {
    line-height: 1.8;
  }
  .mines-page .classic-controls select {
    max-width: 100%;
    flex: 1;
  }
  .classic-help {
    font-size: 11px;
  }
}
@media (max-width: 370px) {
  .tetris-layout {
    grid-template-columns: 50px minmax(0, 1fr) 50px;
    gap: 8px;
  }
  .mine-cell {
    width: 27px;
    height: 27px;
  }
  .classic-title h1 {
    font-size: 28px;
  }
}
.mine-board {
  --mine-size: 34px;
}
@media (max-width: 700px) {
  .mine-board {
    --mine-size: 30px;
  }
}
@media (max-width: 370px) {
  .mine-board {
    --mine-size: 27px;
  }
}
