:root {
  color-scheme: light;
  --paper: #f2eee5;
  --paper-2: #e7e0d3;
  --ink: #101b2a;
  --muted: #68707a;
  --cyan: #21d9df;
  --cyan-deep: #087f87;
  --coral: #ff6a52;
  --line: rgba(16, 27, 42, .2);
  --shadow: 0 18px 50px rgba(16, 27, 42, .12);
  font-family: "Avenir Next", "Trebuchet MS", sans-serif;
  background: var(--paper);
  color: var(--ink);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--ink); }
body { margin: 0; min-height: 100vh; background: var(--paper); position: relative; }
.grain { position: fixed; inset: 0; pointer-events: none; opacity: .22; z-index: 10; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.10'/%3E%3C/svg%3E"); }
a { color: inherit; }
.masthead { min-height: 84px; padding: 20px clamp(20px, 5vw, 72px); display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); position: relative; z-index: 11; }
.wordmark { text-decoration: none; font-weight: 900; letter-spacing: -.04em; font-size: 1.3rem; }
.wordmark span { background: var(--cyan); padding: 3px 4px 1px; margin-right: 2px; }
nav { display: flex; align-items: center; gap: 24px; font-size: .78rem; font-weight: 800; text-transform: uppercase; letter-spacing: .12em; }
nav a { text-decoration: none; }
.inline { display: inline; margin: 0; }
.logout-form button { border: 0; background: none; color: inherit; text-transform: uppercase; font: inherit; letter-spacing: inherit; cursor: pointer; padding: 0; }
main { width: min(1400px, 100%); margin: 0 auto; padding: clamp(32px, 6vw, 90px) clamp(20px, 5vw, 72px) 100px; }
footer { background: var(--ink); color: var(--paper); padding: 20px clamp(20px, 5vw, 72px); display: flex; justify-content: space-between; gap: 20px; font-size: .68rem; letter-spacing: .16em; font-weight: 800; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-family: "Bodoni 72", Didot, "Times New Roman", serif; font-size: clamp(3.2rem, 8vw, 8.5rem); line-height: .84; letter-spacing: -.06em; font-weight: 500; margin-bottom: 28px; }
h1 em { color: var(--cyan-deep); font-weight: 500; }
h2 { font-family: "Bodoni 72", Didot, "Times New Roman", serif; font-size: clamp(2rem, 3.2vw, 3.3rem); line-height: .95; letter-spacing: -.035em; font-weight: 500; }
.eyebrow, .section-label { font-size: .67rem; letter-spacing: .2em; font-weight: 900; text-transform: uppercase; }
.section-label { display: flex; align-items: center; gap: 10px; margin-bottom: 28px; }
.section-label::before { content: ""; width: 28px; height: 3px; background: var(--cyan-deep); }
.lede { max-width: 580px; font-size: clamp(1rem, 1.7vw, 1.25rem); line-height: 1.65; color: var(--muted); }
.login-shell { min-height: 65vh; display: grid; grid-template-columns: 1.2fr minmax(300px, 480px); align-items: end; gap: clamp(40px, 8vw, 120px); }
.login-shell .eyebrow, .login-shell .lede { grid-column: 1; }
.login-shell h1 { grid-column: 1; }
.login-card { grid-column: 2; grid-row: 1 / span 3; align-self: center; background: var(--ink); color: var(--paper); padding: clamp(28px, 5vw, 56px); box-shadow: 18px 18px 0 var(--cyan); transform: rotate(1deg); }
.paper-form { display: grid; gap: 22px; }
label { display: grid; gap: 8px; font-size: .72rem; font-weight: 900; text-transform: uppercase; letter-spacing: .1em; }
input, select { width: 100%; border: 0; border-bottom: 2px solid currentColor; background: transparent; color: inherit; padding: 12px 2px; font: inherit; font-size: 1rem; border-radius: 0; }
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible { outline: 3px solid var(--coral); outline-offset: 3px; }
.form-error { padding: 12px; border: 1px solid var(--coral); color: #ffd6cf; }
.button { min-height: 52px; display: inline-flex; align-items: center; justify-content: space-between; gap: 28px; border: 2px solid var(--ink); padding: 13px 18px; font: inherit; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; text-decoration: none; cursor: pointer; box-shadow: 5px 5px 0 var(--ink); transition: transform .18s ease, box-shadow .18s ease; }
.button:hover { transform: translate(3px, 3px); box-shadow: 2px 2px 0 var(--ink); }
.button.primary { background: var(--cyan); color: var(--ink); }
.login-card .button { margin-top: 12px; box-shadow: 5px 5px 0 var(--paper); }
.button.secondary { background: transparent; }
.hero.compact { display: grid; grid-template-columns: 1fr minmax(260px, 360px); gap: 60px; align-items: end; }
.connection { border: 1px solid var(--line); padding: 20px; display: flex; gap: 14px; align-items: flex-start; background: rgba(255,255,255,.25); }
.connection .signal { width: 12px; height: 12px; border-radius: 50%; background: var(--coral); box-shadow: 0 0 0 5px rgba(255,106,82,.15); margin-top: 4px; flex: none; }
.connection.connected .signal { background: var(--cyan-deep); box-shadow: 0 0 0 5px rgba(8,127,135,.15); }
.connection strong, .connection small { display: block; }
.connection small { color: var(--muted); line-height: 1.45; margin-top: 6px; }
.connection-link { display: inline-block; margin-top: 14px; font-size: .7rem; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; }
.content-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(300px, .7fr); gap: clamp(40px, 7vw, 100px); margin-top: 70px; border-top: 1px solid var(--line); padding-top: 32px; }
.empty-state { display: grid; grid-template-columns: auto 1fr; gap: 28px; align-items: center; padding: 70px 0; border-bottom: 1px solid var(--line); }
.empty-number, .record-number { font-family: "Bodoni 72", Didot, serif; font-size: clamp(4rem, 9vw, 9rem); line-height: 1; color: var(--paper-2); -webkit-text-stroke: 1px var(--ink); }
.empty-state p { color: var(--muted); max-width: 480px; line-height: 1.6; }
.playlist-list { list-style: none; padding: 0; margin: 0; border-top: 2px solid var(--ink); }
.playlist-list li { border-bottom: 1px solid var(--line); }
.playlist-list a { display: grid; grid-template-columns: 46px 1fr auto; gap: 20px; align-items: center; padding: 24px 4px; text-decoration: none; }
.playlist-list a:hover { background: rgba(33,217,223,.15); }
.list-index { font-family: monospace; font-size: .7rem; }
.playlist-list strong, .playlist-list small { display: block; }
.playlist-list strong { font-size: 1.25rem; }
.playlist-list small { color: var(--muted); margin-top: 4px; }
.arrow { font-size: 1.5rem; }
.add-panel { background: var(--paper-2); padding: 30px; align-self: start; border-top: 6px solid var(--ink); }
.back { display: inline-block; margin-bottom: 60px; font-size: .75rem; text-transform: uppercase; letter-spacing: .12em; font-weight: 900; }
.record-header { display: grid; grid-template-columns: auto 1fr; gap: clamp(24px, 6vw, 80px); align-items: center; border-bottom: 1px solid var(--line); padding-bottom: 60px; }
.record-header h1 { font-size: clamp(3rem, 7vw, 7rem); margin-bottom: 14px; }
.source-url { color: var(--muted); overflow-wrap: anywhere; }
.action-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 40px; }
.action-card { border: 1px solid var(--line); padding: clamp(26px, 5vw, 52px); min-height: 420px; display: flex; flex-direction: column; align-items: flex-start; }
.action-card.accent-card { background: var(--ink); color: var(--paper); }
.action-card p { color: var(--muted); line-height: 1.65; max-width: 520px; }
.accent-card p { color: #c6cbd1; }
.action-card form { width: 100%; margin-top: auto; }
.action-card input[type=file] { margin-bottom: 22px; }
.review-header { display: flex; justify-content: space-between; align-items: end; gap: 40px; border-bottom: 5px solid var(--ink); }
.review-header h1 { font-size: clamp(3rem, 7vw, 7rem); }
.review-count { text-align: right; padding-bottom: 28px; }
.review-count strong { display: block; font-family: "Bodoni 72", Didot, serif; font-size: 5rem; line-height: .8; }
.review-count span { display: block; color: var(--muted); margin-top: 12px; }
.match-list { list-style: none; margin: 0; padding: 0; }
.match-row { display: grid; grid-template-columns: 58px 1fr; gap: 24px; padding: 28px 8px; border-bottom: 1px solid var(--line); position: relative; }
.match-row::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--muted); }
.match-row.exact::before { background: var(--cyan-deep); }
.match-row.confident::before { background: var(--cyan); }
.match-row.uncertain::before { background: var(--coral); }
.track-index { font-family: monospace; font-size: .72rem; }
.status-chip { display: inline-block; font-size: .62rem; letter-spacing: .12em; text-transform: uppercase; font-weight: 900; background: var(--paper-2); padding: 5px 8px; margin-bottom: 10px; }
.match-copy h3 { margin-bottom: 4px; font-size: 1.3rem; }
.match-copy p { color: var(--muted); margin-bottom: 0; }
.candidate-select { max-width: 540px; margin-top: 20px; }
.apply-bar { position: sticky; bottom: 18px; z-index: 8; background: var(--ink); color: var(--paper); padding: 18px 20px; margin-top: 32px; display: flex; justify-content: space-between; align-items: center; gap: 30px; box-shadow: var(--shadow); }
.apply-bar strong, .apply-bar span { display: block; }
.apply-bar span { color: #aeb5bd; font-size: .82rem; margin-top: 3px; }
.completion { min-height: 60vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.completion-mark { width: 100px; height: 100px; border-radius: 50%; display: grid; place-items: center; background: var(--cyan); font-size: 3rem; border: 3px solid var(--ink); box-shadow: 8px 8px 0 var(--ink); margin-bottom: 34px; }
.completion h1 { font-size: clamp(3rem, 7vw, 7rem); margin: 15px 0; }
.completion p { color: var(--muted); font-size: 1.1rem; margin-bottom: 30px; }
.error-page h1 { color: var(--coral); }

[hidden] { display: none !important; }
.match-copy, .record-header > div, .playlist-list a > span { min-width: 0; overflow-wrap: anywhere; }
.match-copy select { max-width: 100%; }
.review-tools { margin-block: 24px; max-width: 400px; }
.run-history { margin-top: 48px; border-top: 1px solid var(--line); padding-top: 28px; }
.run-history li { padding-block: 10px; overflow-wrap: anywhere; }
.button:disabled { opacity: .65; cursor: wait; transform: none; box-shadow: none; }
.completion .button { margin-bottom: 20px; }
select { background-color: var(--paper); color: var(--ink); }
::selection { background: var(--cyan); color: var(--ink); }

.setup-shell { max-width: 1080px; margin-inline: auto; }
.setup-shell h1 { font-size: clamp(3rem, 6vw, 5.5rem); line-height: .98; letter-spacing: -.035em; }
.setup-heading { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: end; }
.setup-shell p, .setup-instructions { line-height: 1.65; max-width: 72ch; }
.setup-shell p { color: #495562; }
.setup-progress { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); padding: 0; margin: 28px 0 40px; list-style-position: inside; border-block: 1px solid var(--line); }
.setup-progress li { padding: 20px 12px; font-weight: 800; }
.setup-progress span { display: block; margin-top: 8px; font-size: .8rem; font-weight: 400; color: #495562; }
.setup-section { padding-block: 36px; border-bottom: 1px solid var(--line); scroll-margin-top: 20px; }
.setup-section h2 { font-size: clamp(2rem, 3.5vw, 3rem); line-height: 1.1; }
.setup-form { max-width: 760px; margin-block: 30px; }
.setup-form p { margin-bottom: 0; font-size: .9rem; }
.setup-shell details { margin-block: 24px; }
.setup-shell summary { font-weight: 800; cursor: pointer; padding-block: 12px; text-underline-offset: 4px; }
.setup-shell summary:focus-visible { outline: 3px solid var(--coral); outline-offset: 3px; }
.setup-instructions li { padding: 8px 0 8px 4px; }
.callback-label { max-width: 760px; margin-block: 24px 16px; }
.callback-label input { font-size: .95rem; text-transform: none; letter-spacing: normal; }
.copy-status { margin-inline-start: 18px; font-size: .85rem; }
.check-label { display: flex; align-items: flex-start; text-transform: none; letter-spacing: normal; font-size: .95rem; font-weight: 500; line-height: 1.5; }
.check-label input { width: 20px; height: 20px; margin-top: 2px; flex: none; accent-color: var(--cyan-deep); }
.settings-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-block: 24px; }
.settings-fields label { min-width: 0; }
.deployment-details { display: grid; grid-template-columns: 180px 1fr; gap: 14px 24px; font-size: .9rem; line-height: 1.6; }
.deployment-details dt { font-weight: 800; }
.deployment-details dd { margin: 0; overflow-wrap: anywhere; }
.setup-actions { display: flex; gap: 24px; align-items: center; flex-wrap: wrap; margin-block: 24px; }
.setup-actions form { margin: 0; }
.setup-shell .form-error { color: #792b20; background: #fbe0d9; }
.setup-notice { border: 1px solid var(--cyan-deep); padding: 18px; }
.setup-shell code { overflow-wrap: anywhere; }
#first-playlist > .button { margin-bottom: 20px; }

@media (max-width: 760px) {
  .masthead { min-height: 68px; }
  .masthead { flex-wrap: wrap; gap: 18px; }
  nav { width: 100%; justify-content: space-between; gap: 12px; font-size: .68rem; letter-spacing: .06em; }
  .setup-heading, .settings-fields { grid-template-columns: 1fr; gap: 16px; }
  .setup-progress { grid-template-columns: 1fr 1fr; }
  .setup-progress li { padding-inline: 0; }
  .deployment-details { grid-template-columns: 1fr; gap: 4px; }
  .deployment-details dd { margin-bottom: 16px; }
  .copy-status { display: block; margin: 14px 0; }
  main { padding-top: 40px; }
  footer { flex-direction: column; }
  .login-shell, .hero.compact, .content-grid, .action-columns { grid-template-columns: 1fr; }
  .login-shell { display: block; }
  .login-card { transform: none; margin-top: 44px; box-shadow: 8px 8px 0 var(--cyan); }
  .hero.compact { gap: 24px; }
  .content-grid { margin-top: 45px; }
  .add-panel { padding: 24px; }
  .record-header { grid-template-columns: 1fr; }
  .record-number { font-size: 5rem; }
  .action-card { min-height: 360px; }
  .review-header { align-items: flex-start; flex-direction: column; }
  .review-count { text-align: left; }
  .match-row { grid-template-columns: 36px 1fr; gap: 12px; }
  .apply-bar { align-items: stretch; flex-direction: column; bottom: 8px; }
  .apply-bar .button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
