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

:root {
  --bg:      #e8e3d9;
  --surface: #ede9e2;
  --ink:     #1c1a17;
  --muted:   #8a8070;
  --border:  #d4cfc6;
  --accent:  #b85c38;
  --serif:   'DM Serif Display', Georgia, serif;
  --sans:    'DM Sans', system-ui, sans-serif;
}

html { font-size: 16px; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
}

/* ── Nav ── */
nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 2rem;
  border-bottom: 1px solid var(--border);
}

.nav-logo {
  font-family: var(--serif);
  font-size: 1.1rem;
  text-decoration: none;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.nav-link {
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s;
}

.nav-link:hover { color: var(--ink); }

/* ── Hero ── */
.hero {
  padding: 2.5rem 2rem 2rem;
  border-bottom: 1px solid var(--border);
}

.hero-label {
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.6rem;
}

.hero h1 {
  font-family: var(--serif);
  font-size: clamp(1.8rem, 5vw, 3rem);
  font-weight: 400;
  line-height: 1.12;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.hero h1 em {
  font-style: italic;
  color: var(--muted);
}

/* ── Hero body (intro, glossary, CTA) ── */
.hero-body {
  max-width: 640px;
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.hero-lede,
.hero-instruction,
.hero-versions-note {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--ink);
}

.hero-lede strong {
  font-weight: 500;
  color: var(--ink);
}

.hero-instruction,
.hero-versions-note {
  color: var(--muted);
  font-size: 0.88rem;
}

.hero-versions-note em {
  font-style: normal;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.hero-kbd {
  display: inline-block;
  font-family: var(--sans);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 1px 7px;
  background: var(--ink);
  color: var(--bg);
  border-radius: 2px;
  vertical-align: 1px;
}

/* ── Glossary ── */
.hero-glossary {
  margin: 0.5rem 0;
  padding: 0.9rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 3px;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.hero-glossary-item {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  font-size: 0.82rem;
  line-height: 1.5;
}

.hero-glossary-item dt {
  font-family: var(--serif);
  font-size: 0.95rem;
  color: var(--ink);
  flex-shrink: 0;
  min-width: 92px;
}

.hero-glossary-item dd {
  color: var(--muted);
}

@media (max-width: 480px) {
  .hero-glossary-item {
    flex-direction: column;
    gap: 0.1rem;
  }
  .hero-glossary-item dt {
    min-width: 0;
  }
}

/* ── Sessions ── */
.sessions {
  max-width: 680px;
  margin: 0 auto;
  padding: 1.75rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* ── Card ── */
.session-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1.25rem 1.25rem 1rem;
}

.session-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 1rem;
  gap: 1rem;
}

.session-label {
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 400;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.session-version {
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.session-description {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 1rem;
}

/* ── Audio row ── */
.audio-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

audio {
  flex: 1;
  min-width: 0;
  height: 34px;
  accent-color: var(--ink);
}

/* ── Button ── */
.refresh-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--sans);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0 1.1rem;
  height: 34px;
  background: var(--ink);
  color: var(--bg);
  border: none;
  border-radius: 2px;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.15s;
}

.refresh-btn:hover  { opacity: 0.72; }
.refresh-btn:active { opacity: 0.5;  }
.refresh-btn:disabled { opacity: 0.35; cursor: not-allowed; }

.refresh-btn .spinner {
  display: none;
  width: 11px;
  height: 11px;
  border: 1.5px solid rgba(232,227,217,0.3);
  border-top-color: var(--bg);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.refresh-btn.is-loading .spinner  { display: block; }
.refresh-btn.is-loading .btn-text { display: none;  }

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Status ── */
.status-line {
  margin-top: 0.5rem;
  font-size: 0.75rem;
  color: var(--muted);
  min-height: 1em;
}

.status-line.is-error { color: var(--accent); }

/* ── Feedback modal ───────────────────────────────────────────── */
.feedback-btn {
    background: none;
    border: 1px solid currentColor;
    color: inherit;
    font-family: inherit;
    font-size: 0.8rem;
    border-radius: 4px;
    padding: 0;
    cursor: pointer;
    opacity: 0.55;
    transition: opacity 0.15s;
    align-self: stretch;
    padding-inline: 0.85rem;
}
.feedback-btn:hover { opacity: 1; }

.modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 100;
    align-items: center;
    justify-content: center;
}
.modal-backdrop.is-open { display: flex; }

.modal {
    background: var(--bg, #fff);
    color: var(--fg, #111);
    border-radius: 10px;
    padding: 2rem;
    width: min(420px, 92vw);
    box-shadow: 0 8px 40px rgba(0,0,0,0.22);
    position: relative;
}
.modal h2 {
    font-family: 'DM Serif Display', serif;
    font-size: 1.25rem;
    margin: 0 0 0.25rem;
}
.modal .modal-subtitle {
    font-size: 0.78rem;
    opacity: 0.5;
    margin: 0 0 1.25rem;
}
.modal label {
    display: block;
    font-size: 0.78rem;
    opacity: 0.6;
    margin-bottom: 0.3rem;
}
.modal input,
.modal textarea {
    width: 100%;
    box-sizing: border-box;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.9rem;
    background: transparent;
    border: 1px solid rgba(128,128,128,0.35);
    border-radius: 6px;
    padding: 0.55rem 0.75rem;
    color: inherit;
    margin-bottom: 1rem;
    resize: vertical;
}
.modal input:focus,
.modal textarea:focus {
    outline: none;
    border-color: rgba(128,128,128,0.7);
}
.modal .segments-preview {
    font-size: 0.72rem;
    opacity: 0.38;
    margin-bottom: 1.1rem;
    word-break: break-all;
    line-height: 1.5;
}
.modal-actions {
    display: flex;
    gap: 0.6rem;
    justify-content: flex-end;
    align-items: center;
}
.modal-cancel {
    background: none;
    border: none;
    font-family: inherit;
    font-size: 0.85rem;
    opacity: 0.45;
    cursor: pointer;
    padding: 0.4rem 0.6rem;
    color: inherit;
}
.modal-cancel:hover { opacity: 0.8; }
.modal-submit {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.85rem;
    background: var(--fg, #111);
    color: var(--bg, #fff);
    border: none;
    border-radius: 6px;
    padding: 0.5rem 1.2rem;
    cursor: pointer;
    transition: opacity 0.15s;
}
.modal-submit:disabled { opacity: 0.4; cursor: default; }
.modal-close {
    position: absolute;
    top: 1rem; right: 1rem;
    background: none; border: none;
    font-size: 1.1rem; cursor: pointer;
    opacity: 0.35; color: inherit;
}
.modal-close:hover { opacity: 0.8; }
.modal-status {
    font-size: 0.78rem;
    margin-top: 0.5rem;
    min-height: 1em;
    text-align: right;
}
.modal-status.is-error { color: #e05; }
.modal-status.is-success { color: #080; }

/* ── Footer ── */
footer {
  border-top: 1px solid var(--border);
  padding: 1.25rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.footer-logo {
  font-family: var(--serif);
  font-size: 0.95rem;
  text-decoration: none;
  color: var(--ink);
}

.footer-tagline {
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.04em;
}

/* ── Responsive ── */
@media (max-width: 480px) {
  .audio-row { flex-direction: column; align-items: stretch; }
  audio { width: 100%; }
  .refresh-btn { width: 100%; justify-content: center; }
}

@media (max-width: 600px) {
  nav, .hero, footer { padding-left: 1.25rem; padding-right: 1.25rem; }
  .sessions { padding-left: 1.25rem; padding-right: 1.25rem; }
}
