:root {
  --bg: #1a1a1a;
  --surface: #2a2a2a;
  --surface-light: #3a3a3a;
  --accent: #e8912d;
  --accent-dim: #b8711f;
  --text: #f0f0f0;
  --text-secondary: #a0a0a0;
  --text-muted: #707070;
  --success: #4caf50;
  --error: #ef5350;
  --streak-fire: #ff6b35;
  --border: #333333;
  --radius: 12px;
  --radius-sm: 8px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

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

a:hover {
  text-decoration: underline;
}

/* Auth Gate */
#auth-gate {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

#auth-gate h1 {
  font-size: 24px;
  color: var(--accent);
  margin-bottom: 8px;
}

#auth-gate p {
  color: var(--text-secondary);
  margin-bottom: 24px;
}

#auth-gate form {
  display: flex;
  gap: 12px;
  width: 100%;
  max-width: 360px;
}

#auth-gate input {
  flex: 1;
  padding: 12px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 16px;
  outline: none;
}

#auth-gate input:focus {
  border-color: var(--accent);
}

#auth-gate button {
  padding: 12px 24px;
  border-radius: var(--radius);
  border: none;
  background: var(--accent);
  color: white;
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
}

#auth-gate button:hover {
  background: var(--accent-dim);
}

#auth-error {
  color: var(--error);
  margin-top: 12px;
  font-size: 14px;
  display: none;
}

/* App Container */
#app {
  display: none;
  max-width: 640px;
  margin: 0 auto;
  padding: 16px;
  padding-bottom: 80px;
}

/* Nav */
nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: center;
  gap: 0;
  z-index: 100;
}

nav a {
  flex: 1;
  max-width: 200px;
  text-align: center;
  padding: 12px 0 10px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  transition: color 0.2s;
}

nav a.active,
nav a:hover {
  color: var(--accent);
}

nav a .nav-icon {
  display: block;
  font-size: 20px;
  margin-bottom: 2px;
}

/* Page Header */
.page-title {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 24px;
  padding-top: 8px;
}

/* Streak Card */
.streak-card {
  text-align: center;
  padding: 32px 16px;
  margin-bottom: 24px;
}

.streak-emoji {
  font-size: 40px;
}

.streak-count {
  font-size: 64px;
  font-weight: 800;
  color: var(--streak-fire);
  line-height: 1.1;
}

.streak-label {
  font-size: 16px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* Stats Row */
.stats-row {
  display: flex;
  justify-content: center;
  gap: 48px;
  margin-bottom: 32px;
}

.stat {
  text-align: center;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Section */
.section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

/* Riff Card */
.riff-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 10px;
  border: 1px solid var(--border);
}

.riff-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.riff-date {
  font-size: 14px;
  font-weight: 500;
}

.riff-play {
  background: none;
  border: 1px solid var(--accent);
  color: var(--accent);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.riff-play:hover {
  background: var(--accent-dim);
  color: white;
}

.riff-play.playing {
  background: var(--accent);
  color: white;
}

.riff-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.tag {
  padding: 2px 10px;
  border-radius: 10px;
  background: var(--surface-light);
  font-size: 12px;
  color: var(--text-secondary);
}

.riff-note {
  font-size: 13px;
  color: var(--text-secondary);
  font-style: italic;
  margin-top: 8px;
}

/* Filter Bar */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.filter-chip {
  padding: 6px 14px;
  border-radius: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.filter-chip:hover,
.filter-chip.active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: white;
}

/* Week Group */
.week-group {
  margin-bottom: 28px;
}

.week-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

/* Digest Card */
.digest-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  border: 1px solid var(--border);
}

.digest-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.digest-title {
  font-size: 16px;
  font-weight: 600;
}

.digest-stats {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.digest-actions {
  display: flex;
  gap: 10px;
}

.digest-actions button,
.digest-actions a {
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  border: none;
}

.btn-play {
  background: var(--accent);
  color: white;
}

.btn-play:hover {
  background: var(--accent-dim);
}

.btn-download {
  background: var(--surface-light);
  color: var(--accent);
  border: 1px solid var(--border) !important;
}

.btn-download:hover {
  background: var(--border);
}

/* Loading / Empty */
.loading, .empty {
  text-align: center;
  padding: 48px 16px;
  color: var(--text-muted);
  font-size: 16px;
}

/* Digest play button on dashboard */
.digest-banner {
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  margin-bottom: 24px;
}

.digest-banner button {
  background: var(--accent);
  color: white;
  border: none;
  padding: 10px 24px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.digest-banner button:hover {
  background: var(--accent-dim);
}

/* Responsive */
@media (max-width: 480px) {
  .stats-row {
    gap: 24px;
  }
  .streak-count {
    font-size: 48px;
  }
  .stat-value {
    font-size: 22px;
  }
}
