:root {
  --bg: #0b1020;
  --card: #121a33;
  --card2: #0f1730;
  --text: #e8ecff;
  --muted: #b7c0ff;
  --accent: #7dd3fc;
  --accent2: #a7f3d0;
  --danger: #fb7185;
  --warn: #fbbf24;
  --ok: #34d399;
  --border: rgba(255, 255, 255, 0.12);
  --shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
  --radius: 18px;
  --mono:
    ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
    "Courier New", monospace;
  --sans:
    ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial,
    "Apple Color Emoji", "Segoe UI Emoji";
}
* {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
}
body {
  margin: 0;
  font-family: var(--sans);
  color: var(--text);
  background:
    radial-gradient(
      1200px 600px at 20% 0%,
      rgba(125, 211, 252, 0.2),
      transparent 60%
    ),
    radial-gradient(
      900px 500px at 90% 10%,
      rgba(167, 243, 208, 0.16),
      transparent 55%
    ),
    radial-gradient(
      900px 700px at 50% 100%,
      rgba(251, 113, 133, 0.1),
      transparent 55%
    ),
    var(--bg);
}
a {
  color: inherit;
  text-decoration: none;
}
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 18px 60px;
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(
    180deg,
    rgba(18, 26, 51, 0.88),
    rgba(18, 26, 51, 0.62)
  );
  box-shadow: var(--shadow);
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.logo {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: linear-gradient(
    135deg,
    rgba(125, 211, 252, 0.9),
    rgba(167, 243, 208, 0.85)
  );
  display: grid;
  place-items: center;
  color: #051024;
  font-weight: 900;
}
.brand h1 {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0.5px;
}
.brand .tag {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13px;
}
.nav {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.nav a {
  padding: 9px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 48, 0.45);
}
.nav a:hover {
  border-color: rgba(125, 211, 252, 0.55);
  background: rgba(15, 23, 48, 0.62);
}
.hero {
  margin: 22px 0 18px;
  padding: 18px 4px;
}
.hero h2 {
  margin: 0 0 8px;
  font-size: 30px;
  line-height: 1.15;
}
.hero p {
  margin: 0;
  color: var(--muted);
  max-width: 900px;
  font-size: 15px;
  line-height: 1.6;
}
.grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 14px;
  margin-top: 14px;
}
.card {
  grid-column: span 6;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(
    180deg,
    rgba(18, 26, 51, 0.85),
    rgba(15, 23, 48, 0.62)
  );
  padding: 16px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.card:hover {
  transform: translateY(-1px);
}
.card h3 {
  margin: 0 0 8px;
  font-size: 18px;
}
.card p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}
.badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.badge {
  font-size: 12px;
  padding: 6px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(11, 16, 32, 0.45);
  color: var(--muted);
}
.badge.accent {
  border-color: rgba(125, 211, 252, 0.5);
  color: #cff0ff;
}
.badge.green {
  border-color: rgba(52, 211, 153, 0.45);
  color: #d1fae5;
}
.badge.warn {
  border-color: rgba(251, 191, 36, 0.45);
  color: #fde68a;
}
.footer {
  margin-top: 28px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}
.footer .small {
  font-size: 12px;
  opacity: 0.9;
}
.btnrow {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 48, 0.55);
}
.btn:hover {
  border-color: rgba(167, 243, 208, 0.55);
}
.gameShell {
  margin-top: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(
    180deg,
    rgba(18, 26, 51, 0.85),
    rgba(15, 23, 48, 0.62)
  );
  box-shadow: var(--shadow);
  overflow: hidden;
}
.gameHeader {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.gameHeader h2 {
  margin: 0;
  font-size: 20px;
}
.gameHeader .hint {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  max-width: 720px;
}
.gameBody {
  padding: 16px;
}
.panel {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(11, 16, 32, 0.45);
  padding: 12px;
  margin: 10px 0;
}
.row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
label {
  font-size: 13px;
  color: var(--muted);
}
input[type="number"],
input[type="text"],
select {
  padding: 9px 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 48, 0.55);
  color: var(--text);
  outline: none;
}
button {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(125, 211, 252, 0.16);
  color: var(--text);
  cursor: pointer;
}
button:hover {
  border-color: rgba(125, 211, 252, 0.55);
}
button.secondary {
  background: rgba(167, 243, 208, 0.12);
}
button.danger {
  background: rgba(251, 113, 133, 0.14);
}
kbd {
  font-family: var(--mono);
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 6px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
}
hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 14px 0;
}
.mathInsight {
  border: 1px solid rgba(167, 243, 208, 0.35);
  background:
    radial-gradient(
      700px 240px at 10% 0%,
      rgba(167, 243, 208, 0.16),
      transparent 60%
    ),
    rgba(11, 16, 32, 0.45);
  border-radius: 14px;
  padding: 12px;
}
.mathInsight h3 {
  margin: 0 0 8px;
  font-size: 15px;
}
.mathInsight ul {
  margin: 0 0 0 18px;
  color: var(--muted);
  line-height: 1.65;
}
.notice {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}
.canvasWrap {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}
canvas {
  max-width: 100%;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.25);
}
@media (min-width: 820px) {
  .card {
    grid-column: span 4;
  }
}
/* KUBBU V2 platform layer */
.sectionTitle {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 14px;
  margin: 28px 0 12px;
}
.sectionTitle h2 {
  margin: 0;
  font-size: 20px;
}
.sectionTitle p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}
.dailyHero {
  display: grid;
  grid-template-columns: 1.35fr 0.65fr;
  gap: 14px;
  margin-top: 22px;
}
.dailyMain,
.statPanel {
  border: 1px solid var(--border);
  border-radius: 24px;
  background: linear-gradient(
    160deg,
    rgba(18, 26, 51, 0.95),
    rgba(15, 23, 48, 0.72)
  );
  box-shadow: var(--shadow);
}
.dailyMain {
  padding: 28px;
  position: relative;
  overflow: hidden;
}
.dailyMain:after {
  content: "✦";
  position: absolute;
  right: 24px;
  top: 10px;
  font-size: 110px;
  opacity: 0.06;
}
.eyebrow {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--accent2);
  font-weight: 800;
}
.dailyMain h2 {
  font-size: 34px;
  margin: 8px 0 8px;
}
.dailyMain p {
  max-width: 620px;
  color: var(--muted);
  line-height: 1.65;
}
.primary {
  background: linear-gradient(
    135deg,
    rgba(125, 211, 252, 0.95),
    rgba(167, 243, 208, 0.92)
  );
  color: #061126;
  border: 0;
  font-weight: 900;
}
.statPanel {
  padding: 18px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.statBox {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(11, 16, 32, 0.45);
}
.statBox b {
  display: block;
  font-size: 24px;
}
.statBox span {
  font-size: 12px;
  color: var(--muted);
}
.gameTile {
  min-height: 170px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.gameIcon {
  font-size: 30px;
}
.gameTile .playLabel {
  font-size: 12px;
  color: var(--accent2);
  font-weight: 800;
  letter-spacing: 0.06em;
}
.quickGrid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.quickGrid .card {
  grid-column: auto;
}
.puzzleBoard {
  display: grid;
  gap: 8px;
  max-width: 440px;
  margin: 18px auto;
}
.puzzleCell {
  aspect-ratio: 1;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 20px;
  user-select: none;
}
.puzzleCell.on {
  background: linear-gradient(
    135deg,
    rgba(125, 211, 252, 0.95),
    rgba(167, 243, 208, 0.9)
  );
  color: #071126;
  box-shadow: 0 0 28px rgba(125, 211, 252, 0.15);
}
.puzzleCell.path {
  background: rgba(125, 211, 252, 0.12);
}
.puzzleCell.selected {
  outline: 2px solid var(--accent2);
}
.successBox {
  padding: 16px;
  border-radius: 16px;
  border: 1px solid rgba(52, 211, 153, 0.45);
  background: rgba(52, 211, 153, 0.09);
  margin-top: 12px;
}
.hidden {
  display: none !important;
}
.miniMeta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 12px;
}
.brand .tag.v2tag {
  font-size: 12px;
}
.footer strong {
  color: var(--text);
}
@media (max-width: 760px) {
  .dailyHero {
    grid-template-columns: 1fr;
  }
  .quickGrid {
    grid-template-columns: 1fr 1fr;
  }
  .dailyMain h2 {
    font-size: 28px;
  }
  .brand .tag {
    display: none;
  }
}
@media (max-width: 520px) {
  .quickGrid {
    grid-template-columns: 1fr;
  }
  .statPanel {
    grid-template-columns: 1fr 1fr;
  }
  .container {
    padding: 14px 12px 40px;
  }
  .topbar {
    padding: 12px;
  }
  .nav a {
    padding: 8px 9px;
  }
}
/* KUBBU V3 game additions */
.oddBoard {
  display: grid;
  gap: 6px;
  max-width: 600px;
  margin: 20px auto;
}
.oddCell {
  aspect-ratio: 1;
  padding: 0;
  font-size: clamp(15px, 3vw, 25px);
  background: rgba(255, 255, 255, 0.055);
}
.oddCell.wrong {
  background: rgba(251, 113, 133, 0.28);
}
.centerGame {
  text-align: center;
}
.center {
  justify-content: center;
}
.bigNumbers {
  font-size: clamp(38px, 8vw, 72px);
  font-weight: 900;
  letter-spacing: 0.12em;
  margin: 35px 0;
}
.centerGame input {
  min-width: 280px;
  font-size: 18px;
}
.floodBoard {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 3px;
  max-width: 460px;
  margin: 20px auto;
}
.floodCell {
  aspect-ratio: 1;
  border-radius: 5px;
}
.colorControls {
  display: flex;
  gap: 10px;
  justify-content: center;
}
.colorBtn {
  width: 52px;
  height: 52px;
}
.cA {
  background: #7dd3fc !important;
}
.cB {
  background: #a7f3d0 !important;
}
.cC {
  background: #fbbf24 !important;
}
.cD {
  background: #fb7185 !important;
}
.cE {
  background: #c4b5fd !important;
}
.lineGame {
  display: block;
  width: min(520px, 100%);
  margin: 20px auto;
  background: rgba(11, 16, 32, 0.45);
}
.edge {
  stroke: rgba(232, 236, 255, 0.32);
  stroke-width: 2;
}
.edge.used {
  stroke: #a7f3d0;
  stroke-width: 3;
}
.node {
  fill: #7dd3fc;
  cursor: pointer;
}
.node.active {
  fill: #fbbf24;
  stroke: white;
  stroke-width: 2;
}
.laserBoard {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 5px;
  max-width: 500px;
  margin: 20px auto;
}
.laserCell {
  aspect-ratio: 1;
  padding: 0;
  font-size: 28px;
  background: rgba(255, 255, 255, 0.045);
}
.laserCell.mirror {
  font-family: var(--mono);
  font-size: 36px;
  color: #a7f3d0;
}
.laserCell.source,
.laserCell.target {
  background: rgba(125, 211, 252, 0.1);
}
/* Gameplay refinements; retain the V3.0 site design. */
button,
select,
.nav a {
  min-height: 44px;
  touch-action: manipulation;
}
button:disabled {
  cursor: default;
  opacity: 0.5;
}
button:focus-visible,
a:focus-visible,
select:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}
.selected {
  outline: 3px solid var(--accent2) !important;
}
.row {
  row-gap: 12px;
}
.gameBody {
  min-width: 0;
}
.puzzleCell {
  padding: 0;
  min-width: 0;
}
.laserWrap {
  position: relative;
  max-width: 500px;
  margin: 20px auto;
}
.laserWrap .laserBoard {
  margin: 0;
  gap: 0;
}
.laserWrap #beam {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.laserWrap polyline {
  fill: none;
  stroke: #fb7185;
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 4px #fb7185);
}
.laserCell {
  border-radius: 5px;
  z-index: 1;
  background: transparent;
}
.laserCell:disabled {
  opacity: 1;
}
.laserCell.mirror {
  font-size: 30px;
}
.lineGame {
  border-radius: 14px;
}
.oddBoard {
  max-width: 420px;
  gap: 5px;
}
.oddCell {
  min-height: 44px;
  font-size: 24px;
}
.floodCell {
  display: grid;
  place-items: center;
  color: #101b32;
  font-size: clamp(10px, 3vw, 18px);
}
.colorControls {
  flex-wrap: wrap;
  gap: 8px;
}
.colorBtn {
  color: #101b32;
  font-size: 20px;
}
.colorBtn:disabled {
  opacity: 0.5;
  border: 3px solid white;
}
.numberCards {
  margin: 28px 0;
}
.numberCard {
  font-size: 28px;
  min-width: 64px;
  min-height: 72px;
}
.echoBoard {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  max-width: 340px;
  margin: 20px auto;
}
.echoPad {
  aspect-ratio: 1;
  font-size: 40px;
  color: #0b1020;
  opacity: 0.55;
}
.echoPad.lit {
  opacity: 1;
  outline: 5px solid white;
  transform: scale(0.95);
}
.clockBoard {
  position: relative;
  aspect-ratio: 1;
  max-width: 350px;
  margin: 20px auto;
  border: 1px solid var(--border);
  border-radius: 50%;
}
.clockDot {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--card);
}
.clockDot.target {
  background: #fbbf24;
  color: #101b32;
}
.gemBoard {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  max-width: 450px;
  margin: 24px auto;
}
.gemBoard span {
  font-size: 30px;
  color: var(--accent2);
}
#dots button {
  min-width: 44px;
}
.gameHeader .hint {
  margin-top: 8px;
  line-height: 1.6;
}
#meta {
  min-height: 24px;
}
.successBox {
  line-height: 1.6;
}
#expression {
  overflow-wrap: anywhere;
}
.topbar {
  flex-wrap: wrap;
}
@media (max-width: 380px) {
  .container {
    padding: 10px 8px;
  }
  .gameBody {
    padding: 12px;
  }
  .puzzleBoard {
    gap: 4px;
  }
  .oddBoard {
    gap: 3px;
  }
  .oddCell {
    font-size: 21px;
  }
  .numberCard {
    min-width: 54px;
    padding: 8px;
  }
  .colorControls {
    gap: 5px;
  }
  .colorBtn {
    width: 44px;
    height: 44px;
  }
  .laserCell {
    min-height: 0;
  }
  .clockDot {
    width: 30px;
    height: 30px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *:before,
  *:after {
    transition: none !important;
    animation: none !important;
  }
  .echoPad.lit {
    transform: none;
  }
}
.laserCell.source {
  color: #fb7185;
}
.laserCell.target {
  color: #fbbf24;
}
.puzzleCell,
.oddCell,
.numberCard {
  transition:
    background 0.12s,
    border-color 0.12s;
}
.numberCard:active,
.puzzleCell:active {
  border-color: var(--accent2);
}
