:root {
  --ink: #17130d;
  --muted: #6e675c;
  --paper: #f7f2e8;
  --panel: #fffaf0;
  --line: #d8cdbb;
  --accent: #a6402d;
  --accent-dark: #6f2419;
  --field: #fffdf8;
  --ok: #315f46;
  --danger: #9c2f2f;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(23, 19, 13, 0.035) 1px, transparent 1px) 0 0 / 28px 28px,
    linear-gradient(0deg, rgba(23, 19, 13, 0.025) 1px, transparent 1px) 0 0 / 28px 28px,
    var(--paper);
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  overflow-x: hidden;
}

button,
input,
textarea {
  font: inherit;
}

a {
  color: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px clamp(18px, 4vw, 56px);
  border-bottom: 1px solid rgba(23, 19, 13, 0.14);
  background: rgba(247, 242, 232, 0.9);
  backdrop-filter: blur(12px);
}

.brand {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0;
  text-decoration: none;
  text-transform: uppercase;
}

nav {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 0.95rem;
}

nav a,
.back-link {
  color: var(--ink);
  text-decoration-color: rgba(166, 64, 45, 0.5);
  text-underline-offset: 4px;
}

.app-shell,
.admin-shell {
  width: min(1180px, calc(100% - 36px));
  margin: 0 auto;
  padding: clamp(26px, 6vw, 72px) 0;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(340px, 0.95fr);
  align-items: end;
  gap: clamp(24px, 5vw, 72px);
  min-height: 48vh;
  padding-bottom: clamp(28px, 6vw, 64px);
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent-dark);
  font-size: 0.84rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 13ch;
  margin-bottom: 0;
  font-size: clamp(2.8rem, 6vw, 5.2rem);
  line-height: 0.94;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 14px;
  font-size: 1.45rem;
  line-height: 1.05;
}

h3 {
  margin-bottom: 6px;
  font-size: 1.12rem;
  line-height: 1.2;
}

.submit-panel,
.panel,
.paper-card,
.table-row,
.player-shell {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 240, 0.9);
  box-shadow: 0 18px 48px rgba(45, 31, 17, 0.08);
}

.submit-panel {
  padding: clamp(18px, 3vw, 28px);
}

label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.input-row,
.inline-admin-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

input {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  background: var(--field);
  outline: none;
}

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(166, 64, 45, 0.14);
}

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  color: #fffaf5;
  background: var(--accent);
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}

button:hover,
.button:hover {
  background: var(--accent-dark);
}

.secondary,
.nav-button {
  color: var(--ink);
  border-color: var(--line);
  background: transparent;
}

.secondary:hover,
.nav-button:hover {
  color: var(--ink);
  background: rgba(166, 64, 45, 0.08);
}

.disabled {
  opacity: 0.62;
}

.disabled-link {
  pointer-events: none;
  opacity: 0.52;
}

.access-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  padding: 28px 0;
}

.panel {
  padding: 22px;
}

.panel p,
.muted {
  color: var(--muted);
  overflow-wrap: anywhere;
}

#waitlist-form {
  display: grid;
  gap: 10px;
}

.form-message {
  min-height: 22px;
  margin: 10px 0 0;
  color: var(--accent-dark);
}

.feed-line {
  min-height: 24px;
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.text-button {
  min-height: 0;
  margin-left: 8px;
  padding: 0;
  border: 0;
  color: var(--accent-dark);
  background: transparent;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.text-button:hover {
  color: var(--accent);
  background: transparent;
}

.library,
.admin-grid {
  padding-top: 24px;
}

.section-title,
.admin-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}

.section-title h2,
.admin-header h1 {
  margin-bottom: 0;
}

.admin-header h1 {
  max-width: none;
  font-size: clamp(2.7rem, 8vw, 5.6rem);
}

.paper-list,
.table-list {
  display: grid;
  gap: 10px;
}

.paper-card,
.table-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  padding: 16px;
}

.paper-actions,
.row-actions,
.actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid rgba(49, 95, 70, 0.28);
  border-radius: 999px;
  color: var(--ok);
  background: rgba(49, 95, 70, 0.08);
  font-size: 0.88rem;
}

.error {
  color: var(--danger);
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

.table-row strong,
.table-row span {
  display: block;
}

.table-row strong {
  overflow-wrap: anywhere;
}

.table-row span {
  color: var(--muted);
  font-size: 0.92rem;
}

.player-body {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.player-shell {
  width: min(820px, 100%);
  padding: clamp(22px, 5vw, 44px);
}

.player-shell h1 {
  max-width: 16ch;
  margin: 22px 0 12px;
  font-size: clamp(2.4rem, 7vw, 5rem);
}

audio {
  width: 100%;
  margin: 22px 0;
}

@media (max-width: 820px) {
  .hero,
  .access-grid,
  .admin-grid,
  .paper-card,
  .table-row,
  .admin-header {
    grid-template-columns: 1fr;
  }

  .section-title,
  .admin-header {
    align-items: start;
  }

  .hero {
    min-height: auto;
  }

  h1 {
    max-width: 10ch;
  }

  .input-row,
  .inline-admin-form {
    grid-template-columns: 1fr;
  }

  .input-row button,
  .inline-admin-form button,
  #waitlist-form button {
    width: 100%;
  }
}

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

  nav {
    flex-wrap: wrap;
  }

  .app-shell,
  .admin-shell {
    width: min(100% - 24px, 1180px);
  }
}
