/* ==========================================================
   St. Mary's Typing Champions — Design System
   A "keycap arcade" aesthetic: deep indigo canvas, warm gold +
   coral + teal accents, rounded playful display type paired
   with clean body copy and a monospace face for typed text.
   ========================================================== */

@import url('https://fonts.googleapis.com/css2?family=Baloo+2:wght@500;600;700;800&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  --bg:            #0F1631;
  --bg-elevated:   #161F45;
  --surface:       #1E2A57;
  --surface-hi:    #263468;
  --border:        #33407A;

  --gold:          #F5B93D;
  --gold-dim:      #B8891E;
  --coral:         #FF6B5B;
  --teal:          #2DD4BF;
  --violet:        #9B8CFF;

  --text:          #F4F1EA;
  --text-dim:      #AAB2D6;
  --text-faint:    #6B74A3;

  --font-display:  'Baloo 2', system-ui, sans-serif;
  --font-body:     'Inter', system-ui, sans-serif;
  --font-mono:     'JetBrains Mono', 'Courier New', monospace;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;

  --shadow-key: 0 4px 0 rgba(0,0,0,0.35), 0 8px 18px rgba(0,0,0,0.25);
  --shadow-key-pressed: 0 1px 0 rgba(0,0,0,0.35), 0 2px 6px rgba(0,0,0,0.2);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: radial-gradient(ellipse at top, #14204A 0%, var(--bg) 55%);
  color: var(--text);
  font-family: var(--font-body);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, .display {
  font-family: var(--font-display);
  font-weight: 700;
  margin: 0 0 0.4em;
  letter-spacing: 0.2px;
}

a { color: inherit; text-decoration: none; }

.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- Keycap component — the signature element ---------- */
.keycap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(180deg, var(--surface-hi), var(--surface));
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-key);
  color: var(--text);
  font-family: var(--font-display);
  font-weight: 600;
  padding: 12px 22px;
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
  user-select: none;
}
.keycap:hover { transform: translateY(-2px); }
.keycap:active,
.keycap.pressed {
  transform: translateY(3px);
  box-shadow: var(--shadow-key-pressed);
}
.keycap.gold  { background: linear-gradient(180deg, #FFCF63, var(--gold)); color: #241A03; border-color: var(--gold-dim); }
.keycap.coral { background: linear-gradient(180deg, #FF8B7D, var(--coral)); color: #2B0803; border-color: #B8402F; }
.keycap.teal  { background: linear-gradient(180deg, #5EEFDD, var(--teal)); color: #04302B; border-color: #1B9C8C; }
.keycap.ghost { background: transparent; box-shadow: none; border-color: var(--border); color: var(--text-dim); }
.keycap.ghost:hover { color: var(--text); border-color: var(--text-dim); }
.keycap.sm { padding: 8px 14px; font-size: 0.85rem; border-radius: var(--radius-sm); box-shadow: none; }
.keycap:disabled, .keycap.disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

button.keycap { font-family: var(--font-display); font-size: 1rem; border-width: 1px; }

/* ---------- Cards / surfaces ---------- */
.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 14px;
  font-size: 0.8rem;
  color: var(--text-dim);
}

/* ---------- Top nav ---------- */
.topnav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 32px;
}
.topnav .brand {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-display); font-weight: 800; font-size: 1.25rem;
}
.topnav .brand .mark {
  width: 38px; height: 38px; border-radius: 10px;
  background: linear-gradient(160deg, var(--gold), var(--coral));
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-key);
  font-size: 1.1rem;
}
.topnav nav { display: flex; gap: 8px; align-items: center; }
.topnav nav a.navlink {
  padding: 8px 14px; border-radius: var(--radius-sm); color: var(--text-dim); font-weight: 600; font-size: 0.92rem;
}
.topnav nav a.navlink:hover, .topnav nav a.navlink.active { color: var(--text); background: var(--surface); }

/* ---------- Forms ---------- */
label { display: block; font-size: 0.85rem; color: var(--text-dim); margin-bottom: 6px; font-weight: 600; }
input, select, textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 12px 14px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  margin-bottom: 16px;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--gold);
  outline-offset: 1px;
}
.field-hint { font-size: 0.78rem; color: var(--text-faint); margin-top: -12px; margin-bottom: 16px; }

.auth-shell {
  max-width: 420px;
  margin: 8vh auto;
  padding: 0 20px;
}

.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 18px;
  font-size: 0.9rem;
}
.alert.error   { background: rgba(255,107,91,0.14); border: 1px solid var(--coral); color: #FFB3A8; }
.alert.success { background: rgba(45,212,191,0.14); border: 1px solid var(--teal); color: #9FF3E8; }

/* ---------- Progress bar rendered as a lighting-up key row ---------- */
.key-progress { display: flex; gap: 4px; }
.key-progress .k {
  flex: 1; height: 10px; border-radius: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
}
.key-progress .k.lit { background: linear-gradient(90deg, var(--gold), var(--coral)); border-color: transparent; }

/* ---------- Stat grid ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 16px; }
.stat-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 16px 18px; }
.stat-box .num { font-family: var(--font-display); font-size: 1.9rem; font-weight: 700; }
.stat-box .lbl { color: var(--text-dim); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; }

/* ---------- Lesson / typing area ---------- */
.type-stage {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
}
.type-text {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  line-height: 2;
  letter-spacing: 0.3px;
  color: var(--text-faint);
}
.type-text .char-correct { color: var(--teal); }
.type-text .char-wrong { color: var(--coral); background: rgba(255,107,91,0.18); border-radius: 3px; }
.type-text .char-current { color: var(--bg); background: var(--gold); border-radius: 3px; }
.type-input {
  width: 100%;
  margin-top: 24px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 1.15rem;
  padding: 16px;
  resize: none;
}
.type-input:focus { outline: none; border-color: var(--gold); }

.live-stats { display: flex; gap: 28px; margin-top: 18px; }
.live-stats .item { text-align: center; }
.live-stats .item .v { font-family: var(--font-display); font-size: 1.6rem; }
.live-stats .item .l { font-size: 0.75rem; color: var(--text-dim); text-transform: uppercase; }

/* ---------- Category chip ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.78rem; font-weight: 600;
  padding: 4px 10px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-dim);
}

/* ---------- Table (admin) ---------- */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
th { color: var(--text-dim); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; }
tr:hover td { background: rgba(255,255,255,0.02); }

/* ---------- Achievement badge tile ---------- */
.ach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.ach-tile {
  text-align: center; padding: 18px 10px; border-radius: var(--radius-md);
  background: var(--surface); border: 1px solid var(--border);
}
.ach-tile .icon { font-size: 2rem; }
.ach-tile.locked { opacity: 0.35; filter: grayscale(1); }
.ach-tile .name { font-family: var(--font-display); font-size: 0.9rem; margin-top: 6px; }
.ach-tile .desc { font-size: 0.72rem; color: var(--text-dim); margin-top: 2px; }

/* ---------- Landing hero ---------- */
.hero {
  padding: 64px 0 40px;
  text-align: center;
}
.hero h1 { font-size: 2.6rem; }
.hero p.lead { color: var(--text-dim); font-size: 1.05rem; max-width: 560px; margin: 0 auto 28px; }
.hero-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

.role-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 48px; }
@media (max-width: 640px) { .role-cards { grid-template-columns: 1fr; } }

footer.sitefoot { text-align: center; color: var(--text-faint); font-size: 0.8rem; padding: 40px 0; }

.text-dim { color: var(--text-dim); }
.mt-0 { margin-top: 0; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
