/* ==========================================================================
   The Regulars Design System
   Palette: poker chip colors -- white, red, blue, green, black
   ========================================================================== */

/* --- Tokens: Light theme --- */
:root {
  /* Poker chip palette */
  --chip-white: #f0ede6;
  --chip-red: #c0392b;
  --chip-red-light: #e74c3c;
  --chip-blue: #2c5282;
  --chip-blue-light: #3b82f6;
  --chip-green: #276749;
  --chip-green-light: #38a169;
  --chip-black: #1a1a2e;

  /* Semantic colors */
  --color-bg: #f7f5f0;
  --color-bg-raised: #ffffff;
  --color-bg-sunken: #ece9e1;
  --color-text: #1a1a2e;
  --color-text-secondary: #5a5a6e;
  --color-text-muted: #8a8a9a;

  --color-primary: var(--chip-green);
  --color-primary-hover: var(--chip-green-light);
  --color-danger: var(--chip-red);
  --color-danger-hover: var(--chip-red-light);
  --color-info: var(--chip-blue);
  --color-info-hover: var(--chip-blue-light);

  --color-border: #d4d0c8;
  --color-border-light: #e8e4dc;
  --color-focus: var(--chip-blue-light);

  --color-nav-bg: var(--chip-black);
  --color-nav-text: #f0ede6;
  --color-nav-accent: var(--chip-green-light);

  --color-flash-notice-bg: #d4edda;
  --color-flash-notice-text: #155724;
  --color-flash-alert-bg: #f8d7da;
  --color-flash-alert-text: #721c24;

  /* Table */
  --color-table-header: #e8e4dc;
  --color-table-stripe: rgba(0, 0, 0, 0.02);
  --color-table-hover: rgba(39, 103, 73, 0.06);
  --color-rank-1: #ffd700;
  --color-rank-2: #c0c0c0;
  --color-rank-3: #cd7f32;

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;

  /* Typography */
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-heading: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  /* Lora and Inter are served with the app (fonts.css.erb, WP26). */
  --font-display: "Lora", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --font-mono: "JetBrains Mono", "Fira Code", "SF Mono", "Cascadia Code", monospace;
  /* Numbers in tables, stat cards, and place badges: Inter, not a coding font (WP26). */
  --font-numbers: var(--font-body);
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 2rem;
  --text-4xl: 2.375rem;

  /* Ambient background spotlight (the "table felt" glow) */
  --color-bg-spot: #fdfbf6;

  /* Signature chip stripe -- colors blended heavily into the nav
     background so the stripe reads as a quiet detail, not a banner */
  --chip-stripe: repeating-linear-gradient(
    90deg,
    color-mix(in srgb, var(--chip-green) 40%, var(--color-nav-bg)) 0 32px,
    color-mix(in srgb, var(--chip-red) 40%, var(--color-nav-bg)) 32px 64px,
    color-mix(in srgb, var(--chip-blue) 40%, var(--color-nav-bg)) 64px 96px,
    color-mix(in srgb, var(--chip-white) 40%, var(--color-nav-bg)) 96px 128px
  );

  /* Shape */
  --radius-sm: 4px;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-full: 9999px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.12);

  /* Transitions */
  --transition: 150ms ease;
}

/* --- Tokens: Dark theme --- */
[data-theme="dark"] {
  --color-bg: #0f1923;
  --color-bg-raised: #1a2736;
  --color-bg-sunken: #0a1018;
  --color-text: #e2e8f0;
  --color-text-secondary: #a0aec0;
  --color-text-muted: #718096;

  --color-primary: var(--chip-green-light);
  --color-primary-hover: #48bb78;
  --color-danger: var(--chip-red-light);
  --color-danger-hover: #fc5c65;
  --color-info: var(--chip-blue-light);
  --color-info-hover: #63b3ed;

  --color-border: #2d3748;
  --color-border-light: #1e2a3a;
  --color-focus: var(--chip-blue-light);

  --color-nav-bg: #0a1018;
  --color-nav-text: #e2e8f0;
  --color-nav-accent: var(--chip-green-light);

  --color-flash-notice-bg: #1a3a2a;
  --color-flash-notice-text: #68d391;
  --color-flash-alert-bg: #3a1a1a;
  --color-flash-alert-text: #fc8181;

  --color-table-header: #1e2a3a;
  --color-table-stripe: rgba(255, 255, 255, 0.02);
  --color-table-hover: rgba(56, 161, 105, 0.1);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.4);

  --color-bg-spot: #14222f;
}

/* ==========================================================================
   Reset & Base
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
/* The hidden attribute wins over a class's display (.actions is flex). */
[hidden] { display: none !important; }

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.6;
  background:
    radial-gradient(1100px 480px at 50% -160px, var(--color-bg-spot), transparent 70%)
    fixed,
    var(--color-bg);
  color: var(--color-text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  transition: color var(--transition);
}

::selection {
  background: var(--chip-green);
  color: #fff;
}

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

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.3;
  color: var(--color-text);
  letter-spacing: -0.01em;
}

h1, h2 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0;
}

h1 { font-size: var(--text-4xl); margin-bottom: var(--space-lg); }
h2 { font-size: var(--text-2xl); margin: var(--space-xl) 0 var(--space-md); }
h3 { font-size: var(--text-xl); margin: var(--space-lg) 0 var(--space-sm); }

h1 a { color: inherit; }
h1 a:hover { color: var(--color-primary); }

p { margin-bottom: var(--space-md); }

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition);
}
a:hover { color: var(--color-primary-hover); }

small, .text-sm { font-size: var(--text-sm); }
.text-xs { font-size: var(--text-xs); }
.text-muted { color: var(--color-text-muted); }
.text-secondary { color: var(--color-text-secondary); }
.text-mono { font-family: var(--font-mono); }
.text-right { text-align: right; }
.nowrap { white-space: nowrap; }
/* Shown only on a phone (see Responsive at the end). */
.phone-only { display: none; }
.text-center { text-align: center; }

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

.container {
  max-width: 1024px;
  margin: 0 auto;
  padding: var(--space-lg) var(--space-lg);
}

@media (max-width: 640px) {
  .container { padding: var(--space-md); }
}

/* ==========================================================================
   Navigation
   ========================================================================== */

.top-nav {
  background: var(--color-nav-bg);
  color: var(--color-nav-text);
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

/* Signature: the chip stripe. A thin band of all four chip colors. */
.top-nav::after {
  content: "";
  display: block;
  height: 3px;
  background: var(--chip-stripe);
}

.nav-container {
  max-width: 1024px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem var(--space-lg);
  gap: var(--space-md);
}

.nav-brand {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.nav-brand:hover { opacity: 0.85; }

/* The wordmark logos are 3:1 (brand/*.png), soft white for the dark header in both themes. */
.nav-brand-logo {
  display: block;
  height: 60px;
  width: auto;
}

.nav-links {
  display: flex;
  gap: var(--space-md);
  align-items: center;
  font-size: var(--text-sm);
  white-space: nowrap;
}
.nav-links a {
  color: var(--color-nav-text);
  opacity: 0.85;
  transition: opacity var(--transition);
}
.nav-links a:hover { opacity: 1; color: var(--color-nav-accent); }
.nav-links span { color: var(--color-nav-text); opacity: 0.7; }

.nav-links button,
.nav-links .btn-nav {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: var(--color-nav-text);
  padding: var(--space-xs) 0.75rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  font-size: var(--text-sm);
  transition: all var(--transition);
}
.nav-links button:hover,
.nav-links .btn-nav:hover {
  border-color: var(--color-nav-accent);
  color: var(--color-nav-accent);
}

.theme-toggle {
  background: none;
  border: none;
  color: var(--color-nav-text);
  cursor: pointer;
  font-size: var(--text-lg);
  padding: var(--space-xs);
  opacity: 0.7;
  transition: opacity var(--transition);
  line-height: 1;
}
.theme-toggle:hover { opacity: 1; }

@media (max-width: 640px) {
  .nav-container { padding: var(--space-sm) var(--space-md); }
  .nav-links { gap: var(--space-sm); font-size: var(--text-xs); }
  .nav-brand-logo { height: auto; max-height: 48px; max-width: 100%; }
  /* On the narrowest phones the logo gives way, so Sign Out stays on screen. */
  .nav-brand { flex-shrink: 1; min-width: 0; }

  /* One line on a phone (WP23): "Leagues", and the name as its initials in a circle. The
     full name stays in the page for screen readers; the initials are decoration. */
  .nav-long { display: none; }
  .nav-account {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: var(--radius-full);
    font-weight: 600;
  }
  .nav-account::before {
    content: attr(data-initials);
    content: attr(data-initials) / "";
  }
  .nav-account-name {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
  .nav-links button { padding: var(--space-xs) var(--space-sm); }
}

/* ==========================================================================
   League navigation (sub-nav)
   ========================================================================== */

/* Every league page starts with the league name and these tabs (leagues/_header). */
.league-header-name {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 600;
  line-height: 1.3;
  /* The same space as between the tabs and the line under them (.league-nav). */
  margin: 0 0 var(--space-md);
}
.league-header-name a { color: var(--color-text); }
.league-header-name a:hover { color: var(--color-primary); text-decoration: none; }

.league-nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  padding-bottom: var(--space-md);
  border-bottom: 2px solid var(--color-border-light);
  margin-bottom: var(--space-lg);
}

/* Each tab is a pill, so it reads as something to press (Josh, 2026-10-13); the current one
   is filled in. On a phone the tabs are the dropdown below instead (WP28). */
.league-nav a {
  padding: 0.5rem 1.125rem;
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--color-text);
  background: var(--color-bg-raised);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-sm);
  white-space: nowrap;
  transition: all var(--transition);
}
.league-nav a:hover {
  color: var(--color-primary);
  border-color: var(--color-primary);
  background: var(--color-table-hover);
  text-decoration: none;
}
.league-nav a.active {
  color: #fff;
  background: var(--color-primary);
  border-color: var(--color-primary);
  box-shadow: var(--shadow);
}
/* Opens in a new tab, so it sits apart from the league's own tabs. */
.league-nav a.league-nav-external { margin-left: auto; }
.league-nav a.league-nav-external::after { content: "\00a0\2197"; }

/* The tabs on a phone (WP28): a pill showing the current tab, opening a list of them over
   the page. It takes the tab row's place, line underneath included. */
.league-menu {
  display: none;
  position: relative;
  padding-bottom: var(--space-md);
  border-bottom: 2px solid var(--color-border-light);
  margin-bottom: var(--space-lg);
}
.league-menu summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  width: 12rem;
  padding: 0.5rem 1.125rem;
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--color-text);
  background: var(--color-bg-raised);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-sm);
  list-style: none;
  cursor: pointer;
}
.league-menu summary::-webkit-details-marker { display: none; }
.league-menu summary::after { content: "\25BE"; transition: transform var(--transition); }
.league-menu[open] summary { border-color: var(--color-primary); }
.league-menu[open] summary::after { transform: rotate(180deg); }
.league-menu-list {
  position: absolute;
  top: calc(100% - var(--space-md) + var(--space-xs));
  left: 0;
  z-index: 20;
  width: 12rem;
  padding: var(--space-xs) 0;
  background: var(--color-bg-raised);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}
.league-menu-list a {
  display: flex;
  justify-content: space-between;
  padding: 0.625rem 1.125rem;
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--color-text);
}
.league-menu-list a:hover { background: var(--color-table-hover); text-decoration: none; }
.league-menu-list a.active { color: var(--color-primary); }
.league-menu-list a.active::after { content: "\2713"; }
.league-menu-list a.league-nav-external::after { content: "\2197"; }

/* The page heading under the tabs: the trail from the tab down, earlier steps muted and
   linked, then the page's buttons on the right. */
.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm) var(--space-md);
  margin-bottom: var(--space-lg);
}
.page-title { margin: 0; }
.page-title .sep {
  margin: 0 0.35em;
  color: var(--color-text-muted);
  font-weight: 400;
}
.page-title a.page-title-parent { color: var(--color-text-muted); }
.page-title a.page-title-parent:hover { color: var(--color-primary); }
.page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

/* ==========================================================================
   Cards
   ========================================================================== */

.card {
  background: var(--color-bg-raised);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), background var(--transition);
}
.card:hover { box-shadow: var(--shadow); }

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-md);
}

.card-title {
  font-size: var(--text-lg);
  font-weight: 700;
  margin: 0;
}

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

/* Buttons are poker chips: pill-shaped, and the solid (primary/danger)
   variants carry the dashed edge-ring inset from the rim, matching the
   medal position badges. Quiet buttons stay plain pills. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  padding: 0.5rem 1.125rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border);
  background: var(--color-bg-raised);
  color: var(--color-text);
  cursor: pointer;
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: none;
  transition: all var(--transition);
  line-height: 1.4;
}
.btn:hover {
  text-decoration: none;
  background: var(--color-bg-sunken);
  border-color: var(--color-primary);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}
.btn:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}
.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.45);
}

.btn-primary {
  background: linear-gradient(180deg, var(--color-primary-hover), var(--color-primary));
  color: #fff;
  border-color: var(--color-primary);
  outline: 1px dashed rgba(255, 255, 255, 0.45);
  outline-offset: -4px;
}
.btn-primary:hover {
  background: var(--color-primary-hover);
  border-color: var(--color-primary-hover);
}

.btn-danger {
  background: linear-gradient(180deg, var(--color-danger-hover), var(--color-danger));
  color: #fff;
  border-color: var(--color-danger);
  outline: 1px dashed rgba(255, 255, 255, 0.45);
  outline-offset: -4px;
}
.btn-danger:hover {
  background: var(--color-danger-hover);
  border-color: var(--color-danger-hover);
}

.btn-sm {
  padding: 0.375rem 0.875rem;
  font-size: var(--text-sm);
  outline-offset: -3px;
}
/* The plain small buttons ("Full Season", "Edit", "Week 3") sit next to tables and headings,
   where a white pill disappeared (Josh, 2026-10-13): they take the primary colour's outline
   and a light tint, and fill in on hover. */
.btn-sm:not(.btn-primary):not(.btn-danger) {
  color: var(--color-primary);
  border-color: var(--color-primary);
  background: var(--color-table-hover);
}
.btn-sm:not(.btn-primary):not(.btn-danger):hover {
  color: #fff;
  background: var(--color-primary);
}

.btn-icon {
  padding: var(--space-xs);
  border: none;
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
}
.btn-icon:hover { color: var(--color-text); }

.actions {
  display: flex;
  gap: var(--space-sm);
  align-items: center;
  margin-top: var(--space-lg);
  margin-bottom: var(--space-lg);
}

/* ==========================================================================
   Badges (clinch status, position, etc.)
   ========================================================================== */

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Decided states (clinched/eliminated/completed/locked) are solid chips
   with white text; in-flux states (active/open/contending/upcoming) stay
   as tinted pills with bright colored text. */
.badge-clinched {
  background: var(--chip-green);
  color: #fff;
}

.badge-eliminated {
  background: var(--chip-red);
  color: #fff;
}

.badge-contending {
  background: rgba(44, 82, 130, 0.1);
  color: var(--chip-blue);
}
[data-theme="dark"] .badge-contending {
  background: rgba(59, 130, 246, 0.18);
  color: #7cb5f5;
}

.badge-active {
  background: rgba(39, 103, 73, 0.15);
  color: var(--chip-green);
}
[data-theme="dark"] .badge-active {
  background: rgba(56, 161, 105, 0.2);
  color: #5dd39e;
}

.badge-completed {
  background: var(--color-text-muted);
  color: #fff;
}

.badge-upcoming {
  background: rgba(44, 82, 130, 0.1);
  color: var(--chip-blue);
}
[data-theme="dark"] .badge-upcoming {
  background: rgba(59, 130, 246, 0.18);
  color: #7cb5f5;
}

/* Position badges for final table */
.pos {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 700;
  font-family: var(--font-numbers);
}
/* Top three finishes are rendered as poker chips: a dashed inner ring
   like a chip's edge inlay, plus an outer rim of the same color. */
.pos-1, .pos-2, .pos-3 {
  border: 2px dashed rgba(255, 255, 255, 0.85);
}
.pos-1 {
  background: var(--color-rank-1);
  color: #1a1a2e;
  box-shadow: 0 0 0 2px var(--color-rank-1);
}
.pos-2 {
  background: var(--color-rank-2);
  color: #1a1a2e;
  box-shadow: 0 0 0 2px var(--color-rank-2);
}
.pos-3 {
  background: var(--color-rank-3);
  color: #fff;
  box-shadow: 0 0 0 2px var(--color-rank-3);
}
.pos-4, .pos-5, .pos-6, .pos-7, .pos-8, .pos-9 {
  background: var(--color-bg-sunken);
  color: var(--color-text-secondary);
}

/* Whisper of gold/silver/bronze down the edge of medal rows */
tbody tr:has(.pos-1) td:first-child { box-shadow: inset 3px 0 0 var(--color-rank-1); }
tbody tr:has(.pos-2) td:first-child { box-shadow: inset 3px 0 0 var(--color-rank-2); }
tbody tr:has(.pos-3) td:first-child { box-shadow: inset 3px 0 0 var(--color-rank-3); }

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

.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border-light);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--space-lg);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--color-bg-raised);
  font-size: var(--text-base);
}

th {
  padding: var(--space-sm) var(--space-md);
  text-align: left;
  font-weight: 600;
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  background: var(--color-table-header);
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}

td {
  padding: 0.65rem var(--space-md);
  border-bottom: 1px solid var(--color-border-light);
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }

tr:nth-child(even) { background: var(--color-table-stripe); }

tr:hover td { background: var(--color-table-hover); }

/* Numeric columns. The fixed width spreads the number columns out so
   the flexible player/name column doesn't hoard all the leftover space. */
.col-num {
  text-align: right;
  font-family: var(--font-numbers);
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
  width: 5.5rem;
}

/* Status/badge columns read best centered */
.col-status {
  text-align: center;
  width: 8rem;
}

/* EXPERIMENT 1: the points column is the story of the table --
   let the emphasized numbers step forward a size */
td.col-num strong { font-size: 1.1em; }

/* EXPERIMENT 2: the leader's name carries a little extra weight */
tbody tr:has(.pos-1) td:nth-child(2) { font-weight: 600; }

.col-rank {
  text-align: center;
  width: 3rem;
}

.col-actions {
  text-align: right;
  white-space: nowrap;
}
/* Several buttons in one cell stay side by side, at the right. */
.col-actions .control-row {
  flex-wrap: nowrap;
  justify-content: flex-end;
}

/* Money formatting */
.money-positive { color: var(--chip-green); }
.money-negative { color: var(--chip-red); }
[data-theme="dark"] .money-positive { color: var(--chip-green-light); }
[data-theme="dark"] .money-negative { color: var(--chip-red-light); }

/* ==========================================================================
   Forms
   ========================================================================== */

.field { margin-bottom: var(--space-lg); }

.field label {
  display: block;
  font-weight: 600;
  font-size: var(--text-sm);
  margin-bottom: var(--space-xs);
  color: var(--color-text);
}

.field input[type="text"],
.field input[type="email"],
.field input[type="password"],
.field input[type="number"],
.field input[type="date"],
.field select,
.field textarea {
  width: 100%;
  max-width: 420px;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: var(--text-base);
  font-family: var(--font-body);
  background: var(--color-bg-raised);
  color: var(--color-text);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--color-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* Dropdowns draw their own chevron, so they look the same in every browser and theme.
   `.select` styles one outside a `.field`, sized to sit in a row with a `.btn`. */
.select {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: var(--text-sm);
  font-family: var(--font-body);
  line-height: 1.4;
  background-color: var(--color-bg-raised);
  color: var(--color-text);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.field select,
.select {
  appearance: none;
  cursor: pointer;
  padding-right: 2.25rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5l5-5' fill='none' stroke='%238a8a9a' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  background-size: 0.75rem;
}
.field select:hover,
.select:hover { border-color: var(--color-primary); }
.select:focus {
  outline: none;
  border-color: var(--color-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}
/* The open list follows the theme too. */
[data-theme="dark"] select { color-scheme: dark; }

/* A control and its buttons on one line, wrapping on narrow screens. */
.control-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-sm);
}
.field .control-row input:not([type="submit"]) { flex: 1 1 14rem; width: auto; min-width: 0; }
.card .field:last-child { margin-bottom: 0; }

.field small {
  display: block;
  margin-top: var(--space-xs);
  color: var(--color-text-muted);
  font-size: var(--text-xs);
}

.field input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--color-primary);
  vertical-align: middle;
  margin-right: var(--space-xs);
}

/* Devise forms */
.devise-form {
  max-width: 420px;
  margin: var(--space-2xl) auto;
}
.devise-form h2 {
  text-align: center;
  margin-bottom: var(--space-xl);
}
.devise-links {
  margin-top: var(--space-lg);
  text-align: center;
  font-size: var(--text-sm);
}
.devise-links a { display: block; margin-bottom: var(--space-xs); }

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

.flash {
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius);
  margin-bottom: var(--space-lg);
  font-size: var(--text-sm);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}
.flash-notice {
  background: var(--color-flash-notice-bg);
  color: var(--color-flash-notice-text);
  border-left: 3px solid var(--chip-green);
}
.flash-alert {
  background: var(--color-flash-alert-bg);
  color: var(--color-flash-alert-text);
  border-left: 3px solid var(--chip-red);
}

/* ==========================================================================
   Hero
   ========================================================================== */

.hero {
  position: relative;
  text-align: center;
  padding: var(--space-2xl) var(--space-md);
  overflow: hidden;
}

/* Ghosted suits drifting behind the headline */
.hero::before,
.hero::after {
  position: absolute;
  font-size: 11rem;
  line-height: 1;
  opacity: 0.1;
  pointer-events: none;
  user-select: none;
}
.hero::before {
  content: "\2660";  /* spade */
  top: -1.5rem;
  left: 6%;
  transform: rotate(-14deg);
}
.hero::after {
  content: "\2665";  /* heart */
  bottom: -2.5rem;
  right: 7%;
  transform: rotate(11deg);
  color: var(--chip-red);
  opacity: 0.12;
}

.hero h1 {
  font-size: clamp(var(--text-2xl), 5vw, 3rem);
  margin-bottom: var(--space-sm);
  letter-spacing: -0.02em;
}
.hero p {
  color: var(--color-text-secondary);
  font-size: var(--text-lg);
  margin-bottom: var(--space-lg);
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}
.hero .btn { margin: 0 var(--space-xs); }

/* ==========================================================================
   League list
   ========================================================================== */

.league-list { list-style: none; }
.league-list li {
  background: var(--color-bg-raised);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-md) var(--space-lg);
  margin-bottom: var(--space-sm);
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition);
}
.league-list li:hover { box-shadow: var(--shadow); }
.league-list a { font-weight: 600; }

/* ==========================================================================
   Stats row (quick numbers)
   ========================================================================== */

.stats-row {
  display: flex;
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
  flex-wrap: wrap;
}

.stat-card {
  position: relative;
  overflow: hidden;
  flex: 1;
  min-width: 120px;
  background: var(--color-bg-raised);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  text-align: center;
  box-shadow: var(--shadow-sm);
}

/* --- Stat card suit styling: corner pips + colored label suit ---
   Black suits (spade/club) do the structural corner-pip work in the
   neutral text color; red suits (diamond/heart) accent the label.
   Suits alternate per card so a row reads like a spread hand. */

.stat-card::before,
.stat-card::after {
  content: "\2660";  /* spade */
  position: absolute;
  font-size: var(--text-lg);
  line-height: 1;
  opacity: 0.16;
  pointer-events: none;
}
.stat-card::before { top: 8px; left: 10px; }
.stat-card::after { bottom: 8px; right: 10px; transform: rotate(180deg); }

.stat-card:nth-child(even)::before,
.stat-card:nth-child(even)::after {
  content: "\2663";  /* club */
}

.stat-label::before {
  content: "\2666\00a0";  /* diamond */
  font-size: 1.35em;
  line-height: 1;
  vertical-align: -0.12em;
  color: var(--chip-red-light);
  opacity: 0.75;
}
.stat-card:nth-child(even) .stat-label::before {
  content: "\2665\00a0";  /* heart */
}

/* ==========================================================================
   RSVP
   ========================================================================== */

.rsvp-summary {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
  margin-bottom: var(--space-md);
}

.upcoming-game {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-md);
  flex-wrap: wrap;
  margin-bottom: var(--space-lg);
  border-left: 3px solid var(--chip-green);
}

.rsvp-set-buttons,
.row-actions {
  display: flex;
  gap: var(--space-xs);
  justify-content: flex-end;
}
.rsvp-set-buttons form,
.row-actions form { display: inline; }

.rsvp-page {
  max-width: 480px;
  margin: var(--space-2xl) auto;
}
.rsvp-card { text-align: center; }
.rsvp-card form { text-align: left; }
.rsvp-card h1 { font-size: var(--text-2xl); margin-bottom: var(--space-xs); }
.rsvp-week {
  color: var(--color-text-secondary);
  margin-bottom: var(--space-lg);
}

.rsvp-buttons {
  display: flex;
  gap: var(--space-sm);
  justify-content: center;
  flex-wrap: wrap;
  margin: var(--space-lg) 0 var(--space-md);
}
.rsvp-buttons .rsvp-current {
  box-shadow: 0 0 0 3px var(--color-focus);
}

/* The signed-in player's own answer on the Next game card (WP7). */
.my-rsvp {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  flex-wrap: wrap;
}
.my-rsvp > span { margin-right: var(--space-xs); }

.rsvp-standings-link {
  margin-top: var(--space-lg);
  font-size: var(--text-sm);
}

/* ==========================================================================
   Auth pages (login, sign-up, passwords)
   ========================================================================== */

.auth-page {
  max-width: 440px;
  margin: var(--space-2xl) auto;
}

.auth-card {
  padding: var(--space-xl);
}
.auth-card h1 {
  font-size: var(--text-2xl);
  text-align: center;
  margin-bottom: var(--space-xs);
}
.auth-card .field input {
  max-width: 100%;
}
/* My Account's "Your leagues" card under the account form (WP20), spaced like .auth-danger. */
.auth-card + .auth-card {
  margin-top: var(--space-lg);
}

.auth-intro {
  text-align: center;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-lg);
}

.auth-suits {
  text-align: center;
  font-size: var(--text-xl);
  letter-spacing: 0.4em;
  margin-bottom: var(--space-sm);
  opacity: 0.85;
  user-select: none;
}
.auth-suits .red { color: var(--chip-red-light); }

.btn-block {
  width: 100%;
  justify-content: center;
}

.auth-links {
  margin-top: var(--space-lg);
  padding-top: var(--space-md);
  border-top: 1px solid var(--color-border-light);
  text-align: center;
  font-size: var(--text-sm);
}
.auth-links a {
  display: block;
  margin-bottom: var(--space-xs);
}

.auth-danger {
  margin-top: var(--space-lg);
}

/* Reusable suit texture (the card-back fabric look). */
.suit-texture {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='44' height='44'%3E%3Ctext x='6' y='20' font-size='14' fill='%23808080' fill-opacity='0.15'%3E%E2%99%A3%3C/text%3E%3Ctext x='28' y='42' font-size='14' fill='%23808080' fill-opacity='0.15'%3E%E2%99%A0%3C/text%3E%3C/svg%3E");
}


/* A card holds one value, so its figures keep their natural widths: even-width ones would
   space out a date's hyphens. */
.stat-value {
  font-family: var(--font-numbers);
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stat-card:has(.money-positive, .money-negative) { min-width: 150px; }

.stat-label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: var(--space-xs);
}

/* ==========================================================================
   Inline form (for sign-out button, etc.)
   ========================================================================== */

.inline-form { display: inline; }

/* ==========================================================================
   Empty state
   ========================================================================== */

.empty-state {
  text-align: center;
  padding: var(--space-2xl) var(--space-md);
  color: var(--color-text-muted);
}
.empty-state::before {
  content: "\2663";  /* club */
  display: block;
  font-size: 2.5rem;
  line-height: 1;
  opacity: 0.18;
  margin-bottom: var(--space-sm);
}
.empty-state p { font-size: var(--text-lg); margin-bottom: var(--space-md); }

/* ==========================================================================
   Section header (title + action button)
   ========================================================================== */

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: var(--space-xl);
  margin-bottom: var(--space-md);
}
.section-header:first-child,
h1 + .section-header,
.league-header + .section-header,
.page-header + .section-header,
.stats-row + .section-header,
.actions + .section-header { margin-top: 0; }
.section-header h2 { margin: 0; }
/* More than one button beside a heading (WP33's downloads). On a narrow phone they go under
   it, whole, rather than squeezing it. */
.section-header:has(.section-actions) { flex-wrap: wrap; gap: var(--space-sm); }
.section-actions { display: flex; gap: var(--space-sm); }
.section-actions .btn { white-space: nowrap; }
/* A good preview scrolls to its heading (WP19), clear of the sticky nav. */
.preview-heading { scroll-margin-top: 6rem; }
/* Under a collapsed table (WP22). */
.show-all { margin-top: var(--space-sm); }

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

.card {
  background: var(--color-bg-raised);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-sm);
}
.card p { margin-bottom: var(--space-md); }

.danger-card {
  border-color: var(--color-danger);
}

/* ==========================================================================
   Posts / News
   ========================================================================== */

.posts-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.post-card {
  background: var(--color-bg-raised);
  border: 1px solid var(--color-border-light);
  border-left: 3px solid var(--chip-red);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition);
}
.post-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.post-card h2 {
  margin: 0 0 var(--space-xs);
  font-size: var(--text-xl);
}
/* The league home's latest post, alone between the hero and the stat cards: the News list
   spaces its cards with a gap, so this one needs its own room, as the hero has. */
.home-latest-post,
.year-end-callout { margin-bottom: var(--space-lg); }
.post-card h2 a { color: var(--color-text); }
.post-card h2 a:hover { color: var(--color-primary); }

.post-meta {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-sm);
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  flex-wrap: wrap;
}
.post-meta .sep { color: var(--color-border); }

.post-excerpt {
  color: var(--color-text-secondary);
  margin: 0;
  line-height: 1.6;
}

.post-full { margin-bottom: var(--space-xl); }
.post-body {
  line-height: 1.8;
  font-size: var(--text-base);
  margin-top: var(--space-lg);
}
.post-body p { margin-bottom: var(--space-md); }

.field-checkbox {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}
.field-checkbox input[type="checkbox"],
.field-checkbox input[type="radio"] {
  width: auto;
  margin: 0;
}
.field-checkbox label {
  margin: 0;
  font-weight: 400;
}

/* ==========================================================================
   Import mapper
   ========================================================================== */

.import-instructions {
  font-size: var(--text-sm);
  margin-bottom: var(--space-md);
}

.import-table select,
.import-table input[type="text"] {
  width: 100%;
  padding: var(--space-xs) var(--space-sm);
  font-size: var(--text-sm);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg);
  color: var(--color-text);
}

/* The Settings page's points table and payout split, one box per place (WP31). As narrow
   as the form's other fields. */
.settings-table {
  max-width: 420px;
}

.settings-table input[type="text"] {
  width: 6rem;
  padding: var(--space-xs) var(--space-sm);
  font-size: var(--text-sm);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg);
  color: var(--color-text);
}

.settings-table input[type="text"]:focus {
  outline: none;
  border-color: var(--color-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* A historical week's results, edited as one table (WP18). */
.results-table select,
.results-table .place-input {
  padding: var(--space-xs) var(--space-sm);
  font-size: var(--text-sm);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg);
  color: var(--color-text);
}
.results-table select { width: 100%; }
.results-table .place-input { width: 4.5rem; }
/* The year-end final table's payouts (WP6). */
.results-table .money-input { width: 7rem; text-align: right; }

.import-details {
  margin-bottom: var(--space-lg);
}
.import-details summary {
  cursor: pointer;
  color: var(--color-primary);
  font-weight: 500;
  padding: var(--space-sm) 0;
}

/* The week page's Email / Resend Results: a button that opens the message box (WP5). */
.results-email { margin-bottom: var(--space-lg); }
.results-email h3 { margin: 0 0 var(--space-md); }

.import-details h3 {
  margin-top: var(--space-md);
}

/* ==========================================================================
   Night entry: the organizer's main action on the league home
   ========================================================================== */

.night-entry-hero {
  text-align: center;
  margin-bottom: var(--space-lg);
}
.night-entry-hero p { margin: var(--space-sm) 0 0; }
.btn-lg {
  font-size: var(--text-lg);
  padding: var(--space-md) var(--space-xl);
}
.night-entry-hero .btn-lg { width: 100%; max-width: 24rem; }
/* The latest night under the hero (WP21). */
.night-status {
  margin-top: var(--space-md);
  padding-top: var(--space-md);
  border-top: 1px solid var(--color-border-light);
  font-size: var(--text-sm);
}
.night-status-reminder,
.invites-reminder { font-weight: 600; }
/* The next night ahead (WP7) sits under the latest night's status, without a second rule. */
.night-status + .night-status {
  margin-top: var(--space-xs);
  padding-top: 0;
  border-top: 0;
}

/* ==========================================================================
   Season champion: the winner on the left, the organizer's controls on the right
   ========================================================================== */

.champion-card {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-lg);
  border-left: 4px solid var(--color-rank-1);
}
.champion-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.champion-name {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  /* Lora is served at 600 only, like every heading. */
  font-weight: 600;
  line-height: 1.2;
}
.champion-name a { color: var(--color-text); }
.champion-name a:hover { color: var(--color-primary); }
.champion-name .text-muted { font-size: var(--text-xl); }
.champion-edit {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--space-sm);
}
.champion-edit label {
  display: block;
  font-weight: 600;
  font-size: var(--text-sm);
  margin-bottom: var(--space-xs);
}
.champion-edit .select { min-width: 14rem; }

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

@media (max-width: 640px) {
  h1 { font-size: var(--text-2xl); }
  h2 { font-size: var(--text-xl); }

  .stats-row { gap: var(--space-sm); }
  .stat-card { min-width: 80px; padding: var(--space-sm); }
  .stat-value { font-size: var(--text-xl); }

  th, td { padding: var(--space-xs) var(--space-sm); }

  .league-header-name { font-size: var(--text-xl); }
  .league-nav { display: none; }
  .league-menu { display: block; }

  /* Two stat cards per row (WP23); an odd one out takes the whole row. */
  .stat-card { flex: 1 1 calc(50% - var(--space-sm) / 2); }
  /* A value's small note, like "(2 of 417 weeks recorded)", goes on its own line. */
  .stat-value .text-xs { display: block; white-space: normal; }

  /* Tables fit a phone without scrolling sideways (WP23): headings may wrap ("Final /
     tables"), the fixed column widths give way, and badges get smaller. */
  th { white-space: normal; letter-spacing: 0; }
  /* "Not recorded" in a number column is a note, not a number. */
  .col-num .text-muted { font-size: var(--text-xs); }
  th, td { padding-left: 0.3125rem; padding-right: 0.3125rem; }
  /* The outer cells keep their room: off the table's right edge, and clear of the medal
     rows' colored stripe on the left. */
  th:first-child, td:first-child { padding-left: 0.75rem; }
  th:last-child, td:last-child { padding-right: 0.75rem; }
  .col-num, .col-status, .col-rank { width: auto; }
  td .badge { font-size: 0.625rem; padding: 2px 6px; letter-spacing: 0.02em; }
  .results-table .place-input { width: 2rem; padding-left: var(--space-xs); padding-right: var(--space-xs); }
  .results-table select { min-width: 5.5rem; }

  /* A cell that moves on a phone: shown in one place there, another on wider screens. */
  .phone-only { display: revert; }
  div.phone-only { margin-top: 2px; }
  .hide-on-phone { display: none; }
  /* The cell before a hidden last column is the last one showing, so it takes the outer
     cells' room. */
  th:has(+ .hide-on-phone:last-child), td:has(+ .hide-on-phone:last-child) { padding-right: 0.75rem; }
}
/* The web fonts (WP26): Lora 600 for the display headings, Inter for everything else, served
   with the app so every device shows the same type. Inter is one variable file covering
   400 to 800. Latin, plus Latin Extended for accented names, which loads only when a page
   uses one of its characters. Both are under the SIL Open Font License (OFL-*.txt beside
   the files); from Google Fonts, 2026-10-16. */

  
@font-face {
  font-family: "Lora";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(/assets/lora-600-latin-ext-b8e63b6fe71ef486e745f20bc76a0d39838a2a24a1c99bb16560179d90f8beb1.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
  
@font-face {
  font-family: "Lora";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(/assets/lora-600-latin-c7fe78e09b478ab5d898a3e026fde47164312a5ecb77cd4997f67ba09d86864d.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
  
  
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url(/assets/inter-latin-ext-a07c2ff83e7b39233d9c6dfcb53f4c00fa70302ea78482ef66aabca009df9f46.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
  
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url(/assets/inter-latin-007fce1bff9f7f37469fe61eff9ef62c033af63fccb0e65a2e94f4e0c14d9d6d.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
  
/*
 * This is a manifest file that'll be compiled into application.css, which will include all the files
 * listed below.
 *
 * Any CSS (and SCSS, if configured) file within this directory, lib/assets/stylesheets, or any plugin's
 * vendor/assets/stylesheets directory can be referenced here using a relative path.
 *
 * You're free to add application-wide styles to this file and they'll appear at the bottom of the
 * compiled file so the styles you add here take precedence over styles defined in any other CSS
 * files in this directory. Styles in this file should be added after the last require_* statement.
 * It is generally better to create a new file per style scope.
 *


 */
