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

:root{
  --bg:#1B1533;
  --surface:#251E42;
  --surface-2:#2E2653;
  --line:#3B3268;
  --text:#EDEAFB;
  --muted:#9C93C4;
  --coral:#FF6B6B;
  --mint:#7CFFB2;
  --gold:#FFD166;
  --sky:#5FC9F8;
}

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

body{
  background:
    radial-gradient(circle at 15% 0%, rgba(95,201,248,0.12), transparent 40%),
    radial-gradient(circle at 85% 10%, rgba(255,107,107,0.10), transparent 40%),
    var(--bg);
  color:var(--text);
  font-family:'Inter', sans-serif;
  min-height:100vh;
  overflow-x:hidden;
}

h1,h2,h3, .brand, .btn, .level-name{ font-family:'Fredoka', sans-serif; }
.mono, .type-target, .type-input, .word-chip, .stat-value{ font-family:'JetBrains Mono', monospace; }

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

/* ---------- Header ---------- */
.site-header{
  display:flex; align-items:center; justify-content:space-between;
  padding:20px 6%;
}
.brand{ font-size:1.5rem; font-weight:700; letter-spacing:0.3px; }
.brand .k1{ color:var(--coral); }
.brand .k2{ color:var(--sky); }
.brand .k3{ color:var(--gold); }
.site-nav{ display:flex; gap:22px; font-size:0.9rem; color:var(--muted); }
.site-nav a:hover{ color:var(--text); }

/* ---------- Hero ---------- */
.hero{ text-align:center; padding:20px 6% 10px; }
.hero h1{ font-size:2.4rem; font-weight:700; margin-bottom:10px; line-height:1.2; }
.hero h1 .accent{ color:var(--gold); }
.hero p{ color:var(--muted); font-size:1.05rem; max-width:560px; margin:0 auto; }

/* ---------- Level picker ---------- */
.level-grid{
  max-width:1000px; margin:36px auto; padding:0 6%;
  display:grid; grid-template-columns:repeat(4,1fr); gap:16px;
}
.level-card{
  background:var(--surface); border:2px solid var(--line); border-radius:16px;
  padding:20px 16px; cursor:pointer; text-align:center;
  transition:transform 0.15s ease, border-color 0.15s ease;
}
.level-card:hover{ transform:translateY(-4px); border-color:var(--sky); }
.level-card.selected{ border-color:var(--gold); background:var(--surface-2); }
.level-badge{
  width:44px; height:44px; border-radius:50%; margin:0 auto 10px;
  display:flex; align-items:center; justify-content:center;
  font-family:'Fredoka', sans-serif; font-weight:700; font-size:1.2rem;
  background:linear-gradient(135deg, var(--coral), var(--gold));
  color:var(--bg);
}
.level-name{ font-size:1.05rem; font-weight:600; margin-bottom:4px; }
.level-tagline{ color:var(--muted); font-size:0.78rem; }

/* ---------- Mode cards ---------- */
.mode-grid{
  max-width:1000px; margin:10px auto 60px; padding:0 6%;
  display:grid; grid-template-columns:1fr 1fr; gap:22px;
}
.mode-card{
  background:var(--surface); border:2px solid var(--line); border-radius:20px;
  padding:30px 26px; position:relative; overflow:hidden;
}
.mode-card .tag{
  display:inline-block; background:var(--surface-2); color:var(--sky);
  font-size:0.72rem; font-weight:700; letter-spacing:0.5px; text-transform:uppercase;
  padding:4px 10px; border-radius:20px; margin-bottom:14px;
}
.mode-card h2{ font-size:1.4rem; margin-bottom:8px; }
.mode-card p{ color:var(--muted); font-size:0.9rem; margin-bottom:20px; line-height:1.5; }
.btn{
  display:inline-block; border:none; border-radius:10px; padding:12px 26px;
  font-weight:600; font-size:0.95rem; cursor:pointer;
}
.btn-primary{ background:var(--coral); color:#241428; }
.btn-primary:hover{ background:#ff8080; }
.btn-secondary{ background:var(--sky); color:#0e2233; }
.btn-secondary:hover{ background:#7fd6ff; }
.btn:disabled{ opacity:0.4; cursor:not-allowed; }

/* ---------- Falling Words Game ---------- */
.game-wrap{ max-width:900px; margin:20px auto 60px; padding:0 6%; }
.game-hud{
  display:flex; justify-content:space-between; align-items:center;
  background:var(--surface); border:1px solid var(--line); border-radius:14px;
  padding:14px 22px; margin-bottom:16px; flex-wrap:wrap; gap:10px;
}
.hud-item{ text-align:center; }
.hud-label{ color:var(--muted); font-size:0.72rem; text-transform:uppercase; letter-spacing:0.5px; }
.hud-value{ font-size:1.3rem; font-weight:700; font-family:'JetBrains Mono', monospace; }
.hud-value.timer{ color:var(--gold); }
.hud-value.score{ color:var(--mint); }
.hud-value.missed{ color:var(--coral); }

.game-field{
  position:relative; height:420px; background:var(--surface);
  border:2px solid var(--line); border-radius:16px; overflow:hidden;
}
.game-field::after{
  content:""; position:absolute; left:0; right:0; bottom:52px; height:2px;
  background:repeating-linear-gradient(90deg, var(--coral) 0 10px, transparent 10px 20px);
  opacity:0.5;
}
.word-chip{
  position:absolute; top:-40px; background:var(--surface-2); border:2px solid var(--sky);
  color:var(--text); padding:8px 14px; border-radius:8px; font-size:1rem; font-weight:500;
  white-space:nowrap; box-shadow:0 4px 0 rgba(0,0,0,0.25);
}
.word-chip.matched-progress{ border-color:var(--mint); color:var(--mint); }

.game-input-row{ margin-top:16px; }
.type-input{
  width:100%; padding:16px 18px; font-size:1.15rem; border-radius:12px;
  border:2px solid var(--line); background:var(--surface); color:var(--text);
  outline:none;
}
.type-input:focus{ border-color:var(--gold); }

.overlay{
  position:absolute; inset:0; background:rgba(27,21,51,0.92);
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  text-align:center; gap:10px; padding:20px;
}
.overlay h2{ font-size:1.8rem; }
.overlay .big-stat{ font-size:2.6rem; font-weight:700; color:var(--gold); font-family:'JetBrains Mono', monospace; }

/* ---------- Paragraph Test ---------- */
.type-target{
  font-size:1.25rem; line-height:2; background:var(--surface); border:2px solid var(--line);
  border-radius:16px; padding:28px; letter-spacing:0.2px;
  white-space:normal; word-wrap:break-word; overflow-wrap:break-word;
}
.type-target span.correct{ color:var(--mint); }
.type-target span.incorrect{ color:var(--coral); background:rgba(255,107,107,0.15); border-radius:2px; }
.type-target span.current{ background:var(--gold); color:var(--bg); border-radius:2px; }

.results-grid{
  display:grid; grid-template-columns:repeat(3,1fr); gap:16px; margin-top:20px;
}
.result-box{
  background:var(--surface); border:1px solid var(--line); border-radius:14px;
  padding:20px; text-align:center;
}
.stat-value{ font-size:1.8rem; font-weight:700; color:var(--gold); }
.stat-label{ color:var(--muted); font-size:0.8rem; margin-top:4px; }

footer{ text-align:center; padding:30px; color:var(--muted); font-size:0.85rem; }
.footer-tagline{ margin-bottom:12px; }
.footer-links{ display:flex; justify-content:center; gap:18px; flex-wrap:wrap; }
.footer-links a{ color:var(--muted); }
.footer-links a:hover{ color:var(--sky); }

/* ---------- Info pages (About / Privacy / Contact) ---------- */
.info-wrap{ max-width:760px; margin:20px auto 60px; padding:0 6%; }
.info-wrap h1{ font-size:2rem; margin-bottom:18px; }
.info-wrap h2{ font-size:1.25rem; margin:26px 0 10px; color:var(--sky); }
.info-wrap p{ color:var(--text); line-height:1.75; margin-bottom:14px; opacity:0.92; }
.info-wrap ul{ color:var(--text); line-height:1.75; margin:0 0 14px 22px; opacity:0.92; }
.info-wrap a.inline-link{ color:var(--gold); text-decoration:underline; }
.info-updated{ color:var(--muted); font-size:0.82rem; margin-bottom:24px; }

/* ---------- Homepage extra content ---------- */
.about-section{ max-width:900px; margin:10px auto 40px; padding:0 6%; }
.about-section h2{ font-size:1.5rem; margin-bottom:14px; }
.about-section p{ color:var(--muted); line-height:1.75; margin-bottom:14px; }
.faq-item{ margin-bottom:16px; }
.faq-item h3{ font-size:1.02rem; margin-bottom:6px; color:var(--text); }
.faq-item p{ color:var(--muted); font-size:0.92rem; line-height:1.6; }

@media(max-width:800px){
  .level-grid{ grid-template-columns:repeat(2,1fr); }
  .mode-grid{ grid-template-columns:1fr; }
  .results-grid{ grid-template-columns:1fr; }
  .site-nav{ display:none; }
}
.type-target{
  font-size:1.25rem; line-height:2; background:var(--surface); border:2px solid var(--line);
  border-radius:16px; padding:28px; letter-spacing:0.2px;
  white-space:normal; word-wrap:break-word; overflow-wrap:break-word;
  user-select:none; -webkit-user-select:none; -moz-user-select:none;
}
