/* ===========================
   Variables & Reset
   =========================== */
:root {
  --primary: #6c3fc5;
  --primary-dark: #4e2d96;
  --accent: #f4c430;
  --accent-hover: #e0b020;
  --bg: #f5f4f9;
  --card-bg: #ffffff;
  --text: #1a1a2e;
  --text-muted: #6b6b8a;
  --border: #e0ddf0;
  --success: #28a745;
  --error-bg: #fff0f0;
  --error-border: #e57373;
  --radius: 12px;
  --shadow: 0 4px 16px rgba(108, 63, 197, 0.10);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Segoe UI', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===========================
   Header
   =========================== */
.site-header {
  background: var(--primary);
  padding: 0 2rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.header-inner {
  max-width: 960px;
  margin: 0 auto;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.site-title {
  color: #fff;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: .5px;
  text-decoration: none;
}
.site-nav a {
  color: rgba(255,255,255,0.85);
  margin-left: 1.5rem;
  font-size: 0.95rem;
  font-weight: 500;
  transition: color .15s;
}
.site-nav a:hover { color: #fff; text-decoration: none; }

/* ===========================
   Main Container
   =========================== */
.container {
  max-width: 960px;
  margin: 2rem auto;
  padding: 0 1.5rem;
  flex: 1;
}

/* ===========================
   Footer
   =========================== */
.site-footer {
  background: var(--primary-dark);
  color: rgba(255,255,255,0.7);
  text-align: center;
  padding: 1rem;
  font-size: 0.85rem;
  margin-top: auto;
}

/* ===========================
   Hero / Page Header
   =========================== */
.hero {
  text-align: center;
  padding: 2.5rem 1rem 1.5rem;
}
.hero h1 { font-size: 2.2rem; color: var(--primary); margin-bottom: .5rem; }
.hero-sub { color: var(--text-muted); font-size: 1.1rem; margin-bottom: .75rem; }

.grade-hint {
  display: inline-block;
  background: #efe9fb;
  color: var(--primary-dark);
  border-radius: 20px;
  padding: .35rem 1rem;
  font-size: .9rem;
  font-weight: 500;
}

.page-header { margin-bottom: 2rem; }
.page-header h1 { font-size: 1.8rem; color: var(--primary); margin-bottom: .4rem; }
.page-header .grade-hint { margin-top: .5rem; }

.back-link {
  display: inline-block;
  margin-bottom: .75rem;
  color: var(--text-muted);
  font-size: .9rem;
}
.back-link:hover { color: var(--primary); }

/* ===========================
   Theme Grid (index page)
   =========================== */
.theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}
.theme-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  text-decoration: none;
  color: var(--text);
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.theme-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(108,63,197,0.18);
  border-color: var(--primary);
  text-decoration: none;
  color: var(--text);
}
.theme-icon { font-size: 2.5rem; flex-shrink: 0; }
.theme-name { font-size: 1.1rem; font-weight: 700; margin-bottom: .2rem; }
.theme-meta { font-size: .85rem; color: var(--text-muted); margin-bottom: .6rem; }
.btn-vote {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  font-size: .82rem;
  padding: .3rem .75rem;
  border-radius: 20px;
  font-weight: 600;
}

/* ===========================
   Theme Image
   =========================== */
.theme-image-wrap {
  margin-bottom: 1.75rem;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.theme-image {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  object-fit: cover;
}

/* ===========================
   Song Cards (theme page)
   =========================== */
.songs-list { display: flex; flex-direction: column; gap: 1.25rem; }

.song-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}
.song-info {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex: 1 1 300px;
}
.song-number {
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .95rem;
  flex-shrink: 0;
}
.song-title {
  font-weight: 600;
  margin-bottom: .4rem;
  font-size: 1rem;
}
.audio-player {
  width: 100%;
  max-width: 360px;
  height: 36px;
  border-radius: 20px;
  outline: none;
}

/* ===========================
   Star Rating
   =========================== */
.song-rating {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .35rem;
  flex-shrink: 0;
}
.star-rating {
  display: flex;
  gap: 2px;
}
.star-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 2rem;
  color: #ccc;
  transition: color .1s, transform .1s;
  padding: 0 1px;
  line-height: 1;
  user-select: none;
}
.star-btn:hover,
.star-btn.hovered { color: var(--accent); transform: scale(1.15); }
.star-btn.selected { color: var(--accent); }

.rating-display {
  font-size: .85rem;
  font-weight: 600;
  color: var(--primary);
  min-height: 1.2em;
}

/* ===========================
   Submit Section
   =========================== */
.submit-section {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  margin-top: 2rem;
  display: flex;
  align-items: flex-end;
  gap: 1rem;
  flex-wrap: wrap;
}
.name-field {
  display: flex;
  flex-direction: column;
  gap: .4rem;
  flex: 1 1 200px;
}
.name-field label {
  font-weight: 600;
  font-size: .95rem;
}
.name-field input {
  padding: .6rem .9rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color .15s;
  outline: none;
}
.name-field input:focus { border-color: var(--primary); }

.btn-submit {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: .7rem 1.5rem;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s, transform .1s;
  white-space: nowrap;
}
.btn-submit:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

/* ===========================
   Alert
   =========================== */
.alert {
  border-radius: 8px;
  padding: .85rem 1.2rem;
  margin-bottom: 1.25rem;
  font-weight: 500;
}
.alert-error {
  background: var(--error-bg);
  border: 1px solid var(--error-border);
  color: #c0392b;
}

/* ===========================
   Danke Page
   =========================== */
.danke-page {
  text-align: center;
  padding: 4rem 1rem;
}
.danke-icon { font-size: 4rem; margin-bottom: 1rem; }
.danke-page h1 { font-size: 2rem; color: var(--primary); margin-bottom: .75rem; }
.danke-page p { color: var(--text-muted); font-size: 1.1rem; margin-bottom: 2rem; }
.danke-actions { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }

.btn-primary, .btn-secondary {
  padding: .7rem 1.5rem;
  border-radius: 8px;
  font-weight: 700;
  font-size: .95rem;
  text-decoration: none;
  transition: transform .1s, box-shadow .1s;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); text-decoration: none; }
.btn-secondary { background: var(--card-bg); color: var(--primary); border: 2px solid var(--primary); }
.btn-secondary:hover { background: #efe9fb; text-decoration: none; }

/* ===========================
   Auswertung Page
   =========================== */
.result-section {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  margin-bottom: 2rem;
}
.result-theme-title {
  font-size: 1.3rem;
  color: var(--primary);
  margin-bottom: 1rem;
}

.result-table, .votes-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .95rem;
}
.result-table th, .votes-table th {
  background: var(--primary);
  color: #fff;
  padding: .6rem 1rem;
  text-align: left;
  font-weight: 600;
}
.result-table td, .votes-table td {
  padding: .6rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.result-table tr:last-child td, .votes-table tr:last-child td { border-bottom: none; }

.winner-row td { background: #fffbeb; }
.winner-badge {
  display: inline-block;
  background: var(--accent);
  color: #5a3d00;
  font-size: .75rem;
  font-weight: 700;
  padding: .15rem .5rem;
  border-radius: 12px;
  margin-left: .5rem;
}

.avg-cell { white-space: nowrap; }
.avg-score { font-weight: 700; font-size: 1.1rem; color: var(--primary); margin-right: .4rem; }
.star-filled { color: var(--accent); }
.star-empty { color: #ddd; }
.no-votes { color: var(--text-muted); }

.votes-detail {
  margin-top: 1.25rem;
}
.votes-detail summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--primary);
  padding: .4rem 0;
  user-select: none;
}
.votes-detail summary:hover { text-decoration: underline; }
.votes-table { margin-top: .75rem; }

.empty-msg { color: var(--text-muted); font-style: italic; padding: 1rem 0; }

/* ===========================
   Responsive
   =========================== */
@media (max-width: 600px) {
  .header-inner { flex-direction: column; height: auto; padding: .75rem 0; gap: .4rem; }
  .site-nav a:first-child { margin-left: 0; }
  .hero h1 { font-size: 1.6rem; }
  .song-card { flex-direction: column; align-items: flex-start; }
  .song-rating { align-items: flex-start; }
  .submit-section { flex-direction: column; }
}
