/* style.css — Playfair */

:root {
  --night:   #17122b;
  --panel:   #221a3d;
  --panel-2: #2c2350;
  --edge:    #3a2f63;
  --cream:   #f3effa;
  --lilac:   #b0a2d8;
  --gold:    #f2c14e;
  --jade:    #5bd6a4;
  --coral:   #ff7a85;

  --radius: 14px;
  --display: "Bricolage Grotesque", Georgia, serif;
  --body: "IBM Plex Sans", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(900px 500px at 80% -10%, #34265c 0%, transparent 60%),
    var(--night);
  color: var(--cream);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--gold); }

.shell {
  max-width: 1000px;
  margin: 0 auto;
  padding: 40px 24px 72px;
}

/* ---- masthead ---------------------------------------------------------- */

.masthead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--edge);
  padding-bottom: 20px;
  margin-bottom: 40px;
}

.wordmark {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(28px, 5vw, 40px);
  letter-spacing: -0.02em;
  margin: 0;
}
.wordmark span { color: var(--gold); }

.masthead nav a {
  color: var(--lilac);
  text-decoration: none;
  margin-left: 22px;
  border-bottom: 1px solid transparent;
  padding-bottom: 2px;
}
.masthead nav a:hover,
.masthead nav a[aria-current="page"] {
  color: var(--cream);
  border-bottom-color: var(--gold);
}

/* ---- two-column workspace ---------------------------------------------- */

.workspace {
  display: grid;
  grid-template-columns: minmax(280px, 360px) 1fr;
  gap: 36px;
  align-items: start;
}

@media (max-width: 840px) {
  .workspace { grid-template-columns: 1fr; }
}

/* ---- the listen disc (the one loud element) ---------------------------- */

.capture { text-align: center; }

.disc {
  position: relative;
  width: 220px;
  height: 220px;
  margin: 0 auto;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  color: var(--night);
  background: radial-gradient(circle at 35% 30%, #ffe08a 0%, var(--gold) 55%, #d19a22 100%);
  font-family: var(--display);
  font-weight: 600;
  font-size: 21px;
  line-height: 1.2;
  display: grid;
  place-content: center;
  gap: 6px;
  box-shadow: 0 0 0 1px rgba(242, 193, 78, 0.35), 0 24px 60px -24px rgba(242, 193, 78, 0.55);
  transition: transform 0.18s ease;
}

.disc:hover:not(:disabled) { transform: scale(1.02); }
.disc:active:not(:disabled) { transform: scale(0.985); }
.disc:focus-visible { outline: 3px solid var(--cream); outline-offset: 6px; }
.disc:disabled { cursor: progress; }

.disc small {
  display: block;
  font-family: var(--body);
  font-size: 13px;
  font-weight: 500;
  opacity: 0.72;
}

/* Rings only appear while listening, and only pulse if motion is welcome. */
.disc::before,
.disc::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--gold);
  opacity: 0;
  pointer-events: none;
}

.capture.listening .disc::before { animation: ripple 2.4s ease-out infinite; }
.capture.listening .disc::after  { animation: ripple 2.4s ease-out infinite 1.2s; }

@keyframes ripple {
  0%   { opacity: 0.55; transform: scale(1); }
  100% { opacity: 0;    transform: scale(1.55); }
}

@media (prefers-reduced-motion: reduce) {
  .capture.listening .disc::before,
  .capture.listening .disc::after { animation: none; }
  .capture.listening .disc::before { opacity: 0.5; transform: scale(1.2); }
}

.capture-note {
  color: var(--lilac);
  font-size: 14px;
  margin: 26px auto 0;
  max-width: 34ch;
}

/* ---- upload alternative ------------------------------------------------- */

.upload {
  margin-top: 30px;
  padding-top: 26px;
  border-top: 1px solid var(--edge);
}

.upload h2 {
  font-family: var(--display);
  font-size: 17px;
  font-weight: 600;
  margin: 0 0 6px;
}

.upload p {
  color: var(--lilac);
  font-size: 14px;
  margin: 0 0 14px;
}

.file-field {
  display: block;
  width: 100%;
  padding: 13px;
  border: 1px dashed var(--edge);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--lilac);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}
.file-field:hover { border-color: var(--gold); color: var(--cream); }
.file-field::file-selector-button {
  margin-right: 12px;
  padding: 7px 14px;
  border: 0;
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--cream);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

/* ---- result ------------------------------------------------------------- */

.result {
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  padding: 32px;
  min-height: 320px;
}

.result-idle {
  color: var(--lilac);
  max-width: 46ch;
}
.result-idle h2 {
  font-family: var(--display);
  font-weight: 600;
  font-size: 24px;
  color: var(--cream);
  margin: 0 0 12px;
}
.result-idle ol { padding-left: 20px; margin: 18px 0 0; }
.result-idle li { margin-bottom: 8px; }

.verdict {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 14px;
  color: var(--lilac);
  margin-bottom: 20px;
}
.verdict::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--jade);
}
.verdict.miss::before { background: var(--coral); }

.track-title {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(30px, 4.6vw, 46px);
  line-height: 1.08;
  letter-spacing: -0.02em;
  margin: 0 0 8px;
}

.track-artist {
  font-size: 20px;
  color: var(--gold);
  margin: 0 0 26px;
}

.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1px;
  background: var(--edge);
  border: 1px solid var(--edge);
  border-radius: 10px;
  overflow: hidden;
}
.facts div {
  background: var(--panel-2);
  padding: 13px 15px;
}
.facts dt {
  font-size: 12px;
  color: var(--lilac);
  margin-bottom: 3px;
}
.facts dd { margin: 0; font-size: 15px; }

.listen-links { margin-top: 24px; display: flex; gap: 10px; flex-wrap: wrap; }
.listen-links a {
  text-decoration: none;
  color: var(--cream);
  border: 1px solid var(--edge);
  border-radius: 999px;
  padding: 8px 17px;
  font-size: 14px;
}
.listen-links a:hover { border-color: var(--gold); color: var(--gold); }

.message {
  font-size: 16px;
  color: var(--cream);
  max-width: 48ch;
}
.message.error { color: var(--coral); }

.spinner-line {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--lilac);
}
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--edge);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }

/* ---- recent + history table --------------------------------------------- */

.recent { margin-top: 52px; }
.recent h2,
.page-heading {
  font-family: var(--display);
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 16px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}
th {
  text-align: left;
  font-weight: 500;
  font-size: 13px;
  color: var(--lilac);
  padding: 0 14px 10px 0;
  border-bottom: 1px solid var(--edge);
}
td {
  padding: 13px 14px 13px 0;
  border-bottom: 1px solid rgba(58, 47, 99, 0.5);
  vertical-align: top;
}
tr.miss td { color: var(--lilac); }

.empty {
  color: var(--lilac);
  padding: 26px 0;
}

.searchbar {
  display: flex;
  gap: 10px;
  margin-bottom: 22px;
}
.searchbar input {
  flex: 1;
  padding: 11px 14px;
  border-radius: 10px;
  border: 1px solid var(--edge);
  background: var(--panel);
  color: var(--cream);
  font: inherit;
}
.searchbar input:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
.searchbar button {
  padding: 11px 22px;
  border-radius: 10px;
  border: 0;
  background: var(--gold);
  color: var(--night);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.tally {
  display: flex;
  gap: 28px;
  flex-wrap: wrap;
  color: var(--lilac);
  font-size: 14px;
  margin-bottom: 26px;
}
.tally b {
  display: block;
  font-family: var(--display);
  font-size: 26px;
  color: var(--cream);
  font-weight: 600;
}

/* ---- monitoring --------------------------------------------------------- */

.dial {
  width: 180px;
  height: 180px;
  margin: 0 auto 28px;
  border-radius: 50%;
  border: 2px solid var(--edge);
  background: var(--panel);
  display: grid;
  place-content: center;
  gap: 4px;
  text-align: center;
  transition: border-color 0.3s ease, background 0.3s ease;
}

.dial-state {
  font-family: var(--display);
  font-size: 22px;
  font-weight: 600;
}
.dial-sub {
  font-size: 13px;
  color: var(--lilac);
}

.dial.active {
  border-color: var(--gold);
  background: radial-gradient(circle at 50% 45%, rgba(242, 193, 78, 0.16), var(--panel) 70%);
}
.dial.active .dial-state { color: var(--gold); }

.setup-fields {
  display: grid;
  gap: 14px;
  text-align: left;
  margin-bottom: 22px;
}
.setup-fields label {
  font-size: 13px;
  color: var(--lilac);
  display: grid;
  gap: 6px;
}
.setup-fields input {
  padding: 11px 14px;
  border-radius: 10px;
  border: 1px solid var(--edge);
  background: var(--panel);
  color: var(--cream);
  font: inherit;
  font-size: 15px;
}
.setup-fields input:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
.setup-fields.locked input { opacity: 0.55; }

.primary-action {
  width: 100%;
  padding: 14px 22px;
  border: 0;
  border-radius: 10px;
  background: var(--gold);
  color: var(--night);
  font: inherit;
  font-weight: 600;
  font-size: 16px;
  cursor: pointer;
}
.primary-action:hover:not(:disabled) { filter: brightness(1.07); }
.primary-action:disabled { opacity: 0.5; cursor: progress; }
.primary-action:focus-visible { outline: 3px solid var(--cream); outline-offset: 3px; }
.primary-action.stop { background: var(--coral); color: var(--night); }

.tally.compact { margin-bottom: 20px; gap: 22px; }
.tally.compact b { font-size: 21px; }

.log {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 460px;
  overflow-y: auto;
}
.log-empty { color: var(--lilac); padding: 10px 0; }

.log-row {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 12px;
  align-items: baseline;
  padding: 10px 0;
  border-bottom: 1px solid rgba(58, 47, 99, 0.5);
  font-size: 15px;
}
.log-time { color: var(--lilac); font-size: 13px; }
.log-detail { color: var(--lilac); font-size: 13px; text-align: right; }

.log-row.hit .log-main { color: var(--cream); font-weight: 500; }
.log-row.hit .log-time { color: var(--jade); }
.log-row.miss .log-main,
.log-row.quiet .log-main { color: var(--lilac); }
.log-row.bad .log-main { color: var(--coral); }
.log-row.note .log-main { color: var(--gold); }

@media (max-width: 560px) {
  .log-row { grid-template-columns: 56px 1fr; }
  .log-detail { grid-column: 2; text-align: left; }
}

/* ---- session report ----------------------------------------------------- */

.backlink { margin: 0 0 10px; }
.backlink a { color: var(--lilac); text-decoration: none; }
.backlink a:hover { color: var(--gold); }

.page-heading.big {
  font-size: clamp(28px, 4.5vw, 40px);
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

.subhead { color: var(--lilac); margin: 0 0 26px; }

.compare { margin-top: 48px; }

.compare textarea {
  width: 100%;
  padding: 14px;
  border-radius: 10px;
  border: 1px solid var(--edge);
  background: var(--panel);
  color: var(--cream);
  font: inherit;
  font-size: 15px;
  line-height: 1.7;
  resize: vertical;
  margin-bottom: 14px;
}
.compare textarea:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
.compare .primary-action { width: auto; }

#comparison {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 18px;
  margin-top: 28px;
}

.compare-block {
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  padding: 20px;
  border-top-width: 3px;
}
.compare-block.ok    { border-top-color: var(--jade); }
.compare-block.flag  { border-top-color: var(--coral); }
.compare-block.quiet { border-top-color: var(--lilac); }

.compare-block h4 {
  font-family: var(--display);
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 12px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}
.compare-block h4 span { color: var(--lilac); font-weight: 400; }
.compare-block ul { margin: 0; padding-left: 18px; }
.compare-block li { margin-bottom: 6px; }
.compare-note {
  color: var(--lilac);
  font-size: 13px;
  margin: 14px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--edge);
}
