/* =========================================================================
   iliad // sushi — design system
   Tamari-dark omakase counter meets rustc terminal output.
   ========================================================================= */

:root {
  /* Brand & accents (kept names from the original system; meanings refined) */
  --iliad-red:        #e2001a;
  --iliad-red-hot:    #ff2b3e;
  --iliad-red-deep:   #8c0010;
  --salmon:           #ff8c69;
  --rust-orange:      #cc6633;
  --rust-deep:        #7a3a17;
  --wasabi:           #a8c155;
  --winner-gold:      #f5b300;

  /* Surfaces — tamari-black with a warm soy-sauce undertone */
  --bg-0:             #0d0908;   /* page */
  --bg-1:             #160f0d;   /* sunken */
  --bg-2:             #1a1310;   /* card */
  --bg-3:             #241914;   /* card hover / elevated */
  --bg-4:             #2e2520;   /* highest */

  /* Borders / dividers */
  --line:             #2a201b;
  --line-strong:      #3a2c25;

  /* Text */
  --text:             #f5ede0;   /* rice-cream */
  --text-soft:        #d6c6b3;
  --muted:            #8a7a6c;
  --faint:            #5b4d43;

  /* Status */
  --status-open:      #c9a36a;
  --status-closed:    #8aa46b;
  --error:            #ff5a5a;

  /* Geometry */
  --radius:           14px;
  --radius-sm:        8px;
  --radius-pill:      999px;
  --gap:              0.9rem;

  /* Shadows — warm tinted */
  --shadow-sm:  0 1px 0 rgba(255, 200, 160, 0.04) inset,
                0 4px 14px -8px rgba(0, 0, 0, 0.55);
  --shadow-md:  0 1px 0 rgba(255, 200, 160, 0.05) inset,
                0 18px 40px -22px rgba(0, 0, 0, 0.7),
                0 6px 18px -10px rgba(204, 102, 51, 0.18);
  --shadow-red: 0 0 0 1px rgba(226, 0, 26, 0.35) inset,
                0 22px 48px -24px rgba(226, 0, 26, 0.55);

  /* Type */
  --font-display: 'Fraunces', 'Cormorant Garamond', 'Times New Roman', serif;
  --font-body:    'Sora', ui-sans-serif, system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
}

/* =========================================================================
   Reset + base
   ========================================================================= */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

html { color-scheme: dark; -webkit-tap-highlight-color: transparent; }

body {
  min-height: 100dvh;
  background: var(--bg-0);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  font-weight: 400;
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  position: relative;
  overflow-x: hidden;
}

/* Atmosphere: layered radial glows + rice-grain texture */
body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

body::before {
  background:
    radial-gradient(60% 45% at 92% 8%,
      rgba(226, 0, 26, 0.18) 0%,
      rgba(226, 0, 26, 0.05) 35%,
      transparent 70%),
    radial-gradient(55% 45% at 0% 100%,
      rgba(204, 102, 51, 0.16) 0%,
      rgba(204, 102, 51, 0.03) 40%,
      transparent 75%),
    radial-gradient(80% 60% at 50% -10%,
      rgba(255, 140, 105, 0.06),
      transparent 60%);
}

/* Rice-grain dot field */
body::after {
  background-image:
    radial-gradient(rgba(245, 237, 224, 0.045) 1px, transparent 1.2px);
  background-size: 28px 28px;
  background-position: 0 0;
  mix-blend-mode: screen;
  opacity: 0.8;
}

main, header, footer { position: relative; z-index: 1; }

a { color: var(--salmon); text-decoration: none; transition: color 120ms ease; }
a:hover { color: var(--iliad-red-hot); }

::selection { background: var(--iliad-red); color: var(--text); }

/* =========================================================================
   Typography
   ========================================================================= */

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 500;
  font-style: normal;
  letter-spacing: -0.02em;
  color: var(--text);
  margin: 0 0 0.4em;
  font-variation-settings: "opsz" 144, "SOFT" 50, "WONK" 0;
}

h1 {
  font-size: clamp(1.9rem, 5vw, 2.6rem);
  line-height: 1;
  font-weight: 400;
}

h1 em, h2 em {
  font-style: italic;
  color: var(--salmon);
  font-variation-settings: "opsz" 144, "SOFT" 100, "WONK" 1;
}

h2 {
  font-size: clamp(1.05rem, 2.4vw, 1.25rem);
  line-height: 1.15;
  font-weight: 500;
  color: var(--text-soft);
  margin: 1.4rem 0 0.6rem;
  font-variation-settings: "opsz" 36, "SOFT" 50;
}

/* Section markers — rust-source-code style */
h2::before {
  content: "// ";
  font-family: var(--font-mono);
  font-size: 0.78em;
  color: var(--rust-orange);
  font-weight: 500;
  letter-spacing: 0;
  margin-right: 0.05em;
  vertical-align: 0.06em;
}

p { margin: 0.5rem 0; }

.muted { color: var(--muted); font-size: 0.92rem; }
.empty {
  color: var(--muted);
  font-family: var(--font-display);
  font-style: italic;
  font-variation-settings: "opsz" 36, "SOFT" 100;
  margin: 0.5rem 0;
}
.empty::before {
  content: "// TODO: ";
  font-family: var(--font-mono);
  font-style: normal;
  color: var(--rust-deep);
  font-size: 0.85em;
  margin-right: 0.25em;
}

/* Numerics — Rust-mono, tabular */
.numeric, .points, .total, td.num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "ss01", "ss02";
  color: var(--salmon);
  font-weight: 500;
  letter-spacing: -0.02em;
}

/* =========================================================================
   Topbar
   ========================================================================= */

.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1.25rem;
  background:
    linear-gradient(180deg,
      rgba(13, 9, 8, 0.92) 0%,
      rgba(13, 9, 8, 0.78) 100%);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border-bottom: 1px solid var(--line);
}

.topbar::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg,
    transparent 0%,
    var(--iliad-red) 30%,
    var(--rust-orange) 60%,
    transparent 100%);
  opacity: 0.55;
}

.topbar .brand {
  display: inline-flex;
  align-items: baseline;
  gap: 0.45rem;
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 1.08rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.topbar .brand::before {
  content: "";
  display: inline-block;
  width: 8px; height: 8px;
  background: var(--iliad-red);
  border-radius: 50%;
  box-shadow: 0 0 14px var(--iliad-red), 0 0 2px var(--iliad-red-hot);
  margin-right: 0.4rem;
  align-self: center;
  animation: pulse-dot 2.4s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 14px var(--iliad-red), 0 0 2px var(--iliad-red-hot); }
  50%      { box-shadow: 0 0 22px var(--iliad-red), 0 0 4px var(--iliad-red-hot); }
}

.topbar .brand .slash {
  font-family: var(--font-mono);
  font-weight: 500;
  color: var(--rust-orange);
  font-size: 0.95em;
  letter-spacing: -0.04em;
}

.topbar .brand .b-sushi {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 400;
  text-transform: lowercase;
  letter-spacing: -0.01em;
  color: var(--salmon);
  font-variation-settings: "opsz" 144, "SOFT" 100, "WONK" 1;
}

.topbar .brand:hover { text-decoration: none; }

.topnav { display: flex; gap: 0.15rem; flex-wrap: wrap; }
.topnav a {
  position: relative;
  color: var(--text-soft);
  padding: 0.45rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  transition: color 140ms ease, background 140ms ease;
}
.topnav a:hover {
  color: var(--text);
  background: var(--bg-3);
  text-decoration: none;
}
.topnav a.muted { color: var(--muted); }
.topnav a.muted::before {
  content: "::";
  font-family: var(--font-mono);
  color: var(--rust-orange);
  margin-right: 0.3rem;
  font-size: 0.85em;
  opacity: 0.7;
}

/* =========================================================================
   Layout
   ========================================================================= */

main {
  max-width: 820px;
  margin: 0 auto;
  padding: 1.5rem 1.1rem 4rem;
  animation: page-rise 480ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

@keyframes page-rise {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.appfoot {
  margin-top: 3rem;
  padding: 1.5rem 0 0;
  border-top: 1px dashed var(--line);
  text-align: center;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.02em;
}

.appfoot::before { content: "fn "; color: var(--rust-orange); }
.appfoot::after  { content: " { 🦀 + 🍣 }"; color: var(--faint); }

/* =========================================================================
   Card
   ========================================================================= */

.card {
  position: relative;
  background:
    linear-gradient(180deg,
      var(--bg-2) 0%,
      var(--bg-1) 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem 1.25rem;
  margin: 0.9rem 0;
  box-shadow: var(--shadow-sm);
  transition: border-color 200ms ease, transform 200ms ease;
}

/* Top-edge highlight */
.card::before {
  content: "";
  position: absolute;
  inset: 0 1px auto 1px;
  height: 1px;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(255, 140, 105, 0.35) 30%,
    rgba(204, 102, 51, 0.15) 70%,
    transparent 100%);
  border-radius: var(--radius) var(--radius) 0 0;
  pointer-events: none;
}

.card > h1:first-child,
.card > h2:first-child {
  margin-top: 0.1rem;
}

/* "Hero" card variant — for #1 spotlights and headlines */
.card.hero {
  background:
    radial-gradient(120% 90% at 100% 0%,
      rgba(226, 0, 26, 0.12) 0%,
      transparent 55%),
    radial-gradient(80% 70% at 0% 100%,
      rgba(204, 102, 51, 0.10) 0%,
      transparent 60%),
    linear-gradient(180deg, var(--bg-3) 0%, var(--bg-2) 100%);
  border-color: var(--line-strong);
  padding: 1.5rem 1.35rem 1.4rem;
}

.card.hero::before {
  background: linear-gradient(90deg,
    transparent 0%,
    var(--iliad-red) 30%,
    var(--rust-orange) 65%,
    var(--salmon) 90%,
    transparent 100%);
  height: 1.5px;
  opacity: 0.7;
}

/* =========================================================================
   Hero / brand line on home
   ========================================================================= */

.hero-mark {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--rust-orange);
  letter-spacing: 0.04em;
  margin: 0 0 0.55rem;
  text-transform: lowercase;
  opacity: 0.85;
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 7vw, 3.8rem);
  font-weight: 300;
  line-height: 0.98;
  letter-spacing: -0.035em;
  margin: 0 0 0.7rem;
  font-variation-settings: "opsz" 144, "SOFT" 30;
}

.hero-title .vs {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.45em;
  color: var(--rust-orange);
  font-weight: 500;
  vertical-align: 0.4em;
  margin: 0 0.35em;
  letter-spacing: -0.04em;
}

.hero-title .accent {
  font-style: italic;
  color: var(--iliad-red-hot);
  font-variation-settings: "opsz" 144, "SOFT" 100, "WONK" 1;
}

.hero-sub {
  color: var(--muted);
  font-size: 0.92rem;
  max-width: 56ch;
  margin: 0;
}

/* =========================================================================
   Flash
   ========================================================================= */

.flash {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 1rem;
  margin: 0 0 1rem;
  background:
    linear-gradient(180deg,
      rgba(255, 140, 105, 0.14),
      rgba(204, 102, 51, 0.08));
  border: 1px solid rgba(255, 140, 105, 0.35);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.95rem;
  box-shadow: 0 12px 28px -18px rgba(204, 102, 51, 0.5);
}
.flash::before {
  content: "//";
  font-family: var(--font-mono);
  color: var(--rust-orange);
  font-weight: 500;
  margin-right: 0.4rem;
  flex-shrink: 0;
}
.flash a { color: var(--text-soft); padding: 0 0.4rem; }
.flash a:hover { color: var(--iliad-red-hot); }

/* =========================================================================
   Buttons
   ========================================================================= */

.btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  gap: 0.4rem;
  padding: 0.7rem 1.1rem;
  min-height: 44px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font: inherit;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.92rem;
  letter-spacing: 0.01em;
  cursor: pointer;
  background: transparent;
  color: var(--text);
  transition: transform 120ms ease, background 160ms ease,
              border-color 160ms ease, color 160ms ease, box-shadow 200ms ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: linear-gradient(180deg, var(--iliad-red-hot) 0%, var(--iliad-red) 60%, var(--iliad-red-deep) 100%);
  color: #fff;
  border-color: var(--iliad-red);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.18) inset,
    0 -1px 0 rgba(0, 0, 0, 0.25) inset,
    0 14px 32px -16px rgba(226, 0, 26, 0.6);
}
.btn-primary:hover {
  filter: brightness(1.06) saturate(1.1);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.22) inset,
    0 -1px 0 rgba(0, 0, 0, 0.25) inset,
    0 18px 40px -14px rgba(226, 0, 26, 0.75);
}

.btn-secondary {
  background: var(--bg-2);
  color: var(--text);
  border-color: var(--line-strong);
}
.btn-secondary:hover {
  background: var(--bg-3);
  border-color: var(--rust-orange);
  color: var(--salmon);
}

.btn-ghost {
  background: transparent;
  color: var(--salmon);
  border: none;
  min-height: 0;
  padding: 0.35rem 0.45rem;
  font-weight: 500;
}
.btn-ghost:hover {
  color: var(--iliad-red-hot);
  text-decoration: none;
  background: transparent;
}

.btn-danger {
  background: transparent;
  color: var(--iliad-red-hot);
  border-color: rgba(226, 0, 26, 0.35);
}
.btn-danger:hover {
  background: rgba(226, 0, 26, 0.12);
  border-color: var(--iliad-red);
  color: #fff;
}

.btn-sm {
  min-height: 0;
  padding: 0.4rem 0.7rem;
  font-size: 0.82rem;
  border-radius: 7px;
}

/* =========================================================================
   Inputs
   ========================================================================= */

input, select, textarea {
  font: inherit;
  font-family: var(--font-body);
  font-size: 16px;
  padding: 0.65rem 0.85rem;
  min-height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-1);
  color: var(--text);
  transition: border-color 140ms ease, box-shadow 160ms ease, background 140ms ease;
}
input::placeholder, textarea::placeholder { color: var(--faint); }

input:hover, select:hover, textarea:hover { border-color: var(--rust-deep); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--iliad-red);
  background: var(--bg-2);
  box-shadow:
    0 0 0 4px rgba(226, 0, 26, 0.18),
    0 0 24px -10px rgba(226, 0, 26, 0.5);
}

input.numeric, .input-num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.input-num { max-width: 5.5rem; }

/* checkbox & radio: keep native but accent them */
input[type="checkbox"], input[type="radio"] {
  accent-color: var(--iliad-red);
  width: auto; height: auto; min-height: 0;
  margin-right: 0.4rem;
  vertical-align: -0.12em;
}

select {
  appearance: none;
  -webkit-appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--rust-orange) 50%),
    linear-gradient(135deg, var(--rust-orange) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 50%,
    calc(100% - 13px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 2rem;
}

form {
  display: flex; flex-direction: column;
  gap: 0.7rem;
  margin: 0.6rem 0;
}
form.inline {
  flex-direction: row; flex-wrap: wrap;
  gap: 0.5rem; align-items: center;
}
form.inline input { width: auto; }

label {
  font-weight: 500;
  font-size: 0.85rem;
  color: var(--text-soft);
  letter-spacing: 0.02em;
}

fieldset {
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.9rem;
  margin: 0.3rem 0;
}
fieldset legend {
  padding: 0 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--rust-orange);
}
fieldset label {
  display: flex; align-items: center;
  padding: 0.25rem 0;
  font-weight: 400;
  color: var(--text-soft);
  cursor: pointer;
}
fieldset label:hover { color: var(--text); }

/* =========================================================================
   Badges
   ========================================================================= */

.badge {
  display: inline-flex; align-items: center;
  padding: 0.18rem 0.6rem;
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  vertical-align: 0.1em;
}

.badge.open {
  background: rgba(201, 163, 106, 0.12);
  color: var(--status-open);
  border: 1px dashed rgba(201, 163, 106, 0.45);
}
.badge.open::before { content: "● "; color: var(--status-open); margin-right: 0.2rem; opacity: 0.8; }

.badge.closed {
  background: rgba(138, 164, 107, 0.14);
  color: var(--status-closed);
  border: 1px solid rgba(138, 164, 107, 0.35);
}
.badge.closed::before { content: "✓ "; margin-right: 0.2rem; }

.badge.winner {
  background: linear-gradient(135deg, var(--iliad-red) 0%, var(--rust-orange) 100%);
  color: #fff;
  border: none;
  padding: 0.3rem 0.7rem;
  font-size: 0.78rem;
  text-transform: none;
  letter-spacing: 0.02em;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 500;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.18) inset,
    0 8px 22px -10px rgba(226, 0, 26, 0.6);
}

.badge.inactive {
  background: rgba(245, 237, 224, 0.04);
  color: var(--muted);
  font-family: var(--font-display);
  font-style: italic;
  text-transform: lowercase;
  letter-spacing: 0;
  font-size: 0.74rem;
  border: 1px solid var(--line);
  margin-left: 0.45rem;
}

/* =========================================================================
   Chips (participants)
   ========================================================================= */

.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.7rem 0 0.3rem; }

.chip {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.35rem 0.85rem;
  min-height: 36px;
  border-radius: var(--radius-pill);
  background:
    linear-gradient(180deg,
      rgba(255, 140, 105, 0.14),
      rgba(204, 102, 51, 0.06));
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 500;
  border: 1px solid rgba(255, 140, 105, 0.22);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset;
  transition: border-color 160ms ease, transform 160ms ease;
}
.chip:hover {
  border-color: rgba(255, 140, 105, 0.45);
  transform: translateY(-1px);
}
.chip::before {
  content: "🍣";
  font-size: 0.85em;
  filter: saturate(1.1);
  opacity: 0.95;
}

.chip .btn-sm {
  background: transparent; border: none;
  color: var(--muted);
  padding: 0.15rem 0.35rem;
  min-height: 28px;
  line-height: 1;
}
.chip .btn-sm:hover { color: var(--iliad-red-hot); }

/* =========================================================================
   Tables
   ========================================================================= */

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0.6rem -0.2rem;
  padding: 0 0.2rem;
}

table { width: 100%; border-collapse: collapse; margin: 0.4rem 0; }

th, td {
  text-align: left;
  padding: 0.7rem 0.55rem;
  vertical-align: middle;
}

th {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--rust-orange);
  font-weight: 500;
  border-bottom: 1px solid var(--line-strong);
  padding-top: 0.4rem;
  padding-bottom: 0.55rem;
}

tbody tr {
  border-bottom: 1px solid var(--line);
  transition: background 140ms ease;
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: rgba(255, 140, 105, 0.04); }

tr.inactive td { opacity: 0.55; }
tr.inactive a { color: var(--muted); font-style: italic; }

.row-actions { display: flex; gap: 0.4rem; align-items: center; }

/* Leaderboard — editorial */
.leaderboard td:first-child,
.leaderboard th:first-child {
  width: 2.4rem;
  font-family: var(--font-mono);
  color: var(--faint);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}

.leaderboard tbody td:first-child::before {
  content: ""; /* numerals already rendered in cell */
}

/* Spotlight on rank #1 */
.leaderboard tbody tr:first-child:not(.inactive) {
  background: linear-gradient(90deg,
    rgba(226, 0, 26, 0.08) 0%,
    transparent 75%);
  position: relative;
}
.leaderboard tbody tr:first-child:not(.inactive) td:first-child {
  color: var(--iliad-red-hot);
  font-weight: 700;
  position: relative;
}
.leaderboard tbody tr:first-child:not(.inactive) td:first-child::after {
  content: "🍣";
  margin-left: 0.35rem;
  font-size: 0.82em;
  vertical-align: 0.05em;
}
.leaderboard tbody tr:first-child:not(.inactive) td:nth-child(2) a {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 500;
  color: var(--text);
  letter-spacing: -0.01em;
  font-variation-settings: "opsz" 36, "SOFT" 50;
}
.leaderboard tbody tr:first-child:not(.inactive) td:nth-child(2) a:hover {
  color: var(--iliad-red-hot);
}

/* Person name links elsewhere */
.leaderboard tbody td a { color: var(--text); }
.leaderboard tbody td a:hover { color: var(--iliad-red-hot); text-decoration: none; }

/* Orders table — sushi-counter feel */
.orders-table th:last-child,
.orders-table td:last-child {
  width: 2.5rem;
  text-align: right;
}
.orders-table td:nth-child(2) {
  font-family: var(--font-display);
  font-style: italic;
  font-variation-settings: "opsz" 36, "SOFT" 100;
  color: var(--salmon);
}

/* =========================================================================
   Table list (rows)
   ========================================================================= */

.table-row {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  padding: 0.7rem 0.2rem;
  border-bottom: 1px solid var(--line);
  transition: padding-left 180ms ease;
  position: relative;
}
.table-row::before {
  content: "";
  position: absolute;
  left: -0.2rem; top: 50%;
  transform: translateY(-50%);
  width: 2px; height: 0;
  background: var(--iliad-red);
  border-radius: 2px;
  transition: height 200ms ease;
}
.table-row:hover { padding-left: 0.6rem; }
.table-row:hover::before { height: 60%; }
.table-row:last-child { border-bottom: none; }
.table-row .grow { flex: 1; min-width: 0; }
.table-row a {
  color: var(--text);
  font-weight: 500;
}
.table-row a:hover { color: var(--iliad-red-hot); text-decoration: none; }

/* =========================================================================
   Winner banner
   ========================================================================= */

.winner-banner {
  position: relative;
  display: flex; align-items: center; gap: 0.85rem;
  background:
    radial-gradient(140% 100% at 0% 50%,
      rgba(255, 140, 105, 0.18),
      transparent 55%),
    linear-gradient(120deg,
      var(--iliad-red-deep) 0%,
      var(--iliad-red) 35%,
      var(--rust-orange) 100%);
  color: #fff;
  padding: 0.95rem 1.1rem;
  border-radius: var(--radius);
  margin: 0.7rem 0;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 400;
  letter-spacing: -0.01em;
  font-variation-settings: "opsz" 36, "SOFT" 50;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.2) inset,
    0 22px 50px -22px rgba(226, 0, 26, 0.6);
  overflow: hidden;
}
.winner-banner::after {
  content: "";
  position: absolute;
  top: 0; left: -100%;
  width: 60%; height: 100%;
  background: linear-gradient(90deg,
    transparent,
    rgba(255, 255, 255, 0.18),
    transparent);
  animation: shimmer 5s linear infinite;
}
@keyframes shimmer {
  0%   { left: -100%; }
  60%  { left: 110%; }
  100% { left: 110%; }
}
.winner-banner span:last-child {
  font-style: italic;
  font-variation-settings: "opsz" 144, "SOFT" 100, "WONK" 1;
}

/* =========================================================================
   Tie-break
   ========================================================================= */

.tie-break {
  background:
    repeating-linear-gradient(
      135deg,
      rgba(245, 179, 0, 0.06) 0 8px,
      transparent 8px 16px),
    var(--bg-3);
  border: 1px dashed rgba(245, 179, 0, 0.5);
  padding: 1rem 1.1rem;
  border-radius: var(--radius);
  margin: 0.85rem 0;
}
.tie-break h2 { color: var(--winner-gold); margin-top: 0; }
.tie-break h2::before { color: var(--winner-gold); }
.tie-break form { gap: 0.5rem; }
.tie-break label {
  display: flex; align-items: center;
  padding: 0.3rem 0; font-weight: 400;
  color: var(--text);
}

/* =========================================================================
   Misc
   ========================================================================= */

.error {
  color: var(--error);
  background: rgba(255, 90, 90, 0.08);
  border: 1px solid rgba(255, 90, 90, 0.3);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
  font-size: 0.92rem;
  margin: 0.6rem 0;
  font-family: var(--font-mono);
}
.error::before {
  content: "error[E001]: ";
  color: var(--iliad-red-hot);
  font-weight: 600;
  margin-right: 0.2rem;
}

/* Totals */
.totals-list {
  list-style: none;
  padding: 0;
  margin: 0.6rem 0;
}
.totals-list li {
  padding: 0.55rem 0.2rem;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-bottom: 1px solid var(--line);
  gap: 0.8rem;
}
.totals-list li:last-child { border-bottom: none; }
.totals-list li strong {
  font-family: var(--font-display);
  font-weight: 400;
  font-variation-settings: "opsz" 36, "SOFT" 50;
  font-size: 1.05rem;
  color: var(--text);
}
.totals-list li .numeric {
  font-size: 1rem;
  color: var(--salmon);
}
.totals-list li:first-child .numeric {
  color: var(--iliad-red-hot);
  font-size: 1.15rem;
  font-weight: 600;
}
.totals-list li:first-child strong::before {
  content: "1.";
  font-family: var(--font-mono);
  color: var(--rust-orange);
  margin-right: 0.5rem;
  font-size: 0.78em;
  vertical-align: 0.1em;
}

/* Stats block — magazine numerals */
.stats-block {
  display: grid;
  gap: 0.9rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0.5rem 0;
}
.stats-block p {
  margin: 0;
  padding: 0.85rem 1rem;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.stats-block p strong {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--rust-orange);
}
.stats-block p .numeric {
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
}
.stats-block p a { color: var(--salmon); font-size: 0.85rem; }

/* Auth screens — centered, restrained */
.auth-shell {
  min-height: calc(100dvh - 80px);
  display: grid;
  place-items: center;
  padding: 1.5rem 0;
}
.auth-shell .card {
  width: 100%; max-width: 420px;
  padding: 2rem 1.6rem 1.8rem;
  margin: 0;
}
.auth-shell h1 {
  font-size: clamp(1.8rem, 5vw, 2.2rem);
  margin-bottom: 0.15rem;
}
.auth-shell .auth-sub {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--rust-orange);
  letter-spacing: 0.04em;
  margin-bottom: 1.1rem;
}

/* HTMX request feedback */
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator { display: inline; }
.htmx-request.btn { opacity: 0.75; pointer-events: none; }

/* HTMX swap-in animation */
tr.htmx-added,
.chip.htmx-added,
.table-row.htmx-added {
  animation: row-slip 280ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
@keyframes row-slip {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* =========================================================================
   Responsive
   ========================================================================= */

@media (max-width: 640px) {
  .topbar { padding: 0.7rem 0.9rem; }
  .topbar .brand { font-size: 0.95rem; }
  .topnav a { padding: 0.4rem 0.5rem; font-size: 0.85rem; }
  main { padding: 1rem 0.85rem 3rem; }
  .card { padding: 1rem 1rem; }
  .card.hero { padding: 1.2rem 1rem 1.1rem; }
  th, td { padding: 0.55rem 0.35rem; }
  .hero-title { font-size: clamp(2rem, 9vw, 2.8rem); }
  .stats-block { grid-template-columns: 1fr; }
  .winner-banner { font-size: 1rem; padding: 0.85rem 1rem; }
  .leaderboard tbody tr:first-child:not(.inactive) td:nth-child(2) a {
    font-size: 1.05rem;
  }
}

@media (max-width: 380px) {
  .topbar .brand .b-iliad { font-size: 0.9em; }
  form.inline { gap: 0.4rem; }
}

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