/* Premium-playful agency system for the raffle form.
   Palette (disciplined, one loud field at a time):
   paper cream #FFF6E5, card #FFFDF6, ink #191410, vermilion #FF4A1F,
   cobalt #2438DC, sunny #FFC531, success teal #0E7C6B (status only).
   VC gold #E8C547 appears ONLY inside the black monogram chip image.
   No glows, no gradients, no dark template: flat color fields, thick ink
   borders, hard offset shadows, heavy non-italic display type. */
:root {
  --paper: #FFF6E5;
  --card: #FFFDF6;
  --ink: #191410;
  --vermilion: #FF4A1F;
  --cobalt: #2438DC;
  --sunny: #FFC531;
  --teal: #0E7C6B;
  --muted: #6B5F4D;
  --dash: #D9CFAF;
}
* { box-sizing: border-box; }
html { scroll-padding-top: 150px; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; }
button { font-family: inherit; }
button:disabled { opacity: 0.55; cursor: default; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid var(--vermilion); outline-offset: 2px; }

/* ---- Sticky header: cream, thick ink rule, pill tabs, vermilion CTA ---- */
.site-header { position: sticky; top: 0; z-index: 50; background: var(--paper); border-bottom: 3px solid var(--ink); }
.header-inner { max-width: 1180px; margin: 0 auto; padding: 14px 24px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; }
/* Black circular chip: the square gold-on-black monogram cropped to a
   circle, so it reads on light and bold backgrounds alike. */
.brand-mark { width: 46px; height: 46px; border-radius: 50%; border: 2px solid var(--ink); object-fit: cover; background: #000; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { font-weight: 900; letter-spacing: 0.5px; color: var(--ink); font-size: 20px; }
.tabs { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.tabs button { background: var(--paper); color: var(--ink); border: 2px solid var(--ink); border-radius: 999px; padding: 10px 16px; cursor: pointer; font-size: 14px; font-weight: 700; white-space: nowrap; }
.tabs button.active { background: var(--ink); color: var(--paper); }
.header-wallet { margin-left: auto; background: var(--vermilion); color: var(--paper); border: 2px solid var(--ink); border-radius: 999px; padding: 12px 22px; font-weight: 800; font-size: 14px; letter-spacing: 0.5px; text-transform: uppercase; cursor: pointer; box-shadow: 3px 3px 0 var(--ink); white-space: nowrap; }
.header-wallet.connected { background: var(--paper); color: var(--ink); box-shadow: none; text-transform: none; }
.header-wallet:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
body.admin-mode .tabs, body.admin-mode #headerWalletBtn, body.admin-mode #publicView { display: none; }

/* ---- Wallet menu: small dropdown anchored to the header wallet button ---- */
.wallet-menu-wrap { position: relative; margin-left: auto; display: flex; }
.wallet-menu-wrap .header-wallet { margin-left: 0; }
.wallet-menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 60; background: var(--card); border: 2px solid var(--ink); border-radius: 12px; box-shadow: 3px 3px 0 var(--ink); padding: 6px; min-width: 180px; max-width: calc(100vw - 32px); }
.wallet-menu button { display: block; width: 100%; text-align: left; background: transparent; border: none; padding: 10px 12px; font-size: 14px; font-weight: 700; cursor: pointer; border-radius: 8px; color: var(--ink); }
.wallet-menu button:hover { background: var(--sunny); }

/* ---- Profile view: replaces the public tabs, keeps the header ---- */
body.profile-mode .tabs, body.profile-mode #publicView, body.profile-mode #adminView { display: none; }
.profile-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 10px 0; border-top: 2px dashed var(--dash); }
.profile-row:first-child { border-top: none; }

/* ---- Layout ---- */
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 24px; }
main.wrap { padding-top: 36px; padding-bottom: 8px; }
.hidden { display: none; }
.hint { color: var(--muted); font-size: 14px; line-height: 1.6; }

/* ---- Hero: one loud vermilion field, mega-type as the image ---- */
.hero-field { background: var(--vermilion); border-bottom: 3px solid var(--ink); }
.hero { padding: 64px 0 56px; }
.hero-display { font-family: "Arial Black", "Helvetica Neue", Arial, sans-serif; font-weight: 900; font-style: normal; text-transform: uppercase; color: var(--paper); font-size: clamp(46px, 11vw, 108px); line-height: 0.92; letter-spacing: -1px; margin: 28px 0 20px; }
.sub { color: #FFF1DC; font-size: 18px; line-height: 1.6; max-width: 660px; margin: 0; }

/* ---- The one rhythm strip: scrolling sunny band, repeated phrase ---- */
.rhythm { background: var(--sunny); color: var(--ink); border-bottom: 3px solid var(--ink); padding: 12px 0; font-weight: 800; font-size: 14px; letter-spacing: 1.5px; text-transform: uppercase; overflow: hidden; white-space: nowrap; }
.rhythm-track { display: inline-flex; animation: rhythm-scroll 22s linear infinite; }
.rhythm-track span { padding-right: 16px; }
@keyframes rhythm-scroll { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .rhythm-track { animation: none; } }

/* ---- Stat strip: ticket card, dashed perforations, no dark cards ---- */
.stat-strip { background: var(--card); border: 3px solid var(--ink); border-radius: 20px; box-shadow: 6px 6px 0 var(--ink); margin: 8px 0 32px; overflow: hidden; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.stat { padding: 26px 22px; border-right: 2px dashed var(--dash); min-width: 0; }
.stat:last-child { border-right: none; }
.stat-num { display: block; font-size: clamp(30px, 4vw, 46px); font-weight: 900; color: var(--ink); line-height: 1.05; overflow-wrap: normal; word-break: keep-all; }
#statDeadline { font-size: clamp(20px, 2.6vw, 30px); }
.stat-label { display: block; font-size: 11px; letter-spacing: 1.5px; color: var(--muted); text-transform: uppercase; margin-top: 10px; line-height: 1.5; font-weight: 700; }
#statNote { padding: 0 22px 14px; margin: 0; color: var(--vermilion); font-weight: 700; }

/* ---- Tier cards: cream, ink border, hard shadow, colored dots ---- */
.tiers { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin: 0 0 48px; }
.tier { background: var(--card); border: 2px solid var(--ink); border-radius: 16px; padding: 20px; box-shadow: 4px 4px 0 var(--ink); }
.tier strong { display: block; font-size: 15px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--ink); }
.tier strong::before { content: ""; display: block; width: 10px; height: 10px; border-radius: 50%; background: var(--ink); margin-bottom: 10px; }
.tier:nth-child(1) strong::before { background: var(--vermilion); }
.tier:nth-child(2) strong::before { background: var(--cobalt); }
.tier:nth-child(3) strong::before { background: var(--sunny); border: 2px solid var(--ink); width: 8px; height: 8px; }
.tier span { color: var(--muted); font-size: 13px; line-height: 1.5; display: block; margin-top: 6px; }

/* ---- Panels, forms, inputs: cream cards, ink borders, no glow ---- */
.panel { background: var(--card); border: 3px solid var(--ink); border-radius: 20px; padding: 28px; margin-bottom: 24px; box-shadow: 6px 6px 0 var(--ink); scroll-margin-top: 150px; }
.panel h2 { margin-top: 0; text-transform: uppercase; font-weight: 900; letter-spacing: 0.5px; color: var(--ink); }
/* ---- Wallet box: the connected wallet is shown, never typed ---- */
.wallet-box { background: #fff; border: 2px solid var(--ink); border-radius: 14px; padding: 14px 16px; margin: 14px 0; }
.wallet-box-label { display: block; font-size: 12px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); }
.wallet-box-value { display: block; font-family: ui-monospace, monospace; font-size: 16px; font-weight: 800; margin-top: 6px; }
.wallet-box-value.connected { color: var(--teal); }
.wallet-box-note { margin: 6px 0 0; }

.panel h2::before { content: ""; display: inline-block; width: 12px; height: 12px; background: var(--vermilion); margin-right: 10px; }
.panel h3 { text-transform: uppercase; font-weight: 800; letter-spacing: 0.5px; color: var(--ink); }
label { display: block; margin: 14px 0; font-size: 14px; font-weight: 700; }
label input, select { display: block; width: 100%; margin-top: 6px; background: #fff; border: 2px solid var(--ink); border-radius: 12px; color: var(--ink); padding: 13px 14px; font-size: 16px; font-weight: 400; }
label input:focus, select:focus { outline: none; border-color: var(--vermilion); box-shadow: 0 0 0 3px rgba(255, 74, 31, 0.25); }
label input.locked { background: #FFF1B8; border-color: var(--ink); color: var(--ink); }
button[type="submit"] { background: var(--vermilion); color: var(--paper); border: 2px solid var(--ink); border-radius: 999px; padding: 14px 28px; font-weight: 800; font-size: 16px; letter-spacing: 0.5px; cursor: pointer; margin-top: 8px; box-shadow: 3px 3px 0 var(--ink); }
button[type="submit"]:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.panel button[type="button"], .row button { background: var(--paper); color: var(--ink); border: 2px solid var(--ink); border-radius: 999px; padding: 12px 22px; font-weight: 700; font-size: 14px; cursor: pointer; margin-top: 8px; }
/* ---- Collab type: two large pill buttons, not tiny native radios ----
   The underlying radio inputs keep working (same name/values/logic);
   only their labels are restyled, with the native control visually
   hidden but still focusable. */
.collab-type-pills label { display: flex; flex-direction: column; gap: 2px; background: var(--paper); border: 2px solid var(--ink); border-radius: 16px; padding: 14px 18px; cursor: pointer; margin: 0; min-height: 44px; justify-content: center; }
.collab-type-pills label input[type="radio"] { position: absolute; opacity: 0; pointer-events: none; }
.collab-type-pills label:has(input:checked) { background: var(--ink); color: var(--paper); box-shadow: 3px 3px 0 var(--vermilion); }
.collab-type-pills label:has(input:checked) .collab-type-desc { color: var(--paper); opacity: 0.8; }
.collab-type-desc { font-size: 13px; font-weight: 400; color: var(--muted); }

/* ---- X verify result: a clear green/red pill, not a tiny hint line ---- */
.xstate-pill { display: inline-block; border: 2px solid var(--ink); border-radius: 999px; padding: 6px 14px; font-weight: 800; }
.xstate-pill.ok { background: var(--teal); color: var(--paper); }
.xstate-pill.err { background: var(--vermilion); color: var(--paper); }

/* ---- Past bonus tasks: collapsed by default, pending rows never land
   here (they stay in the live list until the admin decides). ---- */
#bonusPastTasksDetails { border-top: 2px dashed var(--dash); margin-top: 12px; padding-top: 8px; }
#bonusPastTasksDetails summary { cursor: pointer; font-weight: 800; font-size: 14px; padding: 8px 0; }

/* ---- Inline collab-approve form: compact inputs inside the row ---- */
[data-collab-actions] label { display: inline-flex; gap: 6px; align-items: center; margin: 6px 10px 6px 0; }
[data-collab-actions] input { width: 64px; margin-top: 0; }
.msg.ok { color: var(--teal); font-weight: 700; }
.msg.err { color: #C22E00; font-weight: 700; }
.result { margin-top: 16px; line-height: 1.7; }
.badge { display: inline-block; border: 2px solid var(--ink); border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 800; background: var(--paper); color: var(--ink); }
.badge.GTD_WINNER, .badge.GTD, .badge.APPROVED { background: var(--cobalt); color: var(--paper); }
.badge.FCFS_WINNER, .badge.FCFS { background: var(--vermilion); color: var(--paper); }
.badge.TEAM { background: var(--ink); color: var(--paper); }
.badge.NOT_SELECTED, .badge.REJECTED { background: var(--paper); color: var(--vermilion); border-color: var(--vermilion); }
.winners { list-style: none; padding: 0; }
.winners li { padding: 10px 0; border-bottom: 2px dashed var(--dash); font-family: ui-monospace, monospace; font-size: 14px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; margin: 12px 0; }
.row label { margin: 0; }
.row label input { width: 120px; }
.row a { color: var(--vermilion); font-weight: 800; align-self: center; }
.admin-list { margin-top: 16px; font-size: 13px; line-height: 1.8; }
.admin-list .entry { border-bottom: 2px dashed var(--dash); padding: 10px 0; }
.admin-list button { background: var(--paper); color: var(--ink); border: 2px solid var(--ink); border-radius: 999px; padding: 6px 12px; cursor: pointer; margin-right: 6px; font-weight: 700; }
.task-row { border-top: 2px dashed var(--dash); padding: 12px 0; }
.task-row:first-child { border-top: none; }
.task-controls { margin-top: 8px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.task-controls input { flex: 1 1 220px; background: #fff; border: 2px solid var(--ink); border-radius: 12px; color: var(--ink); padding: 11px 12px; font-size: 15px; }
.task-controls button, .task-controls a { background: var(--paper); color: var(--ink); border: 2px solid var(--ink); border-radius: 999px; padding: 9px 16px; cursor: pointer; font-size: 14px; font-weight: 700; text-decoration: none; }
.task-controls small { color: var(--muted); }
.pill { display: inline-block; border: 2px solid var(--ink); border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 800; background: var(--paper); color: var(--ink); margin-left: 6px; }
.pill.ok { background: var(--teal); color: var(--paper); }
.pill.warn { background: var(--sunny); color: var(--ink); }
.pill.bad { background: var(--vermilion); color: var(--paper); }
.refbox { background: #fff; border: 2px solid var(--ink); border-radius: 14px; padding: 12px; margin: 12px 0; }
.refbox span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; font-weight: 700; }
.refbox input { width: 100%; background: var(--paper); border: 2px solid var(--ink); border-radius: 8px; color: var(--ink); padding: 10px 12px; font-size: 13px; font-family: ui-monospace, monospace; }
.refbox button { background: var(--ink); color: var(--paper); border: 2px solid var(--ink); border-radius: 999px; padding: 9px 16px; font-weight: 700; cursor: pointer; margin-top: 8px; }

/* ---- Rules: second loud field (cobalt), cream text, sunny markers ---- */
.rules-field { background: var(--cobalt); border-top: 3px solid var(--ink); border-bottom: 3px solid var(--ink); padding: 48px 0; }
.rules h2 { margin-top: 0; text-transform: uppercase; font-weight: 900; letter-spacing: 0.5px; color: var(--paper); }
.rules-list { color: var(--paper); line-height: 1.7; margin: 0; padding: 0; list-style: none; }
.rules-list li { margin: 10px 0; padding-left: 26px; position: relative; }
.rules-list li::before { content: ""; position: absolute; left: 0; top: 8px; width: 10px; height: 10px; background: var(--sunny); border: 2px solid var(--ink); }


/* ---- Mobile: stack, scale display type, no overflow, thumb-friendly ---- */
@media (max-width: 860px) {
  /* Two-row sticky header: row 1 = brand + wallet, row 2 = full-width
     segmented tabs. The wallet never dangles alone, right-aligned. */
  .brand { order: 1; flex: 1 1 auto; min-width: 0; }
  .wallet-menu-wrap { order: 2; flex: none; margin-left: 0; }
  .tabs { order: 3; flex: 1 1 100%; }
  .tabs button { flex: 1 1 0; text-align: center; min-height: 44px; }
  /* Thumb targets: every tappable control is at least 44px tall. */
  .wallet-menu button { min-height: 44px; }
  .panel button[type="button"], .row button, .task-controls button,
  .admin-list button { min-height: 44px; }
  .task-controls a { display: inline-flex; align-items: center; min-height: 44px; }
}
@media (max-width: 640px) {
  .header-inner { padding: 12px 16px; gap: 12px; }
  /* Compact brand so brand + wallet fit one row at 390px. */
  .brand { gap: 10px; }
  .brand-mark { width: 36px; height: 36px; }
  .brand-name { font-size: 16px; }
  .wrap { padding-left: 16px; padding-right: 16px; }
  main.wrap { padding-top: 24px; }
  .hero { padding: 44px 0 40px; }
  .sub { font-size: 16px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .stat:nth-child(odd) { border-right: 2px dashed var(--dash); }
  .stat:nth-child(even) { border-right: none; }
  /* Row divider only when a second row actually exists (3 cells with
     a deadline set); with 2 cells there is no row below to divide. */
  .stat-grid:has(.stat:nth-child(3)) .stat:nth-child(-n+2) { border-bottom: 2px dashed var(--dash); }
  .tiers { grid-template-columns: repeat(2, 1fr); }
  .tabs button { padding: 9px 14px; font-size: 13px; }
  .header-wallet { padding: 10px 14px; font-size: 12px; letter-spacing: 0; }
  .panel { padding: 20px; }
  .rules-field { padding: 32px 0; }
  /* Forms stack: every field label takes its own row so inputs are
     full-width instead of cramped 120px boxes. Radios keep their
     native size (the collab-type row just stacks vertically). */
  .row label { flex: 1 1 100%; }
  .row label input:not([type="radio"]):not([type="checkbox"]), .row label select { width: 100%; }
}

/* ---- Universal: images never overflow; long unbreakable strings wrap ---- */
img { max-width: 100%; height: auto; }
/* Long unbreakable strings (wallet addresses, tx signatures, links,
   contacts) must wrap instead of forcing a horizontal page scroll. */
.hint, .msg, .wallet-box-value, .admin-list .entry,
.task-row, .winners li, .profile-row strong, #taskCollabPaySig, #taskCollabPayWallet {
  overflow-wrap: anywhere;
}
/* Radios/checkboxes keep their native control size: the generic label
   input rule (block, 100% wide) must not stretch them. Appended last so
   it wins over every earlier input-width rule. */
label input[type="radio"], label input[type="checkbox"] {
  display: inline-block; width: auto; margin: 0 6px 0 0; vertical-align: middle;
}

/* ---- Narrowest phones (<=400px): header STAYS 2 rows, compacted ----
   Width arithmetic at 320px (the narrowest sane viewport):
   inner width = 320 - 2*12 padding = 296. Brand: 30px mark + 8px gap
   + "SPOT RAFFLE" at 14px bold (~95px) = ~133. Gap 8. Wallet:
   "CONNECT WALLET" at 11px (~100px) + 2*10 padding + 4 border
   = ~124. Total ~265 < 296, so brand + wallet share row 1 and tabs
   stay row 2. Connected wallets are shorter (truncated ~11 chars).
   Only below 320px would this genuinely not fit, and no fallback
   row is added for that — 320px is the floor. Header height is then
   ~2 rows (~120px), so anchor offsets drop from 190px to 130px. */
@media (max-width: 400px) {
  .header-inner { padding: 10px 12px; gap: 8px; }
  .brand { order: 1; flex: 1 1 auto; min-width: 0; gap: 8px; }
  .brand-mark { width: 30px; height: 30px; }
  .brand-name { font-size: 14px; }
  .wallet-menu-wrap { order: 2; flex: none; margin-left: 0; }
  .header-wallet { padding: 10px 10px; font-size: 11px; letter-spacing: 0; }
  .tabs { order: 3; }
  html { scroll-padding-top: 130px; }
  .panel { scroll-margin-top: 130px; }
  .hero-display { font-size: 40px; }
  .stat { padding: 18px 14px; }
  .stat-num { font-size: 28px; }
  #statDeadline { font-size: 18px; }
  .tier { padding: 16px; }
  .panel { padding: 18px 16px; }
}

/* ---- Admin panel batch (admin UX audit, 2026-10-25) ---- */
/* Sticky admin header bar (P2-2): replaces the public header while in
   admin mode; compact, always reachable for logout. */
#adminHeaderBar {
  position: sticky; top: 0; z-index: 50;
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
  background: var(--paper); border-bottom: 2px solid var(--ink);
  padding: 10px 16px; margin-bottom: 16px;
}
#adminHeaderBar strong { font-size: 14px; }
#adminHeaderWallet { overflow-wrap: anywhere; font-size: 12px; }
/* Full admin wallet address wraps, never forces horizontal scroll (P2-3). */
#adminWalletValue { overflow-wrap: anywhere; }
/* Summary bar at the top of the admin area (P1-1). */
.admin-summary-bar, .admin-summary {
  border: 2px solid var(--ink); border-radius: 12px;
  padding: 12px 16px; margin: 12px 0; font-size: 14px; line-height: 1.8;
}
.admin-summary-bar a, .admin-summary a { color: var(--vermilion); font-weight: 800; }
/* "Showing: ..." labels above admin lists (P1-3) and filter inputs (P1-8). */
.admin-list-label { font-weight: 800; font-size: 14px; margin: 12px 0 4px; }
.admin-filter { width: 100%; max-width: 420px; margin: 8px 0; }
/* Admin entry rows on mobile (P2-4): CSS-only. Flex wrapping lets the
   action buttons drop onto their own line instead of crowding the row
   text; no markup restructure was needed. */
@media (max-width: 640px) {
  .admin-list .entry { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
  .admin-list .entry button { margin-top: 2px; }
}
