/* ReactionTimer.io — Main Stylesheet */
:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --border: #2a2d3a;
  --text: #e4e6ef;
  --text-secondary: #8b8fa3;
  --accent: #6c5ce7;
  --accent-hover: #7d6ff0;
  --accent-glow: rgba(108, 92, 231, 0.3);
  --success: #00d2a0;
  --danger: #ff5e5e;
  --warning: #ffb347;
  --radius: 12px;
  --radius-lg: 20px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --shadow: 0 4px 24px rgba(0,0,0,0.3);
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* Layout */
.site-wrap {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 260px;
  min-height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 24px 16px;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  overflow-y: auto;
  z-index: 100;
}

.sidebar-logo {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 32px;
  display: block;
}
.sidebar-logo span { color: var(--accent); }
.sidebar-logo:hover { color: var(--text); }

.sidebar-section {
  margin-bottom: 24px;
}

.sidebar-title {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-secondary);
  margin-bottom: 8px;
  padding-left: 8px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 0.9rem;
  transition: all 0.15s;
  margin-bottom: 2px;
}

.sidebar-link:hover,
.sidebar-link.active {
  background: rgba(108, 92, 231, 0.12);
  color: var(--text);
}

.sidebar-link.active {
  color: var(--accent);
  font-weight: 600;
}

.sidebar-icon {
  width: 20px;
  height: 20px;
  fill: currentColor;
  flex-shrink: 0;
}

/* Main content */
.main-content {
  margin-left: 260px;
  flex: 1;
  padding: 32px 40px;
  max-width: 960px;
}

/* Header */
.page-header {
  margin-bottom: 32px;
}

.breadcrumb {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.breadcrumb a { color: var(--text-secondary); }
.breadcrumb a:hover { color: var(--text); }

.page-header h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 8px;
}
.page-header p {
  color: var(--text-secondary);
  font-size: 1.05rem;
}

/* Game card area */
.game-area {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 48px 24px;
  text-align: center;
  margin-bottom: 32px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  min-height: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  user-select: none;
  -webkit-user-select: none;
}

.game-area::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--success), var(--warning), var(--danger));
}

/* Game states */
.game-state { text-align: center; }
.game-state h2 { font-size: 1.4rem; margin-bottom: 8px; }
.game-state p { color: var(--text-secondary); margin-bottom: 24px; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 32px;
  border-radius: 50px;
  font-size: 1rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  outline: none;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 16px var(--accent-glow);
}
.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 24px var(--accent-glow);
}

.btn-secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  background: var(--surface);
  border-color: var(--text-secondary);
}

.btn-sm {
  padding: 8px 20px;
  font-size: 0.85rem;
}

/* Reaction test specific */
.reaction-screen {
  width: 100%;
  min-height: 300px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.1s;
}

.reaction-wait {
  background: var(--danger);
  color: #fff;
  font-size: 1.5rem;
  font-weight: 700;
}

.reaction-ready {
  background: var(--success);
  color: #fff;
  font-size: 2rem;
  font-weight: 700;
}

.reaction-waiting {
  background: #2a1a1a;
  color: var(--danger);
  font-size: 1.2rem;
}

.reaction-result {
  background: var(--surface);
  color: var(--text);
}

/* Score display */
.score-display {
  display: flex;
  gap: 24px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 24px 0;
}

.score-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 28px;
  text-align: center;
  min-width: 120px;
}

.score-card .value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
}

.score-card .label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* Progress bar */
.progress-bar {
  width: 100%;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 16px 0;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.3s;
}

/* Trial list */
.trial-list {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 16px 0;
}

.trial-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 600;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.trial-dot.done {
  background: var(--success);
  border-color: var(--success);
  color: #000;
}

.trial-dot.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.trial-dot.slow {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

/* SEO content section */
.seo-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  margin-bottom: 32px;
}

.seo-content h2 {
  font-size: 1.4rem;
  margin-bottom: 16px;
  margin-top: 24px;
}
.seo-content h2:first-child { margin-top: 0; }
.seo-content h3 { font-size: 1.1rem; margin: 20px 0 10px; }
.seo-content p { color: var(--text-secondary); margin-bottom: 12px; }
.seo-content ul { color: var(--text-secondary); padding-left: 20px; margin-bottom: 12px; }
.seo-content li { margin-bottom: 6px; }

/* Related games */
.related-games {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.related-game-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: all 0.2s;
  display: block;
  color: var(--text);
}
.related-game-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  color: var(--text);
}
.related-game-card h3 { font-size: 1rem; margin-bottom: 6px; }
.related-game-card p { font-size: 0.85rem; color: var(--text-secondary); }

/* Footer */
.site-footer {
  text-align: center;
  padding: 24px;
  color: var(--text-secondary);
  font-size: 0.8rem;
  border-top: 1px solid var(--border);
  margin-top: 48px;
}

/* Aim trainer specific */
.aim-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  width: 100%;
  max-width: 420px;
}

.aim-target {
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--border);
  cursor: pointer;
  transition: all 0.1s;
}

.aim-target.active {
  background: var(--accent);
  box-shadow: 0 0 20px var(--accent-glow);
  transform: scale(1.05);
}

.aim-target.hit {
  background: var(--success);
  box-shadow: 0 0 12px rgba(0,210,160,0.4);
}

/* Sequence memory */
.seq-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  width: 100%;
  max-width: 360px;
}

.seq-cell {
  aspect-ratio: 1;
  border-radius: var(--radius);
  background: var(--border);
  cursor: pointer;
  transition: all 0.15s;
}

.seq-cell.lit {
  background: var(--accent);
  box-shadow: 0 0 16px var(--accent-glow);
}

.seq-cell.wrong {
  background: var(--danger);
}

.seq-cell.correct {
  background: var(--success);
}

/* Typing test */
.typing-display {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 16px;
  font-family: 'Courier New', monospace;
  letter-spacing: 2px;
}

.typing-display .correct { color: var(--success); }
.typing-display .incorrect { color: var(--danger); background: rgba(255,94,94,0.15); }
.typing-display .current { color: var(--accent); text-decoration: underline; }

.typing-input {
  width: 100%;
  max-width: 500px;
  padding: 14px 20px;
  font-size: 1.2rem;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  text-align: center;
  font-family: var(--font);
  outline: none;
  transition: border-color 0.2s;
}
.typing-input:focus { border-color: var(--accent); }

/* Number memory */
.num-display {
  font-size: 3rem;
  font-weight: 700;
  color: var(--accent);
  margin: 16px 0;
  letter-spacing: 4px;
  font-family: 'Courier New', monospace;
}

.num-input {
  width: 100%;
  max-width: 300px;
  padding: 14px 20px;
  font-size: 1.5rem;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  text-align: center;
  font-family: 'Courier New', monospace;
  letter-spacing: 4px;
  outline: none;
  transition: border-color 0.2s;
}
.num-input:focus { border-color: var(--accent); }

/* Stats table */
.stats-table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
}
.stats-table th,
.stats-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.stats-table th {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}
.stats-table td { color: var(--text); }

/* Share section */
.share-section {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: center;
  margin-top: 20px;
}

.badge {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 50px;
  font-size: 0.8rem;
  font-weight: 600;
}

.badge-success { background: rgba(0,210,160,0.15); color: var(--success); }
.badge-warning { background: rgba(255,179,71,0.15); color: var(--warning); }
.badge-danger { background: rgba(255,94,94,0.15); color: var(--danger); }

/* Game iframe */
.game-frame {
  width: 100%;
  position: relative;
  padding-bottom: 65%;
  overflow: hidden;
  border-radius: var(--radius);
  background: #000;
}
.game-frame iframe {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  border: none;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .sidebar {
    display: none;
  }
  .main-content {
    margin-left: 0;
    padding: 20px 16px;
  }
  .game-area {
    padding: 32px 16px;
  }
  .score-display {
    gap: 12px;
  }
  .score-card {
    min-width: 80px;
    padding: 14px 16px;
  }
  .related-games {
    grid-template-columns: 1fr;
  }
  .page-header h1 {
    font-size: 1.5rem;
  }
}

/* Mobile nav */
.mobile-nav {
  display: none;
}

@media (max-width: 768px) {
  .mobile-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 99;
  }
  .mobile-nav .logo {
    font-size: 1.1rem;
    font-weight: 700;
  }
  .mobile-nav .logo span { color: var(--accent); }
  .mobile-menu-btn {
    background: none;
    border: none;
    color: var(--text);
    font-size: 1.4rem;
    cursor: pointer;
    padding: 4px 8px;
  }
}
