:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --card: #ffffff;
  --ink: #1f2937;
  --muted: #6b7280;
  --primary: #4f46e5;
  --danger: #b91c1c;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, sans-serif;
}
.container {
  width: min(1100px, 95vw);
  margin: 1.2rem auto;
  display: grid;
  gap: 1rem;
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}
.card {
  background: var(--card);
  border-radius: 10px;
  padding: 1rem;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}
.grid-2, .grid-3 {
  display: grid;
  gap: .7rem;
}
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

input, select, button {
  width: 100%;
  padding: .55rem .7rem;
  border: 1px solid #d1d5db;
  border-radius: 8px;
}
textarea {
  width: 100%;
  padding: .55rem .7rem;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font: inherit;
}
.btn {
  background: var(--primary);
  color: #fff;
  border: 0;
  cursor: pointer;
}
.btn.secondary { background: #374151; }
.btn.danger { background: var(--danger); }
.btn.small { margin-bottom: .35rem; }

.sort-btn {
  width: auto;
  border: 0;
  background: transparent;
  padding: 0;
  color: inherit;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.participant-actions {
  display: flex;
  align-items: center;
  gap: .35rem;
}

.icon-edit,
.icon-delete {
  width: auto;
  border: 1px solid #d1d5db;
  background: #fff;
  border-radius: 6px;
  padding: 4px;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.icon-delete {
  border-color: #fca5a5;
}

.buzz-decision-actions {
  display: grid;
  gap: .6rem;
  align-self: end;
}

.btn.buzz-true {
  background: #15803d;
}

.btn.buzz-false {
  background: #b91c1c;
}

.btn:disabled {
  opacity: .55;
  cursor: not-allowed;
}

.buzz-limit-status {
  margin: 0;
  color: #1f2937;
  font-weight: 700;
  align-self: end;
}

.buzz-limit-status.is-limit-reached {
  color: #b91c1c;
}

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td {
  text-align: left;
  padding: .5rem;
  border-bottom: 1px solid #e5e7eb;
  vertical-align: top;
}
.hint { color: var(--muted); margin-top: 0; }
.feedback { font-weight: bold; }
.feedback.error { color: var(--danger); }
.feedback.success { color: #15803d; }
.secret-found { text-decoration: line-through; color: var(--muted); }
.participant-card {
  padding: .7rem .8rem;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #f8fafc;
  font-weight: 700;
}
.buzz-list { margin: 0; padding-left: 1rem; }
.actions { margin-top: .8rem; }

.accordion-toggle {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: transparent;
  color: inherit;
  border: 0;
  padding: 0;
  font: inherit;
  font-size: 1.2rem;
  font-weight: 700;
  cursor: pointer;
}
.accordion-icon {
  display: inline-flex;
  transition: transform .2s ease;
}
.accordion-toggle[aria-expanded="true"] .accordion-icon {
  transform: rotate(90deg);
}
.accordion-content {
  margin-top: .8rem;
}

.secrets-filters-panel {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  align-items: end;
  margin-bottom: .8rem;
}

.secrets-filter {
  display: grid;
  gap: .35rem;
  max-width: 340px;
  min-width: min(340px, 100%);
}

.secrets-filter-actions {
  display: flex;
  gap: .5rem;
}

.secrets-filter-actions .btn {
  width: auto;
  min-width: 120px;
}

.secrets-filter-actions .btn.active {
  background: var(--primary);
}

.secrets-table th:nth-child(1),
.secrets-table td:nth-child(1) {
  width: 240px;
}

.secrets-table th:nth-child(2),
.secrets-table td:nth-child(2) {
  width: 100%;
  min-width: 320px;
}

.participant-label {
  display: inline-block;
  white-space: nowrap;
}

.secret-input {
  min-width: 280px;
  resize: vertical;
}

.sensitive-controls-card {
  margin-top: 2rem;
  border-top: 4px solid #d1d5db;
  background: #fffbeb;
}

.sensitive-controls-warning {
  margin: 0 0 .75rem;
  font-weight: 700;
  color: #92400e;
}

.control-group {
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  padding: .9rem;
  display: grid;
  gap: .65rem;
}

.control-group h3 {
  margin: 0;
}

.maintenance-group {
  background: #f8fafc;
}

.closure-group {
  background: #fef2f2;
  border-color: #fecaca;
}

.btn.maintenance {
  background: #4b5563;
}

.btn.maintenance-soft {
  background: #c2410c;
}

#confirmation-message {
  margin: 0;
  line-height: 1.45;
  white-space: pre-line;
}

@media (max-width: 720px) {
  .topbar { flex-direction: column; align-items: flex-start; }

  .secrets-filters-panel {
    flex-direction: column;
    align-items: stretch;
  }

  .secrets-filter-actions .btn {
    flex: 1;
  }

  .buzz-history-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .buzz-history-actions {
    margin-left: 0;
  }

  .buzz-row-actions {
    width: 100%;
  }

  .buzz-validate-btn,
  .buzz-delete-btn {
    width: 100%;
  }

  .secrets-table th:nth-child(1),
  .secrets-table td:nth-child(1) {
    min-width: 190px;
  }

  .points-history-summary {
    font-size: .95rem;
  }
}

.modal {
  border: 0;
  border-radius: 10px;
  padding: 0;
  width: min(480px, 92vw);
}
.modal::backdrop {
  background: rgba(17, 24, 39, 0.45);
}
.modal-content {
  display: grid;
  gap: .75rem;
  padding: 1rem;
}
.modal-content label {
  display: grid;
  gap: .35rem;
}
.modal-actions {
  display: flex;
  gap: .6rem;
}
.modal-actions .btn {
  margin: 0;
}

.toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  max-width: min(420px, calc(100vw - 2rem));
  padding: .75rem .9rem;
  border-radius: 8px;
  color: #fff;
  font-weight: 700;
  box-shadow: 0 10px 18px rgba(15, 23, 42, 0.25);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  z-index: 20;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.success {
  background: #15803d;
}

.toast.error {
  background: #b91c1c;
}

.secrets-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
}

.status-pill.status-proposed { background: #fff4ce; color: #8a5a00; }
.status-pill.status-validated { background: #d9fbe5; color: #166534; }
.status-pill.status-empty { background: #eef2ff; color: #3730a3; }
.status-pill { display:inline-flex; padding:.2rem .55rem; border-radius:999px; font-size:.78rem; font-weight:700; }

.game-state-badge {
  margin: .75rem 0;
  font-weight: 700;
  color: #166534;
}

.game-state-badge.is-closed {
  color: #991b1b;
}

.post-closure-reveal {
  margin-top: 1rem;
  border-top: 1px solid var(--border, #d1d5db);
  padding-top: 1rem;
}

.post-closure-reveal-list {
  display: grid;
  gap: .85rem;
}

.post-closure-card {
  border: 1px solid #d1d5db;
  border-radius: .8rem;
  padding: .85rem;
  background: #fff;
}

.post-closure-card h5 {
  margin: 0 0 .45rem;
  font-size: 1rem;
}

.post-closure-status {
  display: inline-block;
  margin-bottom: .6rem;
  font-size: .85rem;
  color: #6b7280;
}

.post-closure-status.is-found {
  color: #166534;
}

.post-closure-secret,
.post-closure-secret-mask {
  margin: .25rem 0 .75rem;
}

.post-closure-card .btn {
  width: 100%;
  min-height: 46px;
}

.tv-join-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 1rem;
}


.points-history-section {
  margin-top: 1rem;
  border-top: 1px solid #e5e7eb;
  padding-top: .9rem;
}

.points-history-list {
  display: grid;
  gap: .6rem;
}

.points-history-item {
  border: 1px solid #d1d5db;
  border-radius: 10px;
  background: #fff;
  padding: .2rem .6rem .6rem;
}

.points-history-summary {
  cursor: pointer;
  font-weight: 700;
  padding: .45rem 0;
}

.points-history-entries {
  margin: .2rem 0 0;
  padding-left: 1.1rem;
  display: grid;
  gap: .35rem;
}

.points-history-entry {
  line-height: 1.35;
}

.points-history-delta.is-positive {
  color: #166534;
  font-weight: 700;
}

.points-history-delta.is-negative {
  color: #991b1b;
  font-weight: 700;
}

.points-history-timestamp {
  color: #6b7280;
  font-size: .85rem;
}

.points-history-entry-empty {
  color: #6b7280;
  font-style: italic;
}

.special-buzz-toggle {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-weight: 700;
}

.special-buzz-toggle input {
  width: auto;
}


.secret-progress-stats {
  display: grid;
  gap: .4rem;
  margin-bottom: .8rem;
}

.secret-progress-stats p {
  margin: 0;
}

.secret-progress-track {
  display: grid;
  gap: .4rem;
}

.secret-progress-track p {
  margin: 0;
  font-weight: 700;
}

.secret-progress-bar {
  width: 100%;
  height: 12px;
  border-radius: 999px;
  background: #e5e7eb;
  overflow: hidden;
}

.secret-progress-bar span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #f59e0b 0%, #22c55e 100%);
  transition: width .25s ease;
}

.status-chip {
  display: inline-flex;
  border-radius: 999px;
  padding: .2rem .55rem;
  font-size: .78rem;
  font-weight: 700;
}

.status-chip.status-empty {
  background: #e5e7eb;
  color: #374151;
}

.status-chip.status-pending {
  background: #ffedd5;
  color: #9a3412;
}

.status-chip.status-validated {
  background: #dcfce7;
  color: #166534;
}
