/* ==========================================================================
   Secret Santa — a festive midnight theme
   ========================================================================== */

/* Fonts (self-hosted, no third-party requests) */
@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../fonts/fraunces-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../fonts/fraunces-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Fraunces";
  font-style: italic;
  font-weight: 400 700;
  font-display: swap;
  src: url("../fonts/fraunces-italic-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Fraunces";
  font-style: italic;
  font-weight: 400 700;
  font-display: swap;
  src: url("../fonts/fraunces-italic-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../fonts/inter-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../fonts/inter-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Tokens */
:root {
  color-scheme: dark;

  --font-body: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Fraunces", "Iowan Old Style", "Palatino Linotype", Georgia, serif;

  --bg-0: #07120d;
  --bg-1: #0b1b14;
  --surface: #0e2119;
  --surface-soft: #10261c;

  --ink: #f5efe2;
  --ink-soft: #ddd6c7;
  --muted: #a6b6ab;
  --faint: #82968a;

  --gold: #e7c98a;
  --gold-bright: #f6e3b5;
  --gold-deep: #b98f4a;

  --red: #cf4750;
  --red-bright: #e4636b;
  --green: #7ec69f;

  --line: rgba(236, 219, 183, 0.13);
  --line-strong: rgba(236, 219, 183, 0.22);
  --line-gold: rgba(231, 201, 138, 0.26);

  --radius-xl: 26px;
  --radius-lg: 18px;
  --radius-md: 13px;

  --container: 1120px;

  --shadow-card: 0 32px 80px -40px rgba(0, 0, 0, 0.9), 0 2px 10px rgba(0, 0, 0, 0.2);
  --shadow-soft: 0 20px 50px -30px rgba(0, 0, 0, 0.8);
}

/* Reset and base */
*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background-color: var(--bg-0);
  background-image:
    radial-gradient(920px 640px at 84% -8%, rgba(231, 201, 138, 0.12), transparent 66%),
    radial-gradient(720px 540px at 0% 8%, rgba(207, 71, 80, 0.1), transparent 66%),
    radial-gradient(1200px 900px at 52% 108%, rgba(41, 108, 79, 0.22), transparent 70%),
    linear-gradient(180deg, #0a1913 0%, #081510 42%, #06110d 100%);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: url("/static/img/starfield.svg");
  background-repeat: repeat;
  background-size: 760px auto;
  opacity: 0.5;
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, rgba(0, 0, 0, 0.7) 58%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 0%, rgba(0, 0, 0, 0.7) 58%, transparent 100%);
}

img,
svg {
  display: block;
  max-width: 100%;
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

a {
  color: inherit;
}

button,
input,
select {
  font: inherit;
}

::selection {
  color: #132219;
  background: var(--gold);
}

:where(a, button, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  width: 19px;
  height: 19px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon--filled {
  fill: currentColor;
  stroke: none;
}

.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;
}

.skip-link {
  position: fixed;
  top: -80px;
  left: 18px;
  z-index: 100;
  padding: 11px 17px;
  color: #14231a;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  background: var(--gold);
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  transition: top 0.18s ease;
}

.skip-link:focus {
  top: 16px;
}

/* Layout shell */
.site-shell {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: calc(var(--container) + 56px);
  margin: 0 auto;
  padding: 26px 28px calc(36px + env(safe-area-inset-bottom, 0px));
}

/* Top bar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 2px 0 14px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  text-decoration: none;
  border-radius: 12px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 43px;
  height: 43px;
  color: var(--gold-bright);
  background:
    linear-gradient(145deg, rgba(231, 201, 138, 0.22), rgba(207, 71, 80, 0.14)),
    rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(231, 201, 138, 0.34);
  border-radius: 13px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 10px 24px -16px rgba(231, 201, 138, 0.5);
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.brand-mark .icon {
  width: 22px;
  height: 22px;
}

.brand-name {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 600;
  letter-spacing: 0.005em;
  line-height: 1;
}

.season-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.015em;
  background: rgba(255, 248, 233, 0.035);
  border: 1px solid var(--line);
  border-radius: 999px;
  white-space: nowrap;
}

.season-pill .icon {
  width: 14px;
  height: 14px;
  color: var(--gold);
}

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

/* Hero */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.16fr) minmax(300px, 0.84fr);
  gap: 26px;
  align-items: center;
  padding: 40px 0 50px;
}

.hero-copy {
  min-width: 0;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 11px;
  margin: 0 0 17px;
  color: var(--gold);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.22em;
  line-height: 1.4;
  text-transform: uppercase;
}

.eyebrow-line {
  width: 30px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold));
}

.hero h1 {
  max-width: 12ch;
  margin: 0 0 22px;
  font-family: var(--font-display);
  font-size: clamp(2.85rem, 6vw, 4.9rem);
  font-weight: 500;
  letter-spacing: -0.037em;
  line-height: 0.98;
  color: var(--ink);
  text-wrap: balance;
}

.hero h1 em {
  display: inline-block;
  padding-bottom: 0.07em;
  color: var(--gold-bright);
  font-weight: 500;
}

@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .hero h1 em {
    color: transparent;
    background-image: linear-gradient(102deg, #f8e8bf 0%, #e7c98a 42%, #d2a565 78%, #f2d9a5 100%);
    -webkit-background-clip: text;
    background-clip: text;
  }
}

.hero-lede {
  max-width: 49ch;
  margin: 0 0 27px;
  color: var(--muted);
  font-size: 16.5px;
  line-height: 1.72;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 6px 12px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.005em;
  background: rgba(255, 255, 255, 0.028);
  border: 1px solid var(--line);
  border-radius: 999px;
  white-space: nowrap;
}

.meta-pill .icon {
  width: 14px;
  height: 14px;
  color: var(--gold);
}

.meta-pill--success {
  color: #b9e7cc;
  background: rgba(126, 198, 159, 0.07);
  border-color: rgba(126, 198, 159, 0.22);
}

.meta-pill--success .icon {
  color: var(--green);
}

.meta-pill--ready {
  color: var(--gold-bright);
  background: rgba(231, 201, 138, 0.055);
  border-color: rgba(231, 201, 138, 0.2);
}

.meta-pill--warning {
  color: #ffc2c2;
  background: rgba(207, 71, 80, 0.08);
  border-color: rgba(207, 71, 80, 0.24);
}

.meta-pill--warning .icon {
  color: #e98f8f;
}

.status-dot {
  width: 6px;
  height: 6px;
  flex: none;
  background: var(--gold);
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(231, 201, 138, 0.12);
}

/* Hero illustration */
.hero-art {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
}

.gift-illustration {
  width: min(100%, 414px);
  height: auto;
  overflow: visible;
  filter: drop-shadow(0 34px 44px rgba(0, 0, 0, 0.28));
}

.art-glow {
  transform-origin: center;
  animation: glow-pulse 9s ease-in-out infinite;
}

.sparkle {
  transform-box: fill-box;
  transform-origin: center;
  animation: twinkle 4.8s ease-in-out infinite;
}

.sparkle--2 {
  animation-delay: -1.7s;
  animation-duration: 5.6s;
}

.sparkle--3 {
  animation-delay: -3.1s;
  animation-duration: 6.2s;
}

.sparkle--4 {
  animation-delay: -0.8s;
  animation-duration: 5.1s;
}

/* Content */
.content {
  position: relative;
}

.alert {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  margin-bottom: 20px;
  padding: 15px 17px;
  color: #ffc8c8;
  font-size: 13.5px;
  line-height: 1.55;
  background: rgba(207, 71, 80, 0.09);
  border: 1px solid rgba(207, 71, 80, 0.3);
  border-radius: 14px;
}

.alert .icon {
  width: 18px;
  height: 18px;
  margin-top: 1px;
  color: #ed9a9a;
}

.alert p {
  margin: 0;
}

.panel-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 20px;
  align-items: stretch;
}

/* Panels */
.panel {
  position: relative;
  min-width: 0;
  height: 100%;
  background:
    linear-gradient(180deg, rgba(255, 248, 233, 0.045), rgba(255, 248, 233, 0.012) 48%, rgba(255, 248, 233, 0.008)),
    var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.panel::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  border-radius: inherit;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.075);
}

.panel-head {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  gap: 15px;
  padding: 25px 25px 0;
}

.panel-icon {
  display: grid;
  place-items: center;
  width: 43px;
  height: 43px;
  flex: none;
  color: var(--gold);
  background: linear-gradient(145deg, rgba(231, 201, 138, 0.16), rgba(231, 201, 138, 0.045));
  border: 1px solid rgba(231, 201, 138, 0.2);
  border-radius: 13px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.panel-icon .icon {
  width: 21px;
  height: 21px;
}

.panel-icon--red {
  color: #f0a5a5;
  background: linear-gradient(145deg, rgba(207, 71, 80, 0.19), rgba(207, 71, 80, 0.055));
  border-color: rgba(207, 71, 80, 0.25);
}

.panel-titles {
  flex: 1;
  min-width: 0;
  padding-top: 1px;
}

.panel-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 20px;
  margin-bottom: 4px;
}

.step {
  color: var(--gold);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.18em;
  line-height: 1.4;
  text-transform: uppercase;
}

.count-chip {
  flex: none;
  padding: 4px 9px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--line);
  border-radius: 999px;
  white-space: nowrap;
}

.count-chip--success {
  color: #b7e5c9;
  background: rgba(126, 198, 159, 0.08);
  border-color: rgba(126, 198, 159, 0.22);
}

.panel-head h2 {
  margin: 0 0 5px;
  font-family: var(--font-display);
  font-size: 27px;
  font-weight: 500;
  letter-spacing: -0.025em;
  line-height: 1.12;
  color: var(--ink);
}

.panel-head p {
  max-width: 42ch;
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.5;
}

.panel-body {
  position: relative;
  z-index: 1;
  padding: 21px 25px 25px;
}

/* Forms */
.form-shell {
  padding: 15px;
  background: rgba(3, 10, 7, 0.22);
  border: 1px solid rgba(236, 219, 183, 0.08);
  border-radius: 16px;
}

.add-form {
  display: grid;
  gap: 12px;
}

.field-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 11px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}

.field-label {
  display: flex;
  align-items: baseline;
  gap: 6px;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.035em;
  line-height: 1.3;
}

.optional {
  color: var(--faint);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.input,
.select {
  width: 100%;
  min-height: 47px;
  padding: 0 13px;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.4;
  background: rgba(3, 10, 7, 0.42);
  border: 1px solid var(--line);
  border-radius: 11px;
  transition: border-color 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease;
}

.input::placeholder {
  color: var(--faint);
  opacity: 1;
}

.input:focus,
.select:focus {
  outline: none;
  background: rgba(3, 10, 7, 0.62);
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(231, 201, 138, 0.14);
}

.input:focus-visible,
.select:focus-visible {
  outline: none;
}

.select-wrap {
  position: relative;
  display: block;
}

.select {
  padding-right: 38px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

.select option {
  color: var(--ink);
  background: #10251c;
}

.select-chevron {
  position: absolute;
  top: 50%;
  right: 13px;
  width: 15px;
  height: 15px;
  color: var(--muted);
  pointer-events: none;
  transform: translateY(-50%);
}

.form-note {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin: 11px 2px 0;
  color: var(--faint);
  font-size: 11px;
  line-height: 1.55;
}

.form-note .icon {
  width: 13px;
  height: 13px;
  margin-top: 2px;
  color: var(--gold-deep);
}

.list-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 21px 1px 9px;
}

.list-title {
  flex: none;
  color: var(--faint);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.list-line {
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, var(--line), transparent);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 45px;
  padding: 0 18px;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.005em;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: 11px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, color 0.18s ease, transform 0.12s ease;
}

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

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.48;
  transform: none;
  box-shadow: none;
}

.btn .icon {
  width: 17px;
  height: 17px;
}

.btn--primary {
  color: #18251c;
  background: linear-gradient(180deg, #f4dfb0 0%, #e2c07e 100%);
  border-color: rgba(255, 248, 225, 0.3);
  box-shadow: 0 10px 24px -14px rgba(231, 201, 138, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.btn--accent {
  color: #fff8f1;
  background: linear-gradient(180deg, #d9525b 0%, #b1333e 100%);
  border-color: rgba(255, 190, 190, 0.18);
  box-shadow: 0 13px 30px -15px rgba(207, 71, 80, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.btn--danger {
  color: #fff8f5;
  background: linear-gradient(180deg, #c84750 0%, #98262f 100%);
  border-color: rgba(255, 190, 190, 0.16);
  box-shadow: 0 13px 30px -15px rgba(207, 71, 80, 0.85), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.btn--ghost {
  color: var(--ink-soft);
  background: rgba(255, 248, 233, 0.035);
  border-color: var(--line-strong);
}

.btn--quiet {
  min-height: 40px;
  padding: 0 11px;
  color: var(--muted);
  background: transparent;
  border-color: transparent;
}

.btn--tiny {
  min-height: 32px;
  padding: 0 10px;
  font-size: 11.5px;
  border-radius: 8px;
}

.btn--block {
  width: 100%;
}

.btn--lg {
  min-height: 53px;
  padding: 0 27px;
  font-size: 14px;
  border-radius: 13px;
}

/* People */
.people-list,
.rules-list,
.assignment-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.person-row,
.rule-row {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  padding: 8px 8px 8px 10px;
  border: 1px solid transparent;
  border-radius: 13px;
  transition: background-color 0.18s ease, border-color 0.18s ease;
}

.avatar {
  display: grid;
  place-items: center;
  width: 37px;
  height: 37px;
  flex: none;
  color: var(--gold-bright);
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  line-height: 1;
  background: linear-gradient(145deg, rgba(231, 201, 138, 0.2), rgba(231, 201, 138, 0.08));
  border: 1px solid rgba(231, 201, 138, 0.22);
  border-radius: 11px;
}

.person-row:nth-child(4n + 2) .avatar {
  color: #f2b5ae;
  background: linear-gradient(145deg, rgba(207, 71, 80, 0.24), rgba(207, 71, 80, 0.08));
  border-color: rgba(207, 71, 80, 0.24);
}

.person-row:nth-child(4n + 3) .avatar {
  color: #aee4c7;
  background: linear-gradient(145deg, rgba(126, 198, 159, 0.19), rgba(126, 198, 159, 0.06));
  border-color: rgba(126, 198, 159, 0.22);
}

.person-row:nth-child(4n + 4) .avatar {
  color: #c8d8e2;
  background: linear-gradient(145deg, rgba(156, 186, 202, 0.18), rgba(156, 186, 202, 0.06));
  border-color: rgba(156, 186, 202, 0.2);
}

.avatar--sm {
  width: 33px;
  height: 33px;
  font-size: 15px;
  border-radius: 9px;
}

.person-main {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.person-name {
  overflow: hidden;
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.person-email {
  overflow: hidden;
  color: var(--faint);
  font-size: 11px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.person-email--none {
  color: #8da196;
  font-style: italic;
}

.row-action {
  flex: none;
  margin: 0;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 35px;
  height: 35px;
  padding: 0;
  color: var(--faint);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 9px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.18s ease, background-color 0.18s ease, border-color 0.18s ease;
}

.icon-btn .icon {
  width: 16px;
  height: 16px;
}

/* Empty states and hints */
.empty-state {
  padding: 23px 18px 21px;
  text-align: center;
  background: rgba(255, 255, 255, 0.012);
  border: 1px dashed var(--line);
  border-radius: 16px;
}

.empty-state--roomy {
  margin-top: 3px;
  padding: 34px 22px;
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 45px;
  height: 45px;
  margin: 0 auto 12px;
  color: var(--gold);
  background: rgba(231, 201, 138, 0.07);
  border: 1px solid rgba(231, 201, 138, 0.16);
  border-radius: 13px;
}

.empty-icon .icon {
  width: 21px;
  height: 21px;
}

.empty-title {
  margin: 0 0 4px;
  color: var(--ink-soft);
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.015em;
  line-height: 1.25;
}

.empty-copy {
  max-width: 36ch;
  margin: 0 auto;
  color: var(--faint);
  font-size: 11.5px;
  line-height: 1.6;
}

.hint {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin: 11px 3px 0;
  color: var(--faint);
  font-size: 11px;
  line-height: 1.55;
}

.hint .icon {
  width: 13px;
  height: 13px;
  margin-top: 2px;
  color: var(--gold-deep);
}

/* Rules */
.rules-form {
  display: grid;
  gap: 13px;
}

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

.rule-connector {
  display: grid;
  place-items: center;
  height: 47px;
  padding-bottom: 1px;
  color: var(--gold);
}

.connector-dot {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  background: rgba(231, 201, 138, 0.06);
  border: 1px solid rgba(231, 201, 138, 0.23);
  border-radius: 50%;
}

.connector-dot .icon {
  width: 13px;
  height: 13px;
}

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

.check-row input {
  position: relative;
  width: 19px;
  height: 19px;
  flex: none;
  margin: 2px 0 0;
  padding: 0;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background: rgba(3, 10, 7, 0.42);
  border: 1.5px solid var(--line-strong);
  border-radius: 6px;
  transition: background-color 0.16s ease, border-color 0.16s ease;
}

.check-row input:checked {
  background: linear-gradient(180deg, #f2daa4, #d9b771);
  border-color: #e7c98a;
}

.check-row input:checked::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 5.5px;
  width: 5px;
  height: 9px;
  border-right: 2px solid #17251c;
  border-bottom: 2px solid #17251c;
  transform: rotate(41deg);
}

.check-row input:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.check-copy {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.check-title {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
}

.check-desc {
  color: var(--faint);
  font-size: 10.5px;
  line-height: 1.5;
}

.rule-people {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 7px;
  min-width: 0;
  overflow: hidden;
}

.rule-name {
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rule-arrow {
  flex: none;
  color: var(--gold);
  font-size: 14px;
  line-height: 1;
}

.tag {
  flex: none;
  padding: 4px 7px;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.08em;
  line-height: 1.4;
  text-transform: uppercase;
  border: 1px solid transparent;
  border-radius: 5px;
  white-space: nowrap;
}

.tag--both {
  color: #b7dbc5;
  background: rgba(126, 198, 159, 0.08);
  border-color: rgba(126, 198, 159, 0.18);
}

.tag--oneway {
  color: #e7d09d;
  background: rgba(231, 201, 138, 0.08);
  border-color: rgba(231, 201, 138, 0.18);
}

/* Draw panel */
.draw-panel {
  margin-top: 20px;
  border-color: rgba(231, 201, 138, 0.19);
  background:
    radial-gradient(760px 300px at 82% -18%, rgba(231, 201, 138, 0.085), transparent 62%),
    radial-gradient(640px 300px at -5% 110%, rgba(207, 71, 80, 0.08), transparent 64%),
    linear-gradient(180deg, #10261c 0%, #0c1f17 52%, #0b1c15 100%);
}

.draw-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 14px 8px 8px;
  text-align: center;
}

.draw-seal {
  position: relative;
  display: grid;
  place-items: center;
  width: 86px;
  height: 86px;
  margin-bottom: 21px;
  color: var(--gold-bright);
  background: radial-gradient(circle at 35% 28%, rgba(231, 201, 138, 0.2), rgba(231, 201, 138, 0.035) 68%);
  border: 1px solid rgba(231, 201, 138, 0.35);
  border-radius: 50%;
  box-shadow: 0 0 0 9px rgba(231, 201, 138, 0.035), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.draw-seal::before {
  content: "";
  position: absolute;
  inset: -12px;
  border: 1px dashed rgba(231, 201, 138, 0.2);
  border-radius: 50%;
}

.draw-seal::after {
  content: "";
  position: absolute;
  top: 7px;
  right: 7px;
  width: 7px;
  height: 7px;
  background: var(--gold);
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(231, 201, 138, 0.08);
}

.draw-seal .icon {
  width: 33px;
  height: 33px;
  stroke-width: 1.5;
}

.draw-seal--locked {
  color: var(--muted);
  background: radial-gradient(circle at 35% 28%, rgba(166, 182, 171, 0.12), rgba(166, 182, 171, 0.025) 68%);
  border-color: rgba(236, 219, 183, 0.2);
}

.draw-seal--locked::before {
  border-color: rgba(236, 219, 183, 0.12);
}

.draw-seal--locked::after {
  background: var(--muted);
  box-shadow: 0 0 0 4px rgba(166, 182, 171, 0.07);
}

.draw-stage h3 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 31px;
  font-weight: 500;
  letter-spacing: -0.028em;
  line-height: 1.15;
  color: var(--ink);
}

.draw-stage > p {
  max-width: 55ch;
  margin: 0 0 21px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.draw-stage form {
  margin: 0;
}

.fineprint {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 15px 0 0;
  color: var(--faint);
  font-size: 10.5px;
  line-height: 1.5;
}

.fineprint .icon {
  width: 12px;
  height: 12px;
  color: var(--gold-deep);
}

/* Drawn state */
.draw-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 1px 0 17px;
}

.draw-state {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.draw-state-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: none;
  color: var(--green);
  background: rgba(126, 198, 159, 0.09);
  border: 1px solid rgba(126, 198, 159, 0.22);
  border-radius: 50%;
}

.draw-state-icon .icon {
  width: 17px;
  height: 17px;
  stroke-width: 2;
}

.draw-state h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.draw-state p {
  margin: 2px 0 0;
  color: var(--faint);
  font-size: 10.5px;
  line-height: 1.5;
}

.draw-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.assignment-wrap {
  margin-top: 1px;
}

.assignment-head {
  display: grid;
  grid-template-columns: minmax(0, 1.04fr) minmax(0, 1fr) minmax(0, 0.9fr);
  gap: 15px;
  padding: 0 15px 8px;
  color: var(--faint);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.assignment-row {
  display: grid;
  grid-template-columns: minmax(0, 1.04fr) minmax(0, 1fr) minmax(0, 0.9fr);
  gap: 15px;
  align-items: center;
  min-width: 0;
  padding: 12px 15px;
  background: rgba(2, 8, 5, 0.26);
  border: 1px solid rgba(236, 219, 183, 0.085);
  border-radius: 13px;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.assignment-row.is-revealed {
  background: rgba(231, 201, 138, 0.045);
  border-color: rgba(231, 201, 138, 0.22);
}

.assign-giver {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.assign-name {
  overflow: hidden;
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.assign-match {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.match-label {
  display: none;
  flex: none;
  color: var(--faint);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.match-control {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.match-value {
  display: inline-flex;
  align-items: center;
  min-width: 0;
}

.secret {
  display: none;
  overflow: hidden;
  color: var(--gold-bright);
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0.005em;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.assignment-row.is-revealed .secret {
  display: inline-block;
  animation: reveal-name 0.3s ease both;
}

.assignment-row.is-revealed .masked {
  display: none;
}

.masked {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  color: var(--gold);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.17em;
  line-height: 1;
  background: rgba(231, 201, 138, 0.055);
  border: 1px dashed rgba(231, 201, 138, 0.23);
  border-radius: 6px;
  white-space: nowrap;
}

.masked .icon {
  width: 11px;
  height: 11px;
  letter-spacing: 0;
  stroke-width: 1.8;
}

.toggle-one {
  flex: none;
}

.toggle-one[aria-expanded="true"] {
  color: var(--ink-soft);
  background: rgba(231, 201, 138, 0.07);
  border-color: rgba(231, 201, 138, 0.18);
}

.assign-status {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  min-width: 0;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  width: fit-content;
  max-width: 100%;
  padding: 4px 8px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.4;
  border: 1px solid transparent;
  border-radius: 999px;
  white-space: nowrap;
}

.status-chip .icon {
  width: 11px;
  height: 11px;
  stroke-width: 1.9;
}

.status-chip--sent {
  color: #a9e0be;
  background: rgba(126, 198, 159, 0.09);
  border-color: rgba(126, 198, 159, 0.2);
}

.status-chip--pending {
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.035);
  border-color: var(--line);
}

.status-chip--none {
  color: #92a499;
  background: transparent;
  border-color: rgba(236, 219, 183, 0.16);
  border-style: dashed;
}

.status-chip--failed {
  color: #ffb5b5;
  background: rgba(207, 71, 80, 0.1);
  border-color: rgba(207, 71, 80, 0.24);
}

.status-detail {
  overflow: hidden;
  width: 100%;
  color: var(--faint);
  font-size: 10px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-detail--error {
  color: #dc9292;
  white-space: normal;
  overflow-wrap: anywhere;
}

/* Mail panel */
.mail-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px 22px;
  align-items: center;
  margin-top: 20px;
  padding: 18px;
  background:
    linear-gradient(135deg, rgba(231, 201, 138, 0.075), rgba(207, 71, 80, 0.03)),
    rgba(255, 248, 233, 0.02);
  border: 1px solid rgba(231, 201, 138, 0.16);
  border-radius: 17px;
}

.notice {
  display: flex;
  grid-column: 1 / -1;
  align-items: flex-start;
  gap: 9px;
  padding: 11px 13px;
  font-size: 11.5px;
  line-height: 1.55;
  border: 1px solid;
  border-radius: 10px;
}

.notice p {
  margin: 0;
}

.notice .icon {
  width: 14px;
  height: 14px;
  margin-top: 2px;
  stroke-width: 1.9;
}

.notice--success {
  color: #b9e5ca;
  background: rgba(126, 198, 159, 0.07);
  border-color: rgba(126, 198, 159, 0.2);
}

.notice--error {
  color: #ffc0c0;
  background: rgba(207, 71, 80, 0.08);
  border-color: rgba(207, 71, 80, 0.23);
}

.notice--info {
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--line);
}

.mail-intro {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  min-width: 0;
}

.mail-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: none;
  color: var(--gold);
  background: rgba(231, 201, 138, 0.08);
  border: 1px solid rgba(231, 201, 138, 0.17);
  border-radius: 10px;
}

.mail-icon .icon {
  width: 17px;
  height: 17px;
}

.mail-intro h3 {
  margin: 1px 0 3px;
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.mail-intro p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}

.mail-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  flex-wrap: wrap;
}

.mail-actions .btn {
  min-height: 41px;
  font-size: 11.5px;
  padding: 0 14px;
}

.mail-actions .btn .icon {
  width: 15px;
  height: 15px;
}

.mail-fineprint {
  display: flex;
  grid-column: 1 / -1;
  align-items: flex-start;
  gap: 6px;
  margin: 0;
  padding-top: 12px;
  color: var(--faint);
  font-size: 9.5px;
  line-height: 1.55;
  border-top: 1px solid rgba(231, 201, 138, 0.1);
}

.mail-fineprint .icon {
  width: 11px;
  height: 11px;
  margin-top: 2px;
  color: var(--gold-deep);
}

/* Footer */
.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px 20px;
  flex-wrap: wrap;
  margin-top: 30px;
  padding-top: 19px;
  color: var(--faint);
  border-top: 1px solid var(--line);
}

.footer-note {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  font-size: 10.5px;
  line-height: 1.5;
}

.footer-note .icon {
  width: 12px;
  height: 12px;
  color: var(--gold-deep);
}

.footer-actions {
  display: flex;
  align-items: center;
  gap: 13px;
  flex-wrap: wrap;
}

.footer-mark {
  color: var(--faint);
  font-size: 9.5px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.btn-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 32px;
  padding: 4px 6px;
  color: var(--faint);
  font-size: 10.5px;
  font-weight: 500;
  background: none;
  border: 1px solid transparent;
  border-radius: 7px;
  cursor: pointer;
  transition: color 0.18s ease, background-color 0.18s ease;
}

.btn-link .icon {
  width: 12px;
  height: 12px;
}

/* Confirmation dialog */
.confirm-dialog {
  width: min(430px, calc(100vw - 32px));
  max-width: none;
  padding: 0;
  color: var(--ink);
  background: transparent;
  border: none;
  border-radius: 20px;
}

.confirm-dialog::backdrop {
  background: rgba(2, 7, 5, 0.74);
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
}

.confirm-dialog[open] {
  animation: dialog-in 0.2s ease both;
}

.dialog-card {
  padding: 25px;
  background:
    linear-gradient(180deg, rgba(255, 248, 233, 0.05), rgba(255, 248, 233, 0.015)),
    #10241b;
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  box-shadow: 0 44px 100px -28px rgba(0, 0, 0, 0.9);
}

.dialog-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  margin-bottom: 15px;
  color: #f0a5a5;
  background: rgba(207, 71, 80, 0.12);
  border: 1px solid rgba(207, 71, 80, 0.25);
  border-radius: 12px;
}

.dialog-icon .icon {
  width: 20px;
  height: 20px;
}

.dialog-card h2 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 25px;
  font-weight: 500;
  letter-spacing: -0.025em;
  line-height: 1.15;
}

.dialog-card > p {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  flex-wrap: wrap;
}

@media (pointer: coarse) {
  .icon-btn {
    width: 44px;
    height: 44px;
  }

  .toggle-one {
    min-height: 38px;
    padding-inline: 12px;
  }

  .btn-link {
    min-height: 40px;
  }
}

/* Hover states (pointer devices only) */
@media (hover: hover) {
  .brand:hover .brand-mark {
    border-color: rgba(231, 201, 138, 0.55);
    transform: translateY(-1px);
  }

  .btn--primary:hover {
    background: linear-gradient(180deg, #fae7b9 0%, #e9ca8b 100%);
    box-shadow: 0 13px 28px -14px rgba(231, 201, 138, 0.85), inset 0 1px 0 rgba(255, 255, 255, 0.55);
  }

  .btn--accent:hover {
    background: linear-gradient(180deg, #e25f67 0%, #bd3a45 100%);
    box-shadow: 0 16px 34px -15px rgba(207, 71, 80, 0.95), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  }

  .btn--danger:hover {
    background: linear-gradient(180deg, #d5545c 0%, #a52b34 100%);
    box-shadow: 0 16px 34px -15px rgba(207, 71, 80, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.18);
  }

  .btn--ghost:hover {
    color: var(--ink);
    background: rgba(255, 248, 233, 0.075);
    border-color: rgba(231, 201, 138, 0.36);
  }

  .btn--quiet:hover {
    color: var(--ink-soft);
    background: rgba(255, 255, 255, 0.045);
  }

  .icon-btn:hover {
    color: #ffb1b1;
    background: rgba(207, 71, 80, 0.09);
    border-color: rgba(207, 71, 80, 0.2);
  }

  .person-row:hover,
  .rule-row:hover {
    background: rgba(255, 255, 255, 0.028);
    border-color: var(--line);
  }

  .assignment-row:hover {
    border-color: rgba(236, 219, 183, 0.16);
  }

  .btn-link:hover {
    color: #ffb1b1;
    background: rgba(207, 71, 80, 0.07);
  }
}

/* Tablet */
@media (max-width: 980px) {
  .hero {
    grid-template-columns: minmax(0, 1fr);
    padding: 34px 0 40px;
  }

  .hero-copy {
    max-width: 720px;
  }

  .hero-art {
    display: none;
  }

  .hero h1 {
    max-width: 13ch;
  }
}

@media (max-width: 880px) {
  .panel-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
  }

  .draw-panel {
    margin-top: 16px;
  }

  .panel-head {
    padding: 23px 23px 0;
  }

  .panel-body {
    padding: 19px 23px 23px;
  }
}

/* Small tablet / large phone */
@media (max-width: 720px) {
  .site-shell {
    padding: 20px 20px calc(32px + env(safe-area-inset-bottom, 0px));
  }

  .topbar {
    padding-bottom: 10px;
  }

  .hero {
    padding: 28px 0 33px;
  }

  .hero h1 {
    font-size: clamp(2.8rem, 8.6vw, 4rem);
    margin-bottom: 18px;
  }

  .hero-lede {
    font-size: 15.5px;
    margin-bottom: 22px;
  }

  .panel {
    border-radius: 22px;
  }

  .panel-head {
    gap: 12px;
    padding: 21px 20px 0;
  }

  .panel-body {
    padding: 18px 20px 21px;
  }

  .panel-icon {
    width: 39px;
    height: 39px;
    border-radius: 11px;
  }

  .panel-icon .icon {
    width: 19px;
    height: 19px;
  }

  .panel-head h2 {
    font-size: 24px;
  }

  .draw-toolbar {
    align-items: flex-start;
    gap: 13px;
  }

  .draw-actions {
    width: 100%;
  }

  .assignment-head {
    display: none;
  }

  .assignment-row {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "giver"
      "match"
      "status";
    gap: 9px;
    padding: 13px;
  }

  .assign-giver {
    grid-area: giver;
  }

  .assign-match {
    grid-area: match;
    justify-content: space-between;
    padding-top: 9px;
    border-top: 1px dashed rgba(236, 219, 183, 0.1);
  }

  .match-label {
    display: inline;
  }

  .match-control {
    flex: 1;
    justify-content: flex-end;
  }

  .assign-status {
    grid-area: status;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    justify-self: stretch;
    gap: 7px;
    text-align: left;
  }

  .status-detail {
    max-width: none;
    text-align: left;
    white-space: normal;
  }

  .status-detail--error {
    flex: 1 1 100%;
  }

  .mail-panel {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
    padding: 16px;
  }

  .mail-actions {
    justify-content: stretch;
  }

  .mail-actions form {
    flex: 1 1 160px;
  }

  .mail-actions .btn {
    width: 100%;
  }

  .mail-fineprint {
    grid-column: 1;
  }

  .notice {
    grid-column: 1;
  }

  .draw-stage {
    padding: 10px 2px 5px;
  }

  .draw-stage h3 {
    font-size: 27px;
  }
}

/* Phone */
@media (max-width: 560px) {
  .site-shell {
    padding: 16px 15px calc(28px + env(safe-area-inset-bottom, 0px));
  }

  .brand-mark {
    width: 39px;
    height: 39px;
    border-radius: 11px;
  }

  .brand-mark .icon {
    width: 20px;
    height: 20px;
  }

  .brand-name {
    font-size: 19px;
  }

  .season-pill {
    gap: 6px;
    padding: 7px 10px;
    font-size: 10.5px;
  }

  .hero {
    padding: 23px 0 29px;
  }

  .hero h1 {
    font-size: clamp(2.55rem, 10.8vw, 3.1rem);
    line-height: 1.01;
    margin-bottom: 16px;
  }

  .eyebrow {
    margin-bottom: 13px;
    font-size: 9.5px;
    letter-spacing: 0.18em;
  }

  .eyebrow-line {
    width: 22px;
  }

  .hero-lede {
    font-size: 14.5px;
    line-height: 1.68;
    margin-bottom: 19px;
  }

  .hero-meta {
    gap: 6px;
  }

  .meta-pill {
    min-height: 31px;
    padding: 5px 10px;
    font-size: 10.5px;
  }

  .meta-pill .icon {
    width: 12px;
    height: 12px;
  }

  .panel {
    border-radius: 19px;
  }

  .panel-head {
    padding: 18px 16px 0;
    gap: 11px;
  }

  .panel-body {
    padding: 16px;
  }

  .panel-icon {
    width: 37px;
    height: 37px;
    border-radius: 10px;
  }

  .panel-meta-row {
    margin-bottom: 3px;
  }

  .panel-head h2 {
    font-size: 22px;
  }

  .panel-head p {
    font-size: 11.5px;
  }

  .count-chip {
    padding: 3px 7px;
    font-size: 9.5px;
  }

  .form-shell {
    padding: 13px;
  }

  .field-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 11px;
  }

  .input,
  .select {
    min-height: 46px;
    font-size: 16px;
  }

  .form-note {
    font-size: 10.5px;
  }

  .rule-pair {
    grid-template-columns: minmax(0, 1fr);
    gap: 9px;
  }

  .rule-connector {
    height: 26px;
    padding: 0;
  }

  .connector-dot {
    width: 24px;
    height: 24px;
    transform: rotate(90deg);
  }

  .check-desc {
    font-size: 10px;
  }

  .person-row,
  .rule-row {
    padding: 7px 5px 7px 8px;
    gap: 9px;
  }

  .avatar {
    width: 35px;
    height: 35px;
    border-radius: 10px;
  }

  .person-name {
    font-size: 13px;
  }

  .person-email {
    font-size: 10.5px;
  }

  .icon-btn {
    width: 38px;
    height: 38px;
  }

  .tag {
    font-size: 8.5px;
    padding: 3px 6px;
  }

  .empty-state {
    padding: 21px 14px 19px;
  }

  .empty-state--roomy {
    padding: 28px 17px;
  }

  .empty-title {
    font-size: 17px;
  }

  .empty-copy {
    font-size: 11px;
  }

  .draw-panel {
    margin-top: 14px;
  }

  .draw-stage {
    padding: 10px 0 4px;
  }

  .draw-seal {
    width: 76px;
    height: 76px;
    margin-bottom: 18px;
  }

  .draw-seal .icon {
    width: 29px;
    height: 29px;
  }

  .draw-stage h3 {
    font-size: 25px;
  }

  .draw-stage > p {
    font-size: 12px;
    line-height: 1.65;
    margin-bottom: 19px;
  }

  .draw-stage .btn--lg {
    min-height: 50px;
    min-width: min(230px, 100%);
  }

  .draw-toolbar {
    padding-bottom: 14px;
  }

  .draw-state h3 {
    font-size: 20px;
  }

  .draw-state p {
    font-size: 10px;
  }

  .draw-actions .btn {
    flex: 1 1 auto;
    min-height: 42px;
    padding: 0 12px;
    font-size: 11.5px;
  }

  .assignment-row {
    padding: 12px;
    border-radius: 12px;
  }

  .assign-name {
    font-size: 12.5px;
  }

  .avatar--sm {
    width: 31px;
    height: 31px;
    font-size: 14px;
  }

  .match-label {
    font-size: 8px;
  }

  .secret {
    font-size: 15px;
  }

  .status-chip {
    font-size: 9.5px;
    padding: 3px 7px;
  }

  .status-detail {
    font-size: 9px;
  }

  .mail-panel {
    margin-top: 16px;
    padding: 14px;
    border-radius: 15px;
  }

  .mail-intro h3 {
    font-size: 18px;
  }

  .mail-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .mail-actions form {
    flex: 1 1 auto;
    width: 100%;
  }

  .mail-fineprint {
    font-size: 9px;
  }

  .site-footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
    margin-top: 24px;
    padding-top: 16px;
  }

  .footer-actions {
    width: 100%;
    justify-content: space-between;
  }

  .dialog-card {
    padding: 21px;
  }

  .dialog-card h2 {
    font-size: 23px;
  }

  .dialog-card > p {
    font-size: 12.5px;
  }

  .dialog-actions .btn {
    flex: 1;
  }
}

/* Very small phones */
@media (max-width: 340px) {
  .season-word {
    display: none;
  }

  .brand-name {
    font-size: 18px;
  }

  .hero h1 {
    font-size: 2.4rem;
  }

  .panel-meta-row {
    justify-content: flex-start;
  }

  .draw-actions .btn,
  .draw-actions form {
    flex: 1 1 100%;
  }

  .draw-actions form .btn {
    width: 100%;
  }
}


/* ==========================================================================
   Live updates — progress, toasts, loading buttons, and arrival motion
   ========================================================================== */

/* Slim indeterminate progress line shown while a mutation is in flight. */
.live-progress {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: 500;
  height: 3px;
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.18s ease;
}

.live-progress::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 38%;
  height: 100%;
  background: linear-gradient(90deg, transparent, var(--gold), var(--red-bright), transparent);
  transform: translateX(-120%);
}

body.is-updating .live-progress {
  opacity: 1;
}

body.is-updating .live-progress::before {
  animation: loading-sweep 1.05s ease-in-out infinite;
}

/* Toast feedback lives outside the swapped panels, so it survives updates. */
.toast-region {
  position: fixed;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  z-index: 450;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: min(calc(100vw - 28px), 460px);
  pointer-events: none;
  transform: translateX(-50%);
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  max-width: 100%;
  padding: 10px 14px;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.45;
  background: rgba(12, 28, 21, 0.97);
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  box-shadow: 0 20px 50px -20px rgba(0, 0, 0, 0.9);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  animation: toast-in 0.22s ease both;
}

.toast .icon {
  width: 14px;
  height: 14px;
  margin-top: 1px;
  color: var(--gold);
}

.toast--success {
  border-color: rgba(126, 198, 159, 0.36);
}

.toast--success .icon {
  color: var(--green);
}

.toast--error {
  color: #ffd0d0;
  border-color: rgba(207, 71, 80, 0.4);
}

.toast--error .icon {
  color: #ef9797;
}

.toast.is-leaving {
  animation: toast-out 0.2s ease both;
}

/* Buttons show an inline spinner instead of their icon while working. */
.btn.is-loading,
.btn-link.is-loading,
.icon-btn.is-loading {
  cursor: progress;
}

.btn.is-loading .icon,
.btn-link.is-loading .icon,
.icon-btn.is-loading .icon {
  display: none;
}

.btn.is-loading::before,
.btn-link.is-loading::before,
.icon-btn.is-loading::before {
  content: "";
  width: 13px;
  height: 13px;
  flex: none;
  border: 1.8px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  opacity: 0.85;
  animation: spin 0.65s linear infinite;
}

.btn.is-loading:disabled {
  opacity: 0.9;
}

.btn--tiny.is-loading::before {
  width: 11px;
  height: 11px;
}

.btn-link:disabled,
.icon-btn:disabled {
  cursor: wait;
  opacity: 0.65;
}

/* Locally added rows get a short, subtle arrival highlight. */
.person-row.is-new,
.rule-row.is-new {
  animation: row-arrive 0.32s ease both, row-highlight 1.15s ease both;
}

/* Fresh draw results arrive one after another instead of all at once. */
.assignment-list.is-fresh .assignment-row {
  animation: assignment-arrive 0.38s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.assignment-list.is-fresh .assignment-row:nth-child(2) {
  animation-delay: 0.04s;
}

.assignment-list.is-fresh .assignment-row:nth-child(3) {
  animation-delay: 0.08s;
}

.assignment-list.is-fresh .assignment-row:nth-child(4) {
  animation-delay: 0.12s;
}

.assignment-list.is-fresh .assignment-row:nth-child(5) {
  animation-delay: 0.16s;
}

.assignment-list.is-fresh .assignment-row:nth-child(6) {
  animation-delay: 0.2s;
}

.assignment-list.is-fresh .assignment-row:nth-child(n + 7) {
  animation-delay: 0.24s;
}

/* The seal keeps shuffling while the draw request is in flight. */
.draw-panel.is-drawing .draw-seal,
.draw-panel.is-drawing .draw-state-icon {
  animation: draw-breathe 0.65s ease-in-out infinite alternate;
}

.draw-panel.is-drawing .draw-seal .icon {
  animation: draw-shake 0.45s ease-in-out infinite alternate;
}

.draw-panel.is-drawing .draw-seal::before {
  animation: spin 2.4s linear infinite;
}

.alert-slot .alert {
  animation: alert-in 0.25s ease both;
}

@media (max-width: 560px) {
  .toast-region {
    bottom: calc(14px + env(safe-area-inset-bottom, 0px));
    width: calc(100vw - 24px);
  }

  .toast {
    padding: 9px 12px;
    font-size: 11.5px;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.is-updating .live-progress::before {
    animation: none;
    transform: translateX(30%);
  }
}

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

/* Animations */
@keyframes twinkle {
  0%,
  100% {
    opacity: 0.42;
    transform: scale(0.82);
  }
  50% {
    opacity: 1;
    transform: scale(1.06);
  }
}

@keyframes glow-pulse {
  0%,
  100% {
    opacity: 0.85;
  }
  50% {
    opacity: 1;
  }
}

@keyframes reveal-name {
  from {
    opacity: 0;
    transform: translateY(3px);
    filter: blur(3px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

@keyframes dialog-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes loading-sweep {
  0% {
    transform: translateX(-120%);
  }
  100% {
    transform: translateX(320%);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes toast-out {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(5px) scale(0.985);
  }
}

@keyframes row-arrive {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes row-highlight {
  0% {
    background-color: rgba(231, 201, 138, 0.13);
    border-color: rgba(231, 201, 138, 0.24);
  }
  100% {
    background-color: transparent;
    border-color: transparent;
  }
}

@keyframes assignment-arrive {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes draw-breathe {
  from {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(231, 201, 138, 0.12);
  }
  to {
    transform: scale(1.045);
    box-shadow: 0 0 0 9px rgba(231, 201, 138, 0.06);
  }
}

@keyframes draw-shake {
  from {
    transform: rotate(-5deg);
  }
  to {
    transform: rotate(5deg);
  }
}

@keyframes alert-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
