/* ---------- CSS Reset (minimal) ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

/* ---------- Theme variables ---------- */
:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --radius: 14px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1220;
    --surface: #0f172a;
    --text: #e5e7eb;
    --muted: #94a3b8;
    --border: #1e293b;
  }
}

/* ---------- Layout ---------- */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.25rem;
}

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  font-weight: 700;
  letter-spacing: -0.02em;
}

.footer {
  margin-top: 4rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.9rem;
}

/* ---------- Components ---------- */
.hero {
  padding: 3rem 0 2.5rem;
}

.hero h1 {
  font-size: clamp(2rem, 4vw, 3rem);
  margin: 0 0 0.75rem;
  letter-spacing: -0.03em;
}

.subtitle {
  color: var(--muted);
  max-width: 600px;
}

.actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.btn {
  padding: 0.65rem 1.1rem;
  border-radius: 999px;
  font-weight: 600;
  text-decoration: none;
  transition: transform 0.15s ease, background 0.15s ease;
}

.btn.primary {
  background: var(--primary);
  color: white;
}

.btn.primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.btn.ghost {
  border: 1px solid var(--border);
  color: var(--text);
}

.btn.ghost:hover {
  background: rgba(0, 0, 0, 0.04);
}

/* ---------- Cards ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
  margin-top: 2.5rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.06);
}

.card h3 {
  margin-top: 0;
}

/* ---------- Utility ---------- */
.chip {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.25rem 0.6rem;
  font-size: 0.75rem;
  color: var(--muted);
}

/* ---------- Topbar meta (user + actions) ---------- */
.meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.inline-form {
  margin: 0;
}

.btn.btn-sm {
  padding: 0.4rem 0.85rem;
  font-size: 0.85rem;
}

/* Slightly stronger chip for user info */
.chip-email {
  color: var(--text);
  background: var(--surface);
}

/* Role/class chip variants */
.chip-class {
  color: white;
  border: none;
}

.chip-admin {
  background: #ef4444; /* red */
}

.chip-user {
  background: var(--primary); /* default blue */
}

.chip-teacher {
  background: #8b5cf6; /* purple */
}

.chip-student {
  background: #22c55e; /* green */
}

.chip-customer { background: #22c55e; } /* optional */

.btn-logout {
  background-color: #C2FBD7;
border-radius: 50px;
border-width: 0;
box-shadow: rgba(25, 25, 25, 0.04) 0 0 1px 0, rgba(0, 0, 0, 0.1) 0 3px 4px 0;
color: #008000;
cursor: pointer;
display: inline-block;
font-family: Arial, sans-serif;
font-size: 1em;
height: 50px;
padding: 0 25px;
transition: all 200ms;
}

.tv-wrap{
  min-height: calc(100vh - 70px);
  padding: 1.25rem;
  display: grid;
  gap: 1rem;
}

.tv-header{
  display:flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.tv-title{
  font-weight: 800;
  font-size: 1.25rem;
}

.tv-status{
  color: var(--muted);
}

.tv-body{
  display:grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 1.25rem;
  align-items: center;
}

.tv-clue{
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  font-size: clamp(1.5rem, 3vw, 2.6rem);
  font-weight: 800;
  line-height: 1.15;
}

.tv-qr{
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
}

.tv-qr img{
  width: 100%;
  max-width: 520px;
  height: auto;
}

.tv-qr-label{
  margin-top: .75rem;
  color: var(--muted);
  font-weight: 700;
}

/* TV fullscreen mode: hide header */
body.is-fullscreen .tv-topbar {
  display: none;
}

/* If your layout relies on sticky header spacing, ensure content uses full height */
body.is-fullscreen .container {
  max-width: 100%;
}

/* ---------- Sub-navigation for kit pages ---------- */
.subnav{
  display:flex;
  gap:.5rem;
  flex-wrap:wrap;
  margin: 1rem 0 1.25rem;
}

.subnav-link{
  padding: .45rem .85rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  font-size: .9rem;
  background: var(--surface);
}

.subnav-link:hover{
  background: rgba(0,0,0,.04);
}

.subnav-link.active{
  border-color: var(--primary);
  color: var(--primary);
}

/* ---------- Progress bar ---------- */
.progress{
  height: 10px;
  border-radius: 999px;
  background: rgba(0,0,0,.06);
  overflow:hidden;
  margin-top: .5rem;
}

.progress-bar{
  height: 100%;
  background: var(--primary);
  border-radius: 999px;
}

.tv-codebox{
  margin-top: .75rem;
  padding: .75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.tv-codebox-title{
  font-weight: 700;
  color: var(--muted);
  margin-bottom: .5rem;
}
.tv-codebox form{
  display:flex;
  gap:.5rem;
  align-items:center;
}
.tv-codebox input{
  flex:1;
  padding:.5rem .75rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: 1rem;
}

/* TV layout: 3 columns (main clue, QR, sidebar) */
.tv-body-3col{
  display:grid;
  grid-template-columns: 1.2fr 1fr 0.8fr;
  gap: 1.25rem;
  align-items: start;
}

/* Sidebar */
.tv-side{
  display:grid;
  gap: 1rem;
}

.tv-side-card{
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}

.tv-side-title{
  margin: 0 0 .75rem;
  font-size: 1rem;
}

.tv-side-list{
  display:grid;
  gap: .5rem;
}

.tv-side-row{
  display:grid;
  grid-template-columns: 28px 1fr 48px;
  gap: .5rem;
  align-items:center;
  padding: .35rem .5rem;
  border-radius: 10px;
  background: rgba(0,0,0,.03);
}

.tv-side-row .tv-rank{
  font-weight: 800;
  color: var(--muted);
  text-align:center;
}

.tv-side-row .tv-name{
  font-weight: 700;
  overflow:hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tv-side-row .tv-score{
  font-weight: 800;
  text-align:right;
}

.tv-side-row .tv-mini{
  font-weight: 700;
  color: var(--muted);
  text-align:right;
}

.tv-side-empty{
  color: var(--muted);
}

.tv-clue {
  transition: opacity .5s ease;
}
.fade-out {
  opacity: 0;
}