:root {
  --bg: #0f1720;
  --panel: #17212b;
  --panel-2: #1e2a37;
  --text: #e8eef4;
  --muted: #93a4b5;
  --accent: #46c37b;
  --accent-2: #2f9e63;
  --danger: #e5534b;
  --border: #26333f;
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: radial-gradient(1200px 600px at 50% -10%, #16303a 0%, var(--bg) 60%);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Top bar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1.25rem;
  background: rgba(15, 23, 32, 0.7);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(6px);
}
.brand { font-weight: 700; font-size: 1.1rem; color: var(--text); }
.brand:hover { text-decoration: none; }
.topbar nav { display: flex; align-items: center; gap: 1.1rem; flex-wrap: wrap; }
.topbar nav a { color: var(--muted); }
.topbar nav a:hover { color: var(--text); }
.who { color: var(--muted); font-size: 0.9rem; }
.btn-logout {
  border: 1px solid var(--border);
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
}

main {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem 1.25rem;
  flex: 1;
}

h1 { margin-top: 0; }

.muted { color: var(--muted); }
.hint { font-size: 0.85rem; margin-top: 1.25rem; }

/* Cards */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}
.center-card {
  max-width: 420px;
  margin: 2rem auto;
}
.center-card h1 { text-align: center; }

/* Forms */
.stack { display: flex; flex-direction: column; gap: 1rem; margin: 1.25rem 0; }
label { display: flex; flex-direction: column; gap: 0.4rem; font-size: 0.9rem; color: var(--muted); }
input {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.7rem 0.8rem;
  border-radius: 10px;
  font-size: 1rem;
}
input:focus { outline: 2px solid var(--accent-2); border-color: var(--accent-2); }

button {
  background: var(--accent);
  color: #06231a;
  border: none;
  padding: 0.7rem 1rem;
  font-size: 1rem;
  font-weight: 700;
  border-radius: 10px;
  cursor: pointer;
}
button:hover { background: var(--accent-2); color: #fff; }

.btn-secondary {
  display: inline-block;
  margin-top: 1rem;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 0.55rem 0.9rem;
  border-radius: 10px;
}
.btn-secondary:hover { color: var(--text); text-decoration: none; }

.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
  padding: 0.35rem 0.7rem;
  font-size: 0.85rem;
}
.btn-danger:hover { background: var(--danger); color: #fff; }

/* Alerts / results */
.alert {
  background: rgba(229, 83, 75, 0.12);
  border: 1px solid var(--danger);
  color: #ffb4af;
  padding: 0.7rem 0.9rem;
  border-radius: 10px;
  margin-bottom: 1rem;
}
.alert.ok {
  background: rgba(70, 195, 123, 0.12);
  border-color: var(--accent);
  color: #b6f0cf;
}
.result {
  padding: 1rem;
  border-radius: 10px;
  font-size: 1.1rem;
  margin: 1rem 0;
  text-align: center;
}
.result.win { background: rgba(70, 195, 123, 0.15); border: 1px solid var(--accent); }
.result.lose { background: rgba(229, 83, 75, 0.12); border: 1px solid var(--danger); }

/* Grid of games / admin sections */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.25rem;
  margin-top: 1.5rem;
}
.admin-grid { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }

.game-card { display: block; transition: transform 0.1s ease, border-color 0.1s ease; }
.game-card:hover { transform: translateY(-2px); border-color: var(--accent); text-decoration: none; }
.game-card h2 { margin: 0.5rem 0 0.3rem; color: var(--text); }
.game-emoji { font-size: 2.4rem; }

/* Tables */
.table { width: 100%; border-collapse: collapse; margin-top: 0.5rem; }
.table th, .table td { text-align: left; padding: 0.5rem 0.4rem; border-bottom: 1px solid var(--border); }
.table th { color: var(--muted); font-weight: 600; font-size: 0.85rem; }
.right { text-align: right; }
section h3 { margin-top: 1.5rem; }

.row-form { display: flex; gap: 0.5rem; margin-top: 0.5rem; }
.row-form input { flex: 1; }
.small { font-size: 0.8rem; margin-top: 0.4rem; }

.editor-link { display: inline-block; margin: 0.5rem 0; font-weight: 600; }
.admin-head, .football-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap;
}

/* Autocomplete */
.player-search { position: relative; flex: 1; }
.ps-input { width: 100%; }
.ps-results {
  position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 4px);
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 10px; overflow: hidden; box-shadow: 0 10px 30px rgba(0,0,0,0.4);
  max-height: 300px; overflow-y: auto;
}
.ps-item {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding: 0.6rem 0.8rem; cursor: pointer;
}
.ps-item:hover, .ps-item.active { background: rgba(70,195,123,0.18); }
.ps-name { font-weight: 600; }
.ps-meta { color: var(--muted); font-size: 0.8rem; white-space: nowrap; }
.ps-empty { padding: 0.6rem 0.8rem; color: var(--muted); }

/* Guess / skip forms */
.guess-form { display: flex; gap: 0.5rem; align-items: flex-start; margin-top: 1rem; }
.guess-form .ps-submit { flex-shrink: 0; }
.ps-submit:disabled { opacity: 0.4; cursor: not-allowed; }
.skip-form { margin-top: 0.6rem; }

/* Scorebox */
.scorebox {
  display: flex; flex-direction: column; align-items: center;
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 12px; padding: 0.4rem 0.9rem; min-width: 78px;
}
.scorebox.good { border-color: var(--accent); }
.scorebox.bad { border-color: var(--danger); }
.score-num { font-size: 1.8rem; font-weight: 800; line-height: 1; }
.score-label { font-size: 0.7rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }

/* Hints */
.hint-count { margin-top: 1rem; }
.hints { list-style: none; padding: 0; margin: 1rem 0; display: flex; flex-direction: column; gap: 0.6rem; }
.hints .hint {
  position: relative; background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 0.9rem 1rem;
}
.hints .hint.free { border-color: var(--accent-2); }
.hint .tag {
  display: inline-block; background: var(--accent); color: #06231a;
  font-size: 0.65rem; font-weight: 800; padding: 0.1rem 0.4rem;
  border-radius: 5px; margin-right: 0.5rem; vertical-align: middle;
}
.hint-text { line-height: 1.5; }
.hint-img { display: block; max-height: 260px; border-radius: 8px; margin-top: 0.3rem; }

.admin-hints .hint { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.admin-hints .hint-img { max-height: 120px; }
.hint-actions { margin-left: auto; display: flex; gap: 0.3rem; }
.hint-actions form { display: inline; }
.btn-mini {
  background: transparent; border: 1px solid var(--border); color: var(--muted);
  padding: 0.25rem 0.5rem; font-size: 0.85rem; border-radius: 7px;
}
.btn-mini:hover:not(:disabled) { color: var(--text); border-color: var(--accent); }
.btn-mini:disabled { opacity: 0.3; cursor: not-allowed; }
.btn-mini.danger { color: var(--danger); border-color: transparent; }
.btn-mini.danger:hover { border-color: var(--danger); }
.hint-form select { width: 100%; background: var(--panel-2); border: 1px solid var(--border); color: var(--text); padding: 0.6rem; border-radius: 10px; }
.hint-form input[type=file] { color: var(--muted); }

/* Answer reveal card */
.answer-card {
  display: flex; align-items: center; gap: 1rem; margin: 1rem 0;
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 12px; padding: 0.8rem 1rem;
}
.answer-card img { width: 64px; height: 64px; object-fit: cover; border-radius: 50%; background: var(--panel); }
.answer-name { font-size: 1.2rem; font-weight: 700; }

.footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
  padding: 1.5rem;
  border-top: 1px solid var(--border);
}
