/* Night mode: the same clubhouse after dark, for a phone checked in a dim
   room at ten o'clock. Follows the phone's own setting. The palette is
   below; the "Generated" rules mirror every pale surface, dark
   text and pale border in clubhouse.css and evening-book.css, so a new
   rule there wants its night twin here too. */
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --night-page: #0e1412;
    --night-card: #17201c;
    --night-wash: #213029;
    --night-ink: #ebe7da;
    --night-muted: #aab3a6;
    --night-rule: #33433b;
    --night-accent: #9fd3b6;
    --club-paper: var(--night-page);
    --club-card: var(--night-card);
    --club-ink: var(--night-ink);
    --club-muted: var(--night-muted);
    --club-rule: var(--night-rule);
    --color-paper: var(--night-page);
    --color-paper-2: var(--night-card);
    --color-paper-3: var(--night-wash);
    --color-rule: var(--night-rule);
    --color-rule-2: #4b5d53;
    --color-ink: var(--night-ink);
    --color-ink-2: #cfd3c6;
    --color-ink-3: var(--night-muted);
    --color-good: #8fd0a8;
    --color-good-wash: #1d3328;
    --color-warn: #e59a8e;
    --color-warn-wash: #3a2421;
    --color-accent-wash: #1d3328;
    --color-focus: #e2bd6c;
  }
  /* Generated from clubhouse.css and evening-book.css; the hand-made rules
     after it win where they overlap. */
  a { color: var(--night-accent); }
  ::selection { background: var(--night-wash); color: var(--night-ink); }
  .club-brand { color: var(--night-accent); }
  .reading-size { color: var(--night-accent); }
  .reading-size > span:first-child { border-bottom: 1px solid var(--night-rule); }
  .reading-size[aria-pressed="true"] { background: var(--night-card); }
  .signin { color: var(--night-accent); border: 1px solid var(--night-rule); }
  nav.tabs button[aria-current="page"] { color: var(--night-accent); }
  .page-heading h1 { color: var(--night-accent); }
  .ticket-top { border-bottom: 1px solid var(--night-rule); }
  .ticket-details { border-top: 1px dashed var(--night-rule); }
  .ticket-details > span:last-child { border-left: 1px solid var(--night-rule); }
  .ticket-details small { color: var(--night-muted); }
  .club-notice { background: var(--night-card); }
  .club-aside-panel h2 { color: var(--night-accent); }
  .host-section > summary { color: var(--night-accent); }
  .host-section[open] > summary { background: var(--night-card); }
  .club-welcome h2 { color: var(--night-accent); }
  .linkbtn { color: var(--night-accent); }
  .text, .plain, .finder input, select, textarea, input[type="time"] { background: var(--night-card); color: var(--night-ink); border: 1px solid var(--night-rule); }
  .mecard, .mecard[data-s="in"], .mecard[data-s="none"] { border-top: 3px solid var(--night-rule); }
  .mecard .me-msg { color: var(--night-accent); }
  .me-paid { color: var(--night-accent); }
  .switch { color: var(--night-accent); }
  .switch-track { background: var(--night-wash); }
  .club-answer-status { color: var(--night-muted); }
  .club-arrival-summary { color: var(--night-muted); }
  .night-timeline li { border-left: 1px solid var(--night-rule); }
  .night-timeline li::before { background: var(--night-card); }
  .timeline-time { color: var(--night-muted); }
  .timeline-detail strong { color: var(--night-muted); }
  .fixture-card { color: var(--night-muted); }
  .fixture-card:hover, .fixture-card[aria-current] { background: var(--night-card); }
  .fixture-action { color: var(--night-muted); }
  .club-motto p { color: var(--night-muted); }
  .rostertop h2 { color: var(--night-accent); }
  .count-n { color: var(--night-accent); }
  .findprompt { color: var(--night-muted); }
  .answer-filter { color: var(--night-muted); }
  .name[data-s="in"] { background: var(--night-card); border-color: var(--night-rule); }
  .name[data-s="maybe"] .state-tag { background: var(--night-card); color: var(--night-muted); }
  .name[data-s="out"] .state-tag { background: var(--night-card); color: var(--night-muted); }
  .name { background: var(--night-card); border: 1px solid var(--night-rule); }
  .name.in { background: var(--night-card); color: var(--night-ink); border-color: var(--night-rule); }
  .name .av, .avatar, .av { background: var(--night-card); color: var(--night-muted); }
  .name.in .av { background: var(--night-wash); color: var(--night-muted); }
  .sechead h2 { color: var(--night-accent); }
  .host-steps li[data-state="done"]::before { background: var(--night-wash); color: var(--night-ink); }
  .host-steps li[data-state="current"]::before { background: var(--night-card); color: var(--night-ink); border-color: var(--night-rule); }
  .host-briefing h2 { color: var(--night-accent); }
  .whoami { color: var(--night-muted); }
  .subn { color: var(--night-accent); }
  .scoring-guide { background: var(--night-card); }
  .scoring-guide summary { color: var(--night-accent); }
  .keyline { color: var(--night-muted); }
  .table-head, .tablehead { background: var(--night-card); color: var(--night-accent); }
  .table h3, .table h2 { color: var(--night-accent); }
  .seat, .doorname { border-color: var(--night-rule); }
  .seat.out { background: var(--night-card); }
  .seat.winner { background: var(--night-card); }
  .outbtn { background: var(--night-card); color: var(--night-muted); border: 1px solid var(--night-rule); }
  .outbtn.undo { background: var(--night-card); color: var(--night-muted); border-color: var(--night-rule); }
  .league th { background: var(--night-card); color: var(--night-muted); }
  .league td { color: var(--night-muted); }
  .league .total { color: var(--night-accent); }
  .league tr.is-me td { background: var(--night-card); }
  .award,.champ,.week { color: var(--night-accent); }
  .prizes h2 { color: var(--night-accent); }
  .prize strong { color: var(--night-muted); }
  .prize-mark { border: 1px solid var(--night-rule); }
  .note { background: var(--night-card); }
  .tipcard { background: var(--night-card); border: 1px solid var(--night-rule); }
  .dlg-box { border: 1px solid var(--night-rule); }
  .dlg-box h2 { color: var(--night-accent); }
  .dlg-box p { color: var(--night-muted); }
  .club-help-list strong { color: var(--night-accent); }
  .club-help-list h3 { color: var(--night-ink); }
  .chip { background: var(--night-card); color: var(--night-muted); border-color: var(--night-rule); }
  .chip.on { background: var(--night-wash); border-color: var(--night-rule); }
  .postingsoon { background: var(--night-card); color: var(--night-muted); }
  .tablemode { background: var(--night-card); color: var(--night-muted); border-color: var(--night-rule); }
  nav.tabs button { color: var(--night-muted); }
  .ticket-when { border-right: 1px solid var(--night-rule); }
  .ticket-when > span { color: var(--night-muted); }
  .ticket-place span, .ticket-fact > span { color: var(--night-muted); }
  .diary-invitation { background: var(--night-card); }
  .diary-invitation p { color: var(--night-muted); }
  .club-welcome, .mecard, .mecard[data-s] { background: var(--night-card); border-color: var(--night-rule); }
  .club-welcome p:not(.eyebrow) { color: var(--night-muted); }
  .identity-names { border-top: 1px solid var(--night-rule); }
  .identity-name { color: var(--night-ink); border-bottom: 1px solid var(--night-rule); }
  .identity-name:hover { background: var(--night-card); }
  .mecard .me-hi { color: var(--night-muted); }
  .club-answer-status { color: var(--night-muted); }
  .club-arrival-summary .field-hint, .field-hint { color: var(--night-muted); }
  .club-notice { background: var(--night-card); color: var(--night-muted); }
  .preview-notice { background: var(--night-wash); color: var(--night-muted); border: 1px solid var(--night-rule); }
  .club-self-exit { border-top: 1px solid var(--night-rule); }
  .self-exit-status { color: var(--night-muted); }
  .roster-description { color: var(--night-muted); }
  .count-l, .count-sub { color: var(--night-muted); }
  .timeline-detail p { color: var(--night-muted); }
  .fixture-status { color: var(--night-muted); }
  .prizes { border-top: 2px solid var(--night-rule); }
  .clubfoot { color: var(--night-muted); }
  .prize-mark { color: var(--night-muted); }
  .colophon dt { color: var(--night-muted); }
  .host-toolbox p { color: var(--night-muted); }
  .host-counts { border-bottom: 1px solid var(--night-rule); }
  .host-next-job { background: var(--night-card); }
  .host-next-job strong { color: var(--night-ink); }
  .host-next-job p { color: var(--night-muted); }
  .table .thead { border-bottom: 3px solid var(--night-rule); }
  .bountybar { color: var(--night-muted); }
  .league tbody tr:nth-child(even) { background: var(--night-card); }
  .diary-intro, .night-plan-sheet > p { color: var(--night-muted); }
  .diary-date { color: var(--night-accent); }
  .diary-option { color: var(--night-muted); border: 1px solid var(--night-rule); }
  .diary-option:hover:not(:disabled) { background: var(--night-card); color: var(--night-muted); }
  .diary-status { color: var(--night-muted); }
  .diary-review, .night-plan-review { background: var(--night-card); border: 1px solid var(--night-rule); }
  .diary-review-list dd { color: var(--night-muted); }
  .diary-detail { color: var(--night-muted); }
  .diary-error, .night-plan-error { background: var(--night-card); color: var(--night-ink); }
  .night-plan-progress { color: var(--night-muted); border-bottom: 1px solid var(--night-rule); }
  .evening-card { background: var(--night-card); border: 1px solid var(--night-rule); }
  .evening-card-kicker { color: var(--night-muted); }
  .evening-card-details dt { color: var(--night-muted); }
  .evening-card-footnote, .evening-card-url { color: var(--night-muted); }
  .evening-card-alert { color: var(--night-muted); }
  .evening-card-message { border-top: 1px solid var(--night-rule); border-bottom: 1px solid var(--night-rule); }
  .evening-card-answer { color: var(--night-muted); }
  .blind-schedule [aria-current=step] { background: var(--night-card); color: var(--night-ink); border-color: var(--night-rule); }
  .blind-schedule [aria-current=step] strong { color: var(--night-ink); }
  .money-tonight { background: var(--night-card); }
  .money-fig strong { color: var(--night-ink); }
  .money-l { color: var(--night-muted); }
  .money-sub { color: var(--night-muted); }
  .books-start { color: var(--night-muted); }
  .race { background: var(--night-card); border: 1px solid var(--night-rule); }
  .race h3 { color: var(--night-muted); }
  .race ul { color: var(--night-muted); }
  .race .race-in::marker { color: var(--night-muted); }
  .race .race-out::marker { color: var(--night-muted); }
  td.who .move.up { color: var(--night-muted); }
  td.who .move.down { color: var(--night-muted); }
  .profile-facts .pf { background: var(--night-card); }
  .profile-facts strong { color: var(--night-ink); }
  .profile-facts span { color: var(--night-muted); }
  .profile-nights li { border-top: 1px solid var(--night-rule); }
  .pn-date { color: var(--night-muted); }

  html, body { background: var(--night-page); color: var(--night-ink); }

  /* Buttons: the green lifts a shade so it reads against the dark page. */
  .btn, .btn.sm, .btn.big { background: #2b6a52; border-color: #2b6a52; color: #fffdf7; }
  .btn:hover { background: #33795e; }
  .btn.ghost { background: transparent; color: var(--night-accent); border-color: var(--night-rule); }
  .btn.ghost:hover { background: var(--night-wash); color: var(--night-accent); }
  .btn.danger { background: #3a2421; color: #f0b3a9; border-color: #6b3a33; }
  .linkbtn { color: var(--night-accent); }

  /* Cards and panels. */
  .panel, .mecard, .names, .table, .award, .champ, #recentGroup, .club-aside-panel, .fixture-card,
  .diary-invitation, .club-welcome, .host-section, .money-tonight, .kitty-night, .bank-row, .profile-facts .pf {
    background: var(--night-card); border-color: var(--night-rule); color: var(--night-ink);
  }
  .table > header, .table header { border-color: var(--night-rule); }
  .seat, .seat .nm { color: var(--night-ink); }
  h1, h2, h3, .hero-heading, .money-fig strong, .profile-facts strong, .sechead h2 { color: var(--night-ink); }
  .diary-invitation p, .money-sub, .money-l, .hint, .muted, .pn-date { color: var(--night-muted); }
  .money-l { color: #cfd3c6; }

  /* The "Are you playing?" answers: plain ones go dark, the chosen keeps its colour. */
  .club-answer-options .btn.ghost { background: transparent; }

  /* Dialogs and the bottom bar. */
  .dlg-box { background: var(--night-card); color: var(--night-ink); border-color: var(--night-rule); }
  .dlg { background: rgba(0, 0, 0, 0.6); }
  nav.tabs { background: #111a16; border-color: var(--night-rule); }
  nav.tabs button { color: var(--night-muted); }
  nav.tabs button[aria-current="page"] { background: var(--night-wash); color: var(--night-accent); }

  /* League. */
  table.league th, table.league td { border-color: var(--night-rule); color: var(--night-ink); }
  table.league tr.is-me td { background: var(--night-wash); }
  .race { background: #1f1c12; border-color: #5b4d27; }
  .race h3 { color: #e3c271; }
  .race ul { color: var(--night-ink); }
  td.who .move.up { color: #8fd0a8; } td.who .move.down { color: #f0a197; }
  .profile-form .counts { fill: #8fd0a8; } .profile-form .dropped { fill: #3d5248; } .profile-form .missed { fill: #26332d; }
  .profile-link { text-decoration-color: #4b5d53; }

  /* Pay card and the kitty. */
  .pay-copy { background: var(--night-wash); border-color: var(--night-rule); }
  .pay-copy-code { color: var(--night-ink); }
  .me-pay.due { background: #3a2421; box-shadow: 0 0 0 1px #8c4a40; }
  .me-pay-call { color: #f0b3a9; }
  .kitty-bank { background: var(--night-wash); color: var(--night-ink); }
  .books-start { color: var(--night-muted); border-color: var(--night-rule); }
  .race .race-in::marker { color: #8fd0a8; }

  /* The evening's ticket under the hero. */
  .evening-ticket { background: var(--night-card); color: var(--night-ink); border-color: #4b5d53; box-shadow: none; }
  .ticket-when { border-color: var(--night-rule); }
  .ticket-when > span, .ticket-place span, .ticket-fact > span { color: var(--night-muted); }
  .evening-ticket .btn { border-color: var(--night-rule); color: var(--night-accent); }
  .club-brand img { content: url(crest-ivory.png); }

  /* Bounties on the tables. */
  .bountybar { background: #262214; color: #e3c271; border-color: #4a3f1e; }
  .bountybar .tally-b { color: #cdbf95; }
  .seat .target { background: #332b12; color: #e3c271; border-color: #5b4d27; }
  /* The organiser's desk: ghost buttons on the green panel. */
  .host-desk .btn.ghost, .club-seatpass .btn { color: #f5efda; border-color: #6f8a7c; }
  .host-desk .host-next-job .btn.ghost { color: var(--night-accent); border-color: #4b5d53; }
  .host-desk .host-next-job .btn.ghost:hover { background: var(--night-wash); }
  .outbox, .btn.outbtn.sending { background: #2a2414; border-color: #6b5a2a; color: #e3c271; }
  .profile-btn { color: var(--night-accent); border-color: var(--night-rule); }
  .me-owes { color: #8fd0a8; } .me-owes.due { color: #f0a197; }
  .me-night-opts .btn.chosen-in { background: #2b6a52; border-color: #2b6a52; }
}
@media (prefers-color-scheme: dark) {
  .host-manage-h, .host-tile-t, .info-btn, .seg-b[aria-selected="true"] { color: var(--night-accent); }
  .host-tile-s, .seg-b, #subsList .payrow .paystate { color: var(--night-muted); }
  .seg { background: var(--night-wash); }
  .info-btn[aria-expanded="true"] { background: var(--night-wash); }
  .seg-n { color: #d6b56f; }
}
