:root {
  --bg: #0f1115;
  --card: #171a21;
  --text: #e9eef7;
  --muted: #a8b3c7;
  --ok: #4ade80;
  --warn: #fbbf24;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
}

* { box-sizing: border-box; }

.is-hidden { display: none !important; }

body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.container { max-width: 1100px; margin: 0 auto; padding: 18px; }
.card { background: var(--card); border-radius: 14px; padding: 14px; }
.play { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.bigTimer { font-size: 64px; font-weight: 800; }

@keyframes cluedoCriticalBlink {
  0%,
  49% {
    opacity: 1;
  }
  50%,
  100% {
    opacity: 0.45;
  }
}

.badge { padding: 6px 10px; border-radius: 999px; font-weight: 700; }
.badge.wait { background: var(--warn); color: #000; }
.badge.ok { background: var(--ok); color: #000; }

/* ===================== HUB ===================== */


.hub-app-version {
  display: block;
  width: 100%;
  padding: 8px 12px 0;
  text-align: right;
  font-size: 12px;
  color: var(--muted);
  opacity: 0.85;
  letter-spacing: 0.02em;
  pointer-events: none;
}


.hub-return-link {
  position: fixed;
  top: 8px;
  left: 12px;
  z-index: 45;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 12px;
  border-radius: 10px;
  background: #334155;
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 14px;
}

.hub-return-link:hover,
.hub-return-link:focus-visible {
  background: #3f516d;
}

.hub-card { display: flex; flex-direction: column; gap: 18px; }
.hub-section h2 { margin: 0 0 10px; font-size: 1.2rem; }
.hub-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }

.hub-character-list { display: grid; grid-template-columns: 1fr; gap: 14px; }

.hub-character-card {
  display: block;
  background: #10151f;
  border: 1px solid #263247;
  border-radius: 12px;
  padding: 14px;
  color: inherit;
  text-decoration: none;
  transition: border-color .15s ease, transform .15s ease, background .15s ease;
}

.hub-character-card:hover,
.hub-character-card:focus-visible {
  border-color: #3d5578;
  background: #151e2c;
  transform: translateY(-1px);
}
.hub-character-identity {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  text-align: center;
}

.hub-character-photo {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #2d3c55;
  background: #162131;
  flex-shrink: 0;
}

.hub-character-photo-placeholder {
  background: radial-gradient(circle at 30% 30%, #425a7a, #223247 60%, #1a2535 100%);
}

.hub-character-title {
  margin: 0;
  width: 100%;
  font-size: 1.05rem;
  color: #dbe7ff;
  line-height: 1.2;
}

.hub-character-id {
  margin: 0;
  font-size: .9rem;
  color: #9fb3d1;
  font-weight: 600;
}

.hub-bulk-actions {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
}

.hub-button {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  width: 100%;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  padding: 8px 10px;
  text-align: center;
  border: none;
  font-size: 14px;
  cursor: pointer;
}
.hub-button:hover,
.hub-button:focus-visible { background: var(--accent-hover); }


.hub-button-secure { background: #dc2626; }
.hub-button-secure:hover,
.hub-button-secure:focus-visible { background: #b91c1c; }

.hub-button-free { background: #2563eb; }
.hub-button-free:hover,
.hub-button-free:focus-visible { background: #1d4ed8; }
.hub-button-secondary { background: #334155; }
.hub-button-secondary:hover { background: #3f516d; }


.hub-desktop-only { display: none; }

.hub-qr-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.75);
}

.hub-qr-modal-dialog {
  width: min(420px, 100%);
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 14px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
}

.hub-qr-modal-dialog h3 {
  margin: 0;
  font-size: 1.12rem;
  color: #dbeafe;
}

.hub-team-qr-image {
  width: min(320px, 100%);
  height: auto;
  border-radius: 10px;
  background: #fff;
  padding: 8px;
}

.hub-qr-modal-help {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}













/* ===================== ADMIN ===================== */

.admin-page {
  max-width: none;
  width: 100%;
  padding-bottom: 110px;
  padding-left: 14px;
  padding-right: 14px;
}

.admin-subtitle { color: var(--muted); margin-top: -6px; }



.admin-top-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  margin: -6px 0 12px;
  padding: 6px 0 10px;
  background: linear-gradient(to bottom, rgba(15, 17, 21, 0.98), rgba(15, 17, 21, 0.82), rgba(15, 17, 21, 0));
}

.admin-hub-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  border-radius: 10px;
  background: #334155;
  color: #fff;
  font-weight: 700;
  text-decoration: none;
}

.admin-hub-link:hover,
.admin-hub-link:focus-visible { background: #3f516d; }

.admin-save-wrap {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, rgba(15, 17, 21, 0.96), rgba(15, 17, 21, 0.8), rgba(15, 17, 21, 0));
  display: flex;
  justify-content: center;
  pointer-events: none;
}
.admin-open-access { color: #6ee7b7; margin-top: -6px; }

.admin-label {
  display: block;
  margin: 0 0 8px;
  font-size: 14px;
  color: var(--muted);
}

.admin-input {
  width: 100%;
  padding: 12px;
  font-size: 16px;
  border-radius: 10px;
  border: 1px solid #2a3142;
  background: #0f131d;
  color: var(--text);
}

.admin-button,
.admin-save-button,
.admin-nav-button {
  border: none;
  border-radius: 10px;
  cursor: pointer;
}

.admin-button {
  padding: 12px 14px;
  font-size: 15px;
  background: #3b82f6;
  color: #fff;
}

.admin-save-button {
  width: min(1100px, calc(100% - 28px));
  padding: 14px;
  font-size: 18px;
  background: #16a34a;
  color: #fff;
  pointer-events: auto;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.admin-quick-nav,
.admin-global-actions { margin-bottom: 16px; }

.admin-quick-nav h2,
.admin-global-actions h2 { margin: 0 0 10px; font-size: 18px; }

.admin-quick-nav-list { display: flex; flex-wrap: wrap; gap: 8px; }

.admin-nav-button {
  padding: 8px 12px;
  background: #243042;
  color: #dbe7ff;
  font-size: 14px;
}
.admin-nav-button:hover { background: #31445f; }

.admin-global-actions-row { display: flex; flex-direction: column; gap: 10px; }
.admin-global-actions-controls { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.admin-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }

.admin-player-card h3 { margin-top: 0; }
.admin-player-card .admin-input,
.admin-player-card .photo { margin-bottom: 12px; }


.character-photo-card h3 { margin-top: 0; }
.character-photo-input { display: none; }
.admin-photo {
  width: 100%;
  max-height: 200px;
  object-fit: contain;
  border-radius: 10px;
  margin-bottom: 8px;
  background: #0b0f16;
}

.crop-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.crop-dialog {
  width: min(520px, 100%);
  background: #0f131d;
  border: 1px solid #2a3142;
  border-radius: 14px;
  padding: 16px;
}

.crop-dialog h3 {
  margin: 0 0 8px;
}

.crop-help {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 14px;
}

.crop-stage-wrap {
  display: flex;
  justify-content: center;
}

.crop-stage {
  position: relative;
  border-radius: 10px;
  background: #05070b;
  overflow: hidden;
}

.crop-image {
  position: absolute;
  object-fit: contain;
  user-select: none;
  pointer-events: none;
}

.crop-selection {
  position: absolute;
  border: 2px solid #4ade80;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.42);
  cursor: grab;
  touch-action: none;
}

.crop-selection:active {
  cursor: grabbing;
}

.crop-actions {
  margin-top: 14px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ===================== MEDIA QUERIES ===================== */

@media (min-width: 768px) {
  .hub-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hub-character-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .hub-desktop-only { display: flex; }
  .hub-bulk-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hub-character-photo {
    width: 84px;
    height: 84px;
  }
}

@media (min-width: 720px) {
  .admin-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 980px) {
  .admin-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (min-width: 1280px) {
  .admin-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (min-width: 1560px) {
  .admin-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

/* ===================== TEAM HUB ===================== */


.team-page { padding-bottom: 40px; }

.team-title-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.team-hero-name {
  margin: 0;
  text-align: center;
  font-size: clamp(2rem, 9vw, 3rem);
  font-weight: 800;
}

.team-hero-edit-btn {
  padding: 8px 10px;
  line-height: 1;
}

.team-score {
  margin: -8px 0 16px;
  text-align: center;
  font-weight: 800;
  color: #fef08a;
}

.team-notifications-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.team-notifications-header h2 {
  margin: 0;
}

.team-audio-button {
  white-space: nowrap;
}

.team-audio-button.is-enabled {
  background: #16a34a;
}

.team-audio-button.is-disabled {
  background: #b91c1c;
}

.team-message-history {
  margin-top: 10px;
  max-height: 9.5rem;
  overflow-y: auto;
  border: 1px solid #4b5563;
  border-radius: 10px;
  background: #1e293b;
  padding: 8px;
}

.team-message-empty {
  margin: 0;
  color: #fef08a;
}

.team-message-item {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 8px;
  min-height: 1.5rem;
  margin-bottom: 6px;
}

.team-message-item:last-child {
  margin-bottom: 0;
}

.team-message-time {
  color: #facc15;
  font-size: 0.8rem;
  font-weight: 700;
}

.team-message-text {
  margin: 0;
  color: #fde047;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.team-block h2 {
  margin: 0 0 4px;
}

.team-input-row {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
}

.team-participant-add-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.team-players-list {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  display: grid;
  gap: 8px;
}

.team-player-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid #2a3142;
  border-radius: 10px;
  padding: 8px 10px;
}

.team-player-remove {
  border: 0;
  background: transparent;
  color: #fca5a5;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
}

.team-character-photo {
  width: 96px;
  height: 96px;
  border-radius: 10px;
  object-fit: cover;
  background: #1f2937;
}

.team-character-photo-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #cbd5e1;
  font-size: 0.8rem;
  text-align: center;
  padding: 8px;
}
.team-hero {
  margin-bottom: 14px;
  text-align: center;
  padding: 12px 14px;
}
.team-kicker {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.team-hero-main {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}
.team-display-name {
  margin: 0;
  font-size: clamp(1.4rem, 6vw, 2rem);
  line-height: 1.1;
}
.team-edit-name-btn {
  padding: 7px 10px;
  font-size: 13px;
  background: #334155;
}
.team-guidance {
  margin-bottom: 14px;
  border: 1px solid #2a3142;
}
.team-guidance-title {
  margin: 0 0 10px;
  font-size: 1rem;
}
.team-guidance-message {
  margin: 0 0 8px;
  font-size: 0.95rem;
  color: #cfe0ff;
}
.team-guidance-message:last-child {
  margin-bottom: 0;
}
.team-guidance-message.is-ok {
  color: #9fe6ba;
}
.team-accordion { display: grid; gap: 14px; }
.team-block { margin-bottom: 0; }
.team-accordion-heading { margin: 0; }
.team-accordion-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 4px 0;
  font-size: 1.15rem;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}
.team-accordion-hint {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 500;
}
.team-accordion-trigger:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 5px;
  border-radius: 8px;
}
.team-accordion-icon {
  transition: transform 0.2s ease;
  color: var(--muted);
}
.team-accordion-item.is-open .team-accordion-icon {
  transform: rotate(180deg);
}
.team-accordion-panel {
  margin-top: 12px;
  border-top: 1px solid #2a3142;
  padding-top: 12px;
}
.team-accordion-panel h3 {
  margin: 0 0 10px;
  font-size: 1rem;
}
.team-accordion-panel h3 + div {
  margin-bottom: 12px;
}
.team-form h3 { margin: 14px 0 8px; }
.team-inline {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-bottom: 8px;
}
.team-feedback {
  color: var(--muted);
  font-size: 14px;
  min-height: 20px;
}
.team-feedback.is-processing {
  color: #93c5fd;
}
.team-feedback.is-success {
  color: var(--ok);
}
.team-feedback.is-error {
  color: #f87171;
}

.team-photo-input-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.team-photo-block .team-feedback {
  overflow-wrap: anywhere;
}

.team-photo-square {
  aspect-ratio: 1 / 1;
  width: min(100%, 320px);
  object-fit: cover;
}

.team-photo-square-placeholder {
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: radial-gradient(circle at 20% 20%, #3c4f6b, #202b3d);
  color: #e2e8f0;
  font-size: 2rem;
}

@media (min-width: 720px) {
  .team-inline {
    grid-template-columns: 1fr auto;
    align-items: center;
  }
}

/* ===================== SUPERVISION ===================== */

.monitor-page {
  max-width: none;
  width: 100%;
  padding-top: 14px;
  padding-left: 14px;
  padding-right: 14px;
}

.monitor-header-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.monitor-actions-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.monitor-hub-btn,
.monitor-reset-btn {
  border: none;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
}

.monitor-hub-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #334155;
  color: #fff;
  text-decoration: none;
  font-weight: 700;
}
.monitor-hub-btn:hover,
.monitor-hub-btn:focus-visible {
  background: #3f516d;
}
.monitor-reset-btn { background: #475569; color: #fff; }


.monitor-hard-reset-btn {
  border: none;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
  background: #ea580c;
  color: #fff;
}

.monitor-hard-reset-btn:hover,
.monitor-hard-reset-btn:focus-visible {
  background: #c2410c;
}

.monitor-endgame-btn {
  border: none;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
  background: #b91c1c;
  color: #fff;
}

.monitor-endgame-btn.is-active {
  background: #166534;
}

.monitor-end-game-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-weight: 700;
  white-space: nowrap;
}

.monitor-end-game-indicator::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #ef4444;
}

.monitor-end-game-indicator.is-inactive {
  color: #fca5a5;
}

.monitor-end-game-indicator.is-inactive::before {
  background: #ef4444;
}

.monitor-end-game-indicator.is-active {
  color: #86efac;
}

.monitor-end-game-indicator.is-active::before {
  background: #22c55e;
}

.team-endgame-banner {
  margin: 8px 0 0;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #f87171;
  background: #7f1d1d;
  color: #fee2e2;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}



.monitor-sort-controls {
  margin-bottom: 12px;
}

.monitor-sort-controls .admin-label {
  display: block;
  margin-bottom: 6px;
}

#monitor-team-sort {
  min-height: 46px;
  font-size: 1rem;
}


.monitor-message-controls {
  margin-bottom: 16px;
}

.monitor-message-controls h2 {
  margin: 0 0 10px;
}

.monitor-message-intro {
  margin: 0 0 12px;
  color: #dbe7ff;
}

.monitor-message-panels {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.monitor-message-panel {
  border: 1px solid #2a3142;
  border-radius: 12px;
  background: #0f1726;
  padding: 12px;
}

.monitor-message-panel h3 {
  margin: 0 0 6px;
}

.monitor-message-form-row {
  margin-bottom: 10px;
}

.monitor-message-form-row:last-of-type {
  margin-bottom: 0;
}

.monitor-message-input {
  min-height: 120px;
  resize: vertical;
  font-size: 1rem;
}

#monitor-message-target-search,
#monitor-message-target {
  min-height: 48px;
  font-size: 1rem;
}

#monitor-message-target {
  min-height: 220px;
}

.monitor-message-send-btn {
  width: 100%;
  min-height: 48px;
  font-size: 1rem;
}

@media (orientation: landscape), (min-width: 900px) {
  .monitor-message-panel {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(280px, 1.35fr);
    gap: 12px;
    align-items: start;
  }

  .monitor-message-panel > .monitor-muted,
  .monitor-message-panel > .monitor-message-form-row:first-of-type,
  .monitor-message-panel > .monitor-message-send-btn,
  .monitor-message-panel > .team-feedback {
    grid-column: 1 / -1;
  }

  .monitor-message-panel > .monitor-message-form-row:nth-of-type(2) {
    grid-column: 1;
  }

  .monitor-message-panel > .monitor-message-form-row:nth-of-type(3) {
    grid-column: 2;
  }

  #monitor-message-target {
    min-height: 180px;
  }

  .monitor-message-input {
    min-height: 180px;
  }
}

.monitor-grid {
  display: grid;
  grid-template-columns: repeat(1, minmax(0, 1fr));
  gap: 12px;
}

@media (min-width: 640px) {
  .monitor-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.monitor-team-card {
  border: 1px solid #2a3142;
  display: flex;
  flex-direction: column;
}

.monitor-team-header {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 12px;
  align-items: center;
  margin-bottom: 10px;
}

.monitor-team-header-meta {
  min-width: 0;
}

.monitor-team-name {
  margin: 0 0 4px;
}

.monitor-team-photo {
  width: 80px;
  height: 80px;
  border-radius: 12px;
  object-fit: cover;
  background: #1d2635;
}

.monitor-team-photo-placeholder {
  background: radial-gradient(circle at 20% 20%, #3c4f6b, #202b3d);
}

.monitor-status {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.85rem;
}

.monitor-status.is-free { background: #22c55e; color: #062b14; }
.monitor-status.is-with-character { background: #3b82f6; color: #eaf2ff; }
.monitor-status.is-waiting { background: #f59e0b; color: #301e00; }

.monitor-character-context {
  margin: 6px 0 0;
  color: #dbe7ff;
  font-weight: 600;
}

.monitor-team-card h4 {
  margin: 8px 0 6px;
}

.monitor-players,
.monitor-muted {
  margin: 0;
  color: #d1ddf4;
}

.monitor-history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.monitor-history-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  font-size: 0.95rem;
  color: #d1ddf4;
}

.monitor-team-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}

.monitor-team-main {
  min-width: 0;
}

.monitor-card-message {
  background: #0f131d;
  border: 1px solid #263247;
  border-radius: 8px;
  padding: 8px;
  width: 100%;
}

.monitor-card-message p {
  margin: 0;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.monitor-last-character {
  margin: 0;
  color: #d1ddf4;
  font-weight: 600;
}


.monitor-team-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  margin-top: auto;
}

.monitor-team-actions .admin-button {
  flex: 1 1 calc(50% - 4px);
  min-width: 96px;
  width: auto;
}

@media (max-width: 360px) {
  .monitor-team-actions {
    flex-direction: column;
  }

  .monitor-team-actions .admin-button {
    width: 100%;
  }
}

.monitor-team-delete-btn {
  background: #b91c1c;
  border-color: #b91c1c;
}

.monitor-team-delete-btn:hover,
.monitor-team-delete-btn:focus-visible {
  background: #991b1b;
  border-color: #991b1b;
}

.monitor-modal {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.78);
  display: grid;
  place-items: center;
  z-index: 1000;
  padding: 14px;
}

.monitor-modal-dialog {
  width: min(94vw, 460px);
  border-radius: 14px;
  border: 1px solid #334155;
  background: #0f1726;
  padding: 14px;
}

.monitor-modal-dialog h3 {
  margin: 0 0 8px;
}

.monitor-team-qr-image {
  display: block;
  width: min(100%, 320px);
  margin: 10px auto;
  border-radius: 10px;
  border: 1px solid #334155;
  background: #fff;
}

.monitor-modal-link-wrap {
  margin: 10px 0;
}

.monitor-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.monitor-modal-actions .admin-button {
  flex: 1 1 180px;
  text-align: center;
  text-decoration: none;
}

.team-supervision-message {
  margin-bottom: 14px;
  border: 1px solid #2a3142;
}

.team-supervision-message h2 {
  margin: 0 0 8px;
}

.team-audio-controls {
  margin-bottom: 10px;
}

.team-audio-controls .admin-button {
  margin-bottom: 8px;
}

.team-audio-controls .admin-button.is-enabled {
  background: #22c55e;
  color: #062b14;
  border-color: #22c55e;
}

.team-supervision-message-text {
  margin: 0;
  color: #cfe0ff;
}

.team-supervision-message-text.is-active {
  color: #fef08a;
  font-weight: 700;
}

.character-supervision-message-text {
  margin: 0;
  color: #cfe0ff;
}

.character-supervision-message-text.is-active {
  color: #fef08a;
  font-weight: 700;
}

.character-supervision-message {
  border: 2px solid #fef08a;
}

.character-active-team {
  border: 2px solid #22c55e;
  background: linear-gradient(180deg, rgba(34, 197, 94, 0.15), rgba(30, 41, 59, 0.9));
}

.character-active-team h3 {
  margin-top: 0;
}

.character-active-team-priority {
  display: grid;
  gap: 8px;
}

.character-active-team-name {
  margin: 0;
  font-size: clamp(1.4rem, 5vw, 2rem);
  font-weight: 900;
}

.character-active-team-identity {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 12px;
  align-items: start;
}

.character-active-team-photo,
.character-active-team-photo-placeholder {
  width: 92px;
  height: 92px;
  border-radius: 14px;
  border: 2px solid #f8fafc;
}

.character-active-team-photo {
  object-fit: cover;
  display: block;
}

.character-active-team-photo-placeholder {
  display: grid;
  place-items: center;
  background: #334155;
  font-size: 2rem;
}

.character-active-team-state,
.character-active-team-remaining,
.character-active-team-score,
.character-active-team-players-title,
.character-active-team-players-empty {
  margin: 0 0 6px;
}

.character-active-team-players {
  margin: 0;
  color: #e2e8f0;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.character-active-team-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.character-active-team-actions .admin-button {
  flex: 1 1 170px;
  font-size: 1rem;
  padding: 12px 14px;
  font-weight: 800;
}

.character-action-plus {
  background: #22c55e;
  color: #052e16;
}

.character-action-minus {
  background: #f59e0b;
  color: #3b2300;
}

.character-action-eject {
  background: #ef4444;
  color: #fff1f2;
}

.character-score-actions {
  margin-top: 14px;
}

.character-score-action {
  flex: 1 1 260px;
  min-height: 64px;
  line-height: 1.25;
}

.character-score-action-bonus {
  background: #16a34a;
  color: #f0fdf4;
}

.character-score-action-penalty {
  background: #dc2626;
  color: #fff1f2;
}

.character-waiting-queue {
  border: 1px solid #2a3142;
}

.character-queue-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 6px;
}

.character-queue-list li {
  display: flex;
  align-items: baseline;
  gap: 6px;
  white-space: nowrap;
}

.character-queue-team {
  font-weight: 700;
}

.character-queue-meta {
  color: #cfe0ff;
  font-size: 0.95rem;
}


@media (min-width: 900px) {
  .monitor-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 1280px) {
  .monitor-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (min-width: 1560px) {
  .monitor-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

@media (min-width: 1880px) {
  .monitor-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

.team-character-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-top: -2px;
  margin-bottom: 0;
}

.team-character-sort-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.team-character-sort-label {
  margin: 0;
  white-space: nowrap;
}



.team-character-lock-message {
  margin: 0;
  min-height: 0;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: normal;
}

.team-character-help {
  margin: 2px 0 8px;
  min-height: 0;
  white-space: nowrap;
}

.team-character-help.is-error {
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: normal;
}

.team-current-character {
  margin: 2px 0 4px;
}

.team-current-character-card {
  --team-current-state-color: #ffffff;
  --team-current-state-color-rgb: 255, 255, 255;
  border: 1px solid #2a3142;
  border-radius: 10px;
  padding: 10px;
  background: #0f131d;
  border-color: var(--team-current-state-color);
  box-shadow: 0 0 0 2px rgba(var(--team-current-state-color-rgb), 0.25), 0 0 24px rgba(var(--team-current-state-color-rgb), 0.2);
}

.team-current-character-card.is-active {
  --team-current-state-color: #4ade80;
  --team-current-state-color-rgb: 74, 222, 128;
}

.team-current-character-card.is-alert {
  --team-current-state-color: #f59e0b;
  --team-current-state-color-rgb: 245, 158, 11;
}

.team-current-character-card.is-critical {
  --team-current-state-color: #ef4444;
  --team-current-state-color-rgb: 239, 68, 68;
}

.team-current-character-card.is-waiting {
  --team-current-state-color: #fbbf24;
  --team-current-state-color-rgb: 251, 191, 36;
}

.team-current-character-card h3 {
  margin: 0 0 6px;
}

.team-current-character-layout {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
}

.team-current-character-photo-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
}

.team-current-character-meta {
  min-width: 0;
}

.team-current-state {
  margin: 0 0 6px;
  font-weight: 700;
}

.team-current-state.is-active {
  color: #4ade80;
}

.team-current-state.is-alert {
  color: #f59e0b;
}

.team-current-state.is-critical {
  color: #ef4444;
  animation: cluedoCriticalBlink 0.9s steps(1, end) infinite;
}

.team-current-state.is-waiting {
  color: #ffffff;
}

.team-current-meta {
  margin: 0 0 8px;
  color: #cbd5e1;
}

.team-current-leave {
  background: #b91c1c;
  display: block;
  margin: 0 auto;
}

.team-current-leave:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.team-character-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.team-character-item {
  border: 1px solid #2a3142;
  border-radius: 10px;
  padding: 10px;
  display: grid;
  grid-template-columns: 30% 70%;
  gap: 10px;
  align-items: center;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.team-character-item:hover,
.team-character-item:focus-visible {
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.18);
}

.team-character-item.is-disabled {
  cursor: not-allowed;
  opacity: 0.68;
}

.team-character-item.is-current {
  border-color: #4ade80;
  box-shadow: 0 0 0 2px rgba(74, 222, 128, 0.2);
}

.team-character-col {
  min-width: 0;
}

.team-character-col-photo {
  display: flex;
  align-items: center;
}

.team-character-col-meta h3 {
  margin: 0 0 6px;
}

.team-character-line {
  margin: 0 0 4px;
}

.team-character-location {
  font-size: 0.97rem;
  color: #cbd5e1;
}

.team-character-wait {
  font-weight: 700;
}

.team-character-wait.is-wait-green {
  color: #22c55e;
}

.team-character-wait.is-wait-orange {
  color: #f59e0b;
}

.team-character-wait.is-wait-red {
  color: #ef4444;
}

.team-character-wait.is-wait-critical {
  color: #ef4444;
  animation: cluedoCriticalBlink 0.9s steps(1, end) infinite;
}

.team-seen-badge {
  display: inline-block;
  margin-bottom: 4px;
  color: #94a3b8;
  font-size: 0.86rem;
}

.team-photo-preview-wrap {
  margin-bottom: 10px;
}

.character-game-overview {
  border: 1px solid #2a3142;
}

.character-game-overview-accordion summary {
  cursor: pointer;
  font-weight: 800;
}

.character-game-overview-body {
  display: grid;
  gap: 12px;
  margin-top: 10px;
}

.character-game-overview-body h4 {
  margin: 0 0 8px;
}

.character-game-overview-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 6px;
}

.character-game-overview-list li {
  line-height: 1.4;
}

.character-game-overview-item-name {
  font-weight: 700;
}

.character-game-overview-item-state {
  color: #cfe0ff;
}

.character-game-overview-team-active {
  color: #22c55e;
}

.character-game-overview-team-waiting {
  color: #f59e0b;
}

.character-game-overview-empty {
  margin: 0;
  color: #cfe0ff;
}
