:root {
  --bg: #0d1117;
  --bg-card: #161b22;
  --bg-card-hover: #1c232c;
  --border: #2f333d;
  --text: #e6edf3;
  --muted: #8b949e;
  --accent: #ffd43b;
  --accent-soft: rgba(255, 212, 59, 0.15);
  --werewolf: #c2b0ff;
  --flashcards: #79c0ff;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.center { text-align: center; }
.muted { color: var(--muted); }

/* ===== Landing page (drone follower) ===== */
body.landing { overflow: hidden; height: 100vh; }
#sky {
  position: fixed; inset: 0;
  background:
    radial-gradient(circle at 30% 20%, rgba(121, 192, 255, 0.12), transparent 60%),
    radial-gradient(circle at 75% 70%, rgba(194, 176, 255, 0.10), transparent 60%),
    linear-gradient(180deg, #0a0e16 0%, #0d1117 100%);
  z-index: 0;
}
#drone {
  position: fixed;
  width: 100px; height: 100px;
  left: 0; top: 0;
  transform: translate3d(-1000px, -1000px, 0);
  pointer-events: none;
  z-index: 5;
  filter: drop-shadow(0 6px 12px rgba(0,0,0,0.5));
}
#drone .rotor {
  transform-box: fill-box;
  transform-origin: center;
  animation: spin 0.10s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.hero {
  position: relative;
  z-index: 10;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  text-align: center;
}
.hero-title {
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  margin: 0 0 0.5rem;
  letter-spacing: -0.02em;
}
.hero-tagline {
  margin: 0 0 2.5rem;
  font-size: 1.1rem;
  color: var(--muted);
}
.big-buttons {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  width: min(720px, 92vw);
}
@media (min-width: 640px) {
  .big-buttons { grid-template-columns: 1fr 1fr; }
}
.big-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  background: rgba(22, 27, 34, 0.85);
  backdrop-filter: blur(8px);
  border: 2px solid var(--border);
  border-radius: 14px;
  padding: 1.5rem 1.25rem;
  color: var(--text);
  text-decoration: none;
  transition: transform 0.15s, border-color 0.15s, background 0.15s;
  cursor: pointer;
}
.big-btn:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  text-decoration: none;
}
.big-btn.werewolf:hover { border-color: var(--werewolf); }
.big-btn.flashcards:hover { border-color: var(--flashcards); }
.big-btn.minecraft:hover { border-color: #8fce62; }

/* 3-button grid on wide screens */
@media (min-width: 900px) {
  .big-buttons { grid-template-columns: repeat(3, 1fr); }
}

/* Minecraft page */
.mc-status-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}
.mc-status-row {
  display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap;
}
.mc-status-dot {
  width: 14px; height: 14px; border-radius: 50%;
  display: inline-block;
  background: #999;
  box-shadow: 0 0 0 0 rgba(255,255,255,0.4);
}
.mc-status-dot.online {
  background: #4ade80;
  box-shadow: 0 0 10px rgba(74, 222, 128, 0.6);
  animation: pulse 2s ease-in-out infinite;
}
.mc-status-dot.offline { background: #f87171; box-shadow: 0 0 6px rgba(248, 113, 113, 0.4); }
@keyframes pulse { 50% { box-shadow: 0 0 18px rgba(74, 222, 128, 0.95); } }
.mc-status-text { font-size: 1.2rem; font-weight: 700; }
.mc-version { color: var(--muted); font-size: 0.95rem; margin-left: 0.5rem; }
.mc-motd { color: var(--muted); margin: 0.6rem 0 0; font-style: italic; }
.mc-error { color: #ffb3b3; margin-top: 0.5rem; }

.mc-section { margin: 2rem 0; }
.mc-section h2 { font-size: 1.15rem; margin: 0 0 0.75rem; }
.mc-address { display: flex; align-items: center; gap: 0.75rem; margin: 0.75rem 0; flex-wrap: wrap; }
.mc-address code {
  background: #0a0e16; border: 1px solid var(--border);
  padding: 0.55rem 0.85rem; border-radius: 6px;
  font-size: 1.05rem; color: var(--accent);
}
.mc-players, .mc-mods { list-style: none; padding: 0; margin: 0; }
.mc-players li, .mc-mods li {
  padding: 0.45rem 0.75rem; border-bottom: 1px solid var(--border);
}
.mc-players li:last-child, .mc-mods li:last-child { border-bottom: 0; }
.mc-mods li code { background: transparent; color: var(--text); padding: 0; font-size: 0.95rem; }
.small { font-size: 0.85rem; }
.big-btn-icon { font-size: 2.6rem; }
.big-btn-title { font-size: 1.4rem; font-weight: 700; }
.big-btn-sub { font-size: 0.9rem; color: var(--muted); }

/* ===== Topbar + container (interior pages) ===== */
.topbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
}
.topbar-back {
  color: var(--muted);
  font-size: 0.95rem;
}
.topbar-back:hover { color: var(--accent); text-decoration: none; }
.topbar-title {
  font-weight: 700;
  font-size: 1.1rem;
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}
.text-link { color: var(--accent); }

/* ===== Section grid (Chinese / Drones / ...) ===== */
.section-grid, .deck-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}
.section-card, .deck-card {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  color: var(--text);
  transition: transform 0.15s, border-color 0.15s, background 0.15s;
}
.section-card:hover, .deck-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  background: var(--bg-card-hover);
  text-decoration: none;
}
.section-icon { font-size: 2rem; }
.section-title { font-size: 1.4rem; font-weight: 700; }
.section-desc { color: var(--muted); font-size: 0.95rem; }
.section-count { color: var(--accent); font-size: 0.85rem; margin-top: 0.25rem; }
.deck-title { font-size: 1.2rem; font-weight: 700; }
.deck-subtitle { color: var(--muted); font-size: 0.9rem; }

/* ===== Deck / flashcard player ===== */
.deck-container { display: flex; flex-direction: column; align-items: center; }
.field-toggles {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 0.9rem;
}
.toggle-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.toggle-label {
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.8rem;
}
.toggle-group label {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  cursor: pointer;
}

.flashcard {
  width: min(620px, 92vw);
  height: 360px;
  perspective: 1200px;
  cursor: pointer;
  margin: 1rem 0;
}
.flashcard-inner {
  position: relative;
  width: 100%; height: 100%;
  transition: transform 0.5s cubic-bezier(0.6, -0.05, 0.4, 1.5);
  transform-style: preserve-3d;
}
.flashcard.flipped .flashcard-inner { transform: rotateY(180deg); }
.flashcard-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: 16px;
  padding: 2rem;
  text-align: center;
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
}
.flashcard-back { transform: rotateY(180deg); border-color: var(--accent-soft); }

.card-character {
  font-size: clamp(3rem, 10vw, 5.5rem);
  line-height: 1;
  font-weight: 600;
}
.card-pinyin {
  font-size: clamp(1.5rem, 4vw, 2.2rem);
  color: var(--accent);
  font-style: italic;
}
.card-english {
  font-size: clamp(1.1rem, 3vw, 1.5rem);
  color: var(--text);
}
.card-front-text, .card-back-text {
  font-size: clamp(1.1rem, 3vw, 1.5rem);
  line-height: 1.5;
}
.card-front-text strong, .card-back-text strong { color: var(--accent); }

.progress { color: var(--muted); margin: 0.5rem 0 1rem; font-size: 0.9rem; }

.card-controls {
  display: flex;
  gap: 0.5rem;
  margin: 0.35rem 0;
  flex-wrap: wrap;
  justify-content: center;
}
.ctrl {
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.7rem 1.1rem;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.ctrl:hover { background: var(--bg-card-hover); border-color: var(--accent); }
.ctrl.flip { background: var(--accent); color: #1a1d24; border-color: var(--accent); font-weight: 700; }
.ctrl.flip:hover { background: #ffe06b; }
.ctrl.small { padding: 0.5rem 0.9rem; font-size: 0.9rem; }

/* ===== utility ===== */
body.centered {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh;
}
