/* === Root variables for sizing and colors === */
:root {
  --board-max: 90vmin;   /* board scales with viewport */
  --board-cap: 1100px;   /* max size on big screens */
  --gap: 8px;            /* spacing between cells */
  --cell-min: 64px;      /* minimum size of each square cell */
  --bg-dark: #000;
  --bg-card: #0f0f0f;
  --bg-cell: #1a1a1a;
  --bg-cell-filled: #2a2a2a;
  --border: #444;
  --text: #eee;
  --muted: #bdbdbd;
  --accent: #111;
  --link: #7dd3fc;
}

/* === Page base === */
html, body {
  height: 100%;
}
body {
  margin: 0;
  background: var(--bg-dark);
  color: var(--text);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

/* === Top Banner === */
.top-banner {
  width: 100%;
  box-sizing: border-box;
  background: linear-gradient(180deg, #131313, #0b0b0b);
  border-bottom: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
}
.banner-logo,
.banner-mascot {
  width: clamp(48px, 8vw, 90px);
  height: auto;
  justify-self: start;
}
.banner-mascot { justify-self: end; }
.banner-title {
  text-align: center;
}
.banner-school {
  font-size: clamp(1.2rem, 3vw, 1.8rem);
  font-weight: 800;
  letter-spacing: 0.3px;
}
.banner-subtitle {
  font-size: clamp(0.9rem, 2.2vw, 1.1rem);
  color: var(--muted);
  margin-top: 2px;
}

/* === Two-column layout (main + sidebar) === */
.layout {
  width: min(1200px, 96vw);
  margin: 12px auto 32px;
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 16px;
}
@media (max-width: 980px) {
  .layout {
    grid-template-columns: 1fr;
  }
  .sidebar {
    order: -1; /* show sidebar above board on small screens */
  }
}

/* === Header and title === */
header {
  width: 100%;
  padding: 16px 4px 0;
  text-align: center;
}
#board-title {
  margin: 0 0 8px 0;
  font-size: clamp(1.25rem, 2.5vw, 2rem);
  font-weight: 700;
}

/* === Ticker banner under title === */
#ticker {
  margin: 0.25rem auto 1rem;
  padding: 0.5rem 1rem;
  background: var(--accent);
  color: var(--text);
  font-size: clamp(1rem, 1.8vw, 1.2rem);
  font-weight: 600;
  text-align: center;
  border-radius: 6px;
  min-height: 1.6em; /* keeps height steady while cycling */
  width: min(var(--board-max), var(--board-cap));
}
.ticker-item {
  display: inline-block;
  animation: tickerFade 0.3s ease;
}
/* highlight just the student's name in the ticker */
#ticker .student-name {
  color: #22c55e;        /* bright green */
  font-weight: 800;      /* bold for emphasis */
}

@keyframes tickerFade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* === 10×10 Board === */
.board {
  width: min(var(--board-max), var(--board-cap));
  margin: 0 auto 24px;
  display: grid;
  grid-template-columns: repeat(10, minmax(var(--cell-min), 1fr));
  gap: var(--gap);
}

/* === Cells === */
.public-cell {
  aspect-ratio: 1 / 1;               /* force square shape */
  background: var(--bg-cell);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 6px;
  box-sizing: border-box;
  transition: background 0.2s ease;
}
.public-cell.filled {
  background: var(--bg-cell-filled);
}

/* === Numbers and names inside cells === */
.public-cell .number {
  font-weight: 700;
  font-size: clamp(0.8rem, 1.6vw, 1.1rem);
  line-height: 1.1;
}
.public-cell .name {
  font-size: clamp(0.7rem, 1.4vw, 0.95rem);
  opacity: 0.95;
  text-align: center;
  margin-top: 4px;
  line-height: 1.15;
  padding: 0 4px;
  word-break: break-word;
}
.public-cell .teacher {
  font-size: clamp(0.6rem, 1.2vw, 0.8rem);
  color: #4ade80;   /* green text */
  margin-top: 2px;
  text-align: center;
  line-height: 1.1;
}

/* === Sidebar === */
.sidebar {
  width: 100%;
}
.sidebar-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
}
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.sidebar-header h2 {
  margin: 0;
  font-size: 1.1rem;
}
.view-all-link {
  color: var(--link);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
}
.view-all-link:hover {
  text-decoration: underline;
}
.winners-list {
  margin: 0.25rem 0 0;
  padding-left: 1.2rem;
  max-height: 60vh;
  overflow: auto;
}
.winners-list li {
  margin: 4px 0;
  line-height: 1.25;
  font-size: 0.95rem;
  color: var(--text);
}
.winners-list li .when {
  color: var(--muted);
  font-size: 0.85em;
  margin-left: 4px;
}
