﻿:root {
  --ink: #201a14;
  --muted: #7a6256;
  --bg: #fff1ea;
  --paper: #fff9f6;
  --accent: #ff5f2a;
  --accent-dark: #e34a16;
  --danger: #c83a2b;
  --shadow: 0 20px 40px rgba(62, 22, 10, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family:  Trebuchet MS, Segoe UI, sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at top, #fff7ec, var(--bg));
}

.app {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px;
}

.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 28px 32px;
  border-radius: 24px;
  background: linear-gradient(135deg, #fff5e6, #ffe1c7);
  box-shadow: var(--shadow);
}

body:not([data-view="leaderboard"]) .hero {
  display: none;
}

.hero h1 {
  margin: 0 0 8px 0;
  font-size: clamp(28px, 3vw, 40px);
}

.hero p {
  margin: 0;
  color: var(--muted);
}

.tabs {
  display: flex;
  gap: 12px;
  margin: 24px 0 12px;
  flex-wrap: wrap;
}

.tab {
  border: 1px solid transparent;
  padding: 10px 18px;
  border-radius: 999px;
  background: #fff;
  cursor: pointer;
  font-weight: 600;
}

.tab.active {
  border-color: var(--accent);
  background: #fff4e8;
  color: var(--accent-dark);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.grid {
  display: grid;
  gap: 20px;
}

.grid.two {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

#view-players .grid + .grid {
  margin-top: 16px;
}

@media (max-width: 760px) {
  #view-players .grid + .grid {
    margin-top: 24px;
  }
}

.grid.three {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.card {
  background: var(--paper);
  border-radius: 20px;
  padding: 20px;
  box-shadow: var(--shadow);
}

.card.empty {
  text-align: center;
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

#loginStatus {
  align-self: center;
  font-weight: 600;
}

button {
  border: none;
  cursor: pointer;
  padding: 10px 16px;
  border-radius: 10px;
  font-weight: 600;
}

button.primary {
  background: var(--accent);
  color: white;
}

button.primary:hover {
  background: var(--accent-dark);
}

button.ghost {
  background: transparent;
  border: 1px solid #d8c7b5;
}

button.danger {
  background: var(--danger);
  color: #fff;
}

#btnEndGame {
  margin-bottom: 10px;
}

.list {
  display: grid;
  gap: 12px;
}

.list-item {
  padding: 12px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid #eee0d2;
}

.list-item.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.list-item .meta {
  display: grid;
  gap: 4px;
}

.list-item .danger {
  background: var(--danger);
  color: #fff;
}

.score-table {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.score-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid #eee0d2;
  font-weight: 600;
}

.round-form label,
.player-form label {
  display: grid;
  gap: 8px;
  font-weight: 600;
}

.round-form input,
.player-form input {
  padding: 10px;
  border-radius: 10px;
  border: 1px solid #d8c7b5;
}

.round-form h3 {
  margin-top: 0;
}

.round-form .actions {
  margin-top: 10px;
}

#passwordForm {
  margin-top: 12px;
}

#passwordForm button[type="submit"] {
  margin-top: 8px;
}

@media (max-width: 760px) {
  #passwordForm button[type="submit"] {
    margin-top: 16px;
  }
}

.muted {
  color: var(--muted);
  font-size: 0.9rem;
}

.game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.championship-controls {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

.championship-controls select {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #d8c7b5;
  background: #fff;
  font-weight: 600;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 0 20px;
}

.round-form .toggle {
  margin: 0;
  gap: 6px;
}

.round-form .actions .toggle {
  margin: 0;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(20, 12, 4, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: var(--paper);
  border-radius: 20px;
  padding: 20px;
  width: min(500px, 95vw);
  box-shadow: var(--shadow);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 12, 4, 0.6);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 10;
}

.overlay.hidden {
  display: none;
}

.overlay-card {
  background: var(--paper);
  border-radius: 20px;
  padding: 24px;
  width: min(420px, 95vw);
  box-shadow: var(--shadow);
}

.login-form {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.login-form input {
  padding: 10px;
  border-radius: 10px;
  border: 1px solid #d8c7b5;
}

.error {
  color: var(--danger);
  font-weight: 600;
}

hr {
  border: none;
  border-top: 1px solid #e7d8c8;
  margin: 16px 0;
}

#adminUsersCard {
  display: none;
}

@media (max-width: 760px) {
  .hero {
    flex-direction: column;
    align-items: flex-start;
  }

  .game-header {
    flex-direction: column;
    align-items: flex-start;
  }
}
