:root {
  color-scheme: light;
  --ink: #121212;
  --muted: #5f625d;
  --line: #dedbd2;
  --panel: #ffffff;
  --band: #f5f1e8;
  --accent: #0f4b44;
  --accent-dark: #092f2b;
  --gold: #c8a84d;
  --rust: #b45b2c;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: #fbfaf7;
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.55;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
  padding: 30px clamp(18px, 4vw, 56px);
  background: #ffffff;
  border-bottom: 1px solid #cbc6b8;
}

.topbar-actions {
  display: grid;
  justify-items: end;
  gap: 8px;
}

.return-link {
  display: inline-block;
  margin-top: 8px;
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.return-link:hover {
  color: var(--rust);
  text-decoration: underline;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--rust);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

h1, h2, h3 {
  margin: 0;
  line-height: 1.2;
}

h1 {
  font-size: clamp(1.8rem, 4vw, 3rem);
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 500;
  letter-spacing: 0.02em;
}

h2 {
  font-size: 1.35rem;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 500;
}

h3 {
  font-size: 1.08rem;
}

.print-button,
button {
  border: 1px solid var(--ink);
  border-radius: 6px;
  background: var(--ink);
  color: #ffffff;
  padding: 10px 16px;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}

.print-button:hover,
button:hover {
  background: var(--accent);
  border-color: var(--accent);
}

.link-button {
  width: auto;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--accent);
  font-size: 0.92rem;
  font-weight: 700;
  text-decoration: underline;
}

.link-button:hover {
  background: transparent;
  color: var(--rust);
}

.secondary-button {
  background: transparent;
  color: var(--ink);
}

.secondary-button:hover {
  color: #ffffff;
}

.layout {
  max-width: 980px;
  margin: 0 auto;
  padding: 24px clamp(16px, 4vw, 32px) 56px;
}

.admin-layout {
  max-width: 1480px;
}

.intro-band {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px 20px;
  margin-bottom: 22px;
  box-shadow: 0 12px 28px rgba(18, 18, 18, 0.04);
}

.intro-band p {
  margin: 0;
}

.access-gate {
  display: grid;
  gap: 12px;
  margin-bottom: 22px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 12px 28px rgba(18, 18, 18, 0.035);
}

.access-gate[hidden] {
  display: none;
}

.access-form {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(220px, 1.2fr) auto;
  gap: 10px;
  align-items: center;
}

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

.content-stack {
  display: grid;
  gap: 14px;
}

.section {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  box-shadow: 0 12px 28px rgba(18, 18, 18, 0.035);
}

.section::before {
  content: "";
  display: block;
  width: 42px;
  height: 3px;
  margin-bottom: 16px;
  background: linear-gradient(90deg, var(--gold), var(--rust));
}

.section-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
}

.section-body {
  margin-top: 14px;
}

.section-body p {
  margin: 0 0 12px;
}

.section-body ul {
  margin: 8px 0 0 22px;
  padding: 0;
}

.theme-group {
  display: grid;
  gap: 12px;
  margin-top: 22px;
  padding: 18px;
  border: 1px solid #d8ceb6;
  border-radius: 8px;
  background: #fbf8f1;
}

.theme-card {
  padding: 18px;
  border-color: #d8ceb6;
  box-shadow: none;
}

.theme-card::before {
  width: 28px;
  height: 2px;
  margin-bottom: 12px;
}

.theme-card h2 {
  font-size: 1.08rem;
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 700;
}

.theme-toggle {
  display: flex;
  width: 100%;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border: 0;
  border-radius: 0;
  padding: 0;
  color: var(--ink);
  background: transparent;
  text-align: left;
}

.theme-toggle:hover {
  background: transparent;
}

.chevron {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid #c8c1ae;
  border-radius: 6px;
  color: var(--accent);
  flex: 0 0 auto;
}

.theme-summary {
  margin: 14px 0 12px;
  max-width: 760px;
  color: #333632;
  font-size: 1.02rem;
}

.reveal-button {
  display: inline-flex;
  width: auto;
  align-items: center;
  margin-bottom: 6px;
  border-color: var(--accent);
  background: transparent;
  color: var(--accent);
}

.reveal-button:hover {
  color: #ffffff;
}

.comment-area {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.comment-form {
  display: none;
  margin-top: 12px;
}

.comment-form.is-open {
  display: block;
}

.published-section .theme-toggle h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.25rem;
  font-weight: 500;
}

.published-comments {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.published-comments[hidden] {
  display: none;
}

.published-comment {
  margin: 0;
  padding: 14px 16px;
  border-left: 3px solid var(--gold);
  background: var(--band);
}

.published-comment p {
  margin: 0;
  white-space: pre-wrap;
}

textarea {
  width: 100%;
  min-height: 130px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  font: inherit;
  background: #ffffff;
}

textarea:focus {
  outline: 2px solid rgba(200, 168, 77, 0.45);
  border-color: var(--gold);
}

input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  font: inherit;
  background: #ffffff;
}

input:focus {
  outline: 2px solid rgba(200, 168, 77, 0.45);
  border-color: var(--gold);
}

.save-status {
  min-height: 22px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.92rem;
}

.tour-overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(18, 18, 18, 0.42);
}

.tour-overlay[hidden] {
  display: none;
}

.tour-panel {
  width: min(620px, 100%);
  padding: 28px;
  border: 1px solid #cbc6b8;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 24px 64px rgba(18, 18, 18, 0.24);
}

.tour-panel h2 {
  margin-bottom: 12px;
  font-size: clamp(1.5rem, 4vw, 2rem);
}

.tour-panel p {
  margin: 0;
  white-space: pre-line;
}

.tour-checkbox {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 22px;
  color: var(--muted);
}

.tour-checkbox input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.tour-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 24px;
}

.admin-grid {
  display: grid;
  gap: 22px;
  align-items: start;
}

.admin-invites {
  display: grid;
  gap: 12px;
  margin-bottom: 22px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.participant-links {
  margin-top: 22px;
}

.admin-invites h2 {
  margin-bottom: 4px;
}

.invite-form {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(220px, 1.2fr) auto;
  gap: 10px;
  align-items: center;
}

.bulk-invite-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: start;
}

.bulk-invite-form textarea {
  min-height: 92px;
}

.export-button {
  justify-self: start;
}

.copy-button {
  width: auto;
  margin-right: 10px;
  padding: 7px 10px;
  font-size: 0.86rem;
}

.row-actions {
  display: flex;
  gap: 8px;
}

.row-actions .copy-button {
  margin-right: 0;
}

.invite-url {
  display: inline-block;
  max-width: 340px;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  vertical-align: middle;
  white-space: nowrap;
}

.table-input {
  min-width: 170px;
  padding: 7px 9px;
  font-size: 0.9rem;
}

.table-toggle {
  text-align: left;
}

.login-details {
  display: grid;
  gap: 4px;
  margin-top: 8px;
  min-width: 180px;
}

.login-details[hidden] {
  display: none;
}

.admin-panel {
  min-width: 0;
}

.admin-panel h2 {
  margin-bottom: 8px;
}

.table-wrap {
  overflow-x: auto;
  max-height: calc(100vh - 250px);
  overflow-y: auto;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.94rem;
}

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  text-align: left;
}

th {
  position: sticky;
  top: 0;
  background: var(--band);
}

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

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

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

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

  .table-wrap {
    max-height: none;
  }
}

@media (max-width: 640px) {
  .topbar,
  .section-header {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions {
    justify-items: stretch;
  }

  .print-button,
  button:not(.link-button) {
    width: 100%;
    text-align: center;
  }

  .link-button {
    text-align: left;
  }

  .tour-actions {
    flex-direction: column-reverse;
  }
}
