@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600&family=Crimson+Text:wght@400;600&display=swap');

:root {
  --bg: #0b1512;
  --bg-soft: #10201a;
  --accent: #3ed08a;
  --accent-strong: #75f0b9;
  --text: #e6fbf2;
  --muted: #9bc8b1;
  --border: rgba(62, 208, 138, 0.25);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Crimson Text', serif;
  background: radial-gradient(circle at top, #1b2219, #0b0f0c 65%);
  color: var(--text);
}

.stage {
  max-width: 980px;
  margin: 0 auto;
  padding: 48px 24px 72px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  position: relative;
  min-height: 100vh;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 20% 0%, rgba(62, 208, 138, 0.3), transparent 45%),
    radial-gradient(circle at 80% 10%, rgba(47, 170, 132, 0.25), transparent 50%),
    linear-gradient(180deg, rgba(10, 18, 15, 0.95), rgba(8, 12, 10, 0.98));
  pointer-events: none;
  z-index: -2;
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  background: linear-gradient(180deg, rgba(117, 240, 185, 0.22), transparent 35%);
  opacity: 0.7;
  pointer-events: none;
  z-index: -1;
}

.hero h1 {
  font-family: 'Cinzel', serif;
  font-size: clamp(2.2rem, 3vw, 3rem);
  margin: 8px 0 10px;
}

.hero-top > div {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.hero-top {
  display: flex;
  align-items: stretch;
  gap: 16px;
}

.logo {
  width: auto;
  height: 100%;
  max-height: 240px;
  object-fit: contain;
  filter: drop-shadow(0 10px 25px rgba(62, 208, 138, 0.35));
  border-radius: 18px;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--accent);
  font-size: 0.85rem;
}

.lead {
  color: var(--muted);
  font-size: 1.1rem;
  max-width: 70ch;
  margin: 0;
}

.tagline {
  margin-top: 8px;
  color: var(--accent-strong);
  font-style: italic;
  font-size: 1.05rem;
}

.lead-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 6px;
}

.theatre-access {
  flex: 0 0 auto;
  border: 1px solid rgba(117, 240, 185, 0.35);
  border-radius: 14px;
  background: rgba(7, 12, 10, 0.78);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.theatre-cta {
  display: inline-block;
  text-align: center;
  text-decoration: none;
  font-size: 0.95rem;
  padding: 12px 16px;
  white-space: nowrap;
}

.qr-wrap {
  background: #f2fff8;
  border-radius: 10px;
  padding: 6px;
  width: fit-content;
}

.qr-code {
  display: block;
  width: 92px;
  height: 92px;
  border-radius: 6px;
}

.card {
  background: linear-gradient(120deg, rgba(28, 36, 29, 0.95), rgba(15, 19, 16, 0.9));
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-weight: 600;
}

.field span {
  color: var(--accent-strong);
  font-size: 0.95rem;
  font-family: 'Cinzel', serif;
  letter-spacing: 0.08em;
}

textarea,
input,
select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: #0e1210;
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
  appearance: none;
}

.select {
  position: relative;
}

.select-toggle {
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: #0e1210;
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
  cursor: pointer;
  position: relative;
}

.select-toggle::after {
  content: '';
  position: absolute;
  right: 14px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--accent-strong);
  border-bottom: 2px solid var(--accent-strong);
  transform: translateY(-50%) rotate(45deg);
}

.select-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: #0e1210;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 6px;
  margin: 0;
  list-style: none;
  display: none;
  z-index: 10;
  max-height: 240px;
  overflow-y: auto;
  box-shadow: 0 14px 26px rgba(0, 0, 0, 0.35);
}

.select.open .select-menu {
  display: block;
}

.select-option {
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text);
}

.select-option:hover,
.select-option.is-selected {
  background: rgba(62, 208, 138, 0.2);
  color: var(--accent-strong);
}

textarea:focus,
input:focus,
select:focus {
  outline: 2px solid rgba(184, 168, 92, 0.5);
}

.grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  align-items: end;
  margin: 16px 0;
}

.grid.single-col {
  grid-template-columns: 1fr;
}

.quick-presets {
  margin-top: 14px;
}

.quick-title {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 1rem;
}

.preset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.preset-btn {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(62, 208, 138, 0.12);
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  padding: 10px 12px;
  text-align: left;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.preset-btn:hover {
  background: rgba(62, 208, 138, 0.22);
  transform: translateY(-1px);
}

.cta {
  border: none;
  background: var(--accent);
  color: #0b1712;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 12px 20px;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  overflow: hidden;
}

.cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(184, 168, 92, 0.25);
}

.cta.danger {
  background: #d16666;
  color: #200c0c;
}

.cta.danger:hover {
  box-shadow: 0 10px 18px rgba(209, 102, 102, 0.25);
}

.cta::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent, rgba(255, 255, 255, 0.25), transparent);
  transform: translateX(-120%);
  transition: transform 0.5s ease;
}

.cta:hover::after {
  transform: translateX(120%);
}

.result {
  border: 1px dashed rgba(255, 255, 255, 0.2);
  border-radius: 14px;
  padding: 20px;
}

.result.is-revealed {
  animation: reveal 0.9s ease;
  box-shadow: 0 0 24px rgba(212, 199, 122, 0.18);
}

@keyframes reveal {
  0% {
    opacity: 0;
    transform: translateY(6px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.result h2 {
  margin-top: 0;
}

.result-body {
  font-size: 1.1rem;
}

.highlight {
  font-size: 1.3rem;
  color: var(--accent-strong);
}

#per-viewer span {
  display: block;
  margin-top: 6px;
}

.list {
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
  display: grid;
  gap: 8px;
}

.table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
}

.table th,
.table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.admin-table th,
.admin-table td {
  font-size: 0.9rem;
  vertical-align: top;
}

.admin-table td:nth-child(7) {
  max-width: 320px;
  white-space: pre-wrap;
  word-break: break-word;
}

.muted {
  color: var(--muted);
}

.footnote {
  text-align: center;
  color: var(--muted);
}

.footnote a {
  color: var(--accent);
}

.project-strip {
  margin-top: auto;
  width: 100%;
  background: #fff;
  border-radius: 10px;
  padding: 10px;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.project-strip img {
  display: block;
  width: 100%;
  height: auto;
}

.theatre-page {
  background: #000;
}

.theatre-page::before,
.theatre-page::after {
  display: none;
}

.theatre-stage {
  max-width: 1080px;
  gap: 16px;
}

.hemingway-banner {
  background: linear-gradient(180deg, #050505, #000);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 16px;
  padding: 26px;
  box-shadow: inset 0 0 40px rgba(255, 255, 255, 0.06);
}

.hemingway-portrait-wrap {
  margin: -8px -8px 18px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.hemingway-portrait {
  width: 100%;
  height: clamp(180px, 32vw, 340px);
  object-fit: cover;
  object-position: center 24%;
  display: block;
  filter: contrast(1.05) saturate(0.9);
}

.hemingway-banner h1 {
  margin: 10px 0;
  font-family: 'Cinzel', serif;
  font-size: clamp(2rem, 3.7vw, 3.2rem);
}

.top-nav {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 10px;
}

.back-home {
  display: inline-block;
  text-decoration: none;
  border: 1px solid rgba(117, 240, 185, 0.35);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 0.9rem;
  color: var(--accent-strong);
  background: rgba(0, 0, 0, 0.35);
}

.back-home:hover {
  background: rgba(117, 240, 185, 0.16);
}

.theatre-chat-card {
  background: #020202;
  border-color: rgba(255, 255, 255, 0.16);
  padding: 18px;
}

.quick-tools {
  margin-top: 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.02);
}

.quick-tools summary {
  cursor: pointer;
  color: var(--accent-strong);
  font-family: 'Cinzel', serif;
  letter-spacing: 0.06em;
}

.quick-tools[open] summary {
  margin-bottom: 10px;
}

.starter-row,
.vote-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.starter-btn,
.vote-btn {
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  color: #e7e7e7;
  font-family: inherit;
  font-size: 0.95rem;
  padding: 10px 12px;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
}

.starter-btn:hover,
.vote-btn:hover {
  background: rgba(117, 240, 185, 0.14);
  border-color: rgba(117, 240, 185, 0.4);
}

.chat-log {
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  background: #000;
  min-height: 230px;
  max-height: 320px;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.msg {
  padding: 10px 12px;
  border-radius: 10px;
  line-height: 1.4;
  max-width: 90%;
}

.msg.user {
  align-self: flex-end;
  background: rgba(117, 240, 185, 0.16);
  border: 1px solid rgba(117, 240, 185, 0.28);
}

.msg.assistant {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.msg.pending {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.dots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.dots i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-strong);
  opacity: 0.3;
  animation: pulseDot 1s infinite;
}

.dots i:nth-child(2) {
  animation-delay: 0.2s;
}

.dots i:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes pulseDot {
  0%,
  80%,
  100% {
    opacity: 0.25;
    transform: scale(0.9);
  }
  40% {
    opacity: 1;
    transform: scale(1.15);
  }
}

.chat-form {
  margin-top: 14px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.chat-form.is-busy {
  opacity: 0.85;
}

.chat-status {
  min-height: 1.2rem;
  margin: 8px 2px 0;
  color: var(--accent-strong);
  font-size: 0.95rem;
}

.song-card {
  border: 1px dashed rgba(117, 240, 185, 0.35);
}

.song-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}

.song-title {
  margin: 0;
  font-size: 1.2rem;
}

.song-meta {
  color: var(--muted);
  margin-bottom: 12px;
}

.song-lyrics {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 14px;
  white-space: pre-wrap;
  line-height: 1.45;
}

.admin-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

@media (max-width: 640px) {
  .stage {
    padding: 22px 16px 44px;
    gap: 18px;
  }

  .project-strip {
    border-radius: 8px;
    padding: 6px;
  }

  .cta {
    width: 100%;
  }

  .hero h1 {
    font-size: clamp(2rem, 10.2vw, 2.55rem);
    line-height: 1.08;
    margin: 4px 0 6px;
  }

  .eyebrow {
    font-size: 0.72rem;
    letter-spacing: 0.16em;
  }

  .lead {
    font-size: 0.93rem;
    line-height: 1.35;
  }

  .tagline {
    margin-top: 4px;
    font-size: 0.82rem;
    line-height: 1.3;
  }

  .hero-top {
    flex-direction: row;
    align-items: center;
    gap: 10px;
  }

  .logo {
    width: 92px;
    height: auto;
    max-height: none;
    flex: 0 0 auto;
  }

  .chat-form {
    grid-template-columns: 1fr;
  }

  .lead-row {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 8px;
    margin-top: 2px;
  }

  .lead-row .theatre-access {
    order: 1;
  }

  .lead-row .lead {
    order: 2;
    width: 100%;
    max-width: none;
    display: block;
  }

  .theatre-access {
    width: 100%;
    padding: 8px;
    gap: 8px;
    overflow: hidden;
  }

  .theatre-cta {
    width: auto;
    flex: 1 1 0;
    min-width: 0;
    white-space: normal;
    font-size: 0.88rem;
    line-height: 1.2;
    padding: 10px 12px;
    border-radius: 16px;
  }

  .qr-wrap {
    padding: 4px;
  }

  .qr-code {
    width: 68px;
    height: 68px;
  }

  .hemingway-portrait {
    height: 160px;
    object-position: center 20%;
  }

  .chat-log {
    min-height: 46vh;
    max-height: 52vh;
  }

  .starter-row,
  .vote-row {
    display: flex;
    overflow-x: auto;
    grid-template-columns: none;
    padding-bottom: 4px;
  }

  .starter-btn,
  .vote-btn {
    white-space: nowrap;
    min-width: max-content;
  }

  .quick-tools {
    padding: 8px;
  }

  .song-head {
    flex-direction: column;
    align-items: flex-start;
  }
}
