:root {
  --ink: #1c1213;
  --text: #241718;
  --muted: #645255;
  --panel: rgba(255, 255, 255, 0.92);
  --line: rgba(36, 23, 24, 0.18);
  --brand: #b7182b;
  --brand-soft: #f2b5bc;
  --danger: #a10f20;
  --pill-bg: #ffe8ec;
  --pill-border: #f0b7bf;
  --input-bg: #ffffff;
  --table-head: #392427;
  --footer-link: #392427;
  --footer-border: rgba(57, 36, 39, 0.4);
  --body-bg: radial-gradient(circle at 8% 12%, #fff7f7 0%, #ffecec 38%, #f8d8de 100%);
  --orb-a: #ef7485;
  --orb-b: #d64a5f;
}

[data-theme="dark"] {
  --ink: #f8e9eb;
  --text: #f2dde0;
  --muted: #cbaeb2;
  --panel: rgba(24, 16, 17, 0.88);
  --line: rgba(248, 219, 224, 0.2);
  --brand: #ff4f69;
  --brand-soft: #ff96a6;
  --danger: #ff8fa1;
  --pill-bg: rgba(125, 31, 47, 0.5);
  --pill-border: rgba(255, 137, 156, 0.55);
  --input-bg: rgba(15, 11, 11, 0.92);
  --table-head: #f3c4cc;
  --footer-link: #f3c4cc;
  --footer-border: rgba(243, 196, 204, 0.45);
  --body-bg: radial-gradient(circle at 15% 18%, #341d21 0%, #211417 40%, #0f0b0c 100%);
  --orb-a: #6f2632;
  --orb-b: #451820;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "IBM Plex Sans", sans-serif;
  color: var(--text);
  background: var(--body-bg);
  overflow-x: hidden;
  transition: background 260ms ease, color 260ms ease;
}

h1,
h2,
h3,
.eyebrow {
  font-family: "Space Grotesk", sans-serif;
}

.bg-orb {
  position: fixed;
  border-radius: 999px;
  filter: blur(40px);
  opacity: 0.55;
  pointer-events: none;
}

.orb-a {
  width: 300px;
  height: 300px;
  background: var(--orb-a);
  top: -50px;
  left: -50px;
}

.orb-b {
  width: 400px;
  height: 400px;
  background: var(--orb-b);
  bottom: -100px;
  right: -120px;
}

.top-utility {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 0.75rem;
}

.theme-toggle {
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 78%, transparent);
  color: var(--text);
  border-radius: 999px;
  padding: 0.45rem 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.page-shell {
  width: 90%;
  margin: 2rem auto;
  position: relative;
  z-index: 1;
  animation: rise 420ms ease-out;
}

.admin-tabs {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 0.9rem;
}

.tab-link {
  text-decoration: none;
  color: var(--text);
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 80%, transparent);
  padding: 0.5rem 0.9rem;
  border-radius: 999px;
  font-weight: 500;
}

.tab-link.is-active {
  background: color-mix(in srgb, var(--brand-soft) 35%, var(--panel));
  border-color: color-mix(in srgb, var(--brand-soft) 58%, var(--line));
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
  padding: 1.5rem;
  backdrop-filter: blur(8px);
}

.eyebrow {
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--brand) 78%, var(--text));
  margin: 0;
  font-size: 0.78rem;
}

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

.form-grid {
  display: grid;
  gap: 0.65rem;
  margin-top: 1rem;
}

input,
textarea,
select,
button {
  font: inherit;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.7rem 0.85rem;
  background: var(--input-bg);
  color: var(--text);
}

textarea {
  resize: vertical;
}

.btn {
  border: none;
  border-radius: 12px;
  padding: 0.7rem 1rem;
  cursor: pointer;
}

.btn-primary {
  color: #fff6f7;
  background: linear-gradient(120deg, #8f1022, #cf1d35);
}

.btn-small {
  padding: 0.45rem 0.65rem;
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--line);
}

.btn-danger {
  color: #fff6f7;
  background: linear-gradient(120deg, #5f0b17, #a10f20);
}

.btn-danger-outline {
  border-color: color-mix(in srgb, var(--danger) 70%, var(--line));
  color: var(--danger);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
}

.actions-row {
  display: grid;
  grid-template-columns: max-content max-content 1fr;
  gap: 0.8rem;
  margin: 1rem 0;
}

.search-bar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) max-content max-content max-content;
  gap: 0.65rem;
  margin-bottom: 1rem;
  align-items: center;
}

.clear-link {
  text-align: center;
  text-decoration: none;
  color: var(--text);
}

.board-section + .board-section {
  margin-top: 1.25rem;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 0.6rem;
}

.pager {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.85rem;
}

.builder-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem;
  background: color-mix(in srgb, var(--panel) 78%, transparent);
  margin-bottom: 1rem;
}

.builder-form {
  display: grid;
  gap: 0.55rem;
  margin: 0.75rem 0;
}

.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.inline-check input {
  width: auto;
}

.question-list {
  display: grid;
  gap: 0.45rem;
}

.question-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-top: 1px solid var(--line);
  padding-top: 0.55rem;
}

.question-actions {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.multi-choice-group {
  display: grid;
  gap: 0.35rem;
  padding: 0.65rem;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.multi-choice-item {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.multi-choice-item input {
  width: auto;
}

.answer-item {
  margin-bottom: 0.35rem;
}

.link-box {
  border: 1px solid var(--brand-soft);
  background: color-mix(in srgb, var(--panel) 70%, white);
  color: var(--ink);
}

.generated-link-wrap {
  margin-top: 0.9rem;
  display: grid;
  gap: 0.45rem;
}

.status-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 1rem;
}

.pill {
  padding: 0.35rem 0.6rem;
  border-radius: 999px;
  font-size: 0.8rem;
  background: var(--pill-bg);
  border: 1px solid var(--pill-border);
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 980px;
}

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

th {
  color: var(--table-head);
  font-size: 0.86rem;
}

.inline-form {
  display: flex;
  gap: 0.45rem;
  align-items: center;
}

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

.flash-stack {
  display: grid;
  gap: 0.5rem;
  margin-bottom: 0.9rem;
}

.flash {
  border-radius: 10px;
  padding: 0.65rem 0.85rem;
  font-size: 0.95rem;
}

.flash-success {
  background: color-mix(in srgb, var(--brand-soft) 45%, var(--panel));
  border: 1px solid color-mix(in srgb, var(--brand-soft) 70%, var(--line));
}

.flash-error {
  background: #f8d9d9;
  border: 1px solid #e89d9d;
  color: var(--danger);
}

.flash-info {
  background: color-mix(in srgb, var(--panel) 82%, black);
  border: 1px solid var(--line);
}

.site-footer {
  display: flex;
  justify-content: center;
  margin-top: 1rem;
  padding-bottom: 0.5rem;
}

.footer-link {
  color: var(--footer-link);
  text-decoration: none;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--footer-border);
}

@media (max-width: 760px) {
  .actions-row {
    grid-template-columns: 1fr;
  }

  .search-bar {
    grid-template-columns: 1fr;
  }

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

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