:root {
  --paper: #f3eee2;
  --paper-deep: #e7dfcf;
  --paper-light: #fbf8f0;
  --ink: #17211d;
  --ink-soft: #53605a;
  --forest: #123f35;
  --forest-deep: #0b2d26;
  --forest-light: #1e5d4d;
  --orange: #f0a447;
  --orange-deep: #d9852b;
  --mint: #b9d8c5;
  --line: rgba(23, 33, 29, 0.16);
  --line-light: rgba(255, 255, 255, 0.17);
  --danger: #a44332;
  --shadow: 0 28px 70px rgba(32, 45, 39, 0.15);
  --serif: "Iowan Old Style", "Palatino Linotype", "Songti SC", "STSong",
    "Noto Serif CJK SC", serif;
  --sans: "Avenir Next", "Segoe UI", "PingFang SC", "Microsoft YaHei",
    sans-serif;
}

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

html {
  min-width: 320px;
  color-scheme: light;
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 9% 4%, rgba(240, 164, 71, 0.19), transparent 25rem),
    radial-gradient(circle at 94% 25%, rgba(30, 93, 77, 0.12), transparent 28rem),
    var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
  text-decoration: none;
}

code {
  padding: 0.08em 0.35em;
  border-radius: 0.25em;
  background: rgba(18, 63, 53, 0.08);
  color: var(--forest);
  font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  font-size: 0.92em;
}

[hidden] {
  display: none !important;
}

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

.page-grain {
  position: fixed;
  z-index: 100;
  inset: 0;
  pointer-events: none;
  opacity: 0.23;
  background-image:
    radial-gradient(rgba(18, 35, 29, 0.18) 0.55px, transparent 0.65px),
    radial-gradient(rgba(255, 255, 255, 0.9) 0.55px, transparent 0.7px);
  background-position: 0 0, 3px 4px;
  background-size: 7px 7px, 9px 9px;
  mix-blend-mode: multiply;
}

.orb {
  position: fixed;
  z-index: -1;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(1px);
}

.orb-one {
  width: 28rem;
  height: 28rem;
  top: -15rem;
  right: 22%;
  border: 1px solid rgba(18, 63, 53, 0.13);
  box-shadow:
    inset 0 0 0 4rem rgba(255, 255, 255, 0.16),
    inset 0 0 0 9rem rgba(18, 63, 53, 0.025);
}

.orb-two {
  width: 18rem;
  height: 18rem;
  left: -11rem;
  top: 53rem;
  background: rgba(240, 164, 71, 0.09);
}

.site-header {
  position: relative;
  z-index: 20;
  display: flex;
  width: min(1240px, calc(100% - 56px));
  margin: 0 auto;
  padding: 28px 0;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 13px;
  background: var(--forest);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.13);
  color: var(--paper-light);
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 700;
  transform: rotate(-3deg);
}

.brand-copy {
  display: flex;
  flex-direction: column;
  gap: 1px;
  line-height: 1;
}

.brand-copy strong {
  font-family: var(--serif);
  font-size: 18px;
  letter-spacing: 0.06em;
}

.brand-copy small {
  color: var(--ink-soft);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.16em;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.connection-pill {
  display: inline-flex;
  min-height: 34px;
  padding: 0 13px;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(251, 248, 240, 0.50);
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 600;
  backdrop-filter: blur(8px);
}

.connection-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #c19245;
  box-shadow: 0 0 0 4px rgba(193, 146, 69, 0.12);
}

.connection-pill[data-state="online"] .connection-dot {
  background: #4f9877;
  box-shadow: 0 0 0 4px rgba(79, 152, 119, 0.13);
}

.connection-pill[data-state="offline"] .connection-dot {
  background: var(--danger);
  box-shadow: 0 0 0 4px rgba(164, 67, 50, 0.12);
}

.manage-button {
  display: inline-flex;
  min-height: 40px;
  padding: 0 15px;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: transparent;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition:
    background 180ms ease,
    color 180ms ease,
    transform 180ms ease;
}

.manage-button:hover {
  background: var(--ink);
  color: var(--paper-light);
  transform: translateY(-1px);
}

.manage-button:focus-visible,
.draw-button:focus-visible,
.admin-primary:focus-visible,
.icon-button:focus-visible,
.ghost-button:focus-visible,
.secondary-button:focus-visible,
.danger-button:focus-visible,
.text-button:focus-visible,
.inline-manage:focus-visible,
.file-pick:focus-visible {
  outline: 3px solid rgba(240, 164, 71, 0.58);
  outline-offset: 3px;
}

.manage-icon {
  position: relative;
  width: 12px;
  height: 12px;
  border: 1.5px solid currentColor;
  border-radius: 3px;
}

.manage-icon::before {
  position: absolute;
  width: 6px;
  height: 5px;
  left: 50%;
  top: -6px;
  border: 1.5px solid currentColor;
  border-bottom: 0;
  border-radius: 5px 5px 0 0;
  content: "";
  transform: translateX(-50%);
}

main {
  position: relative;
  z-index: 2;
  width: min(1240px, calc(100% - 56px));
  margin: 0 auto;
}

.hero {
  display: grid;
  min-height: 660px;
  padding: 46px 0 90px;
  grid-template-columns: minmax(0, 0.9fr) minmax(430px, 0.78fr);
  align-items: center;
  gap: clamp(48px, 7vw, 108px);
}

.hero-copy {
  position: relative;
  z-index: 2;
}

.eyebrow {
  display: flex;
  margin-bottom: 28px;
  align-items: center;
  gap: 12px;
  color: var(--forest-light);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.eyebrow-line {
  width: 34px;
  height: 1px;
  background: currentColor;
}

.hero h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(58px, 7.2vw, 106px);
  font-weight: 500;
  letter-spacing: -0.075em;
  line-height: 0.99;
}

.hero h1 span {
  position: relative;
  display: inline-block;
  color: var(--forest);
  font-style: italic;
}

.hero h1 span::after {
  position: absolute;
  z-index: -1;
  height: 12px;
  left: 2%;
  right: -3%;
  bottom: 7px;
  background: var(--orange);
  content: "";
  opacity: 0.56;
  transform: rotate(-1.5deg);
  clip-path: polygon(0 25%, 100% 0, 98% 100%, 1% 90%);
}

.hero-intro {
  max-width: 510px;
  margin: 33px 0 0;
  color: var(--ink-soft);
  font-size: 16px;
  line-height: 1.9;
}

.feature-strip {
  display: flex;
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  gap: clamp(25px, 4vw, 48px);
}

.feature-strip div {
  display: flex;
  min-width: 72px;
  flex-direction: column;
  gap: 4px;
}

.feature-strip strong {
  font-family: var(--serif);
  font-size: 29px;
  font-weight: 600;
  line-height: 1;
}

.feature-strip span {
  color: var(--ink-soft);
  font-size: 11px;
  letter-spacing: 0.06em;
}

.algorithm-note {
  display: flex;
  margin: 24px 0 0;
  align-items: center;
  gap: 8px;
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.6;
}

.algorithm-note > span {
  color: var(--orange-deep);
  font-size: 17px;
}

.draw-column {
  position: relative;
  padding: 16px 0 22px;
}

.draw-card {
  position: relative;
  width: 100%;
  min-height: 585px;
  padding: 29px 31px 30px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.23);
  border-radius: 28px;
  background:
    radial-gradient(circle at 78% 10%, rgba(185, 216, 197, 0.13), transparent 12rem),
    linear-gradient(145deg, var(--forest-light) 0%, var(--forest) 48%, var(--forest-deep) 100%);
  box-shadow:
    0 34px 80px rgba(18, 63, 53, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.11);
  color: var(--paper-light);
  transform: rotate(0.8deg);
  transition:
    transform 350ms cubic-bezier(0.2, 0.8, 0.2, 1),
    box-shadow 350ms ease;
}

.draw-card::before,
.draw-card::after {
  position: absolute;
  z-index: 3;
  width: 27px;
  height: 27px;
  top: 445px;
  border-radius: 50%;
  background: var(--paper);
  content: "";
  box-shadow: inset 0 0 0 1px rgba(18, 63, 53, 0.07);
}

.draw-card::before {
  left: -14px;
}

.draw-card::after {
  right: -14px;
}

.draw-card:hover {
  transform: rotate(0.2deg) translateY(-3px);
  box-shadow:
    0 40px 90px rgba(18, 63, 53, 0.30),
    inset 0 1px 0 rgba(255, 255, 255, 0.13);
}

#confetti-canvas {
  position: absolute;
  z-index: 10;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.draw-card-top {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.draw-kicker {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.24em;
  opacity: 0.63;
}

.round-chip {
  padding: 7px 11px;
  border: 1px solid var(--line-light);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(251, 248, 240, 0.78);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.draw-stage {
  position: relative;
  z-index: 2;
  display: flex;
  min-height: 370px;
  padding: 55px 7px 44px;
  align-items: center;
  flex-direction: column;
  justify-content: center;
  text-align: center;
}

.signal {
  display: flex;
  height: 28px;
  margin-bottom: 14px;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.signal span {
  width: 4px;
  height: 4px;
  border-radius: 999px;
  background: var(--orange);
  opacity: 0.72;
}

.signal span:nth-child(2) {
  height: 9px;
}

.draw-caption {
  margin: 0 0 14px;
  color: rgba(251, 248, 240, 0.48);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.15em;
}

.winner-name {
  max-width: 100%;
  min-height: 1.3em;
  font-family: var(--serif);
  font-size: clamp(42px, 5.1vw, 68px);
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 1.2;
  overflow-wrap: anywhere;
  text-wrap: balance;
}

.winner-name.is-long {
  font-size: clamp(31px, 3.8vw, 48px);
  line-height: 1.25;
}

.winner-detail {
  min-height: 1.5em;
  margin: 19px 0 0;
  color: rgba(251, 248, 240, 0.52);
  font-size: 12px;
  line-height: 1.6;
}

.draw-card.is-drawing .winner-name {
  animation: namePulse 380ms ease-in-out infinite alternate;
  color: var(--orange);
  letter-spacing: 0.08em;
}

.draw-card.is-drawing .signal span {
  animation: signalBounce 520ms ease-in-out infinite alternate;
}

.draw-card.is-drawing .signal span:nth-child(2) {
  animation-delay: 100ms;
}

.draw-card.is-drawing .signal span:nth-child(3) {
  animation-delay: 200ms;
}

.draw-card.has-winner .winner-name {
  animation: winnerReveal 650ms cubic-bezier(0.18, 0.9, 0.22, 1.15) both;
}

.draw-card.has-winner .signal span {
  background: var(--mint);
}

.card-progress {
  position: relative;
  z-index: 2;
  padding: 21px 0 22px;
  border-top: 1px dashed var(--line-light);
}

.progress-labels {
  display: flex;
  margin-bottom: 9px;
  justify-content: space-between;
  color: rgba(251, 248, 240, 0.57);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.progress-track {
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--orange), #f6c06f);
  transition: width 600ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.draw-button {
  position: relative;
  z-index: 2;
  display: flex;
  width: 100%;
  min-height: 62px;
  padding: 0 21px 0 25px;
  align-items: center;
  justify-content: space-between;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 15px;
  background: var(--orange);
  box-shadow: 0 11px 24px rgba(0, 0, 0, 0.16);
  color: #1d2b25;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  transition:
    background 180ms ease,
    transform 180ms ease,
    box-shadow 180ms ease;
}

.draw-button:hover:not(:disabled) {
  background: #ffb85e;
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.22);
  transform: translateY(-2px);
}

.draw-button:active:not(:disabled) {
  transform: translateY(0);
}

.draw-button:disabled {
  background: rgba(255, 255, 255, 0.12);
  box-shadow: none;
  color: rgba(255, 255, 255, 0.46);
  cursor: not-allowed;
}

.button-arrow {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid rgba(23, 33, 29, 0.2);
  border-radius: 50%;
  font-size: 16px;
  transition: transform 180ms ease;
}

.draw-button:hover:not(:disabled) .button-arrow {
  transform: rotate(45deg);
}

.barcode {
  position: relative;
  z-index: 2;
  display: flex;
  height: 11px;
  margin-top: 18px;
  align-items: stretch;
  justify-content: center;
  gap: 4px;
  opacity: 0.26;
}

.barcode i {
  display: block;
  width: 2px;
  background: currentColor;
}

.barcode i:nth-child(3n) {
  width: 4px;
}

.barcode i:nth-child(5n) {
  height: 7px;
  align-self: flex-end;
}

.floating-stamp {
  position: absolute;
  z-index: 4;
  display: flex;
  width: 88px;
  height: 88px;
  top: -23px;
  right: -25px;
  align-items: center;
  flex-direction: column;
  justify-content: center;
  border: 1px solid rgba(23, 33, 29, 0.24);
  border-radius: 50%;
  background: var(--paper-light);
  box-shadow: 0 12px 30px rgba(23, 33, 29, 0.13);
  transform: rotate(10deg);
}

.floating-stamp::before {
  position: absolute;
  inset: 6px;
  border: 1px dashed rgba(23, 33, 29, 0.30);
  border-radius: 50%;
  content: "";
}

.floating-stamp span {
  font-family: var(--serif);
  font-size: 27px;
  font-weight: 700;
  line-height: 1;
}

.floating-stamp small {
  margin-top: 3px;
  font-size: 7px;
  font-weight: 800;
  letter-spacing: 0.16em;
}

.floating-note {
  position: absolute;
  z-index: 3;
  display: flex;
  min-height: 42px;
  left: -35px;
  bottom: 0;
  padding: 0 17px;
  align-items: center;
  gap: 9px;
  border: 1px solid rgba(23, 33, 29, 0.1);
  border-radius: 10px;
  background: var(--paper-light);
  box-shadow: 0 12px 28px rgba(23, 33, 29, 0.12);
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 600;
  transform: rotate(-2deg);
}

.note-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--orange);
}

.info-grid {
  display: grid;
  padding: 72px 0;
  border-top: 1px solid var(--line);
  grid-template-columns: 1.3fr 0.7fr;
  gap: 26px;
}

.history-card,
.method-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(251, 248, 240, 0.64);
}

.history-card {
  min-height: 433px;
  padding: 30px 32px 22px;
  backdrop-filter: blur(8px);
}

.section-heading,
.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.section-heading > div {
  display: flex;
  align-items: baseline;
  gap: 14px;
}

.section-index {
  color: var(--orange-deep);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.16em;
}

.section-heading h2,
.method-card h2,
.empty-callout h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 27px;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.live-label {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--ink-soft);
  font-size: 10px;
}

.live-label i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4f9877;
  box-shadow: 0 0 0 4px rgba(79, 152, 119, 0.11);
}

.history-list {
  margin-top: 24px;
}

.history-row {
  display: grid;
  min-height: 65px;
  padding: 11px 0;
  border-top: 1px solid var(--line);
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  animation: rowAppear 360ms ease both;
}

.history-row:first-child {
  border-top-color: transparent;
}

.history-rank {
  display: grid;
  width: 31px;
  height: 31px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--ink-soft);
  font-family: var(--serif);
  font-size: 12px;
}

.history-row:first-child .history-rank {
  border-color: var(--forest);
  background: var(--forest);
  color: var(--paper-light);
}

.history-name {
  min-width: 0;
  overflow: hidden;
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-meta {
  display: flex;
  margin-top: 3px;
  color: var(--ink-soft);
  font-size: 9px;
  letter-spacing: 0.03em;
  gap: 8px;
}

.proof-badge {
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.34);
  color: var(--ink-soft);
  font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  font-size: 8px;
  letter-spacing: 0.04em;
}

.history-empty {
  display: flex;
  min-height: 285px;
  align-items: center;
  justify-content: center;
  gap: 20px;
  color: var(--ink-soft);
}

.history-empty > span {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 50%;
  font-size: 26px;
}

.history-empty p {
  margin: 0;
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.5;
}

.history-empty small {
  color: var(--ink-soft);
  font-family: var(--sans);
  font-size: 10px;
}

.method-card {
  padding: 31px 30px 29px;
  background: var(--paper-deep);
}

.method-card .section-index {
  display: block;
  margin-bottom: 15px;
}

.method-card h2 {
  padding-right: 80px;
  font-size: 25px;
}

.method-card > p {
  margin: 19px 0 23px;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.85;
}

.method-orbit {
  position: absolute;
  display: grid;
  width: 101px;
  height: 101px;
  top: 24px;
  right: -17px;
  place-content: center;
  border: 1px solid rgba(18, 63, 53, 0.22);
  border-radius: 50%;
  color: var(--forest);
  text-align: center;
}

.method-orbit::before,
.method-orbit::after {
  position: absolute;
  border: 1px solid rgba(18, 63, 53, 0.10);
  border-radius: 50%;
  content: "";
}

.method-orbit::before {
  inset: 9px;
}

.method-orbit::after {
  inset: 20px;
}

.method-orbit span {
  position: relative;
  z-index: 1;
  font-family: var(--serif);
  font-size: 26px;
  line-height: 1;
}

.method-orbit small {
  position: relative;
  z-index: 1;
  margin-top: 2px;
  font-size: 7px;
  font-weight: 800;
  letter-spacing: 0.15em;
}

.method-facts {
  margin: 0;
}

.method-facts div {
  display: flex;
  padding: 11px 0;
  border-top: 1px solid var(--line);
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-size: 10px;
}

.method-facts dt {
  color: var(--ink-soft);
}

.method-facts dd {
  margin: 0;
  font-weight: 700;
  text-align: right;
}

.empty-callout {
  display: flex;
  margin: 0 0 82px;
  padding: 27px 31px;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  border: 1px solid rgba(18, 63, 53, 0.22);
  border-radius: 17px;
  background: var(--forest);
  color: var(--paper-light);
}

.empty-callout > div {
  display: flex;
  align-items: center;
  gap: 22px;
}

.empty-number {
  font-family: var(--serif);
  font-size: 42px;
  color: var(--orange);
  opacity: 0.78;
}

.empty-callout h2 {
  font-size: 21px;
}

.empty-callout p {
  margin: 5px 0 0;
  color: rgba(251, 248, 240, 0.57);
  font-size: 11px;
}

.inline-manage {
  flex: none;
  padding: 13px 19px;
  border: 0;
  border-radius: 9px;
  background: var(--orange);
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

footer {
  display: flex;
  width: min(1240px, calc(100% - 56px));
  margin: 0 auto;
  padding: 23px 0 34px;
  border-top: 1px solid var(--line);
  justify-content: space-between;
  color: var(--ink-soft);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.admin-dialog {
  width: min(1040px, calc(100vw - 32px));
  max-width: none;
  max-height: min(860px, calc(100vh - 32px));
  padding: 0;
  overflow: auto;
  border: 0;
  border-radius: 24px;
  background: var(--paper-light);
  box-shadow: 0 40px 110px rgba(8, 28, 23, 0.34);
  color: var(--ink);
}

.admin-dialog[open] {
  animation: dialogIn 220ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.admin-dialog::backdrop {
  background: rgba(8, 24, 20, 0.70);
  backdrop-filter: blur(8px);
}

.admin-shell {
  min-height: 100%;
}

.admin-header {
  position: sticky;
  z-index: 20;
  display: flex;
  min-height: 84px;
  top: 0;
  padding: 17px 29px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: rgba(251, 248, 240, 0.94);
  backdrop-filter: blur(14px);
}

.admin-kicker {
  color: var(--orange-deep);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.2em;
}

.admin-header h2 {
  margin: 4px 0 0;
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 600;
}

.icon-button {
  position: relative;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  transition: background 150ms ease;
}

.icon-button:hover {
  background: var(--paper-deep);
}

.icon-button span::before,
.icon-button span::after {
  position: absolute;
  width: 15px;
  height: 1px;
  left: 11px;
  top: 18px;
  background: currentColor;
  content: "";
}

.icon-button span::before {
  transform: rotate(45deg);
}

.icon-button span::after {
  transform: rotate(-45deg);
}

.admin-login {
  width: min(460px, calc(100% - 44px));
  margin: 0 auto;
  padding: 57px 0 65px;
  text-align: center;
}

.login-symbol {
  position: relative;
  display: grid;
  width: 72px;
  height: 72px;
  margin: 0 auto 22px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--paper);
}

.login-symbol::before {
  width: 22px;
  height: 17px;
  border: 2px solid var(--forest);
  border-radius: 4px;
  content: "";
}

.login-symbol span {
  position: absolute;
  width: 13px;
  height: 12px;
  top: 19px;
  border: 2px solid var(--forest);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
}

.admin-lead {
  margin: 0;
  color: var(--orange-deep);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.admin-login h3 {
  margin: 10px 0 8px;
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 600;
}

.login-help {
  margin: 0 auto 29px;
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.8;
}

.admin-login form {
  text-align: left;
}

.admin-login label {
  display: block;
  margin-bottom: 8px;
  font-size: 10px;
  font-weight: 700;
}

.password-field {
  position: relative;
}

.password-field input {
  width: 100%;
  min-height: 50px;
  padding: 0 68px 0 15px;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
  background: var(--paper);
  color: var(--ink);
  font-size: 13px;
  transition:
    border-color 150ms ease,
    box-shadow 150ms ease;
}

.password-field input:focus {
  border-color: var(--forest);
  box-shadow: 0 0 0 3px rgba(18, 63, 53, 0.09);
}

.password-toggle {
  position: absolute;
  min-width: 46px;
  height: 30px;
  right: 10px;
  top: 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
}

.password-toggle:hover {
  background: var(--paper-deep);
}

.form-error {
  margin: 11px 0;
  padding: 9px 11px;
  border-left: 3px solid var(--danger);
  background: rgba(164, 67, 50, 0.07);
  color: var(--danger);
  font-size: 10px;
  line-height: 1.6;
}

.admin-primary {
  display: flex;
  width: 100%;
  min-height: 53px;
  margin-top: 10px;
  padding: 0 18px;
  align-items: center;
  justify-content: space-between;
  border: 0;
  border-radius: 10px;
  background: var(--forest);
  color: var(--paper-light);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition:
    background 150ms ease,
    opacity 150ms ease;
}

.admin-primary:hover:not(:disabled) {
  background: var(--forest-light);
}

.admin-primary:disabled {
  opacity: 0.43;
  cursor: not-allowed;
}

.admin-warning {
  margin-top: 20px;
  padding: 12px 14px;
  border: 1px solid rgba(193, 143, 65, 0.35);
  border-radius: 8px;
  background: rgba(240, 164, 71, 0.09);
  color: #71521d;
  font-size: 10px;
  line-height: 1.7;
  text-align: left;
}

.admin-console {
  padding: 24px 29px 34px;
}

.admin-statusbar {
  display: grid;
  min-height: 75px;
  padding: 14px 17px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  grid-template-columns: repeat(3, minmax(105px, 1fr)) auto;
  align-items: center;
  gap: 16px;
}

.admin-statusbar > div {
  display: flex;
  min-height: 38px;
  padding-left: 16px;
  border-left: 1px solid var(--line);
  flex-wrap: wrap;
  align-content: center;
  align-items: baseline;
  gap: 4px;
}

.admin-statusbar > div:first-child {
  padding-left: 0;
  border-left: 0;
}

.admin-statusbar span {
  width: 100%;
  color: var(--ink-soft);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.admin-statusbar strong {
  font-family: var(--serif);
  font-size: 22px;
}

.admin-statusbar small {
  color: var(--ink-soft);
  font-size: 9px;
}

.ghost-button,
.text-button {
  border: 0;
  background: transparent;
  color: var(--forest);
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
}

.ghost-button {
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.ghost-button:hover,
.text-button:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.admin-grid {
  display: grid;
  margin-top: 19px;
  grid-template-columns: minmax(0, 1.12fr) minmax(280px, 0.88fr);
  gap: 19px;
}

.import-panel,
.roster-panel {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fffdf8;
}

.panel-heading {
  align-items: center;
  margin-bottom: 18px;
}

.panel-heading h3 {
  margin: 5px 0 0;
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 600;
}

.import-limit {
  color: var(--ink-soft);
  font-size: 9px;
}

.drop-zone {
  display: flex;
  min-height: 95px;
  padding: 17px;
  align-items: center;
  justify-content: center;
  gap: 15px;
  border: 1px dashed rgba(18, 63, 53, 0.35);
  border-radius: 10px;
  background: rgba(185, 216, 197, 0.09);
  text-align: left;
  transition:
    background 150ms ease,
    border-color 150ms ease;
}

.drop-zone.is-dragging {
  border-color: var(--orange-deep);
  background: rgba(240, 164, 71, 0.11);
}

.upload-mark {
  display: grid;
  width: 35px;
  height: 35px;
  flex: none;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--forest);
  font-size: 16px;
}

.drop-zone strong {
  display: block;
  margin-bottom: 4px;
  font-size: 11px;
}

.drop-zone p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 9px;
}

.drop-zone button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--orange-deep);
  font-size: inherit;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.divider {
  position: relative;
  height: 35px;
  text-align: center;
}

.divider::before {
  position: absolute;
  height: 1px;
  left: 0;
  right: 0;
  top: 50%;
  background: var(--line);
  content: "";
}

.divider span {
  position: relative;
  z-index: 1;
  display: inline-block;
  padding: 0 9px;
  top: 13px;
  background: #fffdf8;
  color: var(--ink-soft);
  font-size: 8px;
}

#names-input {
  width: 100%;
  min-height: 162px;
  padding: 12px 14px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 9px;
  outline: none;
  background: var(--paper-light);
  color: var(--ink);
  font-size: 12px;
  line-height: 1.8;
  transition:
    border-color 150ms ease,
    box-shadow 150ms ease;
}

#names-input:focus {
  border-color: var(--forest);
  box-shadow: 0 0 0 3px rgba(18, 63, 53, 0.07);
}

.import-tip {
  margin: 8px 0 12px;
  color: var(--ink-soft);
  font-size: 9px;
  line-height: 1.6;
}

.import-footer {
  display: flex;
  min-height: 28px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.dedupe-control {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-soft);
  font-size: 9px;
  cursor: pointer;
}

.dedupe-control input {
  width: 13px;
  height: 13px;
  accent-color: var(--forest);
}

.name-preview {
  padding: 4px 7px;
  border-radius: 5px;
  background: var(--paper);
  color: var(--ink-soft);
  font-size: 8px;
}

.import-panel .admin-primary {
  min-height: 47px;
  margin-top: 12px;
}

.roster-search input {
  width: 100%;
  height: 36px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  background: var(--paper-light);
  font-size: 10px;
}

.roster-search input:focus {
  border-color: var(--forest);
}

.roster-list {
  height: 322px;
  margin-top: 11px;
  overflow: auto;
  border-top: 1px solid var(--line);
  scrollbar-color: var(--paper-deep) transparent;
  scrollbar-width: thin;
}

.roster-item {
  display: grid;
  min-height: 37px;
  border-bottom: 1px solid rgba(23, 33, 29, 0.08);
  grid-template-columns: 33px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  font-size: 11px;
}

.roster-item span {
  color: var(--ink-soft);
  font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  font-size: 8px;
}

.roster-item strong {
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.roster-empty {
  padding: 30px 10px;
  color: var(--ink-soft);
  font-size: 10px;
  line-height: 1.7;
  text-align: center;
}

.admin-actions {
  display: grid;
  margin-top: 19px;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--paper);
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 22px;
}

.admin-actions h3 {
  margin: 0 0 3px;
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 600;
}

.admin-actions p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 9px;
  line-height: 1.6;
}

.danger-action {
  padding-left: 22px;
  border-left: 1px solid var(--line);
}

.secondary-button,
.danger-button {
  min-height: 38px;
  padding: 0 14px;
  border-radius: 8px;
  background: transparent;
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
}

.secondary-button {
  border: 1px solid var(--forest);
  color: var(--forest);
}

.secondary-button:hover {
  background: var(--forest);
  color: var(--paper-light);
}

.danger-button {
  border: 1px solid rgba(164, 67, 50, 0.38);
  color: var(--danger);
}

.danger-button:hover {
  background: var(--danger);
  color: white;
}

.toast {
  position: fixed;
  z-index: 200;
  min-width: 220px;
  max-width: min(380px, calc(100vw - 32px));
  left: 50%;
  bottom: 28px;
  padding: 12px 16px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  background: var(--forest-deep);
  box-shadow: 0 16px 40px rgba(8, 28, 23, 0.24);
  color: var(--paper-light);
  font-size: 11px;
  line-height: 1.6;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 15px);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

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

.toast.is-error {
  background: #6f2d23;
}

.noscript {
  position: fixed;
  z-index: 500;
  left: 20px;
  right: 20px;
  bottom: 20px;
  padding: 14px 18px;
  border-radius: 10px;
  background: var(--danger);
  color: white;
  font-size: 13px;
  text-align: center;
}

@keyframes namePulse {
  from {
    opacity: 0.42;
    transform: translateY(3px) scale(0.98);
    filter: blur(0.5px);
  }
  to {
    opacity: 1;
    transform: translateY(-3px) scale(1.01);
    filter: blur(0);
  }
}

@keyframes signalBounce {
  from {
    height: 4px;
    opacity: 0.35;
  }
  to {
    height: 15px;
    opacity: 1;
  }
}

@keyframes winnerReveal {
  0% {
    opacity: 0;
    transform: translateY(14px) scale(0.92);
    filter: blur(7px);
  }
  65% {
    opacity: 1;
    transform: translateY(-3px) scale(1.02);
    filter: blur(0);
  }
  100% {
    transform: translateY(0) scale(1);
  }
}

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

@keyframes dialogIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 1040px) {
  .hero {
    min-height: auto;
    padding: 48px 0 88px;
    grid-template-columns: minmax(0, 1fr) minmax(370px, 0.9fr);
    gap: 44px;
  }

  .draw-card {
    min-height: 560px;
    padding: 26px;
  }

  .draw-stage {
    min-height: 350px;
  }

  .info-grid {
    grid-template-columns: 1fr 0.72fr;
  }

  .admin-grid {
    grid-template-columns: 1fr 0.75fr;
  }

  .admin-actions {
    grid-template-columns: 1fr auto;
  }

  .danger-action {
    padding-top: 16px;
    padding-left: 0;
    border-top: 1px solid var(--line);
    border-left: 0;
  }
}

@media (max-width: 820px) {
  .site-header,
  main,
  footer {
    width: min(100% - 36px, 680px);
  }

  .hero {
    padding-top: 26px;
    grid-template-columns: 1fr;
    gap: 56px;
  }

  .hero-copy {
    text-align: center;
  }

  .eyebrow {
    justify-content: center;
  }

  .hero h1 {
    font-size: clamp(56px, 13vw, 88px);
  }

  .hero-intro {
    margin-right: auto;
    margin-left: auto;
  }

  .feature-strip {
    justify-content: center;
  }

  .algorithm-note {
    justify-content: center;
  }

  .draw-column {
    width: min(100%, 470px);
    margin: 0 auto;
  }

  .info-grid {
    grid-template-columns: 1fr;
  }

  .method-card {
    min-height: 360px;
  }

  .admin-grid {
    grid-template-columns: 1fr;
  }

  .roster-list {
    height: 220px;
  }
}

@media (max-width: 620px) {
  .site-header {
    padding: 20px 0;
  }

  .brand-copy small,
  .connection-pill {
    display: none;
  }

  .manage-button {
    min-height: 38px;
    padding: 0 13px;
  }

  .hero {
    padding: 20px 0 70px;
    gap: 48px;
  }

  .eyebrow {
    margin-bottom: 22px;
  }

  .hero h1 {
    font-size: clamp(51px, 15.5vw, 72px);
  }

  .hero-intro {
    margin-top: 28px;
    font-size: 14px;
  }

  .feature-strip {
    margin-top: 30px;
    padding-top: 20px;
    gap: 24px;
  }

  .feature-strip strong {
    font-size: 25px;
  }

  .algorithm-note {
    align-items: flex-start;
    text-align: left;
  }

  .draw-column {
    padding-top: 8px;
  }

  .draw-card {
    min-height: 526px;
    padding: 23px 20px 24px;
    border-radius: 22px;
  }

  .draw-card::before,
  .draw-card::after {
    top: 405px;
  }

  .draw-stage {
    min-height: 318px;
    padding: 43px 2px 34px;
  }

  .winner-name {
    font-size: clamp(39px, 12vw, 56px);
  }

  .floating-stamp {
    width: 72px;
    height: 72px;
    top: -17px;
    right: -8px;
  }

  .floating-stamp span {
    font-size: 23px;
  }

  .floating-note {
    left: 8px;
    bottom: -17px;
  }

  .info-grid {
    padding: 54px 0;
    gap: 17px;
  }

  .history-card,
  .method-card {
    border-radius: 17px;
  }

  .history-card {
    min-height: 410px;
    padding: 23px 20px 16px;
  }

  .section-heading h2 {
    font-size: 24px;
  }

  .history-row {
    grid-template-columns: 33px minmax(0, 1fr) auto;
    gap: 10px;
  }

  .proof-badge {
    font-size: 7px;
  }

  .method-card {
    padding: 25px 22px;
  }

  .empty-callout {
    margin-bottom: 60px;
    padding: 23px;
    align-items: flex-start;
    flex-direction: column;
  }

  .empty-callout > div {
    align-items: flex-start;
  }

  .empty-number {
    font-size: 31px;
  }

  .inline-manage {
    width: 100%;
  }

  footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 7px;
  }

  .admin-dialog {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
    border-radius: 16px;
  }

  .admin-header {
    min-height: 72px;
    padding: 13px 17px;
  }

  .admin-console {
    padding: 16px 13px 22px;
  }

  .admin-statusbar {
    grid-template-columns: repeat(3, 1fr);
    gap: 7px;
  }

  .admin-statusbar > div {
    min-height: 35px;
    padding-left: 8px;
  }

  .admin-statusbar .ghost-button {
    grid-column: 1 / -1;
  }

  .import-panel,
  .roster-panel {
    padding: 17px;
  }

  .form-error {
    font-size: 9px;
  }

  .admin-actions {
    padding: 17px;
    grid-template-columns: 1fr;
    gap: 13px;
  }

  .admin-actions button {
    width: 100%;
  }

  .danger-action {
    padding-top: 13px;
  }
}

@media (max-width: 390px) {
  .site-header,
  main,
  footer {
    width: calc(100% - 28px);
  }

  .hero h1 {
    font-size: 48px;
  }

  .feature-strip {
    gap: 17px;
  }

  .feature-strip span {
    font-size: 9px;
  }

  .draw-card {
    padding-right: 17px;
    padding-left: 17px;
  }

  .winner-name {
    font-size: 38px;
  }

  .winner-name.is-long {
    font-size: 28px;
  }

  .floating-stamp {
    display: none;
  }
}

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