/* === БАЗОВЫЙ СТИЛЬ === */
body {
  background-color: #111;
  color: #fff;
  font-family: "Segoe UI", "Inter", sans-serif;
  text-align: center;
  margin: 0;
  padding: 20px;
  min-height: 100vh;
  box-sizing: border-box;
  overflow-x: hidden;
  max-width: 100vw;
  width: 100%;
}

* {
  box-sizing: border-box;
}

h1 {
  font-size: 1.8rem;
  margin-bottom: 20px;
  line-height: 1.3;
  word-wrap: break-word;
}

button {
  background: #007bff;
  border: none;
  color: #fff;
  padding: 10px 18px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.3s;
  font-size: 1rem;
}

button:hover {
  background: #0056b3;
}

button.secondary {
  background: #555;
}

button.danger {
  background: #b00020;
}

button.danger:hover {
  background: #e53935;
}

input,
select {
  padding: 10px;
  margin: 6px;
  border-radius: 6px;
  border: none;
  background: #222;
  color: #fff;
  font-size: 1rem;
  width: auto;
  max-width: 90%;
}

/* --- УЛУЧШЕННАЯ ШАПКА АДМИНКИ --- */
.admin-top {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: stretch;
  margin-bottom: 28px;
  justify-content: center;
}

.admin-card {
  background: #1a1a1a;
  border: 1px solid #2d2d2d;
  border-radius: 18px;
  padding: 24px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
  flex: 1 1 320px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.admin-game-card {
  max-width: 420px;
}

.card-heading {
  font-size: 1.35rem;
  font-weight: 700;
  color: #ffffff;
  text-align: left;
}

.game-name-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.game-name-input {
  flex: 1 1 240px;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid #3a3a3a;
  background: #202020;
  color: #ffffff;
  font-size: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.game-name-input:focus {
  outline: none;
  border-color: #5c7cfa;
  box-shadow: 0 0 0 3px rgba(92, 124, 250, 0.25);
}

.game-name-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.admin-setup-card {
  flex: 2 1 520px;
  gap: 20px;
}

.setup-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  justify-content: flex-start;
}

.setup-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-weight: 600;
  color: #ffffff;
  align-items: flex-start;
}

.setup-label input {
  margin: 0;
  width: 140px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #3a3a3a;
  background: #202020;
  color: #ffffff;
  font-size: 1rem;
}

.roles-block {
  border-top: 1px solid #2f2f2f;
  padding-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.roles-title {
  font-weight: 600;
  font-size: 1rem;
  color: #ffffff;
  text-align: left;
}

.roles-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: flex-start;
}

.role-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: #202020;
  border: 1px solid transparent;
  border-radius: 10px;
  color: #ffffff;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.role-option:hover {
  border-color: #5c7cfa;
  background: #25293d;
}

.role-option input {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.role-option span {
  font-weight: 600;
}

.role-required {
  color: #ff6b6b;
}

.roles-note {
  color: #ff6b6b;
  font-size: 0.85rem;
  margin: 0;
  text-align: left;
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: flex-start;
}

.primary-button {
  background: #1f7bff;
  border: none;
  color: #ffffff;
  padding: 12px 20px;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}

.primary-button:hover {
  background: #1a63cf;
  transform: translateY(-1px);
}

.neutral-button {
  background: #3a3a3a;
  border: none;
  color: #ffffff;
  padding: 12px 18px;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}

.neutral-button:hover {
  background: #4a4a4a;
  transform: translateY(-1px);
}

.danger-button {
  background: #d64545;
  border: none;
  color: #ffffff;
  padding: 12px 20px;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}

.danger-button:hover {
  background: #b83636;
  transform: translateY(-1px);
}

.ghost-button {
  background: #262626;
  border: 1px solid #3a3a3a;
  color: #dcdcdc;
  padding: 10px 18px;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.ghost-button:hover {
  border-color: #5c7cfa;
  color: #ffffff;
  background: #2e2e2e;
}

/* === ТАБЛИЦЫ === */
table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 20px;
  overflow-x: auto;
  display: block;
}

th,
td {
  padding: 10px 8px;
  border-bottom: 1px solid #333;
  text-align: center;
  vertical-align: middle;
  word-wrap: break-word;
}

th {
  background: #222;
  font-weight: bold;
  position: sticky;
  top: 0;
  z-index: 1;
}

tr:hover {
  background-color: #1b1b1b;
}

.qr-small {
  width: 80px;
  height: 80px;
  border-radius: 4px;
}

/* === ССЫЛКИ === */
a {
  color: #61dafb;
  text-decoration: none;
  word-break: break-all;
}

a:hover {
  text-decoration: underline;
}

/* === АДАПТИВНОСТЬ === */
@media (max-width: 900px) {
  h1 {
    font-size: 1.6rem;
  }

  #setup {
    flex-direction: column;
    gap: 10px;
  }

  table {
    font-size: 0.95rem;
  }

  .qr-small {
    width: 70px;
    height: 70px;
  }

  button {
    padding: 8px 14px;
    font-size: 0.95rem;
  }
}

@media (max-width: 600px) {
  body {
    padding: 10px;
  }

  h1 {
    font-size: 1.4rem;
  }

  table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }

  th,
  td {
    padding: 8px 6px;
  }

  .qr-small {
    width: 60px;
    height: 60px;
  }

  input,
  select {
    width: 100%;
    max-width: none;
  }

  button {
    width: 100%;
    max-width: 300px;
  }
}

@media (max-width: 400px) {
  h1 {
    font-size: 1.2rem;
  }

  .qr-small {
    width: 50px;
    height: 50px;
  }

  table {
    font-size: 0.85rem;
  }

  button {
    padding: 8px;
  }
}
/* === МОДАЛЬНОЕ ОКНО ДЛЯ QR === */
#qrModal {
  display: none;
  position: fixed;
  z-index: 9999;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.9);
  justify-content: center;
  align-items: center;
}

.qr-modal-content {
  text-align: center;
}

#qrModalImg {
  width: 300px;
  height: 300px;
  border-radius: 10px;
  background: white;
}

#qrClose {
  margin-top: 20px;
  background: #b00020;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  color: white;
  cursor: pointer;
}

.qr-clickable {
  cursor: pointer;
  transition: transform 0.2s;
}

.qr-clickable:hover {
  transform: scale(1.05);
}
/* === TOAST-УВЕДОМЛЕНИЯ === */
#toastContainer {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 9999;
}

.toast {
  opacity: 0;
  transform: translateY(20px);
  background: #333;
  color: #fff;
  padding: 10px 16px;
  border-radius: 6px;
  font-size: 0.95rem;
  transition: all 0.3s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  max-width: 300px;
}

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

.toast.info {
  background: #007bff;
}

.toast.success {
  background: #28a745;
}

.toast.error {
  background: #dc3545;
}

.toast.warning {
  background: #ffc107;
  color: #000;
}

.admin-bottom {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  margin-top: 24px;
  margin-bottom: 24px;
}

.admin-stage-card .card-note {
  color: #c7c7c7;
  margin: 0;
  text-align: left;
  font-size: 0.9rem;
}

.timer-controls {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.timer-controls .setup-label select {
  width: 160px;
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #3a3a3a;
  background: #202020;
  color: #ffffff;
}

.admin-sim-card .sim-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
}

.admin-sim-card .sim-controls .setup-label {
  align-items: flex-start;
}

.admin-sim-card select {
  width: 180px;
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #3a3a3a;
  background: #202020;
  color: #ffffff;
}

.round-results {
  border-top: 1px solid #2f2f2f;
  padding-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.results-table-wrapper {
  max-height: 360px;
  overflow: auto;
  border: 1px solid #2d2d2d;
  border-radius: 12px;
}

.results-table-wrapper table {
  margin: 0;
  display: table;
}