:root {
  --bg: #f4f1e8;
  --ink: #111111;
  --panel: #ffffff;
  --orange: #ff8a00;
  --yellow: #f8e84b;
  --teal: #12b7bf;
  --border: #111111;
  --shadow: rgba(0, 0, 0, 0.18);
  --cell-size: 60px;
  --cell-gap: min(0.65vw, 5px);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  overflow: hidden;
  background:
    radial-gradient(circle at top, rgba(18, 183, 191, 0.18), transparent 36rem),
    linear-gradient(180deg, #fff7d8 0%, var(--bg) 58%, #efe8d7 100%);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}

.page {
  width: min(98vw, 960px);
  height: 100vh;
  height: 100svh;
  margin: 0 auto;
  padding: 8px 8px 8px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  margin-bottom: 2px;
}

.home-link {
  justify-self: center;
  color: #111;
  background: rgba(255, 255, 255, 0.85);
  border: 2px solid #111;
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 800;
  text-decoration: none;
  box-shadow: 0 3px 0 #111;
}

.brand {
  justify-self: center;
  text-align: center;
}

.logo {
  display: block;
  max-width: min(82vw, 820px);
  max-height: min(24svh, 190px);
  object-fit: contain;
}

.fallback-title {
  display: none;
  margin: 0;
  font-size: clamp(34px, 7vw, 74px);
  line-height: 0.95;
  letter-spacing: -0.05em;
  color: #fff;
  text-shadow:
    4px 4px 0 #111,
    -2px -2px 0 #111,
    2px -2px 0 #111,
    -2px 2px 0 #111,
    0 7px 0 var(--orange);
}

button {
  border: 2px solid #111;
  border-radius: 999px;
  background: var(--yellow);
  color: #111;
  padding: 9px 13px;
  font-weight: 900;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 4px 0 #111;
}

button:active,
.home-link:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #111;
}

.teacher-note {
  width: fit-content;
  max-width: 100%;
  margin: 0 auto 5px;
  padding: 5px 11px;
  background: rgba(255, 255, 255, 0.78);
  border: 2px solid rgba(0, 0, 0, 0.12);
  border-radius: 999px;
  text-align: center;
  font-size: clamp(12px, 2vw, 15px);
  font-weight: 800;
}

.teacher-note p {
  margin: 0;
}

.random-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  margin: 0 auto 7px;
}

.random-btn {
  background: white;
  padding: 8px 12px;
}

.show-all-btn {
  background: var(--teal);
  color: white;
  padding: 8px 18px;
  font-size: 16px;
}

.chart-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  flex: 1;
  min-height: 0;
}

.grid {
  display: grid;
  grid-template-columns: repeat(10, var(--cell-size));
  grid-template-rows: repeat(10, var(--cell-size));
  gap: var(--cell-gap);
  padding: min(1.1vw, 8px);
  background: rgba(0, 0, 0, 0.88);
  border: 4px solid #111;
  border-radius: 16px;
  box-shadow: 0 14px 28px var(--shadow);
}

.cell {
  width: var(--cell-size);
  height: var(--cell-size);
  background-color: black;
  color: black;
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: 900;
  font-size: clamp(15px, 3.7vw, 28px);
  cursor: pointer;
  user-select: none;
  border-radius: 8px;
  border: 2px solid #333;
  transition: transform 0.08s ease, background-color 0.15s ease, color 0.15s ease;
}

.cell:hover {
  transform: scale(1.03);
}

.cell.blank {
  background-color: white;
  color: white;
  border-color: #dddddd;
}

.cell.revealed {
  background-color: white;
  color: black;
  border-color: #111;
}

.top-actions {
  justify-self: center;
}

#resetBtn {
  background: var(--orange);
  color: white;
}

@media (max-width: 720px) {
  .topbar {
    grid-template-columns: 1fr;
  }

  .home-link,
  .brand,
  .top-actions {
    justify-self: center;
  }

  .logo {
    max-height: min(19svh, 135px);
  }

  .random-controls {
    gap: 5px;
  }

  button {
    font-size: 13px;
    padding: 8px 10px;
  }
}
