:root {
  color-scheme: dark;
  --ink: #f8f5eb;
  --muted: #a9bbb3;
  --pine-950: #041612;
  --pine-900: #08231d;
  --pine-800: #103a30;
  --pine-700: #195143;
  --mint: #b9f6d4;
  --mint-strong: #71e2a6;
  --coral: #ff6b57;
  --coral-dark: #d94837;
  --gold: #ffd873;
  --paper: #fffaf0;
  --paper-ink: #1e2b25;
  --line: rgba(255, 255, 255, .12);
  --surface: rgba(14, 54, 44, .72);
  --surface-strong: rgba(16, 58, 48, .94);
  --shadow: 0 22px 60px rgba(0, 0, 0, .28);
  --radius: 22px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--pine-950); }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 5%, rgba(113, 226, 166, .13), transparent 30rem),
    radial-gradient(circle at 93% 8%, rgba(255, 107, 87, .12), transparent 24rem),
    linear-gradient(145deg, var(--pine-950), #08261f 50%, #061a16);
}

button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }

.shell {
  width: min(1420px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 48px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 26px;
}

.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  color: var(--paper-ink);
  font-size: 1.4rem;
  background: var(--mint);
  box-shadow: 0 8px 24px rgba(113, 226, 166, .22);
}
.brand-copy strong { display: block; letter-spacing: -.02em; }
.brand-copy span { color: var(--muted); font-size: .83rem; }
.top-actions { display: flex; align-items: center; gap: 10px; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, .045);
  font-size: .84rem;
  font-weight: 700;
  text-transform: capitalize;
}
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--gold); }
.pill[data-status="playing"]::before { background: var(--mint-strong); box-shadow: 0 0 0 4px rgba(113, 226, 166, .14); }
.pill[data-status="complete"]::before { background: var(--coral); }

.btn {
  min-height: 44px;
  padding: 10px 17px;
  border: 1px solid transparent;
  border-radius: 12px;
  color: var(--paper-ink);
  background: var(--mint);
  font-weight: 800;
  transition: transform .15s ease, filter .15s ease, background .15s ease;
}
.btn:hover:not(:disabled) { transform: translateY(-1px); filter: brightness(1.04); }
.btn:active:not(:disabled) { transform: translateY(0); }
.btn:focus-visible, .gift-card:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 3px solid rgba(255, 216, 115, .7);
  outline-offset: 2px;
}
.btn:disabled { opacity: .43; cursor: not-allowed; }
.btn-secondary { color: var(--ink); background: rgba(255, 255, 255, .07); border-color: var(--line); }
.btn-danger { color: white; background: var(--coral-dark); }
.btn-small { min-height: 36px; padding: 7px 11px; border-radius: 10px; font-size: .84rem; }
.btn-block { width: 100%; }

.login-page { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(360px, .75fr); }
.login-visual {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(34px, 6vw, 82px);
  background:
    linear-gradient(150deg, rgba(4, 22, 18, .15), rgba(4, 22, 18, .72)),
    radial-gradient(circle at 75% 25%, rgba(255, 107, 87, .24), transparent 26rem),
    #0c3b30;
}
.login-visual::after {
  content: "";
  position: absolute;
  width: 520px;
  height: 520px;
  right: -180px;
  bottom: -230px;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 50%;
  box-shadow: 0 0 0 80px rgba(255, 255, 255, .025), 0 0 0 160px rgba(255, 255, 255, .018);
}
.eyebrow { margin: 0 0 14px; color: var(--mint-strong); font-size: .78rem; font-weight: 900; letter-spacing: .16em; text-transform: uppercase; }
.login-visual h1 { max-width: 820px; margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(3.2rem, 7vw, 7.5rem); line-height: .89; letter-spacing: -.06em; }
.login-visual h1 em { color: var(--coral); font-weight: inherit; }
.login-visual .lead { max-width: 650px; margin: 28px 0 0; color: #c5d8d0; font-size: clamp(1.05rem, 2vw, 1.35rem); line-height: 1.6; }
.feature-line { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: 10px; }
.feature-line span { padding: 9px 13px; border: 1px solid rgba(255,255,255,.14); border-radius: 999px; color: #d6e5df; background: rgba(4,22,18,.22); font-size: .84rem; }

.login-panel { display: grid; align-items: center; padding: clamp(30px, 6vw, 74px); background: #061914; }
.login-card { width: min(420px, 100%); margin: 0 auto; }
.login-card h2 { margin: 0 0 8px; font-size: 2rem; letter-spacing: -.04em; }
.login-card > p { margin: 0 0 28px; color: var(--muted); line-height: 1.55; }

.field { display: grid; gap: 8px; margin-bottom: 16px; }
.field label { color: #dbe8e2; font-size: .86rem; font-weight: 800; }
.field input, .field textarea, .field select {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 12px;
  color: var(--ink);
  background: rgba(255,255,255,.055);
  outline: none;
}
.field textarea { min-height: 104px; resize: vertical; line-height: 1.45; }
.field input::placeholder, .field textarea::placeholder { color: #718b80; }
.field-hint { color: var(--muted); font-size: .78rem; line-height: 1.45; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.check-row { display: flex; align-items: flex-start; gap: 10px; color: #dce9e4; font-size: .9rem; line-height: 1.4; }
.check-row input { width: 18px; height: 18px; accent-color: var(--mint-strong); }

.error-box, .notice-box {
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: 12px;
  line-height: 1.45;
  font-size: .88rem;
}
.error-box { color: #ffd9d3; border: 1px solid rgba(255,107,87,.36); background: rgba(255,107,87,.12); }
.notice-box { color: #d9f9e7; border: 1px solid rgba(113,226,166,.26); background: rgba(113,226,166,.09); }

.page-title { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.page-title h1 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(2.35rem, 5vw, 4.4rem); letter-spacing: -.055em; line-height: .98; }
.page-title p { max-width: 650px; margin: 10px 0 0; color: var(--muted); line-height: 1.55; }

.grid { display: grid; gap: 18px; }
.admin-grid { grid-template-columns: minmax(0, 1.1fr) minmax(360px, .9fr); align-items: start; }
.play-grid { grid-template-columns: 230px minmax(0, 1fr) 320px; align-items: start; }
.stack { display: grid; gap: 18px; }

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}
.card-pad { padding: clamp(20px, 3vw, 28px); }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.card-head h2, .card-head h3 { margin: 0; letter-spacing: -.025em; }
.card-head p { margin: 6px 0 0; color: var(--muted); font-size: .87rem; line-height: 1.45; }
.section-kicker { margin: 0 0 5px; color: var(--mint-strong); font-size: .72rem; font-weight: 900; letter-spacing: .13em; text-transform: uppercase; }

.metric-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 18px; }
.metric { padding: 15px; border: 1px solid var(--line); border-radius: 15px; background: rgba(255,255,255,.04); }
.metric strong { display: block; font-size: 1.45rem; letter-spacing: -.04em; }
.metric span { color: var(--muted); font-size: .76rem; }
.progress { height: 8px; overflow: hidden; border-radius: 99px; background: rgba(255,255,255,.08); }
.progress > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--mint-strong), var(--gold)); }

.steps { display: grid; gap: 10px; margin: 20px 0; }
.step { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 13px; color: var(--muted); }
.step span { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 9px; background: rgba(255,255,255,.07); font-weight: 900; font-size: .8rem; }
.step.done { color: var(--ink); border-color: rgba(113,226,166,.24); }
.step.done span { color: var(--paper-ink); background: var(--mint-strong); }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; }
.divider { height: 1px; margin: 22px 0; background: var(--line); }
.muted { color: var(--muted); }
.tiny { font-size: .78rem; }
.empty { padding: 30px 18px; text-align: center; color: var(--muted); border: 1px dashed rgba(255,255,255,.17); border-radius: 16px; }

.roster { display: grid; gap: 8px; max-height: 430px; overflow: auto; padding-right: 3px; }
.roster-row { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; align-items: center; gap: 11px; padding: 10px; border-radius: 12px; background: rgba(255,255,255,.04); }
.avatar { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 11px; color: var(--paper-ink); background: var(--gold); font-size: .78rem; font-weight: 900; }
.roster-row strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .9rem; }
.roster-row small { color: var(--muted); }
.ready { color: var(--mint-strong) !important; }

.credentials { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 9px; border-bottom: 1px solid var(--line); text-align: left; font-size: .84rem; }
th { color: var(--muted); font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; }
code { color: var(--gold); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

.submission-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, .75fr); gap: 20px; align-items: start; }
.image-drop { position: relative; overflow: hidden; min-height: 210px; display: grid; place-items: center; border: 1px dashed rgba(255,255,255,.22); border-radius: 17px; color: var(--muted); background: rgba(255,255,255,.035); text-align: center; }
.image-drop input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.image-drop img { width: 100%; height: 250px; display: block; object-fit: cover; }

.rule-list { display: grid; gap: 13px; margin: 0; padding: 0; list-style: none; }
.rule-list li { display: grid; grid-template-columns: 30px 1fr; gap: 11px; align-items: start; color: #dbe8e2; line-height: 1.45; }
.rule-list span { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px; color: var(--paper-ink); background: var(--mint); font-weight: 900; font-size: .76rem; }

.turn-banner {
  position: relative;
  overflow: hidden;
  margin-bottom: 18px;
  padding: clamp(22px, 4vw, 34px);
  border: 1px solid rgba(113,226,166,.25);
  border-radius: 24px;
  background: linear-gradient(125deg, #155141, #0b2e26);
  box-shadow: var(--shadow);
}
.turn-banner::after { content: "✦"; position: absolute; right: 26px; top: 4px; color: rgba(255,255,255,.08); font-size: 9rem; line-height: 1; }
.turn-banner h1 { position: relative; z-index: 1; margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(2rem, 5vw, 4rem); line-height: 1; letter-spacing: -.05em; }
.turn-banner p { position: relative; z-index: 1; max-width: 750px; margin: 12px 0 0; color: #c8ddd4; line-height: 1.5; }
.turn-banner.yours { border-color: rgba(255,216,115,.5); background: linear-gradient(125deg, #785326, #3c2d1b); }

.player-order { display: grid; gap: 7px; }
.order-row { display: grid; grid-template-columns: 28px 1fr; gap: 9px; align-items: center; padding: 9px 10px; border-radius: 11px; color: var(--muted); font-size: .84rem; }
.order-row .number { width: 28px; height: 28px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 9px; font-weight: 900; }
.order-row.active { color: var(--ink); background: rgba(255,216,115,.12); }
.order-row.active .number { color: var(--paper-ink); border-color: var(--gold); background: var(--gold); }
.order-row.complete-order { opacity: .62; }

.gift-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.gift-card {
  position: relative;
  min-height: 290px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 19px;
  color: var(--ink);
  background: rgba(255,255,255,.055);
  text-align: left;
  box-shadow: 0 14px 35px rgba(0,0,0,.18);
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.gift-card.actionable:hover { transform: translateY(-4px); border-color: rgba(255,216,115,.62); box-shadow: 0 18px 46px rgba(0,0,0,.28); }
.gift-card.actionable::after { content: attr(data-cta); position: absolute; right: 10px; top: 10px; padding: 6px 9px; border-radius: 9px; color: var(--paper-ink); background: var(--gold); font-size: .72rem; font-weight: 900; text-transform: uppercase; }
.gift-photo { width: 100%; height: 160px; display: block; object-fit: cover; background: #0b2821; }
.gift-photo-placeholder { height: 160px; display: grid; place-items: center; background: linear-gradient(145deg, #174f41, #0c3027); font-size: 3.5rem; }
.gift-body { flex: 1; padding: 16px; }
.gift-body h3 { margin: 0 0 6px; font-size: 1.08rem; letter-spacing: -.025em; }
.gift-body p { margin: 0; color: var(--muted); font-size: .84rem; line-height: 1.45; }
.gift-foot { display: flex; justify-content: space-between; gap: 8px; padding: 0 16px 15px; color: var(--muted); font-size: .74rem; }
.gift-foot strong { color: var(--ink); }
.locked-label { color: var(--gold); font-weight: 900; }

.wrapped { justify-content: center; align-items: center; min-height: 290px; background: linear-gradient(145deg, #ce4c3b, #8f2e24); }
.wrapped::before, .wrapped::after { content: ""; position: absolute; background: rgba(255,216,115,.9); }
.wrapped::before { width: 44px; inset: 0 auto 0 50%; transform: translateX(-50%); }
.wrapped::after { height: 44px; inset: 50% 0 auto; transform: translateY(-50%); }
.wrapped-mark { position: relative; z-index: 1; width: 74px; height: 74px; display: grid; place-items: center; border: 8px solid var(--gold); border-radius: 50%; color: var(--paper-ink); background: var(--paper); font-family: Georgia, serif; font-size: 2.5rem; font-weight: 900; box-shadow: 0 12px 30px rgba(0,0,0,.24); }

.activity { display: grid; gap: 0; max-height: 520px; overflow-y: auto; }
.event { position: relative; padding: 0 0 18px 20px; border-left: 1px solid rgba(255,255,255,.13); color: #dbe7e2; font-size: .84rem; line-height: 1.45; }
.event::before { content: ""; position: absolute; left: -5px; top: 4px; width: 9px; height: 9px; border-radius: 50%; background: var(--mint-strong); box-shadow: 0 0 0 4px var(--pine-800); }
.event time { display: block; margin-top: 4px; color: var(--muted); font-size: .72rem; }

.complete-hero { padding: 34px; text-align: center; }
.complete-hero .celebrate { font-size: 3.5rem; }
.complete-hero h1 { margin: 6px 0 10px; font-family: Georgia, serif; font-size: clamp(2.2rem, 6vw, 4.7rem); letter-spacing: -.055em; }
.complete-hero p { max-width: 650px; margin: 0 auto; color: var(--muted); line-height: 1.55; }

.modal-backdrop { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 20px; background: rgba(0, 10, 8, .76); backdrop-filter: blur(10px); }
.modal { width: min(540px, 100%); padding: 28px; border: 1px solid var(--line); border-radius: 22px; background: var(--pine-800); box-shadow: var(--shadow); }
.modal h2 { margin: 0 0 9px; font-size: 1.7rem; letter-spacing: -.03em; }
.modal > p { margin: 0 0 22px; color: var(--muted); line-height: 1.5; }

.toast { position: fixed; z-index: 50; right: 22px; bottom: 22px; max-width: 390px; padding: 13px 16px; border: 1px solid rgba(113,226,166,.32); border-radius: 12px; color: #e9fff2; background: #154d40; box-shadow: var(--shadow); opacity: 0; transform: translateY(12px); pointer-events: none; transition: .2s ease; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { border-color: rgba(255,107,87,.4); background: #6a2d26; }

.loading { min-height: 100vh; display: grid; place-items: center; color: var(--muted); }
.spinner { width: 34px; height: 34px; margin: 0 auto 14px; border: 3px solid rgba(255,255,255,.1); border-top-color: var(--mint-strong); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 1100px) {
  .play-grid { grid-template-columns: 200px minmax(0, 1fr); }
  .activity-card { grid-column: 1 / -1; }
  .activity { max-height: 280px; }
}

@media (max-width: 840px) {
  .login-page { grid-template-columns: 1fr; }
  .login-visual { min-height: 48vh; padding: 32px 24px; }
  .feature-line { margin-top: 34px; }
  .login-panel { padding: 46px 24px; }
  .admin-grid, .submission-layout { grid-template-columns: 1fr; }
  .play-grid { grid-template-columns: 1fr; }
  .order-card { order: 2; }
  .activity-card { order: 3; grid-column: auto; }
  .player-order { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
  .page-title { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 560px) {
  .shell { width: min(100% - 20px, 1420px); padding-top: 12px; }
  .brand-copy span { display: none; }
  .top-actions .pill { display: none; }
  .form-row, .metric-row { grid-template-columns: 1fr; }
  .page-title h1 { font-size: 2.6rem; }
  .gift-grid { grid-template-columns: 1fr; }
  .gift-card { min-height: 240px; }
  .wrapped { min-height: 240px; }
  .card-pad { padding: 18px; }
  .modal { padding: 22px; }
}

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