:root {
  --ink: #4b1f2d;
  --ink-soft: #6c3948;
  --paper: #fffaf5;
  --paper-deep: #f8eee9;
  --rose-shell: #cfa4a7;
  --rose: #bd4f63;
  --rose-dark: #93384c;
  --rose-soft: #f2d7d9;
  --gold: #c9a45c;
  --gold-soft: #ead6aa;
  --green: #5f856a;
  --muted: #78676b;
  --line: #decac3;
  --white: #fffdfb;
  --danger: #a9364c;
  --shadow: 0 22px 60px rgb(75 31 45 / 18%);
  --shadow-soft: 0 10px 30px rgb(75 31 45 / 12%);
  --radius: 20px;
  --font-display: Baskerville, "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  --font-ui: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html {
  min-height: 100%;
  background: var(--rose-shell);
  color-scheme: light;
}

body {
  min-height: 100vh;
  margin: 0;
  background-color: var(--rose-shell);
  background-image: linear-gradient(rgb(255 255 255 / 4%), rgb(255 255 255 / 4%)), url("assets/peony-watercolor-background.jpg");
  background-position: center top;
  background-repeat: no-repeat;
  background-size: cover;
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.5;
}

button, input, textarea, select { font: 650 1rem/1.25 var(--font-ui); }
button, input, textarea { min-height: 48px; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .5; }

:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 20;
  padding: 10px 14px;
  transform: translateY(-160%);
  border: 1px solid var(--gold);
  border-radius: 10px;
  background: var(--paper);
  box-shadow: var(--shadow-soft);
  color: var(--ink);
}

.skip-link:focus { transform: none; }

.site-header {
  width: min(1180px, calc(100% - 32px));
  min-height: 112px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 28px;
  border-bottom: 1px solid rgb(75 31 45 / 30%);
}

.participant-header { justify-content: space-between; }
.admin-header .header-tools { margin-left: auto; }

.brand {
  display: inline-flex;
  flex-direction: column;
  width: max-content;
  color: var(--ink);
  text-decoration: none;
  line-height: .86;
}

.brand-main {
  font: 400 clamp(2.2rem, 4vw, 3.25rem)/.9 var(--font-display);
  letter-spacing: -.035em;
}

.brand-sub {
  margin-top: 10px;
  color: var(--paper);
  font: 700 .92rem/1 var(--font-ui);
  letter-spacing: .22em;
  text-transform: uppercase;
}

.host-label { margin: 0; color: var(--ink-soft); font-family: var(--font-display); font-size: 1.25rem; }
.header-status { display: flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 750; }
.header-tools { display: flex; align-items: center; gap: 18px; }

.language-control select {
  min-height: 44px;
  padding: 8px 34px 8px 12px;
  border: 1px solid rgb(75 31 45 / 42%);
  border-radius: 12px;
  background: rgb(255 250 245 / 76%);
  color: var(--ink);
  cursor: pointer;
  font-size: .9rem;
  backdrop-filter: blur(8px);
}

.live-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #4ca96d;
  box-shadow: 0 0 0 4px rgb(76 169 109 / 16%);
}

.text-link { color: var(--ink); font-weight: 700; text-underline-offset: 4px; }

.app-shell { width: min(1180px, calc(100% - 32px)); margin: 32px auto 72px; }
.participant-shell { max-width: 820px; }

.paper-panel {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--gold);
  border-radius: var(--radius);
  background:
    linear-gradient(rgb(255 250 245 / 94%), rgb(255 250 245 / 94%)),
    repeating-linear-gradient(0deg, transparent 0 3px, rgb(201 164 92 / 3%) 3px 4px),
    var(--paper);
  box-shadow: var(--shadow);
  color: var(--ink);
}

.paper-panel::before,
.paper-panel::after {
  position: absolute;
  z-index: 2;
  top: 34px;
  width: 12px;
  height: 12px;
  border: 1px solid var(--gold);
  background: var(--paper);
  content: "";
  transform: rotate(45deg);
}

.paper-panel::before { left: -7px; }
.paper-panel::after { right: -7px; }

.panel-content { padding: clamp(30px, 6vw, 64px); }

.loading-panel {
  min-height: 360px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 18px;
  color: var(--muted);
}

.loader {
  width: 38px;
  height: 38px;
  border: 4px solid var(--line);
  border-top-color: var(--rose);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

@keyframes spin { to { transform: rotate(1turn); } }

.kicker { margin: 0 0 10px; color: var(--rose); font-weight: 800; letter-spacing: .015em; }
h1, h2, h3, p { overflow-wrap: anywhere; }
h1, h2, h3 { margin-top: 0; }

h1, .display-title {
  margin-bottom: 18px;
  color: var(--ink);
  font: 400 clamp(2.8rem, 9vw, 5rem)/.95 var(--font-display);
  letter-spacing: -.035em;
}

h2 { color: var(--ink); font: 400 clamp(2rem, 6vw, 3.2rem)/1 var(--font-display); letter-spacing: -.025em; }
h3 { font-size: 1.15rem; }
.lead { max-width: 60ch; color: #66545a; font-size: 1.08rem; }
.centered { text-align: center; }
.narrow { max-width: 520px; margin-inline: auto; }

.button-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.button-row.centered { justify-content: center; }

.button {
  min-height: 50px;
  padding: 13px 22px;
  border: 1px solid var(--ink-soft);
  border-radius: 12px;
  background: transparent;
  color: var(--ink);
  font-size: .95rem;
  font-weight: 800;
  transition: transform 150ms ease, background 150ms ease, border-color 150ms ease, box-shadow 150ms ease, color 150ms ease;
}

.button:hover:not(:disabled) { transform: translateY(-2px); box-shadow: var(--shadow-soft); }

.button-primary {
  border-color: var(--rose);
  background: var(--rose);
  color: var(--white);
  box-shadow: inset 0 -2px 0 rgb(75 31 45 / 24%), 0 7px 18px rgb(189 79 99 / 18%);
}

.button-primary:hover:not(:disabled) { border-color: var(--rose-dark); background: var(--rose-dark); }
.button-danger { border-color: var(--danger); color: var(--danger); }
.button-danger:hover:not(:disabled) { background: var(--danger); color: var(--white); }
.button-success { border-color: var(--green); color: var(--green); }
.button-success:hover:not(:disabled) { background: var(--green); color: var(--white); }

.button-wide {
  width: 100%;
  min-height: 60px;
  font: 400 1.5rem/1 var(--font-display);
  letter-spacing: .015em;
}

.button-link {
  min-height: 44px;
  padding: 8px 0;
  border: 0;
  background: transparent;
  color: var(--rose-dark);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.field { display: grid; gap: 8px; margin: 24px 0; text-align: left; }
.field label { color: var(--ink); font-weight: 800; }

.field input, .field textarea {
  width: 100%;
  padding: 13px 15px;
  border: 1.5px solid var(--ink-soft);
  border-radius: 12px;
  background: var(--white);
  color: var(--ink);
}

.field input:focus, .field textarea:focus, .answer-input:focus { border-color: var(--rose); }
.field-help { margin: 0; color: var(--muted); font-size: .9rem; font-weight: 500; }
.field-error { color: var(--danger); }

.notice {
  margin: 20px 0;
  padding: 14px 16px;
  border-left: 4px solid var(--gold);
  border-radius: 0 10px 10px 0;
  background: #fff3d9;
  color: var(--ink);
}

.notice-error { border-color: var(--danger); background: #fbe5e8; }
.notice-success { border-color: var(--green); background: #e8f2ea; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.round-rail { display: flex; align-items: center; justify-content: center; gap: 0; margin: 30px auto 40px; padding: 0; list-style: none; }
.round-rail li { display: flex; align-items: center; }
.round-rail li:not(:last-child)::after { width: clamp(18px, 6vw, 66px); height: 1px; background: var(--gold); content: ""; }

.round-node {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1.5px solid var(--gold);
  border-radius: 50%;
  background: var(--paper);
  color: var(--ink);
  font-weight: 850;
}

.round-node.complete { border-color: var(--gold); background: var(--gold); color: var(--white); }
.round-node.current { border-color: var(--rose); background: var(--rose); color: var(--white); }
.theme-header { text-align: center; }
.theme-header .lead { margin-inline: auto; }
.divider { display: flex; align-items: center; gap: 14px; margin: 30px 0; color: var(--gold); }
.divider::before, .divider::after { height: 1px; flex: 1; background: var(--gold); content: ""; }
.divider-mark { font-size: 1rem; }

.question-list {
  margin: 0;
  padding: 0 clamp(18px, 3vw, 30px);
  border: 1px solid var(--gold-soft);
  border-radius: 18px;
  list-style: none;
  counter-reset: questions;
}

.question { position: relative; padding: 30px 0; border-top: 1px solid var(--line); counter-increment: questions; }
.question:first-child { border-top: 0; }
.question-title { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 18px; font-size: 1.12rem; }

.question-title::before {
  display: grid;
  min-width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid var(--rose-dark);
  border-radius: 50%;
  background: var(--rose);
  box-shadow: 0 0 0 3px var(--paper), 0 0 0 4px var(--rose-soft);
  color: var(--white);
  content: counter(questions);
  font-family: var(--font-display);
  font-size: 1.25rem;
}

.option-list { display: grid; gap: 8px; margin-left: 54px; }

.option {
  position: relative;
  display: flex;
  min-height: 48px;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border: 1px solid transparent;
  border-radius: 12px;
  cursor: pointer;
}

.option:hover { border-color: var(--rose-soft); background: #fdf0f1; }
.option input { position: absolute; opacity: 0; }

.option-marker {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1.5px solid var(--ink-soft);
  border-radius: 50%;
  font-weight: 850;
}

.option input:checked + .option-marker { border-color: var(--rose); background: var(--rose); color: var(--white); }
.option:has(input:focus-visible) { outline: 3px solid var(--gold); outline-offset: 2px; }

.answer-input {
  margin-left: 54px;
  width: calc(100% - 54px);
  min-height: 50px;
  padding: 13px 15px;
  border: 1.5px solid var(--ink-soft);
  border-radius: 12px;
  background: var(--white);
  color: var(--ink);
}

.scoreboard { width: 100%; border-collapse: collapse; }
.table-scroll { max-width: 100%; overflow-x: auto; }
.scoreboard th, .scoreboard td { padding: 14px 8px; border-bottom: 1px solid var(--line); text-align: left; }
.scoreboard th { color: var(--muted); font-size: .78rem; letter-spacing: .055em; text-transform: uppercase; }
.scoreboard .score { color: var(--rose-dark); font-size: 1.15rem; font-weight: 850; text-align: right; }
.scoreboard .rank { width: 48px; }
.scoreboard tr.is-current { background: #f9e6e8; }
.pending-note { color: var(--muted); font-size: .9rem; }

.admin-board { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.1fr) minmax(320px, 1.35fr); }
.admin-section { min-width: 0; padding: 32px; border-right: 1px solid var(--line); }
.admin-section:last-child { border-right: 0; }

.admin-section h2 {
  padding-bottom: 13px;
  border-bottom: 1px solid var(--gold);
  font-size: 2rem;
}

.scoreboard-compact { table-layout: fixed; }
.scoreboard-compact .rank { width: 48px; }
.scoreboard-compact .score { width: 64px; }
.scoreboard-compact th, .scoreboard-compact td { overflow: hidden; text-overflow: ellipsis; }

.session-command {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 42px 50px;
  border-bottom: 1px solid var(--gold);
}

.session-command h1 { margin: 0; font-size: clamp(2.4rem, 5vw, 4.2rem); }
.session-status { margin: 8px 0 0; color: var(--rose); font-family: var(--font-display); font-size: 1.35rem; }
.session-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 12px; }
.participant-list { display: grid; gap: 14px; }
.participant-row { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.round-dots { display: flex; gap: 7px; grid-column: 1 / -1; }
.round-dot { width: 18px; height: 18px; border: 1.5px solid #9c8b8e; border-radius: 50%; }
.round-dot.complete { border-color: var(--green); background: var(--green); }
.round-dot.open { border-color: var(--rose); background: var(--rose); }
.review-list { display: grid; gap: 14px; }

.review-item {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgb(255 253 251 / 68%);
}

.review-meta { color: var(--muted); font-size: .85rem; }
.review-answer { margin: 6px 0; font-size: 1.05rem; font-weight: 800; }
.review-expected { margin: 6px 0 14px; color: #66545a; font-size: .92rem; }
.empty-state { padding: 26px 0; color: var(--muted); }
.game-grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); margin-top: 26px; }

.game-option {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--white);
  box-shadow: var(--shadow-soft);
}

.game-option h3 { margin-bottom: 6px; font-family: var(--font-display); font-size: 1.45rem; }
.game-option p { color: var(--muted); }

.toast {
  position: fixed;
  z-index: 30;
  right: 20px;
  bottom: 20px;
  max-width: min(420px, calc(100% - 40px));
  padding: 14px 18px;
  border: 1px solid var(--gold);
  border-radius: 12px;
  background: var(--ink);
  box-shadow: var(--shadow);
  color: var(--white);
}

@media (max-width: 900px) {
  .admin-board { grid-template-columns: 1fr; }
  .admin-section { border-right: 0; border-bottom: 1px solid var(--line); }
  .session-command { align-items: flex-start; flex-direction: column; padding: 32px; }
  .session-actions { justify-content: flex-start; }
}

@media (max-width: 620px) {
  body {
    font-size: 15px;
    background-position: 60% top;
    background-size: auto 100vh;
  }

  .site-header { width: min(100% - 24px, 1180px); min-height: 96px; gap: 12px; }
  .brand-main { font-size: 2rem; }
  .brand-sub { margin-top: 8px; font-size: .68rem; }
  .host-label { display: none; }
  .admin-header .text-link { display: none; }
  .header-tools { gap: 8px; }
  .participant-header .header-status { max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .language-control select { width: 96px; padding-inline: 8px; }
  .app-shell { width: min(100% - 20px, 1180px); margin-top: 20px; }
  .paper-panel { border-radius: 16px; }
  .panel-content { padding: 30px 20px; }
  .paper-panel::before, .paper-panel::after { top: 26px; }
  h1, .display-title { font-size: clamp(2.7rem, 14vw, 4rem); }
  .round-rail { margin-block: 24px 32px; }
  .round-node { width: 36px; height: 36px; }
  .question-list { padding-inline: 16px; border-radius: 14px; }
  .option-list { margin-left: 0; }
  .answer-input { margin-left: 0; width: 100%; }
  .question-title { font-size: 1rem; }
  .button-row .button { flex: 1 1 100%; }
  .session-command { padding: 26px 20px; }
  .admin-section { padding: 26px 20px; }
  .scoreboard th:nth-child(3), .scoreboard td:nth-child(3) { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
