:root {
  --bg: #0a0a0f;
  --bg-2: #12121a;
  --bg-3: #1a1a26;
  --fg: #f0f0f5;
  --muted: #7a7a8c;
  --accent: #d6ff3d;
  --accent-2: #ff3dc8;
  --accent-3: #3dd9ff;
  --easy: #3dd9ff;
  --medium: #d6ff3d;
  --hard: #ff3d6e;
  --silly: #ff9d3d;
  --border: rgba(214, 255, 61, 0.15);
  --shadow: 0 0 40px rgba(214, 255, 61, 0.08);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  background: var(--bg);
  color: var(--fg);
  min-height: 100vh;
  overflow-x: hidden;
  background-image:
    radial-gradient(circle at 20% 0%, rgba(214, 255, 61, 0.08), transparent 40%),
    radial-gradient(circle at 80% 100%, rgba(255, 61, 200, 0.06), transparent 40%);
}

.scanlines {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    rgba(255, 255, 255, 0.015) 0px,
    rgba(255, 255, 255, 0.015) 1px,
    transparent 1px,
    transparent 3px
  );
  z-index: 1;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 2rem;
  border-bottom: 1px solid var(--border);
  background: rgba(10, 10, 15, 0.85);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: 'Press Start 2P', monospace;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
}

.logo-mark { font-size: 1.4rem; filter: drop-shadow(0 0 8px var(--accent)); }
.logo-text { color: var(--accent); }

.stats { display: flex; gap: 1.5rem; }

.stat {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-family: 'Press Start 2P', monospace;
  font-size: 0.65rem;
  line-height: 1.6;
}

.stat-num { color: var(--accent); font-size: 0.95rem; }
.stat-label { color: var(--muted); font-size: 0.55rem; text-transform: uppercase; }

.container {
  max-width: 880px;
  margin: 0 auto;
  padding: 3rem 1.5rem 4rem;
  position: relative;
  z-index: 2;
}

.hero { text-align: center; margin-bottom: 3rem; }

.kicker {
  font-family: 'Press Start 2P', monospace;
  font-size: 0.65rem;
  color: var(--accent);
  letter-spacing: 0.2em;
  margin-bottom: 1.5rem;
  opacity: 0.8;
}

.hero h1 {
  font-size: clamp(1.75rem, 5vw, 3rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
}

.hero-accent {
  color: var(--accent);
  text-shadow: 0 0 25px rgba(214, 255, 61, 0.4);
}

.subtitle {
  color: var(--muted);
  font-size: 1.05rem;
  max-width: 32ch;
  margin: 0 auto;
}

.quest-area { margin-bottom: 3rem; }

.quest-card {
  position: relative;
  background: linear-gradient(145deg, var(--bg-2), var(--bg-3));
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2.5rem 2rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s;
  min-height: 280px;
  display: flex;
  flex-direction: column;
}

.quest-card.flipping {
  animation: flip 0.5s ease;
}

@keyframes flip {
  0% { transform: rotateX(0); opacity: 1; }
  50% { transform: rotateX(90deg); opacity: 0; }
  100% { transform: rotateX(0); opacity: 1; }
}

.card-corner {
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid var(--accent);
}
.top-left { top: -1px; left: -1px; border-right: none; border-bottom: none; }
.top-right { top: -1px; right: -1px; border-left: none; border-bottom: none; }
.bottom-left { bottom: -1px; left: -1px; border-right: none; border-top: none; }
.bottom-right { bottom: -1px; right: -1px; border-left: none; border-top: none; }

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  font-family: 'Press Start 2P', monospace;
  font-size: 0.6rem;
  letter-spacing: 0.1em;
}

.quest-category {
  background: rgba(214, 255, 61, 0.12);
  color: var(--accent);
  padding: 0.5rem 0.75rem;
  border-radius: 2px;
}

.quest-difficulty {
  padding: 0.5rem 0.75rem;
  border-radius: 2px;
  background: rgba(61, 217, 255, 0.12);
  color: var(--easy);
}
.quest-difficulty.medium { background: rgba(214, 255, 61, 0.12); color: var(--medium); }
.quest-difficulty.hard { background: rgba(255, 61, 110, 0.12); color: var(--hard); }
.quest-difficulty.silly { background: rgba(255, 157, 61, 0.12); color: var(--silly); }

.quest-title {
  font-size: clamp(1.5rem, 3.5vw, 2.25rem);
  line-height: 1.2;
  margin-bottom: 1rem;
  letter-spacing: -0.01em;
}

.quest-description {
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.6;
  margin-bottom: auto;
  padding-bottom: 1.5rem;
}

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 1.5rem;
  border-top: 1px dashed var(--border);
  font-family: 'Press Start 2P', monospace;
  font-size: 0.7rem;
}

.quest-xp { color: var(--accent); }
.xp-num { font-size: 0.95rem; }
.quest-time { color: var(--muted); }

.actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

@media (min-width: 600px) {
  .actions {
    grid-template-columns: 2fr 1fr 1fr;
  }
}

.btn {
  position: relative;
  font-family: 'Press Start 2P', monospace;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  padding: 1.1rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: var(--bg-2);
  color: var(--fg);
  cursor: pointer;
  transition: all 0.2s;
  overflow: hidden;
  text-transform: uppercase;
}

.btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.btn:active:not(:disabled) { transform: translateY(0); }

.btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
  font-size: 0.85rem;
}

.btn-primary:hover:not(:disabled) {
  box-shadow: 0 6px 30px rgba(214, 255, 61, 0.4);
}

.btn-glow {
  position: absolute;
  top: 0; left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  transition: left 0.6s;
}

.btn-primary:hover .btn-glow { left: 100%; }

.btn-secondary {
  background: rgba(61, 217, 255, 0.1);
  color: var(--easy);
  border-color: rgba(61, 217, 255, 0.3);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
}

.filters {
  text-align: center;
  margin-bottom: 3rem;
}

.filter-label {
  font-family: 'Press Start 2P', monospace;
  font-size: 0.6rem;
  color: var(--muted);
  letter-spacing: 0.15em;
  margin-bottom: 1rem;
}

.filter-chips {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

.chip {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 500;
  font-size: 0.85rem;
  padding: 0.55rem 1rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s;
}

.chip:hover { color: var(--fg); border-color: var(--accent); }

.chip.active {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}

.recent-title {
  font-family: 'Press Start 2P', monospace;
  font-size: 0.7rem;
  color: var(--muted);
  letter-spacing: 0.15em;
  margin-bottom: 1rem;
  text-align: center;
}

.recent-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.recent-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 2px;
  font-size: 0.9rem;
}

.recent-list .recent-cat { font-size: 1.1rem; margin-right: 0.5rem; }
.recent-list .recent-name { flex: 1; color: var(--fg); }
.recent-list .recent-xp { color: var(--accent); font-family: 'Press Start 2P', monospace; font-size: 0.65rem; }

.footer {
  text-align: center;
  padding: 2rem 1.5rem 3rem;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.6;
  border-top: 1px solid var(--border);
  margin-top: 2rem;
}

.footer a { color: var(--accent); text-decoration: none; }
.footer a:hover { text-decoration: underline; }
.footer-small { font-size: 0.75rem; margin-top: 0.5rem; opacity: 0.7; }

.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  background: var(--accent);
  color: var(--bg);
  padding: 1rem 1.5rem;
  border-radius: 2px;
  font-family: 'Press Start 2P', monospace;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  z-index: 100;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}

.toast.show { transform: translateX(-50%) translateY(0); }

@media (max-width: 600px) {
  .topbar { padding: 1rem; }
  .stats { gap: 1rem; }
  .container { padding: 2rem 1rem 3rem; }
  .quest-card { padding: 2rem 1.25rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
