:root {
  --bg: #f7f1e7;
  --bg-accent: #f0e2d1;
  --ink: #1f1915;
  --muted: #6b5f55;
  --primary: #c76c3f;
  --primary-dark: #a75630;
  --secondary: #3a6f62;
  --card: #fff8ef;
  --border: #e1d4c2;
  --shadow: rgba(31, 25, 21, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Manrope", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 20%, rgba(199, 108, 63, 0.18), transparent 45%),
    radial-gradient(circle at 80% 10%, rgba(58, 111, 98, 0.16), transparent 45%),
    linear-gradient(180deg, var(--bg), var(--bg-accent));
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem 2.5rem;
  gap: 2rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand-mark {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: var(--primary);
  color: #fff;
  display: grid;
  place-items: center;
  font-family: "Fraunces", serif;
  font-weight: 700;
  font-size: 1.5rem;
  box-shadow: 0 10px 20px rgba(199, 108, 63, 0.25);
}

.brand-title {
  display: block;
  font-family: "Fraunces", serif;
  font-size: 1.15rem;
  letter-spacing: 0.3px;
}

.brand-subtitle {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.1rem;
}

.nav {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.nav-link {
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 600;
  color: var(--muted);
  transition: all 0.2s ease;
}

.nav-link:hover {
  border-color: var(--border);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.6);
}

.nav-link.active {
  background: #fff;
  border-color: var(--border);
  color: var(--ink);
  box-shadow: 0 8px 18px rgba(31, 25, 21, 0.08);
}

.container {
  width: min(1100px, 92vw);
  margin: 0 auto 3rem;
  flex: 1;
}

.page-header {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 2rem;
}

.page-header h1,
.page-header h2 {
  font-family: "Fraunces", serif;
  font-size: clamp(1.6rem, 1.3rem + 1.6vw, 2.4rem);
  margin: 0;
}

.page-header p {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
  max-width: 60ch;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 1.6rem;
  box-shadow: 0 18px 40px var(--shadow);
  animation: float-in 0.6s ease both;
}

.accordion {
  border: 1px solid var(--border);
  border-radius: 18px;
  background: #fff;
  padding: 0.4rem 1rem 1rem;
}

.accordion + .accordion {
  margin-top: 1rem;
}

.accordion summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
  padding: 0.6rem 0.2rem;
}

.accordion summary::-webkit-details-marker {
  display: none;
}

.accordion summary::after {
  content: "+";
  font-size: 1.2rem;
  color: var(--primary);
}

.accordion[open] summary::after {
  content: "-";
}

.accordion-body {
  padding: 0.4rem 0.2rem 0.2rem;
}

.hero {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 1.5rem;
  align-items: center;
  margin-bottom: 2rem;
}

.hero .eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.7rem;
  color: var(--secondary);
  font-weight: 600;
  margin: 0 0 0.4rem;
}

.hero h1 {
  margin: 0 0 0.6rem;
  font-family: "Fraunces", serif;
  font-size: clamp(2rem, 1.5rem + 2vw, 3rem);
}

.hero p {
  margin: 0;
  color: var(--muted);
}

.stat-grid {
  display: grid;
  gap: 0.8rem;
}

.stat {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1rem 1.2rem;
}

.stat .label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.stat .value {
  font-size: 1.6rem;
  font-weight: 600;
  margin-top: 0.35rem;
  font-family: "Fraunces", serif;
}

.section {
  margin-bottom: 2.4rem;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  min-width: 600px;
}

.table th,
.table td {
  padding: 0.85rem 0.7rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.table th {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.7rem;
  color: var(--muted);
}

.table tr:last-child td {
  border-bottom: none;
}

.table-wrap {
  overflow-x: auto;
}

.chart-wrap {
  width: 100%;
  height: 320px;
}

.chart-wrap canvas {
  width: 100%;
  height: 100%;
}

.scoreboard-grid {
  display: grid;
  grid-template-columns: minmax(240px, 0.9fr) minmax(280px, 1.3fr);
  gap: 1.5rem;
}

.podium {
  display: grid;
  gap: 1rem;
}

.podium-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 1rem 1.2rem;
  box-shadow: 0 14px 26px rgba(31, 25, 21, 0.08);
}

.podium-first {
  border-color: var(--primary);
  box-shadow: 0 18px 32px rgba(199, 108, 63, 0.2);
  transform: translateY(-6px);
}

.podium-rank {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.podium-name {
  font-family: "Fraunces", serif;
  font-size: 1.15rem;
}

.podium-points {
  font-family: "Fraunces", serif;
  font-size: 1.7rem;
  color: var(--primary-dark);
  margin-top: 0.4rem;
}

.podium-meta {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.35rem;
}

.score-list {
  display: grid;
  gap: 0.75rem;
}

.score-row {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  gap: 0.8rem;
  align-items: center;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #fff;
}

.score-row.leader {
  border-color: rgba(199, 108, 63, 0.6);
  box-shadow: 0 10px 22px rgba(199, 108, 63, 0.15);
}

.score-rank {
  font-weight: 600;
  color: var(--primary-dark);
}

.score-name {
  font-weight: 600;
}

.score-meta {
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 0.2rem;
}

.score-bar {
  position: relative;
  height: 8px;
  background: rgba(199, 108, 63, 0.18);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 0.5rem;
}

.score-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #e0a067);
}

.score-points {
  text-align: right;
  min-width: 96px;
}

.score-value {
  font-family: "Fraunces", serif;
  font-size: 1.1rem;
}

.score-gap {
  font-size: 0.8rem;
  color: var(--muted);
}

.book-results {
  display: grid;
  gap: 0.8rem;
  margin-top: 1rem;
}

.book-result {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 0.8rem;
  align-items: start;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  padding: 0.75rem;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  color: var(--ink);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.book-result:hover {
  border-color: var(--primary);
  box-shadow: 0 10px 20px rgba(199, 108, 63, 0.2);
}

.book-result img {
  width: 56px;
  height: 78px;
  object-fit: cover;
  border-radius: 8px;
  background: #f3ece3;
}

.book-cover.placeholder {
  width: 56px;
  height: 78px;
  border-radius: 8px;
  background: #f3ece3;
  display: grid;
  place-items: center;
  font-size: 0.65rem;
  color: var(--muted);
  text-align: center;
  padding: 0.3rem;
}

.book-result-title {
  font-weight: 600;
  margin-bottom: 0.2rem;
}

.book-result-meta {
  font-size: 0.85rem;
  color: var(--muted);
}

.book-selected {
  margin-top: 1rem;
  border: 1px dashed var(--border);
  border-radius: 14px;
  padding: 0.8rem;
  background: rgba(255, 248, 239, 0.6);
}

.book-selected-header {
  font-weight: 600;
  margin-bottom: 0.6rem;
}

.book-selected-body {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 0.8rem;
  align-items: start;
}

.book-selected-body img {
  width: 56px;
  height: 78px;
  object-fit: cover;
  border-radius: 8px;
  background: #f3ece3;
}

.book-selected-title {
  font-weight: 600;
  margin-bottom: 0.2rem;
}

.book-selected-meta {
  font-size: 0.85rem;
  color: var(--muted);
}

.book-subtitle {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.2rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  background: rgba(58, 111, 98, 0.12);
  color: var(--secondary);
  font-size: 0.75rem;
  font-weight: 600;
}

.form {
  display: grid;
  gap: 1rem;
}

.form-row {
  display: grid;
  gap: 0.7rem;
}

.form-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

label {
  font-weight: 600;
  font-size: 0.9rem;
}

input,
select,
textarea {
  width: 100%;
  padding: 0.65rem 0.8rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--ink);
}

input[type="checkbox"] {
  width: auto;
}

.inline input[type="number"] {
  width: 90px;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(199, 108, 63, 0.2);
}

.btn {
  border: none;
  background: var(--primary);
  color: #fff;
  padding: 0.7rem 1.2rem;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(199, 108, 63, 0.25);
}

.btn.secondary {
  background: #fff;
  color: var(--primary-dark);
  border: 1px solid var(--border);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.alert {
  background: rgba(199, 108, 63, 0.12);
  border: 1px solid rgba(199, 108, 63, 0.35);
  color: var(--primary-dark);
  padding: 0.8rem 1rem;
  border-radius: 12px;
  font-weight: 600;
  margin-bottom: 1rem;
}

.notice {
  background: rgba(58, 111, 98, 0.12);
  border: 1px solid rgba(58, 111, 98, 0.35);
  color: #2d5a50;
  padding: 0.7rem 0.9rem;
  border-radius: 12px;
  margin-bottom: 1rem;
}

.footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  padding: 1.5rem 1rem 2rem;
}

.footer-note {
  margin-top: 0.4rem;
  font-size: 0.8rem;
}

.inline {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

@keyframes float-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 800px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .hero {
    grid-template-columns: 1fr;
  }

  .nav {
    width: 100%;
  }

  .scoreboard-grid {
    grid-template-columns: 1fr;
  }
}
