:root {
  --ink: #e9eff5;
  --muted: #7f8c9b;
  --line: rgba(233, 239, 245, 0.25);
  --x: #00e5ff;
  --x-glow: rgba(0, 229, 255, 0.45);
  --o: #ffb300;
  --o-glow: rgba(255, 179, 0, 0.45);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  font-family: 'Exo 2', system-ui, sans-serif;
  background: #000000; /*transparent on the additive lens*/
  color: var(--ink);
  width: 600px; height: 600px; overflow: hidden;
}

#app { width: 600px; height: 600px; position: relative; }

.hidden { display: none !important; }
.cx { color: var(--x); text-shadow: 0 0 24px var(--x-glow); }
.co { color: var(--o); text-shadow: 0 0 24px var(--o-glow); }

/* --- Overlay screens --- */
.screen {
  position: absolute; inset: 0; z-index: 10;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px; text-align: center; padding: 40px;
  background: radial-gradient(600px 400px at 50% 42%, rgba(0, 20, 32, 0.55), rgba(0, 0, 0, 0.82));
}
.panel {
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  background: #0c0f18; border: 2.5px solid rgba(0, 229, 255, 0.6);
  border-radius: 24px; padding: 34px 44px; max-width: 88%;
}
.title {
  font-weight: 700; font-size: 64px; letter-spacing: 0.16em; text-transform: uppercase;
}
.subtitle { font-weight: 500; font-size: 17px; color: var(--muted); line-height: 1.6; }
.meta { font-weight: 700; font-size: 15px; color: rgba(233, 239, 245, 0.75); letter-spacing: 0.06em; }
.cta {
  min-height: 72px; padding: 0 44px; min-width: 300px;
  font-family: 'Exo 2', sans-serif; font-weight: 700; font-size: 22px; letter-spacing: 0.04em;
  color: #04222b; background: var(--x);
  border: 3px solid transparent; border-radius: 16px; cursor: pointer;
  transition: transform 160ms ease-out, box-shadow 160ms ease-out;
}
.cta.ghost { color: var(--x); background: transparent; border-color: rgba(0, 229, 255, 0.55); }
.cta.focus { box-shadow: 0 0 30px var(--x-glow); transform: scale(1.06); }

/* --- Host / join code entry --- */
.bigcode {
  font-size: 110px; font-weight: 700; letter-spacing: 0.22em; padding-left: 0.22em;
  color: var(--x); text-shadow: 0 0 32px var(--x-glow);
}
.digits { display: flex; gap: 18px; }
.digit {
  width: 96px; height: 128px; line-height: 128px; font-size: 84px; font-weight: 700;
  border: 2.5px solid var(--line); border-radius: 18px;
  transition: box-shadow 160ms ease-out, border-color 160ms ease-out, transform 160ms ease-out;
}
.digit.focus {
  border-color: var(--x); box-shadow: 0 0 26px var(--x-glow); transform: scale(1.06);
  color: var(--x);
}

/* --- Game --- */
#topbar, #botbar {
  position: absolute; left: 0; width: 600px; height: 64px; padding: 0 26px;
  display: flex; align-items: center; justify-content: space-between;
}
#topbar { top: 0; }
#botbar { bottom: 0; }
#g-turn { font-weight: 700; font-size: 18px; letter-spacing: 0.1em; text-transform: uppercase; }
#g-turn.mine { animation: breathe 1.6s ease-in-out infinite; }
.chip {
  font-weight: 700; font-size: 14px; letter-spacing: 0.08em;
  padding: 6px 14px; border-radius: 999px; border: 2px solid var(--line);
}
body.me-X .chip { color: var(--x); border-color: var(--x); }
body.me-O .chip { color: var(--o); border-color: var(--o); }

#board {
  position: absolute; top: 86px; left: 90px;
  width: 420px; height: 420px;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px;
}
.cell {
  border: 2.5px solid var(--line); border-radius: 18px;
  display: flex; align-items: center; justify-content: center;
  font-size: 84px; font-weight: 700;
  transition: box-shadow 160ms ease-out, border-color 160ms ease-out, transform 160ms ease-out;
}
body.me-X .cell.focus { border-color: var(--x); box-shadow: 0 0 26px var(--x-glow); transform: scale(1.05); }
body.me-O .cell.focus { border-color: var(--o); box-shadow: 0 0 26px var(--o-glow); transform: scale(1.05); }
.cell.markX { color: var(--x); text-shadow: 0 0 22px var(--x-glow); }
.cell.markO { color: var(--o); text-shadow: 0 0 22px var(--o-glow); }
.cell.pop { animation: stamp 220ms cubic-bezier(0.6, 0, 0.4, 1); }
.cell.winX { border-color: var(--x); box-shadow: 0 0 34px var(--x-glow), inset 0 0 24px rgba(0, 229, 255, 0.18); }
.cell.winO { border-color: var(--o); box-shadow: 0 0 34px var(--o-glow), inset 0 0 24px rgba(255, 179, 0, 0.18); }
#board.dim .cell:not(.winX):not(.winO) { opacity: 0.55; }

/* --- Toast --- */
#toast {
  position: absolute; bottom: 78px; left: 50%; transform: translateX(-50%);
  z-index: 30; padding: 12px 26px; border-radius: 999px;
  background: #0c0f18; border: 2px solid var(--line);
  font-weight: 700; font-size: 16px; white-space: nowrap;
}

.pulse { animation: breathe 1.6s ease-in-out infinite; }
@keyframes breathe { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }
@keyframes stamp { from { transform: scale(0.55); } to { transform: scale(1); } }
