/* Respawn — design system. Always dark (LAN parties happen in dim rooms —
   there is no light variant to fall back to, on purpose). No framework, just
   custom properties + a handful of components reused across every view. */

:root {
  color-scheme: dark;
  --bg: #0f1420;
  --bg-elevated: #171e2e;
  --bg-elevated-2: #1e2740;
  /* Translucent instead of a solid hex: hairlines pick up a hint of whatever
     is behind them, which reads softer/more modern than uniform solid lines. */
  --border: rgba(122, 141, 195, 0.21);
  --text: #eef1f8;
  --text-muted: #8b93a7;
  --accent: #5b8cff;
  --accent-2: #9163f5;
  --accent-3: #ef5da8;
  --accent-gradient: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 55%, var(--accent-3) 100%);
  /* Deeper stops of the same brand hues for small white text on the gradient
     (navigation and bell counters): white stays at least 4.6:1 everywhere
     along it, where the regular stops only reach 3.1-4.0:1. */
  --accent-strong: #3d6fe0;
  --accent-2-strong: #6a3fd8;
  --accent-3-strong: #c2357f;
  --accent-gradient-strong: linear-gradient(135deg, var(--accent-strong) 0%, var(--accent-2-strong) 55%, var(--accent-3-strong) 100%);
  --color-wheel-gradient: conic-gradient(
    var(--danger),
    var(--state-paused),
    var(--state-playing),
    var(--accent),
    var(--accent-2),
    var(--accent-3),
    var(--danger)
  );
  --accent-text: #ffffff;
  /* Tinted accent background - the same "-bg" companion pattern as the
     semantic state colors below, for selected/active chip-style controls
     that need a light fill rather than a solid gradient. */
  --accent-bg: rgba(91, 140, 255, 0.16);
  /* Quieter accent tint for marking the signed-in player's own rows among
     equal siblings (tournament boards) without competing with result states. */
  --accent-bg-subtle: rgba(91, 140, 255, 0.07);
  --rank-1-gold: #ffd166;
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.15);
  --state-playing: #22c55e;
  --state-playing-bg: rgba(34, 197, 94, 0.16);
  --state-paused: #f59e0b;
  --state-paused-bg: rgba(245, 158, 11, 0.16);
  --state-offline: #9ca3af;
  --state-offline-bg: rgba(107, 114, 128, 0.16);
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;
  --motion-fast: 0.15s ease;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
  --nav-height: 64px;
  --topbar-height: 56px;
  --shell-bottom-inset: calc(var(--nav-height) + env(safe-area-inset-bottom));
  --content-max-width: 720px;
  --desktop-nav-width: 192px;
  --desktop-supporting-pane-min-width: 320px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;

  /* Spacing scale — every card/row/section gap and padding in this file
     pulls from here instead of one-off pixel values, so the same kind of
     element (a card, a list row, a section gap) is exactly the same size
     everywhere it appears instead of drifting per-view. No in-between value
     (6px, 10px, 14px, ...) is allowed outside this scale — round up or down
     to the nearest step instead of introducing a new one. */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 32px;
  --space-8: 48px;
  --card-padding: var(--space-4) var(--space-4);
  /* Minimum height for a single-line, icon-led list row (players, games,
     tournaments, the "Mehr" hub) — keeps every such row the same height
     regardless of how much subtext it happens to have. */
  --row-min-h: 68px;
  --row-icon-size: 36px;
  /* Fixed value column of RankedList rows: wide enough for "134h 27m", so
     values align across both columns and every section. */
  --ranked-list-value-width: 96px;
  --ranked-list-value-width-compact: 80px;
  --tap-target-size: 44px;
  /* Shared height for interactive controls: buttons, icon buttons, inputs and
     the searchable-select. One compact rhythm so every button is exactly as
     tall as a standard field like "Titel"/"Info" throughout the app. Icon-only
     controls keep their 44px min WIDTH (--tap-target-size) as the touch target,
     so only the height changes. */
  --control-height: 32px; /* design-token-ok: shared compact control height, matched by the field padding below */
  --control-line-height: 1.25;
  --info-popover-max-width: 320px;
  --area-tour-compact-width: 320px;
  --date-picker-width: 360px;
  --selection-card-min-width: 160px;
  --seating-seat-width: var(--selection-card-min-width);
  --seating-seat-height: calc(var(--avatar-size-lg) + var(--space-2));
  --assignment-select-width: 112px;
  /* Fixed width keeps the food-order payment toggle stable beside the PayPal
     action while its label, position count and amount change. */
  --payment-marker-width: 96px;
  /* Label column of the open Event card's Infos and payment rows, wide enough
     for "Zeitraum" so every value starts on one vertical line. */
  --event-info-label-width: 96px;
  /* Stable Arcade creation geometry: mode-capable and fixed-mode games keep
     the primary lobby action in the same column while switching tiles. */
  --arcade-lobby-mode-width: 134px;
  --arcade-lobby-mode-toggle-width: 154px;
  --arcade-lobby-card-min-height: 220px;
  --challenge-rush-playfield-min-height: 280px;
  --challenge-rush-button-min-width: 180px;
  --challenge-rush-button-min-height: 96px;
  --challenge-rush-trial-grid-max-width: 420px;
  /* Chimp Test: the 8x5 laptop grid stops growing at a size where all tiles
     stay scannable at a glance; on phones the 5x8 grid also keeps the header,
     status line and hint visible below it without scrolling. */
  --chimp-grid-max-width: 560px;
  --chimp-grid-reserved-height: 20rem;
  --chimp-playfield-min-height: 280px;
  --chimp-rating-width: 320px;
  --notification-panel-width: 360px;
  --search-panel-width: 640px;
  /* Info dialog with two columns of entries from --bp-lg. */
  --info-board-panel-width: 880px;
  /* Dialogs with two columns of rows from --bp-lg (Ergebnis eintragen). */
  --wide-dialog-width: 880px;
  /* Letterbox around full-page video (welcome trailer): pure black so the
     video's own black edges do not meet a tinted page background. */
  --media-letterbox: #000000;
  --search-select-results-max-height: 320px;
  /* Caps a single Info entry's content so a long entry scrolls internally
     instead of stretching every card in its two-column grid row to match it.
     ~4 lines at --font-size-lg/1.5 line-height, matching the line-count half
     of isLongContent()'s own threshold in infoBoard.js. */
  /* Set from JS to the first-login onboarding rating dialog's own rendered
     height so the required game rows can scroll fully clear of it instead
     of the last rows staying pinned behind a fixed panel; 0 outside rating
     mode. */
  --onboarding-rating-spacer: 0px;

  /* Avatar sizes — the one scale every avatar/color-dot rendering (see
     avatarHtml in format.js) should size itself from, instead of each call
     site picking its own pixel value. */
  --avatar-size-sm: 24px;
  --avatar-size-md: 32px;
  --avatar-size-lg: 48px;

  /* Typography scale — every font-size in this file (and in the JS views,
     which build HTML as template strings and can't rely on element
     defaults) pulls from here. Named by role, not by raw value, so a future
     re-tune only touches this block. */
  --font-size-2xs: 0.7rem;
  --font-size-xs: 0.78rem;
  --font-size-sm: 0.85rem;
  --font-size-md: 0.95rem;
  --font-size-lg: 1.15rem;
  --font-size-xl: 1.3rem;
  --font-size-2xl: 1.5rem;
  --font-size-3xl: 2rem;
  --font-weight-regular: 400;
  --font-weight-medium: 600;
  --font-weight-bold: 700;
  --font-weight-black: 800;
  --line-height-tight: 1;

  /* Breakpoints — documented here as the single source of truth for the
     literal pixel values used in @media rules throughout this file. CSS
     custom properties can't be read inside a @media condition itself (a
     browser/spec limitation, not something a build step would fix without
     introducing one), so every @media below repeats the literal value but
     references the matching token name in a comment — keep both in sync by
     hand when a breakpoint changes. */
  --bp-sm: 480px;
  --bp-md: 640px;
  --bp-lg: 860px;
  --bp-xl: 1280px;

  /* "Pill" radius — already the de-facto shape for badges, chips, the nav
     pill and vote bars; naming it stops future pill-shaped elements from
     reinventing 999px (or a slightly different, wrong, almost-pill value). */
  --radius-full: 999px;

  /* Glow shadows — the two recurring accent-colored glows (buttons/active
     states in app blue, logo/wordmark in brand purple), previously each
     re-declared with slightly different blur/alpha per element. */
  --shadow-glow-accent: 0 4px 20px rgba(91, 140, 255, 0.42);
  --shadow-glow-brand: 0 0 14px rgba(145, 99, 245, 0.5);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

/* Several elements below (.login-screen, .app) set their own `display` via a
   class, which has the same specificity as the UA stylesheet's
   `[hidden] { display: none }` rule — author CSS wins the tie, so without
   this, toggling the `hidden` attribute alone would NOT actually hide them.
   This rule must win regardless of what else is in this file. */
[hidden] {
  display: none !important;
}

body {
  /* Two faint accent glows behind everything give the flat dark canvas some
     depth without images or extra elements; fixed so they don't scroll away. */
  background:
    radial-gradient(640px 420px at 88% -8%, rgba(145, 99, 245, 0.13), transparent 65%),
    radial-gradient(720px 520px at -12% 108%, rgba(91, 140, 255, 0.09), transparent 65%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font);
  font-size: var(--font-size-md);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

/* ---------- Scrollbars ----------
   The OS-default chrome scrollbar is a wide grey slab that clashes with the
   dark UI. Slim, rounded, translucent thumb on a transparent track instead —
   visible when you need it, invisible when you don't. */
html {
  scrollbar-color: rgba(139, 147, 167, 0.35) transparent; /* Firefox */
}
* {
  scrollbar-width: thin; /* Firefox */
}
::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(139, 147, 167, 0.3);
  border-radius: var(--radius-full);
  /* Transparent outer edge shrinks the visible thumb without shrinking the
     grab/tap target. */
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(139, 147, 167, 0.55);
  background-clip: padding-box;
  border: 2px solid transparent;
}
::-webkit-scrollbar-corner {
  background: transparent;
}

button,
input,
select,
textarea {
  font-family: inherit;
  color: inherit;
  line-height: var(--control-line-height);
}

.muted {
  color: var(--text-muted);
}

/* Keeps content in the accessibility tree and announced by aria-live
   without taking any visible space. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px; /* design-token-ok: standard 1px clip-rect offset for the visually-hidden pattern, tied to the 1x1px box above, not a spacing choice */
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.error-text {
  color: var(--danger);
  font-size: var(--font-size-sm);
}

/* ---------- App shell ---------- */

.app {
  /* Fixed, not min-height: flex children default to min-height:auto, so a
     merely min-height'd container happily grows past the viewport to fit a
     long list instead of letting .view-container's own overflow-y:auto
     handle it — and since .bottom-nav is position:fixed to the real
     viewport, that growth silently clips the last bit of every long list
     behind the nav instead of making it scrollable. */
  height: 100dvh;
  display: flex;
  flex-direction: column;
}

.topbar {
  /* The status-bar inset is padding inside a border-box bar, so it has to be
     added to the height too. Otherwise an installed iOS web app (status bar
     style black-translucent) squeezes the 56px bar into the inset: its
     buttons ride up under the clock and spill over the top of the page,
     covering it and catching its taps. */
  height: calc(var(--topbar-height) + env(safe-area-inset-top));
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-4);
  padding-top: env(safe-area-inset-top);
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
/* Frosted-glass bars where supported: content scrolling past shimmers
   through, which instantly reads as a current-gen app. Solid fallback above
   stays for anything without backdrop-filter. */
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .topbar,
  .bottom-nav {
    background: rgba(23, 30, 46, 0.7);
    -webkit-backdrop-filter: blur(16px) saturate(1.4);
    backdrop-filter: blur(16px) saturate(1.4);
  }
}
/* Thin brand-gradient stripe under the header — a small, cheap touch that
   ties every screen back to the logo's colors without needing images. */
.topbar::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  height: 2px;
  background: var(--accent-gradient);
  opacity: 0.55;
}

/* Technical connection loss is a global app state, so it sits directly
   below the header until Socket.IO confirms a successful reconnect. */
.connection-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border-bottom: 1px solid var(--state-paused);
  background: var(--state-paused-bg);
  color: var(--state-paused);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  text-align: center;
}

.connection-status .ui-icon {
  flex: 0 0 auto;
}

.readiness-details {
  margin: 0;
  padding-left: var(--space-5);
  color: var(--text-muted);
  font-size: var(--font-size-xs);
  overflow-wrap: anywhere;
}

/* Current notification as a prominent direct link below the header. The
   bell beside it remains the full personal history. */
.notification-highlight {
  display: flex;
  align-items: stretch;
  min-width: 0;
  border-bottom: 1px solid var(--border);
  background: var(--accent-gradient);
  color: var(--accent-text);
  box-shadow: var(--shadow-glow-brand);
}
.notification-highlight-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
  flex: 1;
  padding: var(--space-2) var(--space-4);
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.notification-highlight-link > .ui-icon {
  flex: 0 0 auto;
  color: inherit;
}
.notification-highlight-text {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  min-width: 0;
  flex: 1;
  font-size: var(--font-size-sm);
}
.notification-highlight-heading {
  display: flex;
  align-items: baseline;
  min-width: 0;
}
.notification-highlight-heading strong,
.notification-highlight-body {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* A long title truncates before the creator's name; a name wider than the
   whole line wraps inside the text area instead of overflowing it. */
.notification-highlight-actor {
  flex: 0 0 auto;
  max-width: 100%;
  padding-left: var(--space-1);
  overflow-wrap: anywhere;
}
.notification-highlight-body {
  min-width: 0;
  color: inherit;
  opacity: .88;
}
.notification-highlight-dismiss {
  flex: 0 0 auto;
  margin: var(--space-1) var(--space-2) var(--space-1) 0;
}
@media (max-width: 639px) { /* --bp-md */
  .notification-highlight-text {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
  }
}

/* Header notification center. Entries stay personal to the selected identity. */
.notification-center {
  position: relative;
}
.notification-center #notifications-btn {
  position: relative;
}
.notification-count {
  position: absolute;
  top: 0;
  right: 0;
  min-width: var(--space-5);
  height: var(--space-5);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 var(--space-1);
  border-radius: var(--radius-full);
  /* Same look as the navigation counter (.nav-badge): brand gradient, a ring
     in the surface colour and the digit in a .nav-count-value box, trimmed
     to cap height so it sits in the middle of the circle. */
  background: var(--accent-gradient-strong);
  color: var(--accent-text);
  font-size: var(--font-size-2xs);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
  box-shadow: 0 0 0 2px var(--bg-elevated);
}
.notification-center-panel {
  position: absolute;
  top: calc(100% + var(--space-2));
  right: 0;
  z-index: 30;
  width: min(var(--notification-panel-width), calc(100vw - var(--space-4)));
  max-height: calc(100dvh - var(--topbar-height) - env(safe-area-inset-top) - var(--shell-bottom-inset) - var(--space-6));
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  box-shadow: var(--shadow);
}
@media (max-width: 639px) { /* --bp-md */
  .notification-center-panel {
    position: fixed;
    top: calc(var(--topbar-height) + env(safe-area-inset-top) + var(--space-2));
    right: var(--space-2);
    left: var(--space-2);
    width: auto;
  }
}
.notification-center-header {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
}
.notification-center-toolbar {
  position: sticky;
  bottom: 0;
  z-index: 1;
  display: grid;
  grid-auto-columns: minmax(0, 1fr);
  grid-auto-flow: column;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-top: 1px solid var(--border);
  background: var(--bg-elevated);
}
.notification-center-list {
  display: flex;
  flex-direction: column;
}
/* One flat row per entry: the text block is the link, the remove action
   keeps a fixed column on the right. */
.notification-center-entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: var(--space-2);
  padding: var(--space-3);
  border-bottom: 1px solid var(--border);
}
.notification-center-entry:last-child {
  border-bottom: 0;
}
.notification-center-open {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-width: 0;
  padding: 0;
  border: 0;
  color: var(--text-muted);
  font: inherit;
  text-align: left;
  background: transparent;
  cursor: pointer;
}
/* Unread entries read in full contrast with a bold title; read and obsolete
   ones recede to muted text. No color rail; event, audience and state keep
   their pills in the meta line. */
.notification-center-entry.is-unread .notification-center-open {
  color: var(--text);
}
.notification-center-entry.is-unread .notification-center-entry-name {
  font-weight: var(--font-weight-bold);
}
@media (hover: hover) {
  .notification-center-open:hover .notification-center-entry-name {
    color: var(--accent);
  }
}
.notification-center-entry-title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}
.notification-center-entry-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.notification-center-entry-icon {
  display: inline-flex;
  flex: 0 0 auto;
}
.notification-center-body {
  display: -webkit-box;
  overflow: hidden;
  font-size: var(--font-size-sm);
  overflow-wrap: anywhere;
  white-space: pre-line;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.notification-center-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1) var(--space-2);
  color: var(--text-muted);
  font-size: var(--font-size-xs);
}
.notification-center-remove {
  color: var(--text-muted);
}
.notification-center-empty {
  padding: var(--space-5);
}

.topbar-title {
  font-size: var(--font-size-lg);
  display: flex;
  min-width: var(--tap-target-size);
  min-height: var(--tap-target-size);
  align-items: center;
  gap: var(--space-2);
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}

/* Admin mode (switched in Mein Profil) shows as a small shield on the logo
   corner, in the paused/warn color the former banner used. */
.topbar-logo-wrap {
  position: relative;
  display: inline-flex;
  flex: none;
}
.admin-indicator {
  position: absolute;
  right: calc(-1 * var(--space-2));
  bottom: calc(-1 * var(--space-1));
  display: grid;
  place-items: center;
  width: var(--space-5);
  height: var(--space-5);
  border-radius: var(--radius-full);
  background: var(--bg-elevated);
  color: var(--state-paused);
}
.admin-indicator[hidden],
.admin-indicator-label[hidden] {
  display: none;
}
.admin-indicator-label {
  flex: none;
  margin-left: var(--space-1);
  color: var(--state-paused);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
}
.admin-indicator .ui-icon {
  width: var(--font-size-sm);
  height: var(--font-size-sm);
}
.topbar-logo {
  display: block;
  border-radius: var(--radius-sm);
  filter: drop-shadow(0 0 6px rgba(145, 99, 245, 0.5));
}

.login-logo {
  display: block;
  margin: 0 auto;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow), 0 0 52px rgba(145, 99, 245, 0.45);
}

/* The wordmark reuses the accent gradient and stays upright in every context. */
.brand-title {
  display: inline-block;
  font-weight: var(--font-weight-black);
  letter-spacing: -0.02em;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(var(--shadow-glow-brand));
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}
@media (max-width: 479px) { /* --bp-sm */
  .topbar-title .brand-title {
    display: none;
  }
}

@media (max-width: 639px) { /* --bp-md */
  .topbar-title .brand-title,
  .topbar-title .admin-indicator-label,
  .github-icon-btn {
    display: none;
  }
  .topbar-actions {
    gap: var(--space-1);
  }
  .event-context {
    max-width: 164px;
  }
  /* The phone topbar has no room for the chevron's full tap-target inset next
     to the status icon. The toggle keeps its tap target but drops the divider
     and sits its chevron at the right edge; a long event name ends in an
     ellipsis just before the chevron instead of running underneath it. */
  .event-context .search-select-control > input {
    padding-right: calc(var(--space-6) + var(--space-1));
    text-overflow: ellipsis;
  }
  .event-context .search-select-toggle {
    justify-items: end;
    padding-right: var(--space-1);
    border-left: 0;
  }
  /* The switcher only gets ~120px between the logo and the icon buttons, which
     would truncate every LAN name in its own popup. The topbar is sticky at
     the top, so the list anchors to the viewport under it instead of to the
     control — full width, and it cannot spill past either edge the way a
     control-anchored min-width did. */
  .event-context .search-select-list {
    position: fixed;
    top: calc(var(--topbar-height) + env(safe-area-inset-top) + var(--space-1));
    right: var(--space-3);
    left: var(--space-3);
  }
}

/* Event polls — follows the same card, compact row, selection-toolbar and
   collapsible-section vocabulary used by Events, Essen, Vote and Checkliste. */
.event-polls-page {
  /* The view restores its own card anchor after live re-renders. Native scroll
     anchoring would otherwise move the container a second time when the
     focused response button is replaced. */
  overflow-anchor: none;
}
.event-poll-round-header {
  align-items: flex-start;
}
.event-poll-card-title strong {
  margin: 0;
}
.event-poll-list {
  gap: var(--space-3);
}
.card.event-poll-card {
  position: relative;
  padding: 0;
  overflow: visible;
}
.card.has-open-action-menu,
.event-card:has(.action-menu[open]),
.event-poll-card:has(.action-menu[open]) {
  z-index: 20;
}
.event-poll-card-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--card-padding);
}
.event-poll-card-header:has(+ .event-poll-card-content:not([hidden])) {
  padding-bottom: var(--space-3);
}
.event-poll-card-toggle {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: var(--space-3);
  flex: 1 1 auto;
  min-width: 0;
  min-height: var(--tap-target-size);
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.event-poll-card-toggle[aria-expanded='true'] .collapsible-section-chevron {
  transform: rotate(90deg);
}
.event-poll-card[data-latest-vote] .event-poll-card-title {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1) var(--space-3);
}
.event-poll-card[data-latest-vote] .event-poll-card-title > strong {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
}
/* With room to spare, the closed "Letzter Vote" header keeps the height of
   its closed neighbors: beside the title its meta line stays on one row. The
   muted facts (title, starter, date, count) give way first with an ellipsis;
   the winner keeps up to half the line. Narrower layouts wrap instead, so
   neither the facts nor the winner are cut down to a few letters. */
@media (min-width: 1280px) { /* --bp-xl */
  .event-poll-card[data-latest-vote] .event-poll-card-title {
    flex-wrap: nowrap;
  }
  .event-poll-card[data-latest-vote] .event-poll-card-meta-line {
    flex: 1 1 0;
    flex-wrap: nowrap;
  }
  .event-poll-card[data-latest-vote] .event-poll-card-meta-line > .muted {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .event-poll-card[data-latest-vote] .event-poll-best-result {
    flex: 0 0 auto;
    max-width: 50%;
  }
}
.event-poll-card-title {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-width: 0;
}
.event-poll-card-title strong {
  overflow: hidden;
  text-overflow: ellipsis;
}
/* One compact meta line: author, round, answers, deadline and, once ended,
   the winning option. Empty values are left out by the renderer. */
.event-poll-card-meta-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1) var(--space-2);
  min-width: 0;
  font-size: var(--font-size-sm);
}
.event-poll-card-side {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex: 0 0 auto;
  gap: var(--space-2);
}
/* The side action matches the bordered "Aktion" menu trigger beside it. */
.event-poll-card-side > .btn,
.event-poll-history-round > .btn {
  border: 1px solid var(--border);
}
.event-poll-best-result,
.event-poll-history-result {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
  font-weight: var(--font-weight-medium);
}
.event-poll-best-result > span:last-child,
.event-poll-history-result > span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.action-menu {
  position: relative;
  z-index: 4;
}
.action-menu[open] {
  z-index: 21;
}
.action-menu > summary {
  list-style: none;
  white-space: nowrap;
}
.action-menu > summary::-webkit-details-marker {
  display: none;
}
.action-menu-panel {
  position: absolute;
  top: calc(100% + var(--space-1));
  right: 0;
  z-index: 12;
  display: flex;
  width: max-content;
  min-width: 11rem;
  max-width: calc(100vw - var(--space-8));
  gap: 0;
  flex-direction: column;
  padding: var(--space-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  box-shadow: var(--shadow);
}
.action-menu-panel[popover] {
  position: fixed;
  inset: auto;
  margin: 0;
  max-height: calc(100dvh - var(--space-4));
  overflow-y: auto;
  color: var(--text);
}
.action-menu-panel[popover]:not(:popover-open) {
  display: none;
}
/* Menu entries compose the standard button variants with a full touch target.
   They are flat list rows: no box per entry, a hover surface only, and the
   destructive entry keeps its red text behind a hairline instead of a red box. */
.action-menu-panel .btn {
  min-height: var(--tap-target-size);
  min-width: var(--tap-target-size);
  justify-content: flex-start;
  background: transparent;
  text-align: left;
  white-space: normal;
  overflow-wrap: anywhere;
}
@media (hover: hover) {
  .action-menu-panel .btn:not(:disabled):hover {
    background: var(--bg-elevated-2);
  }
  .action-menu-panel .btn-danger:not(:disabled):hover {
    background: var(--danger-bg);
  }
}
.action-menu-panel .btn-danger {
  position: relative;
  margin-top: var(--space-1);
}
.action-menu-panel .btn-danger::before {
  content: '';
  position: absolute;
  inset: calc(var(--space-1) * -1) 0 auto;
  border-top: 1px solid var(--border);
}
.action-menu-row {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}
.action-menu-row > .btn {
  flex: 1;
}
.action-menu > summary.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--control-height);
  border: 1px solid var(--border);
}
.event-poll-card-content {
  gap: var(--space-4);
  padding: 0 var(--space-4) var(--space-4);
}
.event-poll-round {
  gap: var(--space-4);
  /* The card header already supplies the gap before the expanded content. */
  padding-top: 0;
  container-type: inline-size;
}
.event-poll-note {
  margin: 0;
}
.stack.event-poll-options {
  gap: 0;
}
/* Options are flat rows separated by hairlines, not boxes inside the card. */
/* Fixed columns keep every bar the same length: name and note, result bar,
   voter avatars, answer buttons. Ended rounds simply have no last column. */
.event-poll-option {
  display: grid;
  grid-template-columns: clamp(10.5rem, 20%, 14rem) minmax(6rem, 1fr) 7rem auto;
  align-items: center;
  gap: var(--space-2) var(--space-4);
  padding: var(--space-3) 0;
  border-top: 1px solid var(--border);
}
.event-poll-option:first-child {
  border-top: 0;
}
.event-poll-option-note {
  font-size: var(--font-size-sm);
  overflow-wrap: anywhere;
}
.event-poll-option-info {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-width: 0;
}
.event-poll-result {
  /* Center the bar and count together as one block between the row lines. */
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-width: 0;
  margin-inline-end: 0;
}
.event-poll-bar {
  display: block;
  height: var(--space-2);
  overflow: hidden;
  border-radius: var(--radius-full);
  background: var(--border);
}
.event-poll-bar-fill {
  display: block;
  height: 100%;
  border-radius: var(--radius-full);
}
.event-poll-bar-fill.is-choice {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}
.event-poll-legend-item {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
}
.event-poll-legend-dot {
  width: var(--space-2);
  height: var(--space-2);
  border-radius: var(--radius-full);
}
.event-poll-legend-dot.is-can {
  background: var(--accent);
}
.event-poll-legend-dot.is-if-needed {
  background: var(--accent-2);
}
.event-poll-legend-dot.is-cannot {
  background: var(--accent-3);
}
.event-poll-legend-dot.is-open {
  background: var(--border);
}
.event-poll-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.event-poll-tag {
  padding: 0 var(--space-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  color: var(--text-muted);
  font-size: var(--font-size-xs);
  line-height: var(--control-line-height);
}
.event-poll-answer-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  white-space: nowrap;
}
.event-poll-answer-chip svg {
  width: var(--space-3);
  height: var(--space-3);
}
.event-poll-answer-chip.is-missing {
  box-shadow: inset 0 0 0 1px var(--accent);
  background: transparent;
  color: var(--accent);
}
.event-poll-answer-inline {
  display: none;
}
.event-poll-save-row.event-poll-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border);
  font-size: var(--font-size-sm);
}
/* Its own flex row, not the shared `.row`: that 12px gap would push a
   following badge visibly away from the voter avatars. */
/* Avatars start at the column's left edge, so a trailing "+N" never shifts
   them against the rows above and below. A tag that no longer fits beside
   the avatars wraps below them instead of running into the answer buttons. */
.event-poll-option-badges {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: var(--space-1);
  min-height: 24px;
}
.event-poll-reject-tag {
  white-space: nowrap;
}
.event-poll-option-title-row {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  min-width: 0;
}
.event-poll-option-title-row strong {
  overflow-wrap: anywhere;
}
.event-poll-option-title-row .badge {
  flex: none;
  white-space: nowrap;
}
.event-poll-option-link {
  flex: none;
}
.event-poll-counts {
  display: flex;
  flex-wrap: wrap;
  /* Trimmed count text has no leading of its own, so wrapped legend lines
     need the row gap to stay apart. */
  gap: var(--space-1);
  color: var(--text-muted);
  font-size: var(--font-size-xs);
  line-height: var(--control-line-height);
}
.event-poll-count-text {
  /* Center against capitals/baseline, not empty font leading. Descenders stay visible. */
  display: block;
  text-box-trim: trim-both;
  text-box-edge: cap alphabetic;
}
/* Voter avatars beside their option. They carry the same identities the vote
   dialog lists, compressed into the option's existing title row so a visible
   interim result never costs the round an extra line. */
.btn.event-poll-voter-stack {
  min-width: var(--tap-target-size);
  padding-inline: 0;
  padding-block: 0;
  background: transparent;
  justify-content: flex-start;
  /* The control keeps its full 32px target; only its outer box gives way, so
     the avatars ride inside the badge line's 24px instead of making every
     option row with voters taller than the ones without. */
  margin-block: calc(var(--space-1) * -1);
}
.event-poll-voter-stack-avatars {
  display: inline-flex;
  align-items: center;
}
/* A slight overlap keeps the group compact without hiding most of a face.
   The ring separates neighbours on the option's own surface. */
.event-poll-voter-stack-avatars > * + * {
  margin-left: calc(var(--space-1) * -1);
}
.event-poll-voter-stack-avatars > * {
  box-shadow: 0 0 0 2px var(--bg-elevated-2);
}
.event-poll-voter-stack-more {
  color: var(--text-muted);
  font-size: var(--font-size-xs);
}
.event-poll-response-toolbar {
  min-width: 0;
  width: fit-content;
  max-width: 100%;
  flex-wrap: wrap;
}
.event-poll-response-toolbar .btn {
  background: var(--bg-elevated);
}
/* Answer buttons of one option share one width, so the chosen outline never
   makes a row look uneven. */
.event-poll-option > .event-poll-response-toolbar:not(.event-poll-rating-toolbar) {
  display: inline-grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
}
/* The chosen answer is filled, so the own choice reads at a glance across a
   whole ballot. Solid, not the gradient: that stays reserved for the one
   save action below the options. --accent-strong keeps white text readable. */
.event-poll-response-toolbar .btn.is-selected {
  background: var(--accent-strong);
  box-shadow: none;
  color: var(--accent-text);
}
/* Bock/Skill scale: the chosen number and its outline take the former
   slider's saturated color and a fill line below repeats the value with that slider's gradient. */
.rating-scale {
  --scale-track: #39415a; /* unfilled rest of the line, lighter than --bg-elevated-2 so it stays visible */
  display: inline-flex;
  flex-direction: column;
  gap: var(--space-1);
  /* Never stretched by its row: the fill line ends with the last number. */
  width: fit-content;
  max-width: 100%;
}
.rating-scale--bock {
  --scale-low: #c08be6;
  --scale-high: #c24bd8;
}
.rating-scale--skill {
  --scale-low: #9bb7f5;
  --scale-high: #536dff;
}
.rating-scale--vote {
  --scale-low: var(--accent);
  --scale-high: var(--accent-2);
}
.rating-scale .event-poll-response-toolbar .btn.is-selected {
  box-shadow: inset 0 0 0 1px var(--scale-high);
  color: var(--scale-high);
}
/* A Vote ballot's own Bock: a faint dashed outline as orientation, so it never
   reads as the chosen number; choosing it or focusing it shows the full ring. */
.rating-scale .event-poll-response-toolbar .btn.is-hint:not(.is-selected):not(:focus-visible) {
  outline: 1px dashed color-mix(in srgb, var(--scale-high) 60%, transparent);
  outline-offset: -1px;
}
.rating-scale-meter {
  display: block;
  height: var(--space-1);
  border-radius: var(--radius-full);
  background: var(--scale-track);
  overflow: hidden;
}
.rating-scale-meter.is-unrated {
  background: transparent;
  border-top: 1px dashed var(--scale-track);
  border-radius: 0;
}
.rating-scale-meter-fill {
  display: block;
  height: 100%;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, var(--scale-low), var(--scale-high));
}
.event-poll-response-toolbar .btn:not(.btn-square) {
  min-width: var(--tap-target-size);
}
.event-poll-choice-control {
  display: flex;
  align-items: center;
  margin-left: auto;
}
.event-poll-choice-control .selection-toolbar .event-poll-choice-btn {
  /* One width for "Wählen" and "Ausgewählt", so the bar beside it keeps its
     length in every row. */
  min-width: calc(var(--space-8) * 2);
  justify-content: center;
  height: auto;
  padding: var(--space-1) var(--space-2);
  font-size: var(--font-size-xs);
}
.event-poll-save-row {
  justify-content: flex-end;
}
.event-poll-history-round {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-2) 0;
  border-top: 1px solid var(--border);
}
.event-poll-history-round:first-child {
  border-top: 0;
  padding-top: 0;
}
.event-poll-history-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1) var(--space-3);
  min-width: 0;
  font-size: var(--font-size-sm);
}
.event-poll-history-meta {
  color: var(--text-muted);
}
.event-poll-ended-history > .collapsible-section-content {
  padding-top: 0;
}
.event-poll-vote-option-name {
  gap: var(--space-2);
}
.event-poll-vote-details {
  gap: var(--space-3);
}
.event-poll-vote-option {
  gap: var(--space-2);
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated-2);
}
.event-poll-vote-group {
  gap: var(--space-1);
}
.event-poll-vote-person {
  gap: var(--space-3);
  min-height: 28px;
}
.event-poll-vote-person .player-name {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}
.event-poll-voter-name {
  min-width: 0;
  overflow-wrap: anywhere;
}
.event-poll-vote-person time {
  flex: none;
  font-size: var(--font-size-xs);
}
.event-poll-note-input {
  field-sizing: content;
  max-height: calc(var(--control-height) * 4);
}
.event-poll-form-option-list {
  gap: var(--space-2);
}
.event-poll-form-option-main {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.event-poll-form-option-main > [data-poll-option-input] {
  flex: 1 1 auto;
  min-width: 0;
}
.event-poll-option-extra-toggle[aria-expanded='true'] {
  color: var(--accent);
}
.event-poll-option-extra-fields {
  margin-top: var(--space-2);
}
.event-poll-form-option:has(.poll-option-switch:not(:checked)) [data-poll-option-input] {
  color: var(--text-muted);
  text-decoration: line-through;
}
/* Paired fields keep the regular field-label gap of every other field. A
   help trigger beside a label keeps its 32px target through negative block
   margin, so labels with and without help share one line height and both
   inputs start on the same edge. */
.event-poll-form-pair > div > .title-with-info {
  margin-bottom: var(--space-1);
}
.event-poll-form-pair > div > .title-with-info .info-tooltip-trigger {
  margin-block: calc(-1 * var(--space-3));
}
.event-poll-form-flags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-5);
}
.event-poll-flag {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--control-height);
}
.event-poll-flag input[type='checkbox'] {
  width: var(--space-5);
  height: var(--space-5);
  margin: 0;
  accent-color: var(--accent);
}
.poll-option-switch {
  appearance: none;
  position: relative;
  flex: none;
  inline-size: calc(var(--space-5) * 2 + var(--space-1));
  block-size: var(--space-6);
  margin: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--bg-elevated-2);
  cursor: pointer;
  transition: background var(--motion-fast), border-color var(--motion-fast);
}
.poll-option-switch::before {
  content: '';
  position: absolute;
  inset-block-start: var(--space-1);
  inset-inline-start: var(--space-1);
  inline-size: calc(var(--space-6) - var(--space-2));
  block-size: calc(var(--space-6) - var(--space-2));
  border-radius: var(--radius-full);
  background: var(--text);
  transition: transform var(--motion-fast);
}
.poll-option-switch:checked {
  border-color: var(--accent);
  background: var(--accent);
}
.poll-option-switch:checked::before {
  transform: translateX(var(--space-5));
}
.poll-option-switch:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
/* While the result stays hidden from the viewer (a running Vote, an Umfrage
   with a hidden interim result) the result and voter columns would stay
   empty: the answers move up beside the title. Phones keep the regular
   stacked layout below. */
@media (min-width: 640px) { /* --bp-md */
  .event-poll-options.is-compact .event-poll-option {
    grid-template-columns: minmax(0, 1fr) auto auto;
  }
  .event-poll-options.is-compact .event-poll-result {
    display: none;
  }
}
@container (min-width: 88rem) {
  /* Two columns only when each option keeps its title, bar, voters and
     answer controls side by side. Read down the left column first. */
  .stack.event-poll-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(var(--compact-rows, 1), auto);
    grid-auto-flow: column;
    column-gap: var(--space-7);
  }
  .event-poll-options .event-poll-option.is-column-start {
    border-top: 0;
  }
  .event-poll-options.is-ranked .event-poll-option {
    /* Reserve the shared voter column even when an option has no supporters. */
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 7rem;
  }
  .event-poll-options.is-ranked .event-poll-result {
    margin-inline-end: 0;
  }
}
@media (max-width: 639px) { /* --bp-md */
  .event-poll-card-header {
    flex-wrap: wrap;
    align-items: center;
  }
  .event-poll-card-toggle {
    flex-basis: 100%;
    grid-template-columns: auto minmax(0, 1fr);
  }
  /* The compact header actions move below the title on a phone, aligned
     right, instead of squeezing the title into a narrow column. */
  .event-poll-card-side {
    flex: 1 1 100%;
    justify-content: flex-end;
  }
  /* The answer status moves into the card's meta line on a phone. */
  .event-poll-answer-side {
    display: none;
  }
  .event-poll-answer-inline {
    display: inline-flex;
  }
  .event-poll-vote-person.row-between {
    align-items: flex-start;
    flex-direction: column;
    gap: 0;
  }
}
/* A narrow card cannot keep a readable bar and every answer button beside
   the title, even when the viewport itself has passed the phone breakpoint. */
@container (max-width: 36rem) {
  .event-poll-option,
  .event-poll-options.is-compact .event-poll-option {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: var(--space-2);
  }
  .event-poll-option-info {
    grid-column: 1;
    grid-row: 1;
  }
  .event-poll-option-badges {
    grid-column: 2;
    grid-row: 1;
  }
  .event-poll-option-badges,
  .btn.event-poll-voter-stack {
    justify-content: flex-end;
  }
  .event-poll-result,
  .event-poll-option > .rating-scale,
  .event-poll-option > .event-poll-response-toolbar,
  .event-poll-option > .event-poll-choice-control {
    grid-column: 1 / -1;
  }
  .event-poll-option > .event-poll-response-toolbar,
  .event-poll-option > .event-poll-choice-control,
  .event-poll-choice-control .selection-toolbar,
  .event-poll-choice-control .selection-toolbar .event-poll-choice-btn {
    width: 100%;
  }
}

/* Workspace switcher. Deliberately *not* its own control shape: it is the
   shared `.search-select` every other event and game dropdown uses, so it
   reads as the same kind of dropdown as the rest of the app. This wrapper
   only bounds its width inside the crowded topbar; the status icon, listbox
   and colours all come from the shared component. */
.event-context {
  display: block;
  width: 100%;
  max-width: 300px;
}
.event-context[hidden] {
  display: none;
}
/* The topbar sits above the page content, so the switcher's popup has to as
   well — otherwise the open list slides behind the first card. */
.event-context .search-select-list {
  z-index: 40;
}

.icon-btn {
  display: inline-flex;
  min-width: var(--tap-target-size);
  min-height: var(--control-height);
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text);
  font-size: var(--font-size-lg);
  cursor: pointer;
  padding: var(--space-1);
  line-height: var(--control-line-height);
  border-radius: var(--radius-sm);
  text-decoration: none;
}
.topbar .icon-btn {
  width: var(--tap-target-size);
}
.nav-btn.needs-setup .nav-icon {
  position: relative;
}
.nav-btn.needs-setup .nav-icon::after {
  content: '';
  position: absolute;
  top: -2px;
  right: -2px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--state-paused);
  box-shadow: 0 0 0 2px var(--bg-elevated);
}

/* Navigation counter: unread notifications plus open To-Dos of an area (see
   navBadges.js). It points at something new rather than warning, so it uses
   the brand gradient (its deeper, readable variant) instead of the danger red. The number is aria-hidden;
   the button's name carries „N neu“ instead. */
.nav-icon,
.more-card .list-row-icon {
  position: relative;
}
.nav-badge {
  position: absolute;
  top: calc(-1 * var(--space-2));
  right: calc(-1 * var(--space-3));
  min-width: var(--space-4);
  height: var(--space-4);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 var(--space-1);
  border-radius: var(--radius-full);
  background: var(--accent-gradient-strong);
  color: var(--accent-text);
  font-size: var(--font-size-2xs);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
  box-shadow: 0 0 0 2px var(--bg-elevated);
  pointer-events: none;
}
/* The line box reserves room for descenders, which digits never use, so the
   number sat visibly high. Trimming to cap height and baseline centres the
   glyph itself; browsers without text-box keep the previous rendering. */
.nav-count-value {
  text-box: trim-both cap alphabetic;
}
/* In the desktop rail the counter ends the row instead of covering the label. */
.desktop-nav-btn > .nav-badge {
  position: static;
  flex: 0 0 auto;
  margin-left: auto;
  box-shadow: none;
}

.view-container {
  flex: 1;
  min-height: 0; /* allow this flex item to actually shrink and scroll internally, see .app */
  overflow-y: auto;
  /* Reserve the scrollbar track even for short views so switching to a
     longer view never changes the content width for a single frame. */
  scrollbar-gutter: stable;
  /* Full-width scroll area with the content column centered via computed
     side padding instead of max-width + auto margins — same visible column,
     but the scrollbar parks at the window's right edge instead of floating
     mid-screen at the column's edge on a wide display. */
  padding: var(--space-4) max(var(--space-4), calc((100% - var(--content-max-width)) / 2))
    calc(var(--shell-bottom-inset) + var(--space-6));
  width: 100%;
}
/* Re-applied by switchView() on every tab change (and only there — realtime
   re-renders must not flash): the incoming view fades in briefly. Opacity
   only, deliberately not transform: animating transform on this element
   would animate the scroll container itself (it's also the overflow-y:auto
   box), which briefly promotes it to its own compositing layer on every
   switch and made overlay-style scrollbars flash in at the right edge for
   that instant even on a view short enough to need no scrollbar at all. */
.view-container.view-enter {
  animation: view-in 0.22s ease;
}
@keyframes view-in {
  from {
    opacity: 0;
  }
}

/* On a laptop/desktop screen, a 720px-capped column leaves most of the
   display empty. Widen the content area in steps as there's room for it.
   At --bp-xl, the compact bottom bar gives way to the grouped desktop rail;
   routes and permissions remain shared while frequent secondary areas become
   direct destinations. */
@media (min-width: 860px) { /* --bp-lg */
  :root {
    --content-max-width: 1080px;
  }
}
@media (min-width: 1280px) { /* --bp-xl */
  :root[data-layout-mode='desktop'] {
    --content-max-width: 1600px;
    --shell-bottom-inset: 0px;
  }
  :root[data-layout-mode='desktop'] .notification-highlight,
  :root[data-layout-mode='desktop'] .connection-status,
  :root[data-layout-mode='desktop'] .view-container {
    margin-left: var(--desktop-nav-width);
  }
  :root[data-layout-mode='desktop'] .view-container {
    width: calc(100% - var(--desktop-nav-width));
    padding: var(--space-4)
      max(var(--space-4), calc((100% - var(--desktop-nav-width) - var(--content-max-width)) / 2))
      var(--space-6);
  }
  :root[data-layout-mode='desktop'] .topbar #feedback-btn {
    display: none;
  }
}

.desktop-nav {
  display: none;
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(var(--nav-height) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
  z-index: 10;
}

/* The bar's background/border span the full width (looks intentional at any
   size), but the tap targets themselves are capped to the same column width
   as .view-container and centered — on a wide laptop screen, 5 icons spread
   with justify-content:space-around across the full viewport would land tens
   of pixels apart with dead space between each, instead of reading as one
   navigation bar. */
.bottom-nav-inner {
  display: flex;
  justify-content: space-around;
  max-width: 720px;
  height: 100%;
  margin: 0 auto;
}

@media (min-width: 1280px) { /* --bp-xl */
  :root[data-layout-mode='desktop'] .bottom-nav {
    display: none;
  }
  :root[data-layout-mode='desktop'] .desktop-nav {
    position: fixed;
    top: calc(var(--topbar-height) + env(safe-area-inset-top));
    bottom: 0;
    left: 0;
    z-index: 10;
    display: flex;
    width: var(--desktop-nav-width);
    min-height: 0;
    flex-direction: column;
    background: var(--bg-elevated);
    border-right: 1px solid var(--border);
  }
  :root[data-layout-mode='desktop'] .desktop-nav-main {
    min-height: 0;
    flex: 1 1 auto;
    overflow-y: auto;
    padding: var(--space-2);
    scrollbar-gutter: stable;
  }
  :root[data-layout-mode='desktop'] .desktop-nav-utilities {
    flex: 0 0 auto;
    padding: var(--space-2);
    border-top: 1px solid var(--border);
    background: var(--bg-elevated);
  }
  :root[data-layout-mode='desktop'] .desktop-nav-group + .desktop-nav-group {
    margin-top: var(--space-1);
    padding-top: var(--space-1);
    border-top: 1px solid color-mix(in srgb, var(--border) 68%, transparent);
  }
  :root[data-layout-mode='desktop'] .desktop-nav-heading {
    display: block;
    padding: 0 var(--space-2) var(--space-1);
    color: var(--text-muted);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-bold);
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }
  :root[data-layout-mode='desktop'] .desktop-nav-btn {
    position: relative;
    display: flex;
    width: 100%;
    min-height: var(--tap-target-size);
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2);
    color: var(--text-muted);
    font-size: var(--font-size-md);
    text-align: left;
    white-space: nowrap;
    cursor: pointer;
    background: none;
    border: 0;
    border-radius: var(--radius-sm);
    transition: color 0.15s ease, background 0.15s ease;
  }
  :root[data-layout-mode='desktop'] .desktop-nav-btn.active {
    color: var(--accent);
    font-weight: var(--font-weight-bold);
    background: var(--accent-bg);
  }
  :root[data-layout-mode='desktop'] .desktop-nav-icon {
    position: relative;
    display: grid;
    flex: 0 0 auto;
    place-items: center;
  }
  :root[data-layout-mode='desktop'] .desktop-nav-icon .ui-icon {
    width: 18px;
    height: 18px;
  }
  :root[data-layout-mode='desktop'] .desktop-nav-btn.needs-setup .desktop-nav-icon::after {
    content: '';
    position: absolute;
    top: -2px;
    right: -2px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--state-paused);
    box-shadow: 0 0 0 2px var(--bg-elevated);
  }
}

@media (min-width: 1280px) and (hover: hover) and (pointer: fine) { /* --bp-xl */
  :root[data-layout-mode='desktop'] .desktop-nav-btn {
    min-height: var(--control-height);
    padding-block: var(--space-1);
  }
}

@media (min-width: 1280px) and (hover: hover) { /* --bp-xl */
  :root[data-layout-mode='desktop'] .desktop-nav-btn:hover:not(.active) {
    color: var(--text);
    background: var(--bg-elevated-2);
  }
}


.nav-btn {
  flex: 1;
  min-width: 0;
  max-width: 120px;
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  color: var(--text-muted);
  font-size: var(--font-size-2xs);
  border-radius: var(--radius-sm);
  position: relative;
  transition: color 0.15s ease;
}
.nav-btn:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}
.nav-icon {
  display: grid;
  place-items: center;
  transition: transform 0.18s ease;
}
.ui-icon {
  display: inline-block;
  width: 1.2em;
  height: 1.2em;
  flex: 0 0 auto;
  vertical-align: -0.18em;
}
.inline-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: currentColor;
  vertical-align: -0.18em;
}
.inline-icon + .inline-icon {
  margin-left: var(--space-1);
}
.list-row-icon .ui-icon {
  width: 24px;
  height: 24px;
}
.nav-icon .ui-icon {
  width: 22px;
  height: 22px;
}
.icon-btn .ui-icon {
  width: 20px;
  height: 20px;
}
.badge .ui-icon,
.chip .ui-icon {
  width: 15px;
  height: 15px;
}
/* Soft pill behind the active tab's icon (Material/iOS-style) — scales in
   instead of popping, so switching tabs feels alive. */
.nav-btn::before {
  content: '';
  position: absolute;
  top: 8px;
  left: 50%;
  width: 46px;
  height: 27px;
  border-radius: var(--radius-full);
  background: rgba(91, 140, 255, 0.17);
  opacity: 0;
  transform: translateX(-50%) scale(0.55);
  transition: opacity 0.18s ease, transform 0.18s ease;
  pointer-events: none;
}
.nav-btn.active {
  color: var(--accent);
}
.nav-btn.active::before {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}
.nav-btn.active .nav-icon {
  transform: translateY(-1px);
  filter: drop-shadow(0 0 6px rgba(91, 140, 255, 0.55));
}
.nav-btn.active .nav-label {
  font-weight: var(--font-weight-bold);
}

/* ---------- Buttons & inputs ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  border: none;
  border-radius: var(--radius-sm);
  min-height: var(--control-height);
  padding: 6px var(--space-5); /* design-token-ok: 32px control minimum with a 1.25 line box; wrapped labels grow */
  font-size: var(--font-size-md);
  line-height: var(--control-line-height);
  text-align: center;
  overflow-wrap: break-word;
  font-weight: var(--font-weight-medium);
  cursor: pointer;
  background: var(--bg-elevated-2);
  color: var(--text);
  text-decoration: none;
  transition: transform 0.05s ease, opacity 0.15s ease, filter 0.15s ease, box-shadow 0.15s ease;
}
/* Hover feedback only where hover exists — on touch screens :hover sticks
   after a tap and leaves buttons looking half-pressed. */
@media (hover: hover) {
  .btn:hover:not(:disabled) {
    filter: brightness(1.12);
  }
  .btn-primary:hover:not(:disabled) {
    box-shadow: var(--shadow-glow-accent);
  }
  .icon-btn:hover {
    background: var(--bg-elevated-2);
  }
}
.btn:active {
  transform: scale(0.97);
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn-primary {
  background: var(--accent-gradient);
  color: var(--accent-text);
  box-shadow: 0 2px 14px rgba(91, 140, 255, 0.28);
}
.btn-primary:active {
  box-shadow: none;
}
.btn-primary:disabled {
  box-shadow: none;
}
.btn-danger {
  background: var(--danger-bg);
  color: var(--danger);
}
.btn-block {
  width: 100%;
}
.btn-sm {
  padding-inline: var(--space-3);
  font-size: var(--font-size-sm);
}
.btn.btn-square {
  flex: 0 0 var(--control-height);
  width: var(--control-height);
  min-width: var(--control-height);
  height: var(--control-height);
  padding: 0;
  font-size: var(--font-size-xs);
}
/* Uniform-width buttons so a set of them (lobby actions, in-game controls)
   reads as a tidy group instead of a jumble of different widths. Wide enough
   that the longest current label ("Lobby öffnen") fits without growing past
   it, so every such button ends up the same size. */
/* Two or more dialog footer buttons share the full width equally (cancel
   left, the confirming action right). */
.modal-actions {
  display: grid;
  grid-auto-columns: minmax(0, 1fr);
  grid-auto-flow: column;
  gap: var(--space-2);
}

.btn-equal {
  min-width: 7.5rem;
}

input[type='text'],
input[type='password'],
input[type='number'],
input[type='url'],
input[type='search'],
input[type='datetime-local'],
select,
textarea {
  background: var(--bg-elevated-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  min-height: var(--control-height);
  padding: 5px var(--space-3); /* design-token-ok: 32px control minimum including the field's two border pixels */
  font-size: var(--font-size-md);
  line-height: var(--control-line-height);
  color: var(--text);
  width: 100%;
  /* Flex items default to min-width:auto, i.e. never shrink past their
     content's intrinsic width — for a datetime-local input that's wide
     enough that two side by side in a .row overflow the card on a phone
     screen instead of sharing the space evenly. */
  min-width: 0;
}
textarea {
  font-family: inherit;
  resize: vertical;
}
/* Placeholders show an example or a format, never a value. Italic keeps them
   visibly apart from real input in every field. */
input::placeholder,
textarea::placeholder {
  font-style: italic;
}

/* Focus: accent ring on fields, visible keyboard-focus outline everywhere
   else — without leaving mouse/touch users with permanent outlines. */
input[type='text']:focus,
input[type='password']:focus,
input[type='number']:focus,
input[type='url']:focus,
input[type='search']:focus,
input[type='datetime-local']:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: rgba(91, 140, 255, 0.65);
  box-shadow: 0 0 0 3px rgba(91, 140, 255, 0.16);
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
/* Headings and other script-only focus targets (tabindex="-1", e.g. the view
   heading focused after navigation for screen readers) are not controls, so
   they must not show the keyboard ring as a stray blue frame. */
[tabindex='-1']:focus-visible {
  outline: none;
}

/* Native dropdown arrows don't theme; replace with a custom chevron so
   selects match the rest of the dark controls. */
select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238b93a7' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 38px; /* design-token-ok: clears the custom select chevron at its fixed 12px inset */
}

/* Searchable select: the options stay inside the app instead of using the
   browser's unthemeable native datalist popup. */
.search-select {
  position: relative;
}
.search-select-control {
  position: relative;
}
.search-select-control > input {
  min-height: var(--control-height);
  padding-right: calc(var(--tap-target-size) + var(--space-2));
}
.search-select-toggle {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  display: grid;
  place-items: center;
  width: var(--tap-target-size);
  min-height: var(--control-height);
  padding: 0;
  border: 0;
  border-left: 1px solid var(--border);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}
.search-select.is-open .search-select-toggle {
  color: var(--text);
}
.search-select.is-open .search-select-toggle .ui-icon {
  transform: rotate(180deg);
}
/* A non-searchable select reads as a choice, not as a text field. */
.search-select.is-readonly .search-select-control > input {
  cursor: pointer;
  caret-color: transparent;
  text-overflow: ellipsis;
}
/* Busy state while a selection triggers an in-flight request (e.g. the
   topbar workspace switcher awaiting its activate call) — same treatment as
   .btn:disabled so it reads as the same kind of "wait" state app-wide. */
.search-select-control > input:disabled,
.search-select-toggle:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.search-select-list {
  position: absolute;
  z-index: 20;
  top: calc(100% + var(--space-1));
  right: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  max-height: min(
    var(--search-select-results-max-height),
    var(--search-select-available-height, var(--search-select-results-max-height))
  );
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  box-shadow: var(--shadow);
}
/* The popup is a flex column, and `display` from a class outranks the UA's
   `[hidden] { display: none }` — so the closed state has to be restated here. */
.search-select-list[hidden] {
  display: none;
}
/* Only the results scroll: a pinned action below them keeps its place while a
   long list runs past the popup's maximum height. */
.search-select-results {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: var(--space-1);
}
.search-select.opens-upward .search-select-list {
  top: auto;
  bottom: calc(100% + var(--space-1));
}
.search-select-option {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  min-height: var(--tap-target-size);
  padding: var(--space-2) var(--space-3);
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font-size: var(--font-size-md);
  text-align: left;
  cursor: pointer;
}
.search-select-option-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* The food-order description dropdown's per-option price (see "Food orders"
   in DESIGN_SYSTEM.md) - a plain trailing muted value, not a status icon. */
.search-select-option-price {
  flex: 0 0 auto;
  color: var(--text-muted);
  font-size: var(--font-size-sm);
}

/* Status icon for the event dropdowns. It sits inside the field's own left
   padding when collapsed — the same seating the topbar switcher already used
   — and repeats on every row of the open list, so the state is readable while
   choosing instead of only afterwards. Never colour alone: each icon carries
   the German state as its accessible name and native title. */
.search-select-value-icon {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--space-3);
  display: flex;
  align-items: center;
  color: var(--text-muted);
  pointer-events: none;
}
.search-select.has-status-icon .search-select-control > input {
  padding-left: 38px; /* design-token-ok: clears the status icon, mirrors the chevron's own 38px inset */
}
.search-select-status,
.search-select-option-icon {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  line-height: var(--line-height-tight);
  color: var(--text-muted);
}
.search-select-status[data-event-status='tracking'],
.search-select-option-icon[data-event-status='tracking'] {
  color: var(--state-playing);
}
.search-select-status[data-event-status='ended'],
.search-select-option-icon[data-event-status='ended'] {
  color: var(--state-offline);
}
.search-select-status[data-event-status='base'],
.search-select-option-icon[data-event-status='base'] {
  color: var(--accent);
}
.search-select-option[aria-selected='true'] {
  background: var(--accent-bg);
  color: var(--accent-text);
}
.search-select-option.is-active {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
.search-select-empty {
  padding: var(--space-3);
  color: var(--text-muted);
  font-size: var(--font-size-sm);
  text-align: center;
}

/* Pinned action: a command that leaves the picker, not one more entry to pick.
   It reads as a different kind of thing through four cues at once — a
   full-bleed divider, its own footer surface, accent text and a trailing
   chevron for "this navigates somewhere" — so it no longer looks like the
   option rows directly above it. It is a real <button> outside the listbox,
   so keyboard and screen-reader users meet it as an action too. */
.search-select-action {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  gap: var(--space-2);
  width: 100%;
  min-height: var(--tap-target-size);
  padding: var(--space-2) var(--space-3);
  border: 0;
  border-top: 1px solid var(--border);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  background: var(--bg-elevated-2);
  color: var(--accent);
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-medium);
  text-align: left;
  cursor: pointer;
}
.search-select-action-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.search-select-action-icon,
.search-select-action-chevron {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  line-height: var(--line-height-tight);
}
.search-select-action-chevron {
  color: var(--text-muted);
}
@media (hover: hover) {
  .search-select-option:hover {
    background: var(--bg-elevated-2);
  }
  .search-select-action:hover {
    background: var(--accent-bg);
  }
}
/* Chrome/Edge render the datetime-local picker icon dark-on-dark by default
   (it doesn't follow color-scheme automatically inside a custom-background
   input) — invert it so it's visible against the app's dark inputs. */
input[type='datetime-local']::-webkit-calendar-picker-indicator {
  filter: invert(1);
}
input[type='color'] {
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: none;
  cursor: pointer;
}

/* Number inputs are often sized narrow (team counts, etc.); the native
   up/down spinner steals space from that on top of the usual padding,
   which is what was clipping placeholders like "Teams". `numberStepper.js`
   replaces it app-wide with the compact `.number-stepper` buttons below,
   which also cover mouse-wheel-over-a-focused-field the native spinner never
   handled well anyway. */
input[type='number'] {
  -moz-appearance: textfield;
  appearance: textfield;
}
input[type='number']::-webkit-outer-spin-button,
input[type='number']::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* `numberStepper.js` wraps every `input[type="number"]` in `.number-stepper`
   and overlays the two `.number-stepper-btn` step buttons inside the input's
   own right-hand padding via `position: absolute`, the same spot the native
   spinner used to occupy before the rule above disabled it. Taking the
   buttons out of normal flow this way means the wrapper's footprint stays
   exactly the input's own footprint — every narrow context above (team
   counts, scores, seat counts, ...) that was already sized for a bare input
   keeps working unchanged, with no per-view width adjustments needed. */
.number-stepper {
  position: relative;
}
.number-stepper input[type='number'] {
  padding-right: 30px; /* design-token-ok: reserves exactly the .number-stepper-steps width below plus its 1px inset, in the input's own padding */
}
.number-stepper-steps {
  position: absolute;
  top: 1px;
  right: 1px;
  bottom: 1px;
  width: 26px; /* design-token-ok: a compact overlay control sized to the input's own reserved padding, not the standalone tap-target-size scale — typing stays the primary way to set a value, this is a supplementary click/tap shortcut */
  display: flex;
  flex-direction: column;
}
.number-stepper-btn {
  flex: 1 1 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-left: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}
.number-stepper-btn:first-child {
  border-bottom: 1px solid var(--border);
}
.number-stepper-btn .ui-icon {
  width: 11px; /* design-token-ok: scaled to this compact overlay half-button, not the standalone icon scale */
  height: 11px;
}
@media (hover: hover) {
  .number-stepper-btn:hover {
    color: var(--text);
    background: var(--bg-elevated-2);
  }
}

/* A persistent label above a field — for cases where a placeholder alone
   isn't enough (e.g. a number input that starts pre-filled with a default
   value, so its placeholder text never actually becomes visible). */
.field-label {
  display: block;
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  margin: 0 0 var(--space-1) 2px; /* design-token-ok: 2px optical indent aligns the label with the input's inset text */
}
.field-label.is-required::after {
  content: ' *';
  color: var(--accent);
  font-weight: var(--font-weight-bold);
}

/* ---------- Layout helpers ---------- */

.row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
/* A web address inside user-written text (Durchsage, Info entry), made
   clickable by linkifyHtml(); long URLs wrap instead of widening the page. */
.text-link {
  color: var(--accent);
  overflow-wrap: anywhere;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: var(--space-1);
}
.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

/* A pair of labeled fields side by side (arrival/departure, event start/end,
   analytics date range). flex-wrap plus a sane min-width lets the pair drop
   to one field per line instead of overflowing on narrow phones. */
.field-row {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
  align-items: flex-start;
}
.field-row > div {
  flex: 1 1 180px;
  min-width: 0;
}

.selection-toolbar {
  display: flex;
  min-width: 0;
  align-items: end;
  gap: var(--space-2);
  flex-wrap: wrap;
}
.selection-toolbar .field-label {
  flex-basis: 100%;
  margin-bottom: 0;
}
/* A roster's own label sits the standard label distance (--space-1) above
   its controls, like a labelled toolbar field (Anzahl Teams). Otherwise the
   roster jumps when Match switches between Auslosung and Captain Draft. */
.selection-toolbar .selection-toolbar-label:not(:last-child) {
  margin-bottom: calc(var(--space-1) - var(--space-2));
}
.selection-toolbar input[type='number'] {
  width: calc(var(--space-8) * 2);
  flex: 0 0 auto;
}
.selection-toolbar .btn {
  min-height: var(--control-height);
}
.selection-toolbar-icon {
  width: var(--tap-target-size);
  min-height: var(--control-height);
  padding: var(--space-1);
  border: 1px solid var(--border);
  background: var(--bg-elevated-2);
  color: var(--text);
}
.selection-toolbar-icon--clear {
  color: var(--danger);
}
.selection-search {
  display: flex;
  align-items: center;
  flex: 1 1 calc(var(--tap-target-size) * 4);
  min-width: 0;
}
.selection-search:not(.is-open) {
  flex: 0 0 var(--tap-target-size);
  min-width: var(--tap-target-size);
}
.selection-search-trigger,
.selection-search-close {
  width: var(--tap-target-size);
  min-height: var(--control-height);
  padding: var(--space-1);
  border: 1px solid var(--border);
  background: var(--bg-elevated-2);
  color: var(--text);
}
.selection-search-field {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  width: 100%;
  min-width: 0;
}
.selection-search-field input {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
}
@media (hover: hover) {
  .selection-toolbar-icon:hover,
  .selection-search-trigger:hover,
  .selection-search-close:hover {
    background: var(--bg-elevated-2);
  }
}
@media (max-width: 639px) { /* --bp-md */
  .selection-search {
    flex-basis: 100%;
  }
}
.tournament-team-count-field {
  flex: 0 0 calc(var(--space-8) * 2);
}
.tournament-team-count-field input[type='number'] {
  width: 100%;
}
.tournament-team-count-field .field-label {
  margin-bottom: var(--space-1);
}
.player-selection-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-2);
}
.player-selection-grid .check-row {
  min-width: 0;
  padding: var(--space-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
/* Long gamertags wrap (mid-word if needed) while checkbox, avatar and
   skill value keep their size, so no part escapes the card border. */
.player-selection-grid .check-row .player-name {
  min-width: 0;
  overflow-wrap: anywhere;
}
.player-selection-grid .check-row input[type='checkbox'],
.player-selection-grid .check-row .avatar-img,
.player-selection-grid .check-row .avatar-dot,
.player-selection-grid .check-row .rating {
  flex-shrink: 0;
}
.checklist-assignment-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.checklist-assignment-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-3);
}
.checklist-assignment-toolbar .field-label {
  margin: 0;
}
.checklist-assignment-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-2);
}
@media (max-width: 639px) { /* --bp-md */
  .checklist-assignment-toolbar {
    grid-template-columns: minmax(0, 1fr);
  }
  .checklist-assignment-actions {
    width: 100%;
  }
}
.player-assignment-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) var(--assignment-select-width);
  align-items: center;
  gap: var(--space-2);
}

.profile-color-trigger {
  position: absolute;
  right: calc(-1 * var(--space-1));
  bottom: calc(-1 * var(--space-1));
  width: var(--space-5);
  height: var(--space-5);
  padding: 0;
  border: 3px solid var(--bg-elevated);
  border-radius: var(--radius-full);
  background: var(--profile-color);
  cursor: pointer;
}
/* The dot is small; an invisible margin keeps a comfortable hit area. */
.profile-color-trigger::after {
  content: '';
  position: absolute;
  inset: calc(-1 * var(--space-2));
}
.profile-color-picker-modal {
  align-items: center;
}
.profile-color-picker-modal .modal {
  width: calc(100% - var(--space-4) * 2);
  max-width: calc(var(--space-8) * 8);
  border-radius: var(--radius-lg);
}
.profile-color-picker {
  display: grid;
  justify-items: center;
  gap: var(--space-4);
}
.profile-color-picker-wheel {
  position: relative;
  width: min(70vw, calc(var(--space-8) * 5));
  aspect-ratio: 1;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background:
    radial-gradient(circle, var(--accent-text) 0%, transparent 72%),
    var(--color-wheel-gradient);
  box-shadow: var(--shadow);
  cursor: crosshair;
  touch-action: none;
}
.profile-color-picker-marker {
  position: absolute;
  width: var(--space-4);
  height: var(--space-4);
  border: var(--space-1) solid var(--accent-text);
  border-radius: var(--radius-full);
  box-shadow: var(--shadow);
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.profile-color-picker-preview-row {
  display: grid;
  width: 100%;
  grid-template-columns: auto minmax(0, 1fr) var(--tap-target-size);
  align-items: center;
  gap: var(--space-3);
}
.profile-color-picker-preview {
  display: block;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--profile-color);
}
.profile-color-picker-preview {
  width: var(--tap-target-size);
  height: var(--control-height);
}
.profile-color-picker-value {
  width: 100%;
  min-width: 0;
  font-weight: var(--font-weight-medium);
  text-transform: uppercase;
}
.profile-color-picker-value[aria-invalid='true'] {
  border-color: var(--danger);
}
.profile-color-picker-error {
  width: 100%;
  color: var(--danger);
  font-size: var(--font-size-xs);
}
.profile-color-picker-copy {
  width: var(--tap-target-size);
  min-height: var(--control-height);
  border: 1px solid var(--border);
  background: var(--bg-elevated-2);
}
.profile-color-picker-actions {
  display: grid;
  width: 100%;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-2);
}
/* Mein Profil: settings as hairline rows, each with one action in a fixed
   right column shared across the page (same slot width in every card). */
.profile-rows {
  display: flex;
  flex-direction: column;
}
.profile-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 10rem;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-3) 0;
  border-top: 1px solid var(--border);
}
.profile-row:first-child {
  padding-top: 0;
  border-top: 0;
}
.profile-row:last-child {
  padding-bottom: 0;
}
.profile-row.is-form {
  align-items: end;
}
.profile-row-main {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
}
button.profile-row-main {
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.profile-row-number {
  flex: none;
  width: var(--space-5);
  color: var(--text-muted);
  font-weight: var(--font-weight-bold);
  font-variant-numeric: tabular-nums;
}
.profile-row-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.profile-row-title {
  font-weight: var(--font-weight-medium);
  overflow-wrap: anywhere;
}
.profile-row-meta {
  margin-top: var(--space-1);
  color: var(--text-muted);
  font-size: var(--font-size-sm);
  overflow-wrap: anywhere;
}
.profile-row-action {
  display: flex;
  justify-content: flex-end;
}
.profile-row-action > .btn,
.profile-row-action > select {
  width: 100%;
}
/* The select matches the neighbouring compact buttons' type size. */
.profile-row-action > select {
  font-size: var(--font-size-sm);
}
/* A row with a second, secondary action (Datenschutz: "Daten löschen"
   beside the consent toggle) grows its action column to the left, so the
   right-hand button stays on the shared column edge and keeps its width. */
.profile-row.has-action-pair {
  grid-template-columns: minmax(0, 1fr) auto;
}
.profile-row.has-action-pair .profile-row-action {
  display: grid;
  grid-template-columns: repeat(2, 10rem);
  gap: var(--space-2);
}
.profile-identity {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(0, 1fr);
  align-items: end;
  gap: var(--space-3) var(--space-4);
}
.profile-avatar-editor {
  position: relative;
  align-self: center;
  width: var(--avatar-size-lg);
  height: var(--avatar-size-lg);
}
.profile-identity .field-label {
  display: block;
}
.profile-avatar-control {
  display: block;
  border-radius: var(--radius-full);
  cursor: pointer;
}
.profile-avatar-control .avatar {
  display: block;
}
.profile-text-field {
  min-width: 0;
}
.profile-note {
  margin: 0;
  color: var(--text-muted);
  font-size: var(--font-size-sm);
}
.reauth-note {
  margin-top: var(--space-2);
}
.profile-link-btn {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}
.profile-check {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-1);
  cursor: pointer;
}
.profile-monitor-group {
  display: flex;
  flex-direction: column;
}
.profile-monitor-group[hidden],
.profile-monitor-row[hidden] {
  display: none;
}
.profile-group-title {
  margin: 0;
  padding-bottom: var(--space-2);
  color: var(--text-muted);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  text-transform: uppercase;
}
/* A standing option below a changing list (events come and go) is set
   apart by a gap and a full hairline. */
.profile-rows-separate {
  margin-top: var(--space-5);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
}
/* A lead row (a card's own action) above a list: the list starts below a
   full hairline. */
.profile-rows-divided {
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border);
}
/* A longer list of short rows may use two columns on wide screens, filled
   column by column; the caller marks each column's first and last row. */
@media (min-width: 860px) { /* --bp-lg */
  .profile-rows-columns {
    display: grid;
    grid-template-rows: repeat(var(--profile-rows-count, 1), auto);
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-flow: column;
    column-gap: var(--space-7);
  }
  .profile-rows-columns > .profile-row.is-column-top {
    padding-top: 0;
    border-top: 0;
  }
  .profile-rows-columns > .profile-row.is-column-bottom {
    padding-bottom: 0;
  }
  .profile-rows-columns > .profile-row:last-child:not(.is-column-bottom) {
    padding-bottom: var(--space-3);
  }
}
.profile-monitor-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
  padding: var(--space-2) 0;
  border-top: 1px solid var(--border);
  cursor: pointer;
}
.profile-monitor-row .player-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.profile-tracking-details p {
  margin: var(--space-1) 0 0;
  color: var(--text-muted);
}
.invitation-detail-footer {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-2);
}
.invitation-detail-footer.has-excuse {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
@media (max-width: 639px) { /* --bp-md */
  .profile-row {
    grid-template-columns: minmax(0, 1fr) 8.5rem;
    gap: var(--space-3);
  }
  .profile-row.is-form {
    grid-template-columns: minmax(0, 1fr);
  }
  .profile-row.is-form .profile-row-action {
    justify-self: end;
    width: 8.5rem;
  }
  /* Two 8.5rem buttons side by side would squeeze the title on phones, so
     the pair stacks inside the regular action column. */
  .profile-row.has-action-pair .profile-row-action {
    grid-template-columns: 8.5rem;
  }
  .profile-identity {
    grid-template-columns: auto minmax(0, 1fr);
  }
  .profile-real-name {
    grid-column: 1 / -1;
  }
  .profile-row-main {
    gap: var(--space-2);
  }
  .profile-row-number {
    width: var(--space-3);
  }
}
/* Meine Statistiken: the event filter sits in the title row; key figures
   share one card as hairline-separated columns; every list is a row table
   with its value in a fixed right column. */
.my-stats-filter {
  width: 16rem;
  min-width: 0;
}
.my-stats-kpis {
  display: grid;
  grid-auto-columns: minmax(0, 1fr);
  grid-auto-flow: column;
}
.my-stats-kpi {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
  padding: 0 var(--space-4);
  border-left: 1px solid var(--border);
  text-align: center;
}
.my-stats-kpi:first-child {
  border-left: 0;
}
.my-stats-kpi-value {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  font-variant-numeric: tabular-nums;
}
.my-stats-kpi-label {
  color: var(--text-muted);
  font-size: var(--font-size-sm);
}
/* RankedList (frontend-contracts/components/ranked-list.md): flat hairline
   rows, value in a fixed right column, two columns read top to bottom from
   --bp-md. Rows side by side keep identical padding so they share one center
   line; the list absorbs the last row's bottom padding. */
.ranked-list {
  display: flex;
  flex-direction: column;
}
.ranked-list-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--ranked-list-value-width);
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-2) 0;
  border-top: 1px solid var(--border);
}
.ranked-list-row:first-child {
  padding-top: 0;
  border-top: 0;
}
.ranked-list-row:last-child {
  padding-bottom: 0;
}
.ranked-list-row.is-ranked {
  grid-template-columns: var(--space-6) minmax(0, 1fr) var(--ranked-list-value-width);
}
.ranked-list-row.has-lead {
  grid-template-columns: auto minmax(0, 1fr) var(--ranked-list-value-width);
}
.ranked-list-row.is-ranked.has-lead {
  grid-template-columns: var(--space-6) auto minmax(0, 1fr) var(--ranked-list-value-width);
}
.ranked-list-rank {
  color: var(--text-muted);
  font-weight: var(--font-weight-bold);
  font-variant-numeric: tabular-nums;
}
.ranked-list-lead {
  display: flex;
}
.ranked-list-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.ranked-list-title {
  overflow: hidden;
  font-weight: var(--font-weight-medium);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ranked-list-meta {
  color: var(--text-muted);
  font-size: var(--font-size-sm);
}
.ranked-list-value {
  font-weight: var(--font-weight-bold);
  font-variant-numeric: tabular-nums;
  text-align: right;
}
@media (min-width: 640px) { /* --bp-md */
  .ranked-list:not(.ranked-list--single) {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(var(--ranked-list-rows, 1), auto);
    grid-auto-flow: column;
    column-gap: var(--space-7);
    margin-bottom: calc(-1 * var(--space-2));
  }
  /* In two columns the right column starts at the break row, too. */
  .ranked-list:not(.ranked-list--single) > .ranked-list-row.is-column-top {
    padding-top: 0;
    border-top: 0;
  }
  .ranked-list:not(.ranked-list--single) > .ranked-list-row:last-child {
    padding-bottom: var(--space-2);
  }
}
@media (max-width: 639px) { /* --bp-md */
  .ranked-list {
    --ranked-list-value-width: var(--ranked-list-value-width-compact);
  }
  .ranked-list-row {
    gap: var(--space-3);
  }
  .ranked-list-row.is-ranked {
    grid-template-columns: var(--space-5) minmax(0, 1fr) var(--ranked-list-value-width);
  }
  .ranked-list-row.is-ranked.has-lead {
    grid-template-columns: var(--space-5) auto minmax(0, 1fr) var(--ranked-list-value-width);
  }
}
@media (max-width: 639px) { /* --bp-md */
  .more-subpage-title-row.my-stats-title-row {
    grid-template-columns: minmax(0, 1fr);
  }
  .my-stats-filter {
    width: 100%;
    margin-bottom: var(--space-3);
  }
  .my-stats-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-flow: row;
    row-gap: var(--space-4);
  }
  .my-stats-kpi:nth-child(odd) {
    border-left: 0;
  }
  /* A lone last figure (five with "Alle Events") spans the row. */
  .my-stats-kpi:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }
}
.player-assignment-row select {
  width: 100%;
}
.history-details {
  margin-top: var(--space-4);
}
.history-details + .history-details {
  margin-top: var(--space-3);
}
.matchmaking-draw-card {
  margin-bottom: var(--space-3);
}
.matchmaking-active-tournaments {
  margin-bottom: var(--space-4);
}
.matchmaking-open-draws {
  margin-top: var(--space-4);
}
.matchmaking-setup-head {
  display: grid;
  gap: var(--space-4);
}
.matchmaking-setup-head > div {
  min-width: 0;
}
.matchmaking-active-tournament-grid,
.matchmaking-history-teams {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-2);
}
.matchmaking-history-filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-4);
  margin-bottom: var(--space-3);
}
.matchmaking-history-item {
  margin-bottom: var(--space-2);
}
.matchmaking-history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.matchmaking-history-toggle {
  display: flex;
  align-items: center;
  flex: 1 1 auto;
  min-width: 0;
  min-height: var(--tap-target-size);
  gap: var(--space-2);
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.matchmaking-history-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.matchmaking-history-chevron {
  display: inline-flex;
  flex: 0 0 auto;
  color: var(--text-muted);
}
.matchmaking-history-toggle[aria-expanded='true'] .matchmaking-history-chevron {
  transform: rotate(90deg);
}
.matchmaking-history-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.matchmaking-history-meta {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2);
  font-size: var(--font-size-xs);
}
.matchmaking-history-details {
  margin-top: var(--space-3);
}
.matchmaking-history-team {
  min-width: 0;
  padding: var(--space-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
}
.matchmaking-history-team.is-loser {
  color: var(--text-muted);
}
.matchmaking-history-team-head {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}
.matchmaking-history-team-head > strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.matchmaking-history-team-head .team-skill-total,
.matchmaking-history-placement {
  flex-shrink: 0;
}
.matchmaking-history-placement {
  white-space: nowrap;
}
.matchmaking-history-team-head .lb-rank.is-first {
  color: var(--rank-1-gold);
}
.matchmaking-history-team-score {
  margin-left: auto;
  flex-shrink: 0;
  font-weight: var(--font-weight-bold);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.matchmaking-history-team-score.is-win,
.matchmaking-history-meta .is-win {
  color: var(--state-playing);
}
.matchmaking-history-players {
  margin-top: var(--space-1);
  font-size: var(--font-size-xs);
}
/* A recorded result whose players can still be removed lists them as rows,
   so every name gets its own trailing remove action. */
.matchmaking-history-player-rows {
  display: grid;
  gap: var(--space-1);
}
.matchmaking-history-player-rows .team-player-name {
  flex: 1;
}
.matchmaking-history-team-context {
  margin-top: var(--space-1);
  font-size: var(--font-size-xs);
}
.matchmaking-history-tournament-summary {
  margin-bottom: var(--space-3);
  font-size: var(--font-size-xs);
}
.matchmaking-history-more {
  display: flex;
  justify-content: center;
  margin-top: var(--space-3);
}
@media (max-width: 859px) { /* below --bp-lg */
  .matchmaking-history-toggle {
    display: grid;
    grid-template-columns: var(--space-4) minmax(0, 1fr);
    flex-basis: 100%;
  }
  .matchmaking-history-chevron {
    grid-row: 1 / 3;
  }
  .matchmaking-history-title,
  .matchmaking-history-meta {
    grid-column: 2;
  }
  .matchmaking-history-head .matchmaking-draw-actions {
    margin-left: auto;
  }
}
@media (min-width: 640px) { /* --bp-md */
  .matchmaking-active-tournament-grid,
  .matchmaking-history-teams {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (min-width: 640px) { /* --bp-md */
  .matchmaking-setup-head {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: end;
  }
}
@media (min-width: 860px) { /* --bp-lg */
  .matchmaking-setup-head .selection-toolbar {
    display: grid;
    grid-template-columns: auto auto auto;
    align-items: end;
  }
  .matchmaking-setup-head .selection-toolbar .field-label {
    grid-column: 1 / -1;
  }
  .matchmaking-history-teams {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .matchmaking-history-head {
    flex-wrap: nowrap;
  }
}
.matchmaking-draw-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  min-height: var(--control-height);
}
.matchmaking-draw-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}
/* Draw team names derive from player names (up to 30 characters, often one
   word), so the title shrinks and wraps inside the card instead of pushing the
   skill total and neighbouring cards aside. */
.matchmaking-draw-team-title {
  min-width: 0;
}
.matchmaking-draw-team-name {
  min-width: 0;
  overflow-wrap: anywhere;
}
.matchmaking-draw-team .team-card-header .tournament-fixture-score {
  padding-block: 0;
  line-height: var(--control-line-height);
}
.matchmaking-draw-team.is-loser .team-player-name,
.matchmaking-draw-team.is-loser .team-card-header {
  color: var(--text-muted);
}
.matchmaking-new-draw {
  margin-top: var(--space-4);
}
.matchmaking-new-draw-title {
  margin: 0 0 var(--space-3);
  font-size: var(--font-size-lg);
}
.captain-selection-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.captain-selection-group .field-label {
  margin-bottom: 0;
}
.draft-pool-player {
  width: 100%;
  color: inherit;
  font: inherit;
  text-align: left;
  background: var(--bg-elevated);
}
button.draft-pool-player {
  cursor: pointer;
}
@media (hover: hover) {
  button.draft-pool-player:hover {
    border-color: var(--accent);
    background: var(--bg-elevated-2);
  }
}
@media (min-width: 640px) { /* --bp-md */
  .player-selection-grid {
    grid-template-columns: repeat(auto-fit, minmax(var(--selection-card-min-width), 1fr));
  }
}

/* Tournament overview deliberately uses its available width: one or two
   entries stretch instead of reserving empty auto-fill columns, while player
   pickers cap at two cards per row from --bp-md and stack on phones. */
.tournament-detail-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: calc(var(--space-3) * -1);
  margin-bottom: var(--space-3);
}
.tournament-team-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-3);
}
.card-grid.tournament-list-grid {
  grid-template-columns: minmax(0, 1fr);
}
.collapsible-section-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: var(--space-3);
  min-height: var(--tap-target-size);
  margin-bottom: 0;
  cursor: pointer;
  list-style: none;
}
.collapsible-section-header > :nth-child(2) {
  flex: 1;
  min-width: 0;
}
.collapsible-section-header h2 {
  margin: 0;
  font-size: var(--font-size-lg);
}
.collapsible-section-header::-webkit-details-marker {
  display: none;
}
.collapsible-section[open] > .collapsible-section-header {
  margin-bottom: var(--space-3);
}
.collapsible-section-summary-end {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  margin-left: auto;
}
.collapsible-section-chevron {
  display: inline-flex;
  flex: 0 0 auto;
  color: var(--text-muted);
  transition: transform var(--motion-fast);
}
.collapsible-section[open] > .collapsible-section-header > .collapsible-section-chevron {
  transform: rotate(90deg);
}
.tournament-list-result {
  font-size: var(--font-size-xs);
  color: var(--text);
}
.tournament-list-section .tournament-list-card {
  background: var(--bg-elevated-2);
}
.tournament-list-card {
  width: 100%;
  min-height: calc(var(--row-min-h) + var(--space-4));
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-3);
  text-align: left;
  cursor: pointer;
}
.tournament-list-card-main,
.tournament-list-card-end {
  display: flex;
}
.tournament-list-card-main {
  min-width: 0;
  flex-direction: column;
  gap: var(--space-1);
}
.tournament-list-card-main .player-name {
  overflow-wrap: anywhere;
}
.tournament-list-game,
.tournament-list-meta {
  font-size: var(--font-size-xs);
}
.tournament-list-card-end {
  align-items: center;
  gap: var(--space-2);
}
/* Player cards carry checkbox, avatar, name and skill value — two of them
   per phone row leave no readable room for the name, so the two-column cap
   only applies from --bp-md (phones keep the base single column). */
@media (min-width: 640px) { /* --bp-md */
  .player-selection-grid.tournament-player-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
.tournament-section-panel {
  position: relative;
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}
.tournament-section-panel::before {
  content: '';
  position: absolute;
  inset: var(--space-3) auto var(--space-3) 0;
  width: var(--space-1);
  border-radius: 0 var(--radius-full) var(--radius-full) 0;
  background: var(--accent-gradient);
}
/* The catalog keeps one stable toolbar. Variable-length filter choices move
   into a menu instead of producing a different set of rows on every width. */
.game-catalog-toolbar {
  display: grid;
  grid-template-columns: minmax(10rem, 1fr) repeat(2, 9.5rem);
  align-items: center;
  gap: var(--space-2);
}
.game-catalog-sort-menu,
.game-catalog-filter-menu {
  width: 100%;
}
.game-catalog-sort-trigger,
.game-catalog-filter-trigger {
  justify-content: space-between;
  width: 100%;
  min-width: 0;
  text-align: left;
}
.game-catalog-sort-trigger {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
}
.game-catalog-sort-trigger .ui-icon,
.game-catalog-filter-trigger .ui-icon {
  width: 14px;
  height: 14px;
  color: var(--text-muted);
}
.game-catalog-sort-menu[open] > summary svg,
.game-catalog-filter-menu[open] > summary svg {
  transform: rotate(180deg);
}
.game-catalog-sort-panel {
  left: 0;
  right: auto;
  width: 100%;
  gap: var(--space-1);
  padding: var(--space-2);
  border-radius: var(--radius);
}
.game-catalog-sort-option {
  width: 100%;
  border-color: transparent;
  background: transparent;
}
.game-catalog-sort-option.is-active {
  color: var(--accent);
  background: var(--accent-bg);
}
.game-catalog-filter-panel {
  width: min(16rem, calc(100vw - var(--space-8)));
  gap: var(--space-3);
  padding: var(--space-3);
}
.game-catalog-filter-section {
  gap: var(--space-2);
}
.game-catalog-filter-section + .game-catalog-filter-section {
  padding-top: var(--space-3);
  border-top: 1px solid var(--border);
}
.game-catalog-filter-heading {
  color: var(--text);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
}
.game-catalog-filter-reset {
  align-self: flex-start;
}
.check-row.game-detail-seat-option {
  margin: calc(-1 * var(--space-1)) 0 0;
  padding-block: 0 var(--space-2);
}
.game-detail-info-field textarea {
  display: block;
}
.section-title.game-detail-process-title {
  margin: 0;
}
@media (max-width: 639px) { /* --bp-md */
  .game-catalog-toolbar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .game-catalog-toolbar > input[type='search'] {
    grid-column: 1 / -1;
  }
  .game-catalog-sort-menu .game-catalog-sort-panel,
  .game-catalog-filter-menu .game-catalog-filter-panel {
    position: fixed;
    inset: auto var(--space-3) calc(var(--shell-bottom-inset) + var(--space-3));
    width: auto;
    max-width: none;
    max-height: calc(100dvh - var(--topbar-height) - var(--shell-bottom-inset) - var(--space-8));
    overflow-y: auto;
    border-radius: var(--radius);
  }
}
.tournament-group-stage {
  display: grid;
  gap: var(--space-4);
  margin-top: var(--space-4);
}
.tournament-groups-grid {
  display: grid;
  gap: var(--space-4);
}
@media (min-width: 640px) { /* --bp-md */
  .tournament-groups-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
.tournament-round-panel > .section-title {
  margin: 0;
}
.tournament-group-panel > .section-title {
  margin-top: 0;
}
.tournament-team-preview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-3);
}
.tournament-draft-team {
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.tournament-draft-team.is-drag-target {
  border-color: var(--accent);
  background: var(--bg-elevated-2);
}
.tournament-drag-player {
  width: 100%;
  margin: 0;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: inherit;
  font-size: inherit;
  text-align: left;
  cursor: grab;
}
.tournament-drag-player:active {
  cursor: grabbing;
}
.tournament-drag-player.is-dragging {
  opacity: 0.45;
}
.tournament-option-label {
  flex: 1;
}
.tournament-option-label label {
  cursor: pointer;
}
.tournament-lobby-matchup {
  color: var(--text);
  font-size: var(--font-size-md);
}
.tournament-lobby-access {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.tournament-lobby-credential {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) var(--tap-target-size);
  align-items: center;
  flex: 1 1 var(--selection-card-min-width);
  gap: var(--space-2);
  padding: var(--space-1) var(--space-1) var(--space-1) var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
}
.tournament-lobby-credential span {
  color: var(--text-muted);
  font-size: var(--font-size-xs);
}
.tournament-lobby-credential strong {
  color: var(--text);
  font-size: var(--font-size-lg);
  line-height: var(--line-height-tight);
}
.tournament-lobby-copy {
  width: var(--tap-target-size);
  min-height: var(--control-height);
  flex: 0 0 var(--tap-target-size);
  color: var(--text-muted);
}
@media (hover: hover) {
  .tournament-lobby-copy:hover {
    color: var(--accent);
    background: var(--bg-elevated-2);
  }
}
.tournament-team-card .team-card-header .muted {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-regular);
}
.tournament-team-card-heading {
  min-width: 0;
}
.tournament-team-card-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tournament-board-panel {
  overflow: hidden;
}
@media (min-width: 640px) { /* --bp-md */
  .card-grid.tournament-list-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .tournament-list-grid .tournament-list-card:only-child {
    grid-column: 1 / -1;
  }
  .tournament-team-grid,
  .tournament-team-preview-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (min-width: 860px) { /* --bp-lg */
  .tournament-team-grid,
  .tournament-team-preview-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (hover: hover) {
  .tournament-drag-player:hover {
    background: var(--bg-elevated-2);
  }
}

/* ---------- Custom date/time field (server/public/js/dateTimeField.js) ----------
   One manually editable date plus one time field, backed by the shared dark
   calendar. Paired instances additionally communicate a real date range. */
.dt-field {
  min-width: 0;
  container-type: inline-size;
}
.dt-inputs {
  display: flex;
  align-items: stretch;
  gap: var(--space-2);
  min-width: 0;
}
.dt-date-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--tap-target-size);
  gap: var(--space-2);
  flex: 1 1 180px;
  min-width: 0;
}
.dt-date-input {
  width: 100%;
  border-radius: var(--radius-sm);
}
.dt-calendar-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--tap-target-size);
  min-height: var(--control-height);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated-2);
  color: var(--text-muted);
}
@media (hover: hover) {
  .dt-calendar-btn:hover {
    background: var(--bg-elevated-2);
    color: var(--text);
  }
}
.dt-time-input {
  flex: 0 0 88px;
  width: 88px;
  text-align: center;
}
.dt-clear-btn {
  flex: 0 0 var(--tap-target-size);
  color: var(--text-muted);
}
.dt-error {
  margin: var(--space-1) 0 0;
  color: var(--danger);
  font-size: var(--font-size-sm);
}
.dt-date-input[aria-invalid='true'],
.dt-time-input[aria-invalid='true'] {
  border-color: var(--danger);
}

/* A date, 44px calendar action and time cannot stay legible in the narrow
   half of a paired form. React to the component's own width (not only the
   viewport) and give the date row the full available width. A date-only
   field has no time input and keeps its clear action on the same line. */
@container (max-width: 280px) {
  .dt-field:not([data-dt-date-only='true']) .dt-inputs {
    flex-wrap: wrap;
  }
  .dt-field:not([data-dt-date-only='true']) .dt-date-control {
    flex-basis: 100%;
  }
}

.dt-popover {
  width: var(--date-picker-width);
  max-width: calc(100vw - 2 * var(--space-2));
  z-index: 80;
  box-shadow: var(--shadow);
}
.dt-popover-header {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  margin-bottom: var(--space-2);
}
.dt-popover-month-year {
  display: flex;
  flex: 1;
  min-width: 0;
  gap: var(--space-1);
}
.dt-popover-month-year select {
  min-width: 0;
  padding: var(--space-1) var(--space-2);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  text-align: center;
  text-align-last: center;
}
.dt-popover-month-year .dt-month-select {
  flex: 1.4;
}
.dt-popover-month-year .dt-year-select {
  flex: 1;
}
.dt-calendar {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}
.dt-calendar th {
  font-size: var(--font-size-2xs);
  color: var(--text-muted);
  font-weight: var(--font-weight-medium);
  padding-bottom: var(--space-2);
}
.dt-calendar abbr {
  text-decoration: none;
}
.dt-calendar td {
  text-align: center;
  padding: var(--space-1);
}
.dt-day {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: var(--font-size-sm);
  cursor: pointer;
}
.dt-day:disabled {
  color: var(--state-offline);
  cursor: not-allowed;
  opacity: 0.55;
}
.dt-day-filler {
  cursor: default;
  pointer-events: none;
}
@media (hover: hover) {
  .dt-day:not(:disabled):hover {
    background: var(--bg-elevated-2);
  }
}
.dt-day-today {
  box-shadow: inset 0 0 0 1px var(--accent);
}
.dt-day-selected {
  background: var(--accent-gradient);
  color: var(--accent-text);
  font-weight: var(--font-weight-bold);
}
.dt-day-in-range:not(.dt-day-selected) {
  background: var(--accent-bg);
}
.dt-popover .btn-block {
  margin-top: var(--space-2);
}

@media (max-width: 640px) { /* --bp-md */
  .dt-inputs {
    flex-wrap: wrap;
  }
  .dt-date-control {
    flex-basis: calc(100% - var(--tap-target-size) - var(--space-2));
  }
  /* The time grows to the row width on phones; it then starts at the
     same left edge as the date above it instead of floating centered. */
  .dt-time-input {
    flex: 1 1 88px;
    width: auto;
    text-align: left;
  }
  .dt-popover {
    right: var(--space-2);
    bottom: var(--space-2);
    left: var(--space-2);
    width: auto;
    max-width: none;
    border-radius: var(--radius-lg);
  }
}

.stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.notice {
  margin: 0;
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated-2);
  color: var(--text-muted);
  font-size: var(--font-size-sm);
}
.notice-warning {
  border-color: var(--state-paused);
  background: var(--state-paused-bg);
  color: var(--state-paused);
}
.grid {
  display: grid;
  gap: var(--space-3);
}

/* Same idea as .stack (a plain vertical list of cards) but reflows into
   multiple columns once there's room for it — for lists of fairly uniform,
   lightweight cards (players, games, tournaments, the "Mehr" hub) where a
   single column just wastes a wide screen. Kept as its own class rather
   than making .stack responsive everywhere, since .stack is also used for
   things that must stay single-column regardless of width (form fields
   inside a card, a settings page's stacked sections, ...). */
.card-grid {
  display: grid;
  gap: var(--space-3);
  grid-template-columns: 1fr;
}
@media (min-width: 640px) { /* --bp-md */
  .card-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  }
  .card-grid.more-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.view-title {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-black);
  margin: var(--space-1) 0 var(--space-4);
}

/* Untabbed page headers always occupy the same compact row. This preserves
   the 124px first-card edge on both phone and laptop instead of letting the
   smaller phone title line shorten only some views by a few pixels. */
.view-container > .view-title,
.page-title-row {
  min-height: var(--tap-target-size);
  margin-bottom: var(--space-2);
}
.view-container > .view-title {
  display: flex;
  align-items: center;
  margin-top: 0;
}
.page-title-row {
  align-items: center;
}
.page-title-row .view-title {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

/* Untabbed secondary destinations reached from "Mehr" or Admin use the same
   compact title row as the main navigation. Orga reserves a second row for its
   five area tabs on phone and laptop layouts. */
.more-subpage-header {
  display: flex;
  flex-direction: column;
  margin-bottom: var(--space-2);
}
.more-subpage-title-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  min-height: var(--tap-target-size);
  align-items: center;
  gap: var(--space-2);
}
.more-subpage-title-row .view-title {
  min-width: 0;
  margin: 0;
}
/* Keep a trailing header action inside the phone viewport when a long title
   and its help trigger cannot share one row with it. */
@media (max-width: 479px) { /* --bp-sm */
  .more-subpage-title-row--stack-action {
    grid-template-columns: minmax(0, 1fr);
  }
  .more-subpage-title-row--stack-action > .btn:last-child {
    justify-self: end;
  }
}
.more-subpage-header--tabs {
  min-height: calc(var(--tap-target-size) + var(--tap-target-size) + var(--space-2));
  gap: var(--space-2);
  margin-bottom: 0;
}
.orga-page-title {
  display: none;
}
@media (max-width: 639px) { /* --bp-md */
  .more-subpage-header--tabs {
    min-height: calc(var(--tap-target-size) + var(--tap-target-size) + var(--tap-target-size) + var(--space-1));
  }
}
@media (min-width: 1280px) { /* --bp-xl */
  :root[data-layout-mode='desktop'] .more-subpage-header--tabs {
    min-height: 0;
    margin-bottom: var(--space-2);
  }
  :root[data-layout-mode='desktop'] .more-subpage-header--tabs .section-tabs,
  :root[data-layout-mode='desktop'] .orga-area-title {
    display: none;
  }
  :root[data-layout-mode='desktop'] .orga-page-title {
    display: inline;
  }
}

/* Tabbed areas keep their tabs on a dedicated second header row. Match and
   Auswertung always use it; Orga uses it on phone and laptop layouts. */
.section-page-header {
  display: flex;
  min-height: calc(var(--tap-target-size) + var(--tap-target-size) + var(--space-2));
  flex-direction: column;
  align-items: stretch;
  gap: var(--space-2);
}
.section-page-header .view-title {
  display: flex;
  min-height: var(--tap-target-size);
  align-items: center;
  margin: 0;
}
.more-subpage-header--tabs .section-tabs,
.section-page-header .section-tabs {
  margin: 0;
}

.section-title {
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-bold);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin: var(--space-5) 0 var(--space-2);
}

/* Tab row of a merged top-level area (Match, Auswertung, compact Orga — see
   sectionNav.js). Each tab is a real route, so this is navigation, not a
   filter: the active tab carries aria-current="page" plus the primary button
   treatment. It sits directly under the area title, outside any card, which is
   what keeps it distinguishable from the in-card control rows further down. */
.section-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: calc(-1 * var(--space-2)) 0 var(--space-4);
}
/* Phones share the full width so every tab keeps a comfortable tap target. */
.section-tab {
  flex: 1 1 auto;
}
/* On a wide column, stretching two tabs across 1080px would make them read as
   banners instead of navigation — from here they size to their own label. */
@media (min-width: 640px) { /* --bp-md */
  .section-tab {
    flex: 0 0 auto;
  }
}

.title-with-info {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

/* The tour action remains immediately beside its heading at every width. */
.area-tour-heading {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}
.area-tour-heading > .icon-btn {
  flex-shrink: 0;
}
.title-with-info .field-label {
  margin: 0;
}
.food-order-paypal-label {
  position: relative;
  display: block;
  width: fit-content;
  max-width: 100%;
  margin-bottom: var(--space-1);
  padding-right: calc(var(--control-height) + var(--space-1));
}
.food-order-paypal-label .field-label {
  margin: 0;
}
.food-order-paypal-label .info-tooltip {
  position: absolute;
  top: calc((1em - var(--control-height)) / 2);
  right: 0;
}
.info-tooltip {
  position: relative;
  display: inline-flex;
  align-items: center;
}
/* Square target instead of the 44px icon-button width: the trigger belongs to
   the label it explains, and a 44px box parks the glyph 18px away from the
   text it points at — far enough that it reads as a separate control in a row
   rather than as part of the title. The square keeps the glyph 12px from the
   text in every context and stays well above the 24px minimum target size. */
.info-tooltip-trigger {
  width: var(--control-height);
  min-height: var(--control-height);
  min-width: var(--control-height);
  line-height: var(--control-line-height);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-1);
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  cursor: default;
}
/* A <button> does not inherit the app font size, so the 1.2em glyph resolves
   against the UA button default and is uniform only by accident. Pin it, or a
   later font-size on the trigger would silently move the glyph in every
   context at once. */
.info-tooltip-trigger .ui-icon {
  width: 16px; /* design-token-ok: pinned info glyph, keeps the established 16px that the UA button font produced */
  height: 16px; /* design-token-ok: pinned info glyph, keeps the established 16px that the UA button font produced */
}
.info-tooltip-trigger[aria-expanded='true'] {
  color: var(--accent);
  background: var(--bg-elevated-2);
}
.info-tooltip-trigger--warning {
  color: var(--danger);
}
.info-tooltip-trigger--warning[aria-expanded='true'] {
  color: var(--danger);
  background: var(--danger-bg);
}
.info-tooltip-panel {
  position: fixed;
  z-index: 20;
  pointer-events: none;
  width: min(var(--info-popover-max-width), calc(100vw - var(--space-4)));
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated-2);
  box-shadow: var(--shadow);
  color: var(--text);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-regular);
  line-height: 1.45;
  text-transform: none;
  letter-spacing: normal;
}
@media (hover: hover) {
  .info-tooltip-trigger:hover {
    color: var(--accent);
    background: var(--bg-elevated-2);
  }
  .info-tooltip-trigger--warning:hover {
    color: var(--danger);
    background: var(--danger-bg);
  }
}
/* Scoped to a direct child of the view container (i.e. actually the first
   thing on the page) — NOT a bare `.section-title:first-child`, which would
   also match a section-title that merely happens to be the first child of
   some unrelated wrapper (e.g. a `.row-between` pairing it with a button).
   That mismatch is exactly what left headings like "Sitznachbarn" glued to
   whatever came before them: the wrapper isn't the top of the page, but the
   selector couldn't tell the difference and zeroed the margin anyway. */
.view-container > .section-title:first-child {
  margin-top: 0;
}

/* ---------- Cards ---------- */

.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--card-padding);
  /* Faint top highlight for a bit of glass-like depth — cheap (no extra
     element/image), barely visible on its own, but adds polish. */
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

/* A card's primary action(s), set off from a long preceding list (vote game
   rows, player-selection grids, ...) with a hairline divider. Scrolls with
   the page like any other card content — no longer pinned to the viewport
   (see GitHub issue 557: a fixed bar over a scrolling list briefly covered
   whatever row passed behind it, which was worse than just scrolling a
   little further to reach the button). */
.card-footer-actions {
  padding-top: var(--space-3);
  border-top: 1px solid var(--border);
}

/* Cards that ARE buttons (game rows, tournament list, "Mehr" hub): lift
   slightly on hover so tappable rows are distinguishable from static cards
   on a laptop without needing extra affordance on touch. */
button.card {
  transition: border-color 0.15s ease, transform 0.15s ease, background-color 0.15s ease;
}
@media (hover: hover) {
  button.card:hover {
    border-color: rgba(91, 140, 255, 0.55);
    background: var(--bg-elevated-2);
    transform: translateY(-1px);
  }
}

/* A single-line, icon-led, tappable list row — the shared shape behind the
   Spieler/Spiele/Turniere lists and the "Mehr" hub. Centralizing this (they
   used to each repeat their own inline `style="width:100%;..."`) is what
   guarantees they're actually the same height as each other rather than
   whatever their individual content happened to produce. */
.list-row {
  width: 100%;
  text-align: left;
  cursor: pointer;
  min-height: var(--row-min-h);
}
.list-row-icon {
  width: var(--row-icon-size);
  height: var(--row-icon-size);
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-2xl);
  line-height: var(--line-height-tight);
}
/* Reserves space for a 2-line description so repeated status and overview
   cards stay the same height when individual blurbs wrap differently. */
.list-row-desc {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.4em;
  font-size: var(--font-size-xs);
}
.home-current-row {
  display: flex;
  align-items: stretch;
  overflow: hidden;
  padding: 0;
  cursor: default;
}
.home-current-items {
  display: grid;
  gap: var(--space-2);
}
.home-current--compact .home-current-items,
.home-compact-items {
  display: grid;
  gap: var(--space-1);
}
.home-current--compact .home-current-items {
  gap: 0;
}
.home-live-grid {
  /* Include both borders so a game subtitle fits without growing its row. */
  --home-player-row-height: calc(var(--tap-target-size) + var(--space-8) + 2px);
  grid-auto-rows: minmax(var(--home-player-row-height), auto);
}
.home-current--compact {
  padding-block: var(--space-3);
}
/* "Meine To-Dos" borrows the compact rows but keeps the standard card inset,
   so its heading lines up with the first card of every other area. */
.home-current--compact[data-home-assigned-todos] {
  padding-block: var(--space-4);
}
.home-current--compact .home-current-row {
  min-height: var(--tap-target-size);
}
.home-current--compact .home-current-navigate {
  min-height: var(--tap-target-size);
  padding: var(--space-1) var(--space-3);
}
.home-current--compact .home-current-copy,
.home-todo-navigate .home-current-copy {
  flex-direction: row;
  align-items: baseline;
  gap: var(--space-3);
}
.home-current--compact .list-row-desc,
.home-todo-navigate .list-row-desc {
  display: block;
  min-height: 0;
  margin-left: auto;
  white-space: nowrap;
}
@media (max-width: 479px) { /* --bp-sm */
  .home-current--compact .home-current-copy,
  .home-todo-navigate .home-current-copy {
    flex-direction: column;
    gap: 0;
  }
  .home-current--compact .list-row-desc,
  .home-todo-navigate .list-row-desc {
    margin-left: 0;
  }
}
/* "Meine To-Dos" rows keep the navigating copy and add a trailing action
   slot (Bezahlen, Bezahlt, Eintragen, Annehmen, Erledigt, Beenden). On
   phones the actions move below the copy instead of squeezing the title. */
.home-todo-row {
  flex-wrap: wrap;
  align-items: center;
}
/* The row clips its hover background; an open answer menu has to reach
   beyond it. */
.home-todo-row:has(.action-menu[open]) {
  overflow: visible;
}
.home-todo-actions {
  display: flex;
  flex-shrink: 0;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-2);
  margin-left: auto;
  padding: var(--space-1) var(--space-3);
}
@media (max-width: 479px) { /* --bp-sm */
  .home-todo-actions {
    width: 100%;
    padding-top: 0;
  }
}
.home-current-navigate {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
  min-height: var(--row-min-h);
  flex: 1;
  padding: var(--card-padding);
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.home-current-copy {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
}
@media (hover: hover) {
  .home-current-navigate:hover {
    background: var(--bg-elevated-2);
  }
  .home-current-row:has(.home-current-navigate:hover) {
    border-color: var(--accent);
  }
  .home-current--compact .home-current-row:has(.home-current-navigate:hover) {
    border-color: transparent;
  }
}
.more-card {
  display: grid;
  grid-template-columns:
    calc(var(--row-icon-size) + var(--space-2)) minmax(0, 1fr)
    calc(var(--row-icon-size) + var(--space-2));
  align-items: center;
  min-height: calc(var(--row-min-h) + var(--space-5));
  gap: 0;
  padding: var(--space-5);
}
.more-card-label {
  grid-column: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  gap: var(--space-3);
}
.more-card .list-row-icon {
  width: calc(var(--row-icon-size) - var(--space-1));
  height: calc(var(--row-icon-size) - var(--space-1));
}
.more-card .list-row-icon .ui-icon {
  width: calc(var(--row-icon-size) - var(--space-1));
  height: calc(var(--row-icon-size) - var(--space-1));
}
.more-card .player-name {
  font-size: var(--font-size-lg);
}
.more-card-title {
  min-width: 0;
  text-align: center;
}
.more-card-chevron {
  grid-column: 3;
  width: calc(var(--row-icon-size) + var(--space-2));
  height: calc(var(--row-icon-size) + var(--space-2));
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
/* Spiele view (gameCatalog.js): one compact table-like row per game. A real
   <table> would need horizontal scroll on a phone (the lesson from the old
   .catalog-table), so it's a CSS grid: name/Bock/Skill as columns on wide
   screens; on a phone Bock and Skill stack below the name, each with the full
   width for its 0-5 number scale. .game-row-sliders becomes display:contents
   on wide screens. */
.game-table {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.game-table-row {
  display: grid;
  grid-template-areas:
    'name'
    'sliders';
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  padding: var(--space-2) var(--space-4);
  overflow: hidden;
}
.game-row-name {
  grid-area: name;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}
.game-row-detail-trigger {
  justify-content: flex-start;
  padding-inline-end: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
}
@media (hover: hover) {
  .game-row-detail-trigger:hover:not(:disabled) {
    color: var(--accent);
  }
}
/* Optional genre tag directly after the action group. It gives way before the
   action slots on narrow rows, so the game name and every control remain usable. */
.game-row-genre {
  flex: 0 1 auto;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--font-size-xs);
}
@media (max-width: 639px) { /* --bp-md */
  .game-row-name {
    flex-wrap: wrap;
    row-gap: 0;
  }
  .game-row-detail-trigger {
    padding-inline-start: 0;
  }
  .game-row-genre {
    flex-basis: 100%;
    padding-inline-start: 0;
  }
}
/* "Vorschlag" marker, only rendered in the mixed "Alle" list where catalog
   games and suggestions sit side by side. Unlike the genre tag it must not
   give way on narrow rows — it is the row's status, not a detail. Icon-only
   (see gameRowHtml in gameCatalog.js) so the status reads at a glance
   without spelling the word out on every row; the icon carries an
   accessible name and a native title for that. */
.game-row-status-badge {
  flex: 0 0 auto;
}
/* Same status, reinforced on the row itself so it doesn't depend on
   noticing the small badge alone: a border plus inset shadow in the
   paused/amber color already tied to "Vorschlag" everywhere else. */
.game-table-row.is-suggestion {
  border-color: var(--state-paused);
  box-shadow: inset 0 0 0 1px var(--state-paused);
}
/* Static (non-interactive) marker for "agent can detect this game", reusing
   the same green already used for "spielt"/"trackt gerade" elsewhere so the
   color itself carries the meaning at a glance. Sized to match the glyph
   weight of the row's other icons (.game-icon-btn) instead of the smaller
   default — otherwise it reads as a stray, oddly tiny mark next to them. */
.game-track-indicator {
  display: inline-flex;
  flex: 0 0 auto;
  width: var(--control-height);
  min-height: var(--control-height);
  align-items: center;
  justify-content: center;
  color: var(--state-playing);
}
.game-track-indicator .ui-icon {
  width: 18px;
  height: 18px;
}
/* Plattform, Trailer and the tracking hint follow the game details directly.
   Catalog links use the documented compact 32px slots, so the visible glyphs
   and the non-interactive tracking marker read as one compact group. */
.game-row-links {
  display: inline-flex;
  align-items: center;
  gap: 0;
}
.game-icon-btn {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: var(--control-height);
  min-height: var(--control-height);
  border-radius: var(--radius-sm);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
}
@media (hover: hover) {
  .game-icon-btn:hover {
    color: var(--accent);
  }
}
.game-row-sliders {
  grid-area: sliders;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
}
/* On a phone the Ø note gets its own always-reserved line inside each rating
   cell — inline it would wrap only when present, and rows in the same list
   must never end up with different heights (see CLAUDE.md list rules). */
@media (max-width: 639px) { /* --bp-md */
  .game-table-row .game-avg-note {
    display: block;
    width: 100%;
    min-height: 1.1rem;
  }
}
@media (min-width: 640px) { /* --bp-md */
  .game-table-row {
    grid-template-areas: 'name bock skill';
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) minmax(0, 1fr);
    column-gap: var(--space-4);
  }
  .game-row-sliders {
    display: contents;
  }
  .game-row-bock {
    grid-area: bock;
    min-width: 0;
  }
  .game-row-skill {
    grid-area: skill;
    min-width: 0;
  }
}
.game-avg-note {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-regular);
}
/* Skill-Vorschlag chip (derived from match results, see skillSuggestion.ts):
   tappable, not just a label — clicking applies it. No pill background/
   border, unlike .chip — it sits inline in the Skill row's label line right
   next to the Ø note, so a filled pill there reads as a second, competing
   button rather than part of that line. The accent color plus icon carry
   the "tap me" affordance instead. Highlighted when it diverges 2+ points
   from the player's own self-rating — a gentle nudge to reconsider, not a
   claim that the derived number is "more right". */
.skill-suggestion-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  background: none;
  border: none;
  padding: 0;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  color: var(--accent-3);
  cursor: pointer;
}
.skill-suggestion-chip .ui-icon {
  width: 14px;
  height: 14px;
}
/* The brain glyph's own visual mass sits slightly above center within its
   viewBox, so flex-centering the icon box alone still reads as a hair too
   high next to the chip's number/the Ø note beside it. */
.skill-suggestion-icon {
  transform: translateY(1px);
}
@media (hover: hover) {
  .skill-suggestion-chip:hover {
    color: var(--accent);
  }
}
.skill-suggestion-chip-diverges {
  color: var(--state-playing);
  font-weight: var(--font-weight-bold);
}
.arrivals-layout {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-width: 0;
}
.arrivals-block > .section-title {
  margin-top: 0;
}
.arrival-note-input {
  min-height: var(--control-height);
}
/* The collapsible times card follows the page rhythm, not the extra
   history offset. */
.arrivals-layout > .history-details {
  margin-top: 0;
}
.arrivals-form-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
}
.arrivals-member-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}
.arrivals-member-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--row-icon-size);
  min-width: 0;
}
.arrivals-member-row + .arrivals-member-row {
  border-top: 1px solid var(--border);
}
.arrivals-member-row .player-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.arrivals-member-role {
  margin-left: auto;
  flex-shrink: 0;
  color: var(--text-muted);
  font-size: var(--font-size-sm);
}
/* The long direction title wraps on phones; the header action keeps one line. */
.arrivals-carpool-section > .grouped-page-section-title > .btn {
  flex-shrink: 0;
  white-space: nowrap;
}
/* "Frei" lines up with the member names next to the avatar column. */
.arrivals-free-seat-row {
  padding-left: calc(var(--avatar-size-sm) + var(--space-2));
}
.arrivals-carpool-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-3);
}
.arrivals-carpool-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}
.arrivals-carpool-title {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-width: 0;
}
.arrivals-carpool-title > strong {
  overflow-wrap: anywhere;
}
.arrivals-carpool-meta {
  font-size: var(--font-size-sm);
}
.arrivals-carpool-action {
  display: inline-flex;
  flex-shrink: 0;
}
/* Bearbeiten/Eintragen/Austragen match the bordered "Aktion" menu trigger. */
.arrivals-carpool-action > .btn {
  border: 1px solid var(--border);
}
.arrivals-mobile-sort {
  display: none;
}
.arrivals-times-header,
.arrivals-times-row {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) repeat(2, minmax(0, 1fr));
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) 0;
}
.arrivals-times-row {
  border-top: 1px solid var(--border);
}
.arrivals-times-header {
  padding-top: 0;
  color: var(--text-muted);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.arrivals-sort-button,
.player-detail-sort-button {
  display: inline-flex;
  min-height: var(--control-height);
  align-items: center;
  gap: var(--space-1);
  min-width: 0;
  padding: 0;
  border: 0;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  background: transparent;
  cursor: pointer;
}
.arrivals-sort-button.is-active,
.player-detail-sort-button.is-active {
  color: var(--text);
}
.arrivals-sort-button .ui-icon,
.player-detail-sort-button .ui-icon {
  width: 1em;
  height: 1em;
}
.arrivals-times-player {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}
.arrivals-times-name {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.arrivals-times-player .player-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.arrivals-times-note,
.arrivals-times-driver {
  font-size: var(--font-size-xs);
  overflow-wrap: anywhere;
}
.arrivals-times-value {
  display: flex;
  flex-direction: column;
  min-width: 0;
  font-size: var(--font-size-sm);
}
.arrivals-times-value strong {
  font-weight: var(--font-weight-medium);
}
@media (hover: hover) {
  .arrivals-sort-button:hover {
    color: var(--accent);
  }
}
@media (min-width: 640px) { /* --bp-md */
  .two-column-card-grid.arrivals-carpool-grid > :only-child,
  .two-column-card-grid.arrivals-carpool-grid > :last-child:nth-child(odd),
  .two-column-card-grid.home-live-grid > :last-child:nth-child(odd) {
    /* Entity cards (carpools, player status) keep sibling width; an
       odd final card must not stretch across the full row. */
    grid-column: auto;
  }
  /* The live board reads like every list: the left column fills top to
     bottom before the next one starts (row counts set by home.js). */
  .two-column-card-grid.home-live-grid {
    grid-template-rows: repeat(var(--home-live-rows-2, 1), minmax(var(--home-player-row-height), auto));
    grid-auto-flow: column;
  }
}
@media (max-width: 639px) { /* --bp-md */
  .arrivals-mobile-sort {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-2);
  }
  .arrivals-mobile-sort .arrivals-sort-button {
    min-height: var(--control-height);
    padding: 6px var(--space-3); /* design-token-ok: 32px compact sorting control with its border and 1.25 line box */
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    text-transform: none;
    background: var(--bg-elevated-2);
  }
  .arrivals-mobile-sort .arrivals-sort-button.is-active {
    border-color: var(--accent);
    color: var(--text);
  }
  .arrivals-times-header {
    display: none;
  }
  .arrivals-times-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    gap: var(--space-2) var(--space-3);
  }
  .arrivals-times-player {
    grid-column: 1 / -1;
  }
  .arrivals-times-value {
    padding-left: calc(var(--avatar-size-sm) + var(--space-2));
  }
  .arrivals-times-value + .arrivals-times-value {
    padding-left: 0;
  }
  .arrivals-times-value::before {
    content: attr(data-label);
    color: var(--text-muted);
    font-size: var(--font-size-xs);
  }
}

/* Invite dialog: the link field fills the row's text column, the QR code
   opens as its own centered row below its toggle. The QR SVG draws its own
   white background, needed for scanning regardless of theme. */
.profile-row-main > .invite-link-field {
  flex: 1;
  min-width: 0;
  font-family: monospace;
}
.admin-invite-qr {
  display: flex;
  justify-content: center;
  padding: var(--space-3) 0;
  border-top: 1px solid var(--border);
}
.admin-invite-qr[hidden] {
  display: none;
}
.admin-invite-qr svg {
  width: min(100%, 240px); /* design-token-ok: QR size readable for phone cameras */
  height: auto;
  border-radius: var(--radius-sm);
}
.admin-register-invite-note {
  margin: 0;
  font-size: var(--font-size-sm);
}
.invite-qr-modal {
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-backdrop.invite-qr-backdrop {
  align-items: center;
}
.invite-qr-backdrop .modal {
  border-radius: var(--radius-lg);
  animation-name: dialog-in;
  animation-duration: 0.18s;
}
.invite-qr-modal svg {
  border-radius: var(--radius);
  overflow: hidden;
  max-width: 100%;
  height: auto;
  padding: var(--space-3);
  background: #ffffff; /* design-token-ok: QR codes need a true-white quiet zone for reliable scanning */
}

.empty-state {
  text-align: center;
  padding: var(--space-8) var(--space-4);
  color: var(--text-muted);
}
.empty-state-compact {
  padding: var(--space-4);
}
input[type='text'].invite-link-field {
  font-size: var(--font-size-xs);
}
.empty-state-structured {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
}
.empty-state-actions {
  margin-top: var(--space-1);
}
.mascot {
  display: block;
  margin: 0 auto var(--space-2);
  animation: mascot-bob 2.4s ease-in-out infinite;
}
@keyframes mascot-bob {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-5px);
  }
}
/* One switch for every animation/transition in the file — anyone who asked
   their OS for reduced motion gets a fully static UI. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------- Player avatar / color dot ---------- */

.avatar-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.avatar-img {
  display: inline-block;
  border-radius: 50%;
  flex-shrink: 0;
  object-fit: cover;
  background: var(--bg-elevated-2);
}

.player-name {
  font-weight: var(--font-weight-medium);
}

/* ---------- Status badges & chips ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
}
.badge-playing {
  background: var(--state-playing-bg);
  color: var(--state-playing);
}
.badge-online {
  background: var(--accent-bg);
  color: var(--accent);
}
.badge-paused {
  background: var(--state-paused-bg);
  color: var(--state-paused);
}
.badge-offline {
  background: var(--state-offline-bg);
  color: var(--state-offline);
}
/* Neutral label badge (e.g. a To-Do's Art, or a plain not-yet-urgent due
   date) - visually quiet, distinct from the semantic state badges above. */
.badge-neutral {
  background: var(--bg-elevated-2);
  color: var(--text-muted);
}
/* Event identity on a notification: which workspace an entry came from. It
   names a scope rather than a state, so it stays as quiet as .badge-neutral
   instead of competing with the semantic colours - the notification center
   shows it right next to the "Für dich" audience chip, which is the one that
   should carry emphasis. */
.badge-event {
  background: var(--bg-elevated-2);
  color: var(--text-muted);
}
/* Error badge (admin log): the danger pair used everywhere else. */
.badge-overdue {
  background: var(--danger-bg);
  color: var(--danger);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--bg-elevated-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: var(--space-1) var(--space-3);
  font-size: var(--font-size-sm);
  /* Some chips render as <a> (external links) rather than <span> — without
     this they'd pick up the browser's default blue/underlined link style. */
  color: inherit;
  text-decoration: none;
}
button.chip {
  min-height: var(--control-height);
  justify-content: center;
}
/* Selected-filter state (To-Dos' Art/"von mir erstellt" chips) - same
   accent-border convention as .group-option.is-active, plus a light fill so
   a row of several chips still reads clearly on a phone at a glance. */
.chip.is-active {
  border-color: var(--accent);
  background: var(--accent-bg);
  color: var(--text);
}
@media (hover: hover) {
  a.chip:hover {
    filter: brightness(1.12);
  }
}

/* Arcade lobby "Bereit" status reuses the live-status green so readiness
   reads consistently with active states elsewhere. */
.btn-ready {
  background: var(--state-playing-bg);
  color: var(--state-playing);
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

/* Guided vote start (views/voteWizard.js): one column, one decision per
   step, a three-part progress bar on top and the actions in a footer. */
.vote-wizard {
  gap: var(--space-4);
}
.vote-wizard-progress {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.vote-wizard-step-label {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
}
.vote-wizard-segments {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-1);
}
.vote-wizard-segment {
  height: var(--space-1);
  border-radius: var(--radius-full);
  background: var(--bg-elevated-2);
}
.vote-wizard-segment.is-done {
  /* One gradient runs across all three parts: each part shows its own third
     of it, so a finished bar reads like the brand gradient. */
  background: var(--accent-gradient);
  background-size: 300% 100%;
}
.vote-wizard-segment.is-done:nth-child(2) {
  background-position: 50% 0;
}
.vote-wizard-segment.is-done:nth-child(3) {
  background-position: 100% 0;
}
.vote-wizard-title {
  margin: 0;
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
}
.vote-wizard-kinds {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
}
.vote-wizard-kind,
.vote-wizard-mode {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated-2);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}
.vote-wizard-kind {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: calc(var(--tap-target-size) * 2.5);
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
}
.vote-wizard-kind-icon .ui-icon {
  width: var(--space-7);
  height: var(--space-7);
}
.vote-wizard-mode {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-1);
  padding: var(--space-3) var(--space-4);
  text-align: left;
}
.vote-wizard-mode.is-static {
  cursor: default;
}
.vote-wizard-kind.is-selected,
.vote-wizard-mode.is-selected {
  border-color: var(--accent);
  background: var(--accent-bg);
}
@media (hover: hover) {
  .vote-wizard-kind:hover,
  .vote-wizard-mode:not(.is-static):hover {
    border-color: var(--accent);
  }
}
.vote-wizard-modes {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-2);
}
.vote-wizard-game-toolbar {
  flex-wrap: wrap;
  gap: var(--space-3);
}
.vote-wizard-game-toolbar input {
  flex: 1 1 var(--selection-card-min-width);
  min-width: 0;
}
.vote-wizard-game-toolbar-end {
  gap: var(--space-3);
}
.vote-wizard-game-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-1) var(--space-3);
  max-height: var(--search-select-results-max-height);
  overflow-y: auto;
}
.vote-wizard-game {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--control-height);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.vote-wizard-answer {
  gap: var(--space-2);
}
.vote-wizard-answer input {
  flex: 1;
  min-width: 0;
}
.vote-wizard-empty {
  margin: 0;
}
.vote-wizard-footer {
  padding-top: var(--space-3);
  border-top: 1px solid var(--border);
}
@media (min-width: 640px) /* --bp-md */ {
  .vote-wizard-modes,
  .vote-wizard-game-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Guided ballot (views/ballotFlow.js). One option per step, large worded
   choices, every option with its answer as pills on top, a summary before
   handing in and a short celebration afterwards. */
.ballot {
  gap: var(--space-4);
}
.ballot-body {
  gap: var(--space-4);
}
.ballot-segments {
  display: flex;
  gap: var(--space-1);
}
.ballot-segment {
  flex: 1;
  height: var(--space-1);
  border-radius: var(--radius-full);
  background-color: var(--bg-elevated-2);
}
.ballot-segment.is-done {
  background-image: var(--accent-gradient);
}
.ballot-pills {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  max-height: calc(var(--control-height) * 3 + var(--space-2) * 2);
  overflow-y: auto;
}
.ballot-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  min-height: var(--control-height);
  padding: 0 var(--space-3) 0 var(--space-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--bg-elevated-2);
  color: var(--text-muted);
  font: inherit;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  cursor: pointer;
}
.ballot-pill-mark {
  display: inline-flex;
  width: var(--space-4);
  height: var(--space-4);
}
.ballot-pill-mark .ui-icon {
  width: var(--space-4);
  height: var(--space-4);
}
.ballot-pill.is-answered {
  color: var(--text);
}
.ballot-pill.is-answered .ballot-pill-mark {
  color: var(--state-playing);
}
.ballot-pill-value {
  color: var(--accent);
  font-weight: var(--font-weight-bold);
}
.ballot-pill.is-current {
  border-color: var(--accent);
  background: var(--accent-bg);
  color: var(--text);
}
.ballot-main {
  gap: var(--space-4);
}
.ballot-main.is-shaking {
  animation: ballot-shake 0.32s ease;
}
.ballot-item {
  gap: var(--space-1);
  animation: ballot-step-in 0.22s ease;
}
.ballot-position,
.ballot-hint {
  font-size: var(--font-size-xs);
}
.ballot-item-title {
  margin: 0;
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-black);
  line-height: var(--control-line-height);
}
.ballot-item-meta {
  font-size: var(--font-size-sm);
}
.ballot-question {
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-bold);
}
.ballot-choices {
  display: grid;
  gap: var(--space-2);
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.ballot-choice,
.ballot-tile {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated-2);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  transition: transform var(--motion-fast), border-color var(--motion-fast), background-color var(--motion-fast);
}
.ballot-choice {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  min-height: calc(var(--tap-target-size) * 2);
  padding: var(--space-2);
  text-align: center;
}
.ballot-choice-number {
  font-size: var(--font-size-3xl);
  font-weight: var(--font-weight-black);
  line-height: var(--line-height-tight);
}
.ballot-choice-label {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
}
.ballot-choice.is-selected,
.ballot-tile.is-selected {
  border-color: var(--accent);
  background: var(--accent-strong);
  color: var(--accent-text);
}
.ballot-choice.is-selected {
  animation: ballot-pick 0.22s ease;
}
.ballot-tiles {
  display: grid;
  gap: var(--space-2);
  grid-template-columns: minmax(0, 1fr);
}
.ballot-tile {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: calc(var(--tap-target-size) * 1.5);
  padding: var(--space-3) var(--space-4);
  text-align: left;
}
.ballot-tile-text {
  gap: var(--space-1);
  min-width: 0;
}
.ballot-tile.is-selected .muted {
  color: var(--accent-text);
}
.ballot-tile-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: var(--space-6);
  height: var(--space-6);
  border: 2px solid currentColor;
  border-radius: var(--radius-full);
}
.ballot-tile-mark.is-box {
  border-radius: var(--radius-sm);
}
.ballot-summary {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.ballot-summary-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: var(--tap-target-size);
  padding: 0 var(--space-4);
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.ballot-summary-row:last-child {
  border-bottom: 0;
}
.ballot-summary-label {
  flex: 1;
  min-width: 0;
}
.ballot-summary-value {
  color: var(--accent);
  font-weight: var(--font-weight-bold);
}
.ballot-summary-row.is-missing .ballot-summary-value {
  color: var(--state-paused);
}
.ballot-footer {
  padding-top: var(--space-3);
  border-top: 1px solid var(--border);
  gap: var(--space-2);
}
.ballot-success {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-6) 0 var(--space-2);
  text-align: center;
}
.ballot-success p {
  margin: 0;
}
.ballot-success-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: calc(var(--tap-target-size) * 1.6);
  height: calc(var(--tap-target-size) * 1.6);
  border-radius: var(--radius-full);
  background: var(--state-playing-bg);
  color: var(--state-playing);
  animation: ballot-check-in 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.ballot-success-check .ui-icon {
  width: var(--space-7);
  height: var(--space-7);
}
.ballot-confetti {
  position: absolute;
  top: calc(var(--space-6) + var(--tap-target-size) * 0.8);
  left: 50%;
  pointer-events: none;
}
.ballot-confetti span {
  position: absolute;
  width: var(--space-2);
  height: var(--space-3);
  border-radius: var(--radius-full);
  animation: ballot-confetti 1s ease-out forwards;
}
@keyframes ballot-confetti {
  from { transform: translate(0, 0) rotate(0); opacity: 1; }
  to { transform: translate(var(--dx), var(--dy)) rotate(var(--spin)); opacity: 0; }
}
@keyframes ballot-check-in {
  from { transform: scale(0.3); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
@keyframes ballot-pick {
  50% { transform: scale(1.06); }
}
@keyframes ballot-step-in {
  from { transform: translateX(var(--space-4)); opacity: 0; }
  to { transform: none; opacity: 1; }
}
@keyframes ballot-shake {
  25% { transform: translateX(calc(var(--space-2) * -1)); }
  75% { transform: translateX(var(--space-2)); }
}
@media (hover: hover) {
  .ballot-choice:not(.is-selected):hover,
  .ballot-tile:not(.is-selected):hover,
  .ballot-pill:hover {
    border-color: var(--accent);
  }
  .ballot-summary-row:hover {
    background: var(--bg-elevated-2);
  }
}
@media (min-width: 640px) /* --bp-md */ {
  .ballot-choices--points {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
  .ballot-tiles {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Vote overview cards: the own answer per option and the card status. */
.vote-my-answer {
  display: inline-flex;
  align-items: center;
  justify-self: end;
  gap: var(--space-2);
  min-height: var(--control-height);
  padding: 0 var(--space-3);
  border-radius: var(--radius-sm);
  background: var(--accent-strong);
  color: var(--accent-text);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  white-space: nowrap;
}
.vote-my-answer.is-empty {
  padding: 0;
  background: none;
}
.vote-my-answer-number {
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-black);
}
.vote-card-status {
  gap: var(--space-1);
  min-width: 0;
}
.vote-card-missing {
  font-size: var(--font-size-xs);
}
.vote-due-chip {
  background: var(--bg-elevated-2);
  color: var(--text-muted);
}
.vote-due-chip.badge-paused {
  background: var(--state-paused-bg);
  color: var(--state-paused);
}
.event-poll-card.is-just-voted {
  animation: vote-card-voted 1.4s ease;
}
.event-poll-card.is-new {
  animation: vote-card-new 0.6s ease;
}
#vote-waiting-title .badge.is-pop {
  animation: vote-count-pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes vote-card-voted {
  0% { box-shadow: 0 0 0 0 var(--state-playing-bg); border-color: var(--state-playing); }
  40% { box-shadow: 0 0 0 var(--space-2) var(--state-playing-bg); border-color: var(--state-playing); }
  100% { box-shadow: 0 0 0 0 transparent; }
}
@keyframes vote-card-new {
  from { transform: translateY(calc(var(--space-4) * -1)); opacity: 0; }
  to { transform: none; opacity: 1; }
}
@keyframes vote-count-pop {
  50% { transform: scale(1.35); }
}
.vote-wizard-preview {
  gap: var(--space-2);
}
.vote-wizard-preview-card {
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--bg-elevated-2);
}
.vote-wizard-preview-kind {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
}
.vote-wizard-preview-options {
  flex-wrap: wrap;
  gap: var(--space-2);
}
@media (min-width: 860px) /* --bp-lg */ {
  .vote-dialog-wide .modal {
    max-width: var(--wide-dialog-width);
  }
}
h3.ballot-question {
  margin: 0;
}
/* An unanswered row keeps its grid column on wide screens but adds no
   height on phones, where the columns stack. */
.vote-my-answer.is-empty {
  min-height: 0;
}
@media (max-width: 639px) /* --bp-md */ {
  .event-poll-option-badges:empty {
    display: none;
  }
}
@media (pointer: coarse) {
  .ballot-hint {
    display: none;
  }
}
.vote-card-summary {
  margin: 0;
  color: var(--text-muted);
}
