:root {
  color-scheme: dark;
  font-size: 14px;
  --void-bg: #030303;
  --void-surface: rgba(255, 255, 255, 0.045);
  --void-border: rgba(255, 255, 255, 0.08);
  --void-accent: #4dffb3;
  --void-text: #d7d7d7;
  --void-muted: rgba(215, 215, 215, 0.62);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--void-bg);
  background-image: radial-gradient(1px 1px at 20px 20px, rgba(255, 255, 255, 0.25), transparent),
    radial-gradient(1px 1px at 60px 40px, rgba(255, 255, 255, 0.18), transparent),
    radial-gradient(1.5px 1.5px at 90px 70px, rgba(255, 255, 255, 0.12), transparent);
  background-size: 120px 120px;
  color: var(--void-text);
  font-family: "Space Grotesk", "IBM Plex Sans", "Segoe UI", sans-serif;
  letter-spacing: 0.03em;
  display: flex;
  justify-content: center;
  align-items: stretch;
  padding: clamp(24px, 8vw, 64px);
}

.main-shell {
  width: min(1100px, 100%);
  display: grid;
  gap: clamp(20px, 4vw, 32px);
}

.top-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  padding: 18px 22px;
  border: 1px solid var(--void-border);
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.035), rgba(17, 17, 17, 0.35));
  backdrop-filter: blur(8px);
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.brand-title {
  font-size: 1.05rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 600;
}

.brand-subtitle {
  font-size: 0.68rem;
  color: var(--void-muted);
}

.meta-row {
  margin-left: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.meta-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(77, 255, 179, 0.2);
  background: rgba(77, 255, 179, 0.08);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.meta-chip span {
  color: var(--void-accent);
  font-weight: 600;
}

.meta-link {
  text-decoration: none;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--void-muted);
  transition: color 160ms ease;
}

.meta-link:hover {
  color: var(--void-accent);
}

.protocol-shell {
  border: 1px solid var(--void-border);
  border-radius: 22px;
  background: rgba(12, 12, 12, 0.72);
  padding: clamp(20px, 4vw, 32px);
  display: grid;
  gap: 20px;
}

.protocol-header {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.protocol-title {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 1rem;
}

.protocol-description {
  margin: 0;
  font-size: 0.76rem;
  color: var(--void-muted);
  letter-spacing: 0.06em;
  line-height: 1.6;
}

.minesweeper-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.minesweeper-stat {
  min-width: 120px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.minesweeper-stat-label {
  font-size: 0.64rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--void-muted);
}

.minesweeper-stat-value {
  font-size: 0.86rem;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.minesweeper-board-wrapper {
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.03);
  padding: 12px;
}

.minesweeper-board {
  --minesweeper-columns: 24;
  display: grid;
  gap: 4px;
  grid-template-columns: repeat(var(--minesweeper-columns, 24), minmax(32px, 1fr));
  justify-content: flex-start;
  align-content: start;
}

.minesweeper-cell {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--void-text);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
  aspect-ratio: 1 / 1;
  transition: transform 80ms ease, background 120ms ease, border-color 120ms ease;
}

.minesweeper-cell:focus-visible {
  outline: 2px solid rgba(77, 255, 179, 0.6);
  outline-offset: 2px;
}

.minesweeper-cell:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.12);
}

.minesweeper-cell--revealed {
  background: rgba(12, 12, 12, 0.78);
  border-color: rgba(255, 255, 255, 0.16);
  cursor: default;
  transform: none;
}

.minesweeper-cell--flagged {
  background: rgba(77, 255, 179, 0.18);
  border-color: rgba(77, 255, 179, 0.45);
  color: var(--void-accent);
}

.minesweeper-cell--bomb {
  background: rgba(255, 123, 123, 0.18);
  border-color: rgba(255, 123, 123, 0.65);
  color: rgba(255, 123, 123, 0.92);
}

.minesweeper-cell--hit {
  background: rgba(255, 123, 123, 0.32);
  border-color: rgba(255, 123, 123, 0.86);
  color: rgba(255, 255, 255, 0.94);
}

.minesweeper-cell--value-1 {
  color: #69a3f5;
}

.minesweeper-cell--value-2 {
  color: #4dffb3;
}

.minesweeper-cell--value-3 {
  color: #ff6b6b;
}

.minesweeper-cell--value-4 {
  color: #ffb347;
}

.minesweeper-cell--value-5 {
  color: #ab6bff;
}

.minesweeper-cell--value-6 {
  color: #6c81ff;
}

.minesweeper-cell--value-7 {
  color: #d7d7d7;
}

.minesweeper-cell--value-8 {
  color: #ffffff;
}

.minesweeper-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.minesweeper-actions button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  border-color: rgba(255, 255, 255, 0.16) !important;
  background: rgba(255, 255, 255, 0.06) !important;
  color: var(--void-muted) !important;
}

.minesweeper-cashout {
  appearance: none;
  border-radius: 12px;
  border: 1px solid rgba(255, 198, 93, 0.45);
  background: rgba(255, 198, 93, 0.14);
  color: rgba(255, 198, 93, 0.92);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: 10px 16px;
  font-size: 0.68rem;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease;
}

.minesweeper-cashout:hover:not(:disabled) {
  border-color: rgba(255, 198, 93, 0.7);
  background: rgba(255, 198, 93, 0.22);
}

.minesweeper-reset {
  appearance: none;
  border-radius: 12px;
  border: 1px solid rgba(77, 255, 179, 0.45);
  background: rgba(77, 255, 179, 0.14);
  color: var(--void-accent);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: 10px 16px;
  font-size: 0.68rem;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease;
}

.minesweeper-reset:hover {
  border-color: rgba(77, 255, 179, 0.65);
  background: rgba(77, 255, 179, 0.22);
}

.minesweeper-status {
  margin: 0;
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  color: var(--void-muted);
}

.status-line {
  margin: 0;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  color: var(--void-muted);
}

.status-line[data-state="error"] {
  color: rgba(255, 123, 123, 0.9);
}

.status-line[data-state="ok"] {
  color: var(--void-accent);
}

@media (max-width: 720px) {
  body {
    padding: 18px;
  }

  .minesweeper-board {
    --minesweeper-columns: 12;
    grid-template-columns: repeat(var(--minesweeper-columns, 12), minmax(28px, 1fr));
    min-width: calc(var(--minesweeper-columns, 12) * 28px);
  }
}
