@import url('./tokens.css');

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--brand-navy);
  color: var(--fg1);
  overflow: hidden;
  height: 100vh;
}

kbd {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.18);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 1px 6px;
  color: var(--brand-lime);
}

.app {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: grid;
  grid-template-columns: 1fr 280px;
  grid-template-rows: 72px 1fr;
  grid-template-areas:
    "top   top"
    "board side";
  background: var(--brand-navy);
}

/* =========================================================
   TOP BAR
========================================================= */
.topbar {
  grid-area: top;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 var(--space-5);
  gap: var(--space-5);
  background: linear-gradient(180deg, #0e2238 0%, var(--brand-navy) 100%);
  border-bottom: 1px solid rgba(208, 224, 16, 0.15);
  color: var(--white);
  position: relative;
  z-index: 5;
}
.topbar::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -3px;
  height: 3px;
  background: var(--brand-lime);
  opacity: 0.35;
}
.topbar.is-critical::after {
  opacity: 1;
  animation: pulse-stripe 1s ease-in-out infinite;
}
@keyframes pulse-stripe {
  50% { opacity: 0.35; }
}

.topbar__left {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  min-width: 0;
}
.topbar__logo {
  height: 34px;
  width: auto;
  opacity: 0.95;
}
.topbar__title {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.topbar__game-name {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 500;
  color: var(--white);
  letter-spacing: -0.01em;
}
.eyebrow {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--brand-teal-bright);
}
.eyebrow--lime { color: var(--brand-lime); }

/* Timer */
.timer {
  position: relative;
  width: 88px;
  height: 88px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--white);
  margin-top: 8px; /* so it floats slightly down */
}
.timer__ring {
  position: absolute;
  inset: 0;
  transform: rotate(-90deg);
}
.timer__ring-bg {
  fill: none;
  stroke: rgba(255,255,255,0.08);
  stroke-width: 6;
}
.timer__ring-fg {
  fill: none;
  stroke: var(--brand-lime);
  stroke-width: 6;
  stroke-linecap: round;
  transition: stroke-dashoffset 980ms linear, stroke 200ms;
}
.topbar.is-critical .timer__ring-fg { stroke: #ff6060; }
.timer__num {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 32px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  color: var(--white);
}
.topbar.is-critical .timer__num {
  color: #ff8a8a;
  animation: timer-shake 0.4s ease-in-out infinite;
}
@keyframes timer-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-1px); }
  75% { transform: translateX(1px); }
}
.timer__label {
  font-family: var(--font-display);
  font-size: 9px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.55);
  margin-top: -2px;
}

.topbar__right {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  justify-content: flex-end;
}
.score {
  text-align: right;
}
.score__num {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 28px;
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.score__hits { color: var(--brand-lime); }
.score__sep { color: rgba(255,255,255,0.3); margin: 0 2px; }
.score__total { color: rgba(255,255,255,0.6); font-weight: 400; }
.score__label {
  font-family: var(--font-display);
  font-size: 10px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.55);
  margin-top: 2px;
}
.icon-btn {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius-md);
  width: 36px; height: 36px;
  display: grid; place-items: center;
  color: var(--white);
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-standard);
}
.icon-btn:hover {
  background: rgba(208, 224, 16, 0.15);
  border-color: rgba(208, 224, 16, 0.4);
  color: var(--brand-lime);
}


/* =============================================
   RESPONSIVE — sidebar + topbar + board frame
   ============================================= */

/* Medium screens (1024–1280px): slim sidebar */
@media (max-width: 1280px) {
  .app { grid-template-columns: 1fr 200px; }
  .bingo { padding: var(--space-4) var(--space-3); }
  .bingo__item { font-size: 12px; padding: 6px 8px; }
  .bingo__count { font-size: 18px; }
  .topbar__game-name { font-size: 12px; }
  .topbar__logo { height: 26px; }
}

/* Small screens (<= 900px): hide sidebar, shrink topbar */
@media (max-width: 900px) {
  .app {
    grid-template-columns: 1fr;
    grid-template-rows: 56px 1fr;
    grid-template-areas: "top" "board";
  }
  .bingo { display: none !important; }
  .topbar { padding: 0 var(--space-4); }
  .topbar__logo { height: 22px; }
  .topbar__game-name { display: none; }
  .topbar__title .eyebrow { display: none; }
  .timer { width: 60px; height: 60px; margin-top: 4px; }
  .timer__num { font-size: 22px; }
  .score__num { font-size: 20px; }
  .board { padding: var(--space-2); }
  .board__frame {
    width: min(100%, calc((100vh - 56px - 16px) * (1920 / 1080)));
  }
}

/* Very small / landscape mobile (<= 600px) */
@media (max-width: 600px) {
  .topbar { display: flex; justify-content: space-between; align-items: center; }
  .topbar__left { gap: var(--space-2); }
}
