:root {
  color-scheme: light;
  --ink: #171717;
  --muted: #686868;
  --paper: #f6f3ed;
  --panel: #ffffff;
  --accent: #222222;
  --line: rgba(23, 23, 23, 0.14);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-width: 320px;
  background: var(--paper);
  color: var(--ink);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.55;
}

body[style] {
  --muted: color-mix(in srgb, var(--ink) 70%, transparent);
  --line: color-mix(in srgb, var(--ink) 16%, transparent);
}

a { color: inherit; text-underline-offset: .18em; }

.public-brand {
  display: flex;
  justify-content: center;
  padding-top: clamp(.75rem, 3vw, 1.5rem);
}
.public-brand a {
  display: grid;
  width: 52px;
  height: 78px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 18px;
  background: #171717;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .14);
}
.public-brand img { display: block; width: 100%; height: 100%; object-fit: cover; }

.public-shell {
  width: min(100% - 2rem, 980px);
  margin: 0 auto;
  padding: clamp(2rem, 7vw, 5rem) 0;
}

.access-card,
.delivery-controller {
  max-width: 620px;
  margin: 0 auto;
  padding: clamp(1.5rem, 5vw, 3rem);
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--panel);
  box-shadow: 0 20px 70px rgba(0, 0, 0, .07);
}

.eyebrow {
  margin: 0 0 .5rem;
  color: var(--muted);
  font-size: .76rem;
  font-weight: 750;
  letter-spacing: .14em;
  text-transform: uppercase;
}

h1, h2 { line-height: 1.08; letter-spacing: -.035em; }
h1 { margin: 0 0 1.25rem; font-size: clamp(2rem, 7vw, 4.5rem); }
h2 { margin: 0 0 1rem; font-size: clamp(1.65rem, 4vw, 2.5rem); }

.notice {
  padding: .85rem 1rem;
  border-radius: 12px;
  background: #f1ece4;
}

.notice-error { border-left: 4px solid #6e271f; }
.secondary-action { margin-top: 2rem; color: var(--muted); }

.manual-form { display: grid; gap: .85rem; margin-top: 2rem; }
.manual-form label { font-weight: 700; }
.manual-form input {
  width: 100%;
  padding: .9rem 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  font: 700 1.05rem ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .08em;
  text-transform: uppercase;
}

button,
.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: .8rem 1.2rem;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: var(--paper);
  font: inherit;
  font-weight: 750;
  text-decoration: none;
}

button:disabled { cursor: not-allowed; opacity: .42; }

.album-heading { margin: 0 auto 2rem; text-align: center; }
.artwork-frame {
  overflow: hidden;
  border-radius: 24px;
  background: #111;
  box-shadow: 0 22px 80px rgba(0, 0, 0, .16);
}
.artwork-frame iframe { display: block; width: 100%; height: 78vh; border: 0; }
.delivery-controller { margin-top: 2rem; }
.delivery-form { display: grid; gap: 1.25rem; margin-top: 1.5rem; }
.format-choice { display: grid; gap: .75rem; margin: 0; padding: 0; border: 0; }
.format-choice legend { margin-bottom: .75rem; font-weight: 750; }
.format-choice label {
  display: flex;
  align-items: center;
  gap: .85rem;
  padding: .9rem 1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  cursor: pointer;
}
.format-choice input { width: 1.15rem; height: 1.15rem; flex: 0 0 auto; }
.format-choice span { display: flex; flex: 1; justify-content: space-between; gap: 1rem; }
.format-choice small { color: var(--muted); }
.readiness-check { display: flex; gap: .75rem; margin: 1.5rem 0; }
.readiness-check input { width: 1.15rem; height: 1.15rem; flex: 0 0 auto; }
.delivery-form .readiness-check { margin: 0; }
.delivery-ready {
  margin: 1.5rem 0;
  border: 1px solid rgba(0, 0, 0, .12);
  background: #fff;
  color: #111;
  font-size: .98rem;
  line-height: 1.45;
  box-shadow: 0 .5rem 1.5rem rgba(0, 0, 0, .08);
}
.delivery-ready strong { color: #000; }
.technical-note { color: var(--muted); font-size: .88rem; }
.public-footer { display: grid; gap: .35rem; justify-items: center; margin-top: 2.5rem; color: var(--muted); text-align: center; }
.link-stack { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; margin-top: 2rem; }

.local-player {
  max-width: 860px;
  margin: 0 auto;
  padding: clamp(1.5rem, 5vw, 3rem);
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--panel);
  box-shadow: 0 20px 70px rgba(0, 0, 0, .07);
}
.local-player-lead { max-width: 68ch; font-size: 1.08rem; }
.local-file-picker { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; margin: 2rem 0 1rem; }
.local-file-picker input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.local-file-picker input[type="file"]:focus-visible + .technical-note,
.local-file-picker:focus-within .button-link { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 3px; }
.local-player-status { margin: 1rem 0 1.5rem; }
.local-player-library { margin-top: 2rem; padding-top: 2rem; border-top: 1px solid var(--line); }
.local-player-heading { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.quiet-button {
  min-height: 40px;
  padding: .55rem .9rem;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  font-size: .88rem;
}
.local-player-now {
  display: grid;
  gap: .7rem;
  margin: 1.5rem 0;
  padding: 1.25rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: color-mix(in srgb, var(--paper) 72%, transparent);
}
.local-player-now audio { width: 100%; }
.local-track-export { width: fit-content; font-size: .88rem; }
.local-track-list { display: grid; gap: .6rem; margin: 1rem 0 0; padding: 0; list-style: none; }
.local-track-button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  width: 100%;
  min-height: 0;
  padding: .85rem 1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: transparent;
  color: var(--ink);
  text-align: left;
}
.local-track-button span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.local-track-button small { color: var(--muted); }
.local-track-button[aria-current="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 9%, transparent); }
.local-player-help { display: grid; gap: .6rem; margin-top: 2rem; }
.local-player-help details { padding: .85rem 1rem; border: 1px solid var(--line); border-radius: 14px; }
.local-player-help summary { cursor: pointer; font-weight: 750; }
.local-player-help details p { margin-bottom: 0; }
.local-privacy-note { margin-top: 1.5rem; }

@media (max-width: 600px) {
  .public-shell { width: min(100% - 1rem, 980px); padding: .5rem 0 2rem; }
  .access-card, .delivery-controller, .local-player { border-radius: 18px; }
  .artwork-frame { border-radius: 18px; }
  .artwork-frame iframe { height: 72vh; }
  .local-track-button { grid-template-columns: 1fr; gap: .2rem; }
}

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