/* ---------- Login screen ---------- */

.login-screen {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
}
.login-card {
  width: 100%;
  max-width: 340px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-6) var(--space-6);
  text-align: center;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.login-card h1 {
  margin: var(--space-1) 0 0;
  font-size: var(--font-size-3xl);
}

/* ---------- Toasts ---------- */

/* ---------- Countdown overlay (public/js/arcade/countdown.js) ----------
   Shared "3 · 2 · 1 · Los!" intro for every arcade game. Full-screen, with a
   translucent unblurred backdrop so the board remains readable, and a big
   gradient number in the brand style that pops in per second. */
.countdown-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(6, 9, 18, 0.38);
  pointer-events: none;
}
.countdown-content {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.countdown-content.is-anchored {
  position: absolute;
  top: var(--countdown-y);
  left: var(--countdown-x);
  transform: translate(-50%, -50%);
}
.countdown-num-wrap {
  position: relative;
  display: inline-block;
  /* Blur headroom must live INSIDE this box: with GPU compositing (real
     browsers, Retina — not headless test runners) both Blink and Gecko cut
     the glow child off at the wrap's own bounds, no matter how far the
     child's box extends beyond it. Symmetric padding keeps the text
     centered and gives the 16px blur (3σ ≈ 48px) room on every side. */
  padding: 4.5rem; /* design-token-ok: blur headroom sized to the glow's 3-sigma radius, see comment above */
}
.countdown-num {
  font-size: clamp(4rem, 22vw, 8rem);
  font-weight: var(--font-weight-black);
  /* Deliberately NOT italic: SF Pro's italic terminals are sheared at an
     angle (top of "L", "!"), which reads as the glyphs being clipped. */
  letter-spacing: -0.03em;
  white-space: nowrap;
}
/* Two stacked copies of the same text instead of one element trying to be
   both glowing AND gradient-filled: any `filter`/`text-shadow` on an element
   that also has `background-clip: text` gets clipped to a hard box in every
   engine we've tested — fine for a plain rectangle of glyphs, but a visible
   cut wherever the actual ink (an italic ascender, the "!") pokes past it.
   A plain solid-colour blurred copy behind a crisp gradient-clipped copy on
   top has no such interaction and glows cleanly on every edge. The room the
   blur needs comes from the wrap's padding (see above) — the glow layer
   itself must NOT reach outside the wrap, or GPU compositing clips it. */
.countdown-num-glow {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-2);
  filter: blur(16px);
  opacity: 0.85;
}
.countdown-num-fill {
  position: relative;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}
@media (max-height: 480px) { /* design-token-ok: viewport-height fallback; width breakpoints do not model short screens */
  .countdown-num-wrap {
    padding: var(--space-1);
  }
  .countdown-num {
    font-size: clamp(
      var(--font-size-3xl),
      18vh,
      calc(var(--font-size-3xl) + var(--font-size-3xl))
    );
  }
}
.countdown-pop {
  animation: countdown-pop 0.85s cubic-bezier(0.2, 0.9, 0.3, 1);
}
@keyframes countdown-pop {
  0% {
    opacity: 0;
    transform: scale(1.9);
  }
  35% {
    opacity: 1;
  }
  100% {
    opacity: 0.92;
    transform: scale(1);
  }
}

.toast-container {
  position: fixed;
  bottom: calc(var(--shell-bottom-inset) + var(--space-3));
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  width: calc(100% - 32px);
  max-width: 420px;
  pointer-events: none;
}
.toast {
  background: var(--bg-elevated-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-3) var(--space-4);
  font-size: var(--font-size-sm);
  box-shadow: var(--shadow);
  text-align: center;
  animation: toast-in 0.22s cubic-bezier(0.2, 0.9, 0.3, 1);
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.97);
  }
}
.toast.toast-error {
  color: var(--danger);
  border-color: var(--danger);
}
.toast.toast-clickable {
  cursor: pointer;
  border-color: var(--accent);
}

/* ---------- Modal / dialog (settings, forms) ---------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(6, 9, 18, 0.55);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 50;
  animation: backdrop-in 0.18s ease;
}
@media (min-width: 640px) { /* --bp-md */
  .modal-backdrop {
    align-items: center;
  }
}
.modal {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: var(--space-5);
  width: 100%;
  max-width: 480px;
  max-height: 85dvh;
  overflow-y: auto;
  /* Bottom sheet slides up on phones… */
  animation: sheet-in 0.26s cubic-bezier(0.2, 0.9, 0.3, 1);
}

/* ---------- First-login onboarding ---------- */

/* Manual area tours use the shared modal's focus and dismissal behavior. */
.area-tour-backdrop {
  background: transparent;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  animation: none;
}
.area-tour-backdrop .modal {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: fixed;
  z-index: 1;
  left: var(--space-4);
  right: var(--space-4);
  bottom: var(--space-4);
  width: auto;
  max-height: calc(100dvh - var(--space-8));
  margin: 0 auto;
  border-radius: var(--radius-lg);
  animation: none;
}
.area-tour-backdrop .modal-header,
.area-tour-backdrop .area-tour-actions {
  flex-shrink: 0;
}
.area-tour-backdrop .modal-body {
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.area-tour-backdrop .modal[data-tour-placement="top"] {
  top: var(--space-4);
  bottom: auto;
}
.area-tour-backdrop .modal[data-tour-align="left"] {
  margin: 0 auto 0 0;
}
.area-tour-backdrop .modal[data-tour-align="right"] {
  margin: 0 0 0 auto;
}
@media (min-width: 640px) and (max-height: 560px) { /* --bp-md; design-token-ok: shallow landscape windows need a narrower narration panel. */
  .area-tour-backdrop .modal {
    max-width: var(--area-tour-compact-width);
  }
}
.area-tour-target {
  position: fixed;
  pointer-events: none;
  border-radius: var(--radius-sm);
  box-shadow: 0 0 0 var(--space-1) var(--accent),
    0 0 0 9999px color-mix(in srgb, var(--bg) 55%, transparent);
}
.area-tour-shade {
  position: absolute;
  inset: 0;
  background: color-mix(in srgb, var(--bg) 55%, transparent);
  pointer-events: none;
}
.area-tour-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--space-2);
  margin-top: var(--space-4);
}
.area-tour-chapters {
  display: grid;
  gap: var(--space-2);
  margin-block: var(--space-4);
}
.area-tour-explanation {
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
}
.area-tour-scene-frame {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100dvh;
  z-index: 49;
  border: 0;
  background: var(--bg);
}
.area-tour-demo-page {
  overflow: hidden;
}

#onboarding-root {
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
}

.onboarding-backdrop {
  position: absolute;
  inset: 0;
  background: var(--bg);
  /* Only used on steps with no highlighted target (see onboarding.js) - a
     step that highlights something instead relies on the ring's own
     spotlight shadow below, so the two never stack into a double-dark
     overlay. Lower than the previous 0.78 so the dimmed page underneath
     stays legible instead of nearly invisible. */
  opacity: 0.5;
  pointer-events: auto;
}

.onboarding-dialog {
  position: fixed;
  z-index: 42;
  left: var(--space-4);
  right: var(--space-4);
  bottom: calc(var(--shell-bottom-inset) + var(--space-4));
  max-width: var(--search-panel-width);
  margin: 0 auto;
  padding: var(--space-4);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  pointer-events: auto;
}

.onboarding-progress {
  margin: 0 0 var(--space-2);
  color: var(--text-muted);
  font-size: var(--font-size-xs);
}

.onboarding-dialog h2 {
  margin: 0 0 var(--space-2);
  font-size: var(--font-size-lg);
}

.onboarding-dialog p {
  margin: 0;
  line-height: 1.45;
}

.onboarding-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

.onboarding-actions-spacer {
  flex: 1 1 auto;
}

/* The welcome trailer fills the whole page (agreed with the organizers) and
   becomes real browser fullscreen when the browser allows it. Controls float
   small and translucent at the edges so the picture stays free. */
.onboarding-trailer {
  position: fixed;
  inset: 0;
  z-index: 42;
  display: grid;
  place-items: center;
  background: var(--media-letterbox);
  pointer-events: auto;
}

.onboarding-trailer:focus {
  outline: none;
}

.onboarding-trailer video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  cursor: pointer;
}

.onboarding-trailer-control,
.onboarding-trailer-status {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--tap-target-size);
  padding: var(--space-2) var(--space-4);
  color: var(--text);
  font: inherit;
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-bold);
  background: color-mix(in srgb, var(--bg) 62%, transparent);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.onboarding-trailer-control {
  cursor: pointer;
}

.onboarding-trailer-control[hidden],
.onboarding-trailer-status[hidden] {
  display: none;
}

.onboarding-trailer-control .ui-icon {
  width: var(--space-5);
  height: var(--space-5);
}

/* While the sound is off, "Ton an" is the one action that matters. */
.onboarding-trailer-sound[data-muted] {
  color: var(--accent-text);
  background: var(--accent-gradient);
  border-color: transparent;
  box-shadow: var(--shadow-glow-accent);
}

.onboarding-trailer-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-5) max(var(--space-5), env(safe-area-inset-right)) max(var(--space-6), env(safe-area-inset-bottom)) max(var(--space-5), env(safe-area-inset-left));
}

.onboarding-trailer-fullscreen {
  position: absolute;
  top: max(var(--space-4), env(safe-area-inset-top));
  right: max(var(--space-4), env(safe-area-inset-right));
  justify-content: center;
  width: var(--tap-target-size);
  padding: 0;
}

.onboarding-trailer-status {
  position: absolute;
  margin: 0;
}

/* Only when the browser blocks even muted playback. */
.onboarding-trailer-start-wrap {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
}

.onboarding-trailer-start-wrap[hidden] {
  display: none;
}

.onboarding-trailer-start {
  display: grid;
  place-items: center;
  width: calc(var(--tap-target-size) * 1.75);
  height: calc(var(--tap-target-size) * 1.75);
  color: var(--accent-text);
  background: var(--accent-gradient);
  border: 0;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-glow-accent), var(--shadow);
  cursor: pointer;
}

.onboarding-trailer-start .ui-icon {
  width: var(--space-7);
  height: var(--space-7);
  /* Optical centering: the play triangle's mass sits left of its box. */
  margin-left: var(--space-1);
}

.onboarding-trailer-start-label {
  color: var(--text);
  font-weight: var(--font-weight-bold);
}

.onboarding-trailer[data-state='idle'] video {
  opacity: 0.45;
}

.onboarding-trailer-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--space-1);
  background: color-mix(in srgb, var(--text) 18%, transparent);
}

.onboarding-trailer-progress span {
  display: block;
  height: 100%;
  background: var(--accent-gradient);
  transform: scaleX(0);
  transform-origin: left;
}

@media (hover: hover) {
  .onboarding-trailer-control:hover {
    background: color-mix(in srgb, var(--bg-elevated-2) 80%, transparent);
  }

  .onboarding-trailer-sound[data-muted]:hover {
    background: var(--accent-gradient);
    filter: brightness(1.08);
  }
}

.onboarding-rating-dialog {
  /* Only the dialog's own controls stay clickable (see the button rule
     below) - everything else, including its own background, lets clicks
     and taps fall through to whatever required game row is scrolled behind
     it, since this dialog stays fixed over a scrollable list. Combined with
     the onboarding-rating-list spacer below, every required row is
     reachable either way; this is the fallback for the brief moments (a
     resize, a font-size change) where the measured spacer hasn't caught up
     yet. */
  background: color-mix(in srgb, var(--bg-elevated) 88%, transparent);
  pointer-events: none;
}

.onboarding-rating-dialog button,
.onboarding-rating-dialog input,
.onboarding-rating-dialog [tabindex] {
  pointer-events: auto;
}

@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .onboarding-rating-dialog {
    -webkit-backdrop-filter: blur(16px) saturate(1.4);
    backdrop-filter: blur(16px) saturate(1.4);
  }
}

.onboarding-rating-list {
  padding-bottom: var(--onboarding-rating-spacer);
}

.onboarding-rating-progress {
  margin-top: var(--space-3) !important;
  color: var(--text-muted);
  font-size: var(--font-size-sm);
}

.onboarding-rating-actions {
  justify-content: flex-end;
}

.onboarding-target-highlight {
  border-radius: var(--radius-sm);
}

.onboarding-target-ring {
  position: fixed;
  z-index: 41;
  pointer-events: none;
  border-radius: var(--radius-sm);
  /* The huge fourth spread value is the actual highlighting mechanism: it
     dims the whole viewport except this element's own box, which stays
     fully transparent - so the highlighted icon renders at full brightness
     instead of sitting dimmed under a separate full-screen backdrop (see
     onboarding.js, which skips rendering .onboarding-backdrop whenever a
     step has a target for exactly this reason). */
  box-shadow:
    0 0 0 var(--space-1) var(--accent),
    var(--shadow-glow-accent),
    0 0 0 9999px color-mix(in srgb, var(--bg) 50%, transparent);
}

.game-table-row.onboarding-required {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.onboarding-required-badge {
  flex: 0 0 auto;
}

.onboarding-rating-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3);
  background: var(--bg-elevated-2);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
}

.onboarding-rating-banner-copy {
  flex: 1 1 240px;
  min-width: 0;
}

.onboarding-rating-banner-copy strong,
.onboarding-rating-banner-copy span {
  display: block;
}

.onboarding-rating-banner-copy span {
  margin-top: var(--space-1);
  color: var(--text-muted);
  font-size: var(--font-size-xs);
}

@media (min-width: 640px) { /* --bp-md */
  .onboarding-dialog {
    bottom: var(--space-6);
  }
}

@media (max-width: 639px) { /* --bp-md */
  .onboarding-rating-dialog {
    padding: var(--space-3);
  }

  .onboarding-rating-dialog .onboarding-rating-actions {
    flex-wrap: nowrap;
    gap: var(--space-1);
    margin-top: var(--space-3);
  }

  .onboarding-rating-dialog .onboarding-rating-actions .btn {
    flex: 1 1 0;
    min-width: 0;
    padding-inline: var(--space-2);
    font-size: var(--font-size-xs);
    white-space: nowrap;
  }
}

@media (min-width: 640px) { /* --bp-md */
  .modal {
    border-radius: var(--radius-lg);
    /* …and gently scales in as a centered dialog on wider screens. */
    animation-name: dialog-in;
    animation-duration: 0.18s;
  }
}
@keyframes backdrop-in {
  from {
    opacity: 0;
  }
}
@keyframes sheet-in {
  from {
    transform: translateY(28px);
    opacity: 0.5;
  }
}
@keyframes dialog-in {
  from {
    transform: scale(0.96) translateY(6px);
    opacity: 0;
  }
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-4);
}
.modal-header h2 {
  margin: 0;
  font-size: var(--font-size-lg);
}
/* A dialog's one primary action sits right in the header, next to the
   close button. */
.modal-header-action {
  margin-left: auto;
  margin-right: var(--space-2);
}
.modal-header-action:last-child {
  margin-right: 0;
}

/* Info dialog (topbar "i"): reference material — WLAN, Discord, server IPs,
   house rules — that people look up mid-conversation, so it opens over the
   current view instead of replacing it. Same width cap as the search palette,
   since both hold a list of short titles plus a short preview. */
.info-board-modal .modal {
  max-width: var(--search-panel-width);
}
@media (min-width: 860px) { /* --bp-lg */
  /* Two columns of entries need the wider panel. */
  .info-board-modal .modal {
    max-width: var(--info-board-panel-width);
  }
}
/* Same header height with or without "Eintrag anlegen", so the list starts
   at the same place for admins and members. */
.info-board-modal .modal-header {
  min-height: var(--control-height);
}
/* Title and preview take the row; copying is one square icon button. Side
   by side rows share a height, so titles and buttons start at the top and
   neighbouring titles stay on one line. */
.info-board-list .profile-row {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: var(--space-3);
}
.info-board-list .btn-square {
  color: var(--text-muted);
}
.info-board-dialog > .empty-state {
  min-height: 0;
  padding: var(--space-4) 0;
}
.info-board-list .profile-row-text {
  width: 100%;
}
.info-board-list .profile-row-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* Two lines of the content are enough to read a WLAN password or an IP
   without opening the entry; the rest lives in its detail dialog. */
.info-board-preview {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  white-space: pre-line;
}
.info-board-content {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.info-board-meta {
  margin: 0;
  color: var(--text-muted);
  font-size: var(--font-size-sm);
}
.info-board-content-field {
  field-sizing: content;
  max-height: calc(var(--control-height) * 8);
}

/* Global command palette: fast navigation across every area without adding
   a search service or a second navigation hierarchy. */
.global-search-modal .modal {
  max-width: var(--search-panel-width);
  padding: var(--space-4);
}
.global-search {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.global-search-label {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
}
#global-search-input {
  width: 100%;
  border-radius: var(--radius);
  padding: var(--space-3) var(--space-4);
}
.global-search-summary {
  color: var(--text-muted);
  font-size: var(--font-size-xs);
}
.global-search-results {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  max-height: 55dvh;
  overflow-y: auto;
}
.global-search-result {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  width: 100%;
  padding: var(--space-3);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.global-search-result.is-selected {
  border-color: var(--accent);
  background: var(--bg-elevated-2);
}
.global-search-result-main {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
}
.global-search-result-main .muted,
.global-search-result-description {
  font-size: var(--font-size-xs);
}
.global-search-empty {
  padding: var(--space-5);
  color: var(--text-muted);
  text-align: center;
}

.search-target-highlight {
  border-color: var(--accent) !important;
  box-shadow: var(--shadow-glow-accent);
}

/* ---------- Shared physical seating plan ---------- */
/* The plan lies flat inside its card (no second frame): seats around an
   outlined table. Home and the Admin editor render the same markup. */
.seating-plan {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(150px, 1.35fr) minmax(0, 1fr);
  grid-template-rows: auto minmax(150px, 1fr) auto;
  grid-template-areas:
    "top top top"
    "left center right"
    "bottom bottom bottom";
  gap: var(--space-3);
  align-items: stretch;
}

.seating-side-top { grid-area: top; }
.seating-side-right { grid-area: right; }
.seating-side-bottom { grid-area: bottom; }
.seating-side-left { grid-area: left; }

.seating-side {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.seating-side-seats {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: safe center;
  gap: var(--space-2);
}
/* The long sides share the row: every seat keeps the same width and shrinks
   evenly once the side holds more seats than fit, so the plan never scrolls
   sideways. seating.js sets --seating-side-count per side. */
.seating-side-top .seating-side-seats,
.seating-side-bottom .seating-side-seats {
  display: grid;
  grid-template-columns: repeat(var(--seating-side-count, 1), minmax(0, var(--seating-seat-width)));
  justify-content: center;
}
.seating-side-top .seating-seat,
.seating-side-bottom .seating-seat {
  width: auto;
}
.seating-table-center {
  grid-area: center;
  min-height: 150px;
  display: flex;
  justify-content: center;
  align-items: center;
  /* Like a free seat: only its outline, so occupied seats carry the plan. */
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: var(--font-size-xs);
}
.seating-seat {
  flex: 0 0 auto;
  box-sizing: border-box;
  width: var(--seating-seat-width);
  height: var(--seating-seat-height); /* fits the gamer name plus the small real-name line below it */
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: var(--font-size-xs);
  text-align: left;
  transition: border-color var(--motion-fast), background var(--motion-fast);
}
/* A free seat is only its outline, an occupied one carries the fill. */
.seating-seat.is-occupied {
  background: var(--bg-elevated-2);
  color: var(--text);
}
.seating-seat-free-label {
  color: var(--text-muted);
}
button.seating-seat {
  cursor: pointer;
}
.seating-plan.is-editable .seating-seat.is-occupied {
  cursor: grab;
}
.seating-plan.is-editable .seating-seat.is-occupied:active {
  cursor: grabbing;
}
@media (hover: hover) {
  button.seating-seat:hover {
    border-color: var(--accent);
  }
}
/* While dragging, every seat a player could land on is framed blue and the
   target under the pointer is tinted. */
.seating-plan.is-moving .seating-seat:not(.is-occupied) {
  border-color: var(--accent);
}
.seating-seat.is-drag-target,
.seating-pool.is-drag-target {
  border-color: var(--accent);
  background: var(--accent-bg);
}
/* Gamer name with the live status dot, and the real name in small muted text
   below it when set. */
.seating-seat-names {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  max-width: 100%;
}
.seating-seat-name,
.seating-seat-realname {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
.seating-seat-name-line {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
  max-width: 100%;
}
.seating-seat-realname {
  font-size: var(--font-size-2xs);
  color: var(--text-muted);
}
.seating-seat-name {
  min-width: 0;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
}
/* Live status: a small static dot next to the name; its aria-label carries
   the state in words, so the colour is never the only signal. */
.seating-status-indicator {
  flex: 0 0 var(--space-2);
  width: var(--space-2);
  height: var(--space-2);
  border-radius: var(--radius-full);
  background: var(--state-offline);
}
.seating-status-indicator.is-playing { background: var(--state-playing); }
.seating-status-indicator.is-online { background: var(--accent); }
.seating-status-indicator.is-paused { background: var(--state-paused); }

.seating-plan-note {
  margin: 0;
  color: var(--text-muted);
  font-size: var(--font-size-sm);
}
/* Below the plan the note keeps clear of the last row of seats. */
.seating-plan + .seating-plan-note {
  margin-top: var(--space-3);
}
/* "Ohne Platz": avatar, name and status dot share the title line; the rows
   carry no action (a seat is filled from the seat itself). */
.seating-pool .profile-row {
  grid-template-columns: minmax(0, 1fr);
}
.seating-pool .profile-row-action {
  display: none;
}
/* Rows with and without a real name keep one height, so both columns stay
   even. */
.seating-pool .profile-row-text {
  justify-content: center;
  min-height: calc(var(--control-height) + var(--space-2));
}
.seating-pool .profile-row-title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}
.seating-pool-name,
.seating-pool .profile-row-meta {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.seating-pool .avatar,
.seating-pool .avatar-img,
.seating-pool .seating-status-indicator {
  flex: none;
}
.seating-pool .profile-row[draggable='true'] {
  cursor: grab;
}
/* Seat-count fields in "Tisch ändern" only need two digits. */
.seating-count-input {
  width: 5.5rem;
}

@media (min-width: 640px) { /* --bp-md */
  /* The short sides sit against the table like the long sides do: their
     columns are wider than a seat, so centering left a large gap. Pulling
     each column toward the table leaves only the plan's own --space-3 gap,
     the same distance the top and bottom rows keep. */
  .seating-side-left .seating-side-seats {
    align-items: flex-end;
  }
  .seating-side-right .seating-side-seats {
    align-items: flex-start;
  }
  /* Many seats on a long side: the name moves below the avatar so it keeps
     a readable width. seating.js marks the plan once a long side exceeds
     eight seats. */
  .seating-plan.is-dense .seating-side-top .seating-seat,
  .seating-plan.is-dense .seating-side-bottom .seating-seat {
    flex-direction: column;
    gap: var(--space-1);
  }
  .seating-plan.is-dense .seating-side-top .seating-seat-names,
  .seating-plan.is-dense .seating-side-bottom .seating-seat-names {
    align-items: center;
  }
  .seating-plan.is-dense .seating-side-top .seating-seat-realname,
  .seating-plan.is-dense .seating-side-bottom .seating-seat-realname {
    display: none;
  }
}

@media (max-width: 859px) { /* --bp-lg */
  .seating-plan {
    --seating-seat-width: calc(var(--selection-card-min-width) - var(--space-8));
  }
}

/* Phones: the table stands upright, turned a quarter clockwise. The long
   sides become the two columns and the short sides the rows above and below,
   so no seat shrinks to an unreadable width and nothing scrolls sideways.
   The reversed directions keep every seat next to its real neighbours. */
@media (max-width: 639px) { /* --bp-md */
  .seating-plan {
    grid-template-columns: minmax(0, 1fr) var(--space-7) minmax(0, 1fr);
    grid-template-rows: auto auto auto;
    gap: var(--space-2);
    --seating-seat-height: calc(var(--avatar-size-lg) + var(--space-1));
  }
  .seating-side-top { grid-area: right; }
  .seating-side-right { grid-area: bottom; }
  .seating-side-bottom { grid-area: left; }
  .seating-side-left { grid-area: top; }
  .seating-side-seats,
  .seating-side-top .seating-side-seats,
  .seating-side-bottom .seating-side-seats {
    display: flex;
    align-items: stretch;
  }
  .seating-side-top .seating-side-seats { flex-direction: column; }
  .seating-side-bottom .seating-side-seats { flex-direction: column-reverse; }
  .seating-side-right .seating-side-seats,
  .seating-side-left .seating-side-seats {
    flex-direction: row-reverse;
  }
  .seating-seat {
    width: 100%;
    justify-content: flex-start;
  }
  .seating-side-right .seating-seat,
  .seating-side-left .seating-seat {
    flex: 1 1 0;
    width: auto;
  }
  .seating-seat:not(.is-occupied) {
    justify-content: center;
  }
  .seating-table-center {
    min-height: 0;
    writing-mode: vertical-rl;
  }
}

@media (min-width: 480px) { /* --bp-sm */
  .view-title {
    font-size: var(--font-size-2xl);
  }
}


/* ---------- Shared music session ---------- */

.oauth-callback-page {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: var(--space-4);
}
.oauth-callback-card {
  width: min(100%, var(--search-panel-width));
}
/* Jam follows the flat table style: hairline rows, gray meta lines, compact
   neutral actions and one gradient for the next step. */
.music-note {
  margin: 0;
  color: var(--text-muted);
  font-size: var(--font-size-sm);
}
.music-meta {
  min-width: 0;
  overflow: hidden;
  color: var(--text-muted);
  font-size: var(--font-size-sm);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.music-me {
  color: var(--text);
  font-weight: var(--font-weight-bold);
}
.music-track-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.music-track-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.music-cover {
  width: calc(var(--tap-target-size) + var(--space-7));
  height: calc(var(--tap-target-size) + var(--space-7));
  flex: 0 0 auto;
  border-radius: var(--radius-sm);
  object-fit: cover;
}
.music-cover-placeholder {
  display: grid;
  place-items: center;
  background: var(--bg-elevated-2);
  color: var(--text-muted);
}

/* Setup: numbered hairline rows instead of framed step cards. */
.music-setup-steps {
  margin: 0;
  padding: 0;
  list-style: none;
}
.music-setup-steps li {
  display: grid;
  grid-template-columns: var(--space-5) minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-top: 1px solid var(--border);
}
.music-setup-steps li:last-child {
  padding-bottom: 0;
}
.music-setup-steps .music-meta {
  white-space: normal;
}
.music-setup-step-number {
  color: var(--text-muted);
  font-weight: var(--font-weight-bold);
  font-variant-numeric: tabular-nums;
}
.music-setup-steps li.is-current .music-setup-step-number {
  color: var(--text);
}
.music-setup-steps li.is-complete strong {
  color: var(--text-muted);
  font-weight: var(--font-weight-medium);
}
/* Step actions share one fixed, right-aligned column. */
.music-setup-step-action {
  display: flex;
  justify-content: flex-end;
  width: 11rem;
}
.music-setup-step-action > .btn {
  width: 100%;
}
.music-pairing-code {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

/* Idle playback keeps the card compact between header and controls. */
.grouped-page-section .empty-state.music-idle {
  min-height: 0;
  padding: var(--space-2) 0;
}
/* Now playing: flat track row, progress with time, equal footer buttons. */
.music-now-playing {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: var(--space-4);
}
.music-progress-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-1);
}
.music-progress {
  flex: 1;
  height: var(--space-1);
  overflow: hidden;
  border-radius: var(--radius-full);
  background: var(--border);
}
.music-progress > span {
  display: block;
  width: 100%;
  height: 100%;
  transform-origin: left center;
  border-radius: inherit;
  background: var(--accent-gradient);
  will-change: transform;
}
.music-duration-row {
  flex: none;
  font-size: var(--font-size-xs);
  font-variant-numeric: tabular-nums;
}
/* Playback controls are compact, equally wide and end the card on the right. */
.music-host-actions {
  display: grid;
  grid-template-columns: repeat(2, 8rem);
  justify-content: end;
  gap: var(--space-2);
}

/* Queue and search results: one quiet table with equal row heights. */
.music-queue-row {
  display: grid;
  grid-template-columns: var(--space-5) var(--avatar-size-md) minmax(0, 1fr) minmax(0, 11rem) 3.5rem;
  align-items: center;
  gap: var(--space-3);
  position: relative;
  padding: var(--space-2) 0;
  border-top: 1px solid var(--border);
}
.music-queue-row:last-child {
  padding-bottom: 0;
}
.music-queue-row.music-search-row {
  grid-template-columns: var(--avatar-size-md) minmax(0, 1fr) 7rem;
}
.music-queue-row.music-queue-more > :last-child {
  grid-column: 3 / -1;
}
.music-queue-cover {
  display: block;
  width: var(--avatar-size-md);
  height: var(--avatar-size-md);
  border-radius: var(--radius-sm);
  object-fit: cover;
}
.music-queue-position {
  color: var(--text-muted);
  font-size: var(--font-size-sm);
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.music-queue-title {
  max-width: 100%;
  overflow: hidden;
  font-weight: var(--font-weight-medium);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.music-queue-row > [data-music-detail] {
  display: none;
}
.music-queue-who-inline {
  display: none;
}
.music-queue-duration {
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.music-search-action > .btn {
  width: 100%;
}
.music-queue-row.is-dragging {
  opacity: 0.55;
}
.music-queue-row.is-drag-target {
  border-top-color: var(--accent);
}
@media (hover: hover) and (pointer: fine) {
  .music-queue-list.is-draggable .music-queue-row[draggable] {
    cursor: grab;
    user-select: none;
  }
}
/* Shared drop target at the bottom edge while something removable is dragged:
   Jam requests and players dragged out of a Match lineup. */
.drag-remove-zone {
  position: fixed;
  z-index: 25;
  left: 50%;
  bottom: calc(var(--shell-bottom-inset) + var(--space-5));
  display: flex;
  align-items: center;
  gap: var(--space-2);
  max-width: calc(100vw - var(--space-8));
  padding: var(--space-3) var(--space-4);
  transform: translateX(-50%);
  border: 1px solid var(--danger);
  border-radius: var(--radius);
  background: var(--bg-elevated-2);
  box-shadow: var(--shadow);
  color: var(--text);
}
.drag-remove-zone[hidden] {
  display: none;
}
.drag-remove-zone.is-over {
  background: var(--danger-bg);
  color: var(--danger);
}
@media (hover: none), (pointer: coarse) {
  .music-queue-row.music-queue-request:has(> [data-music-detail]) {
    grid-template-columns: var(--space-5) var(--avatar-size-md) minmax(0, 1fr) minmax(0, 11rem) 3.5rem var(--tap-target-size);
  }
  .music-queue-row > [data-music-detail] {
    display: flex;
  }
}
.music-search-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-2);
}
.music-search-results {
  display: grid;
  gap: var(--space-3);
  margin-top: var(--space-3);
}
.music-search-status {
  margin: var(--space-3) 0 0;
}
.music-result-type-switch {
  display: flex;
  gap: var(--space-2);
}
.music-result-type-button.is-selected {
  box-shadow: inset 0 0 0 1px var(--accent);
  color: var(--accent);
}

/* Starting a Jam: a labeled output field with its button, not a full-width form. */
/* The controller line belongs to the heading above it. */
.music-account {
  margin-top: calc(-1 * var(--space-2));
}
.music-device-area {
  display: grid;
  gap: var(--space-3);
}
.music-device-picker {
  display: grid;
  grid-template-columns: minmax(0, 24rem) auto;
  justify-content: start;
  align-items: end;
  gap: var(--space-2);
}
.music-device-field {
  display: grid;
  gap: var(--space-1);
}
.music-management-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}
.music-management-row .music-meta {
  white-space: normal;
}
.music-management-row > .btn {
  flex: none;
}
.music-local-player {
  padding-top: var(--space-3);
  border-top: 1px solid var(--border);
}

/* Request details: full title, facts as hairline rows, equal actions. */
.modal.music-detail-modal {
  max-width: 400px;
}
.music-detail-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: var(--space-3);
}
.music-detail-title {
  overflow-wrap: anywhere;
}
.music-detail-facts {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  margin: 0;
  font-size: var(--font-size-sm);
}
.music-detail-facts dt,
.music-detail-facts dd {
  margin: 0;
  padding: var(--space-1) 0;
  border-top: 1px solid var(--border);
}
.music-detail-facts dt {
  padding-right: var(--space-5);
  color: var(--text-muted);
}
.music-detail-footer {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-2);
}

@media (max-width: 639px) { /* --bp-md */
  .music-cover {
    width: calc(var(--tap-target-size) + var(--space-3));
    height: calc(var(--tap-target-size) + var(--space-3));
  }
  .music-now-playing {
    gap: var(--space-3);
  }
  /* Requester moves into the artist line; the fixed columns stay. */
  .music-queue-row {
    grid-template-columns: var(--space-4) var(--avatar-size-md) minmax(0, 1fr) 2.75rem;
    gap: var(--space-2);
  }
  .music-queue-row.music-search-row {
    grid-template-columns: var(--avatar-size-md) minmax(0, 1fr) 6.5rem;
  }
  .music-queue-who {
    display: none;
  }
  .music-queue-who-inline {
    display: inline;
  }
  .music-device-picker {
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .music-setup-steps li {
    grid-template-columns: var(--space-5) minmax(0, 1fr);
  }
  .music-setup-step-action {
    grid-column: 2;
    justify-self: end;
  }
  .music-management-row {
    align-items: flex-start;
  }
}
@media (max-width: 639px) and (hover: none), (max-width: 639px) and (pointer: coarse) { /* --bp-md */
  .music-queue-row.music-queue-request:has(> [data-music-detail]) {
    grid-template-columns: var(--space-4) var(--avatar-size-md) minmax(0, 1fr) 2.75rem var(--tap-target-size);
  }
}
