:root {
  --bg: #121212;
  --surface: #1e1e1e;
  --surface-2: #262626;
  --border: #333;
  --text: #f5f5f5;
  --muted: #a0a0a0;
  --accent: #ff6b00;
  --accent-2: #ff8533;
  --danger: #ff4d4d;
  --success: #2ecc71;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.hidden {
  display: none !important;
}

/* ---------- Layout ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}

.brand-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, var(--accent-2), var(--accent));
  box-shadow: 0 0 10px rgba(255, 107, 0, 0.6);
}

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 20px 16px 64px;
}

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.card h1,
.card h2 {
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}

.muted {
  color: var(--muted);
  font-size: 0.95rem;
}

/* ---------- Forms ---------- */
label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin: 14px 0 6px;
}

input,
textarea {
  width: 100%;
  padding: 12px 14px;
  font-size: 1rem;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.15s ease;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
}

textarea {
  resize: vertical;
  font-family: inherit;
}

/* ---------- Buttons ---------- */
.btn,
.btn-ghost,
.btn-outline,
.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.05s ease, opacity 0.15s ease;
}

.btn {
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  color: #fff;
}

.btn:hover {
  filter: brightness(1.08);
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled,
.btn.disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: none;
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent-2);
}

.btn-ghost.danger:hover {
  border-color: var(--danger);
  color: var(--danger);
}

.btn-outline {
  background: transparent;
  color: var(--accent-2);
  border: 1px solid var(--accent);
}

.btn-outline:hover {
  background: rgba(255, 107, 0, 0.12);
}

.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
}

.btn-danger:hover {
  background: rgba(255, 77, 77, 0.12);
}

.link {
  background: none;
  border: none;
  color: var(--accent-2);
  font-size: 0.85rem;
  cursor: pointer;
  padding: 2px;
}

.link:hover {
  text-decoration: underline;
}

.row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 18px;
}

/* ---------- Profile chip ---------- */
.profile-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 8px 6px 14px;
  font-size: 0.85rem;
  max-width: 70%;
}

.chip-name {
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chip-email {
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chip-edit {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 4px 8px;
  border-radius: 999px;
}

.chip-edit:hover {
  color: var(--accent-2);
  background: var(--surface);
}

/* ---------- Tabs ---------- */
.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
  background: var(--surface);
  padding: 6px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.tab {
  flex: 1;
  padding: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.tab.active {
  background: var(--accent);
  color: #fff;
}

.tab:not(.active):hover {
  color: var(--text);
  background: var(--surface-2);
}

/* ---------- Games ---------- */
.games-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.game-card {
  padding: 18px;
}

.game-card.cancelled {
  opacity: 0.6;
}

.game-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.game-date {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.game-location {
  color: var(--accent-2);
  font-weight: 600;
  margin-top: 2px;
}

.game-notes {
  margin: 10px 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.game-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.9rem;
}

.spots {
  font-weight: 600;
  color: var(--text);
}

.roster {
  list-style: none;
  margin: 12px 0 0;
  padding: 12px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.roster li {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.8rem;
}

.game-actions {
  margin-top: 14px;
}

.game-actions .btn,
.game-actions .btn-ghost {
  width: 100%;
}

/* ---------- Pills ---------- */
.pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.pill.scheduled {
  background: rgba(46, 204, 113, 0.15);
  color: var(--success);
}

.pill.cancelled {
  background: rgba(255, 77, 77, 0.15);
  color: var(--danger);
}

.pill.completed {
  background: rgba(255, 107, 0, 0.15);
  color: var(--accent-2);
}

/* ---------- Empty state ---------- */
.empty {
  text-align: center;
  color: var(--muted);
  padding: 48px 16px;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

/* ---------- Admin grid ---------- */
.admin-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

@media (min-width: 860px) {
  .admin-grid {
    grid-template-columns: 340px 1fr;
    align-items: start;
  }
}

.admin-game {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  background: var(--surface-2);
}

.admin-game-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.admin-game-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.admin-game-actions button {
  font-size: 0.8rem;
  padding: 8px 12px;
}

/* ---------- Dialog / Toast ---------- */
dialog {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  width: min(92vw, 420px);
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(2px);
}

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

#roster-dialog {
  width: min(92vw, 480px);
}

.roster-table {
  list-style: none;
  margin-top: 12px;
  max-height: 60vh;
  overflow-y: auto;
}

.roster-table li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.roster-table .sub {
  color: var(--muted);
  font-size: 0.8rem;
}

.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 12px 22px;
  font-size: 0.9rem;
  box-shadow: var(--shadow);
  z-index: 100;
  animation: fade-up 0.2s ease;
  max-width: 90vw;
  text-align: center;
}

.toast.error {
  border-color: var(--danger);
  color: #ffb3b3;
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translate(-50%, 8px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}
