/* Secret Santa (caelestis.fun) */

:root {
  color-scheme: light dark;
  --bg: #f7f1e6;
  --bg-glow: #fbe5d6;
  --surface: #fffdf8;
  --surface-2: #f8f2e7;
  --field: #ffffff;
  --ink: #1d2721;
  --muted: #5b675f;
  --border: #e6dac6;
  --border-strong: #cdbb9c;
  --hover: #f1e8d8;
  --red: #b3261e;
  --red-hover: #9a1f18;
  --red-text: #a3241c;
  --red-soft: #fbe6e2;
  --red-border: #efc2bb;
  --green: #1e5a43;
  --green-text: #1b5a42;
  --green-soft: #e2efe7;
  --green-border: #b9d6c5;
  --gold-soft: #f8edd3;
  --gold-border: #e8d29c;
  --tag: #fffaf0;
  --tag-edge: #e3cfa6;
  --tag-stitch: #c9a55a;
  --live: #2f9e68;
  --focus: #2f7d5e;
  --shadow: 0 1px 2px rgba(70, 45, 10, 0.05), 0 8px 24px rgba(70, 45, 10, 0.06);
  --shadow-lg: 0 2px 6px rgba(70, 45, 10, 0.08), 0 24px 48px rgba(70, 45, 10, 0.16);
  --radius: 16px;
  --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --font-mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1613;
    --bg-glow: #1b2b23;
    --surface: #15211c;
    --surface-2: #1b2923;
    --field: #101a16;
    --ink: #f1ebdf;
    --muted: #a9b5ad;
    --border: #283a32;
    --border-strong: #3b5247;
    --hover: #22332b;
    --red: #c63a30;
    --red-hover: #d64a40;
    --red-text: #f28b80;
    --red-soft: #3a1d1a;
    --red-border: #6b2f29;
    --green: #2f7d5e;
    --green-text: #8fd4b2;
    --green-soft: #183328;
    --green-border: #2c5a47;
    --gold-soft: #2d2615;
    --gold-border: #5a4a22;
    --tag: #1c2a24;
    --tag-edge: #3b5247;
    --tag-stitch: #b8954d;
    --live: #5fd39a;
    --focus: #8fd4b2;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
    --shadow-lg: 0 2px 6px rgba(0, 0, 0, 0.35), 0 24px 48px rgba(0, 0, 0, 0.45);
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg) radial-gradient(1000px 440px at 50% -140px, var(--bg-glow), transparent 70%) no-repeat;
  color: var(--ink);
  font: 16px/1.55 var(--font-body);
  overflow-x: hidden;
}

[hidden] {
  display: none !important;
}

a {
  color: var(--green-text);
  text-underline-offset: 3px;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  line-height: 1.15;
  letter-spacing: -0.005em;
}

p {
  margin: 0 0 12px;
}

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

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.ico {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

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

.hint {
  font-size: 0.92rem;
}

.small {
  font-size: 0.85rem;
}

.center {
  text-align: center;
}

/* ---------- layout ---------- */

.wrap {
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  padding: 0 16px;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 680px;
  margin: 0 auto;
  padding: 14px 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
}

.site-nav {
  display: flex;
  gap: 16px;
  font-size: 0.95rem;
}

.site-nav a {
  color: var(--muted);
  text-decoration: none;
}

.site-nav a:hover {
  color: var(--ink);
  text-decoration: underline;
}

.hero {
  text-align: center;
  padding: 18px 0 6px;
}

.hero h1 {
  margin: 0 0 14px;
  font-size: clamp(2.1rem, 7vw, 3.1rem);
}

.lede {
  max-width: 32em;
  margin: 0 auto;
  color: var(--muted);
  font-size: 1.08rem;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--red-text);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* ---------- cards and form controls ---------- */

.card {
  margin: 16px 0;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card > h2 {
  margin: 0 0 14px;
  font-size: 1.35rem;
}

.card h3 {
  margin: 22px 0 8px;
  font: 700 1rem var(--font-body);
}

.optional {
  margin-left: 4px;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 500;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--field);
  color: var(--ink);
  font: inherit;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus) 45%, transparent);
  outline-offset: 0;
  border-color: var(--focus);
}

textarea {
  min-height: 72px;
  resize: vertical;
}

input:disabled,
select:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.field {
  margin: 0 0 14px;
}

.field > label {
  display: block;
  margin: 0 0 6px;
  font-size: 0.92rem;
  font-weight: 650;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 12px;
}

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

.add-row input {
  flex: 1;
  min-width: 0;
}

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--ink);
  font: 650 0.95rem var(--font-body);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, transform 0.1s;
}

.btn:hover {
  background: var(--hover);
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  border-color: var(--red);
  background: var(--red);
  color: #fff;
}

.btn-primary:hover {
  border-color: var(--red-hover);
  background: var(--red-hover);
}

.btn-secondary {
  border-color: var(--green-border);
  background: var(--green-soft);
  color: var(--green-text);
}

.btn-secondary:hover {
  border-color: var(--green-text);
  background: var(--green-soft);
}

.btn-ghost {
  border-color: transparent;
  background: transparent;
  color: var(--green-text);
}

.btn-ghost:hover {
  background: var(--green-soft);
}

.btn-danger,
.btn-danger:hover {
  color: var(--red-text);
}

.btn-danger:hover {
  background: var(--red-soft);
}

.btn-small {
  min-height: 36px;
  padding: 6px 12px;
  font-size: 0.88rem;
}

.btn-big {
  width: 100%;
  min-height: 56px;
  border-radius: 14px;
  font-size: 1.1rem;
}

.link-btn {
  padding: 6px 0;
  border: 0;
  background: none;
  color: var(--green-text);
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.link-btn.small {
  font-size: 0.85rem;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: none;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.icon-btn:hover {
  background: var(--hover);
  color: var(--ink);
}

/* ---------- notices ---------- */

.error {
  margin: 0 0 12px;
  padding: 12px 14px;
  border: 1px solid var(--red-border);
  border-radius: 10px;
  background: var(--red-soft);
  color: var(--ink);
}

/* ---------- home ---------- */

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

.plain-list a {
  font-weight: 650;
}

/* ---------- room header ---------- */

.room-head {
  padding: 14px 0 4px;
  text-align: center;
}

.room-head h1 {
  margin: 0 0 8px;
  font-size: clamp(1.9rem, 6vw, 2.6rem);
  overflow-wrap: anywhere;
}

.room-meta {
  margin: 0 0 6px;
  color: var(--muted);
}

.room-message {
  max-width: 32em;
  margin: 0 auto 10px;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.status {
  display: inline-block;
  margin: 4px 0 0;
  padding: 4px 14px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green-text);
  font-size: 0.9rem;
  font-weight: 650;
}

.live-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-left: 4px;
  border-radius: 50%;
  background: var(--border-strong);
  vertical-align: 1px;
}

.live-dot.on {
  background: var(--live);
}

/* ---------- invite ---------- */

.share {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px 20px;
}

.qr {
  width: 168px;
  height: 168px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
}

.share-code {
  margin: 0 0 10px;
  font-family: var(--font-mono);
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 0.12em;
}

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

/* ---------- you ---------- */

.me {
  margin: 0 0 12px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-2);
}

.card .me-name {
  margin: 0 0 12px;
  font: 700 1.3rem var(--font-display);
  overflow-wrap: anywhere;
}

.wishlist {
  margin: 16px 0 4px;
}

.wishlist .hint {
  margin: 4px 0 0;
}

.me-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
}

.claim {
  margin-top: 14px;
}

.claim .hint {
  margin-bottom: 8px;
}

.claim-names {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.reel {
  padding: 20px 10px;
  border: 2px dashed var(--tag-stitch);
  border-radius: 14px;
  background: var(--tag);
  color: var(--muted);
  font-family: var(--font-display);
  font-size: clamp(2rem, 9vw, 2.8rem);
  font-weight: 700;
  line-height: 1.1;
  text-align: center;
  overflow-wrap: anywhere;
}

.reel.landed {
  border-style: solid;
  color: var(--red-text);
}

.match-box {
  padding: 20px 14px 12px;
  border: 1px solid var(--tag-edge);
  border-radius: 16px;
  outline: 1.5px dashed var(--tag-stitch);
  outline-offset: -9px;
  background: var(--tag);
  text-align: center;
}

.tag-label {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.match-name {
  margin: 4px 0 12px;
  color: var(--red-text);
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 10vw, 3.2rem);
  font-weight: 700;
  line-height: 1.05;
  overflow-wrap: anywhere;
  outline: none;
}

.match-name.pop {
  animation: pop 0.45s cubic-bezier(0.2, 0.8, 0.3, 1.3);
}

@keyframes pop {
  from {
    opacity: 0.2;
    transform: scale(0.8);
  }
}

.hints-box {
  max-width: 30em;
  margin: 0 auto 10px;
  padding: 10px 12px;
  border: 1px dashed var(--tag-stitch);
  border-radius: 12px;
  background: var(--surface-2);
  text-align: left;
}

.hints-box p:last-child {
  margin: 0;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

/* ---------- people ---------- */

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

.roster-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 8px;
  min-height: 48px;
  padding: 6px 6px 6px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
}

.roster-name {
  flex: 1 1 8em;
  min-width: 0;
  overflow-wrap: anywhere;
  font-weight: 650;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  padding: 2px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 650;
  white-space: nowrap;
}

.chip.ok {
  border-color: var(--green-border);
  background: var(--green-soft);
  color: var(--green-text);
}

.chip.you {
  border-color: var(--gold-border);
  background: var(--gold-soft);
  color: var(--ink);
}

.chip.warn {
  border-color: var(--red-border);
  background: var(--red-soft);
  color: var(--red-text);
}

.chip.muted {
  border-style: dashed;
}

.roster-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ---------- organizer ---------- */

.host > h3:first-of-type {
  margin-top: 4px;
}

.rule-sentence {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}

.rule-sentence span {
  color: var(--muted);
  font-weight: 600;
}

.rule-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-top: 8px;
}

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

.rule {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 4px 4px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
}

.options {
  margin-top: 12px;
}

.check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 0;
  cursor: pointer;
}

.check input {
  width: 20px;
  height: 20px;
  min-height: 0;
  flex: none;
  margin: 2px 0 0;
  padding: 0;
  accent-color: var(--green);
}

.check.inline {
  padding: 4px 0;
  font-size: 0.92rem;
}

.host-actions {
  display: grid;
  gap: 10px;
  margin-top: 22px;
}

/* ---------- FAQ ---------- */

.faq {
  margin: 40px 0 0;
}

.faq h2 {
  margin: 0 0 8px;
  font-size: 1.5rem;
}

.faq details {
  border-bottom: 1px solid var(--border);
}

.faq summary {
  padding: 14px 0;
  font-weight: 650;
  cursor: pointer;
}

.faq details p {
  margin: 0 0 14px;
  color: var(--muted);
}

/* ---------- footer and Ko-fi ---------- */

.site-footer {
  max-width: 680px;
  margin: 48px auto 0;
  padding: 24px 16px 48px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
}

.site-footer p {
  margin: 0 0 10px;
}

.footer-links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px 16px;
}

.footer-links a {
  color: var(--muted);
}

.support-line {
  display: flex;
  justify-content: center;
}

.kofi-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border: 1px solid var(--gold-border);
  border-radius: 999px;
  background: var(--gold-soft);
  color: var(--ink);
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.kofi-link svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.kofi-link:hover {
  border-color: var(--border-strong);
}

/* ---------- dialog and toast ---------- */

dialog {
  width: min(92vw, 420px);
  max-height: 90vh;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-lg);
}

dialog::backdrop {
  background: rgba(10, 16, 13, 0.6);
}

dialog h2 {
  margin: 0 0 10px;
  font-size: 1.3rem;
  overflow-wrap: anywhere;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  z-index: 50;
  width: max-content;
  max-width: min(92vw, 460px);
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--ink);
  color: var(--bg);
  box-shadow: var(--shadow-lg);
  font-size: 0.94rem;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 16px);
  transition: opacity 0.2s, transform 0.2s;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- prose pages ---------- */

.prose {
  max-width: 640px;
  margin: 0 auto;
  padding: 8px 16px 0;
}

.prose h1 {
  margin: 12px 0 18px;
  font-size: clamp(2rem, 6vw, 2.6rem);
}

.prose h2 {
  margin: 28px 0 10px;
  font-size: 1.35rem;
}

/* ---------- small screens ---------- */

@media (max-width: 560px) {
  .card {
    padding: 16px;
  }

  .field-row,
  .rule-sentence {
    grid-template-columns: 1fr;
  }

  .share {
    justify-content: center;
    text-align: center;
  }

  .share-actions {
    justify-content: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation: none !important;
  }
}
