/* ── Reset & base ───────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:          #0d1117;
  --bg2:         #161b22;
  --card-bg:     #f5f0e8;
  --card-header: #1a3560;
  --gold:        #c9a227;
  --text:        #1a1a1a;
  --text-muted:  #555;
  --correct:     #1f7a45;
  --wrong:       #b52b2b;
  --easy:        #1f7a45;
  --medium:      #c07a10;
  --hard:        #b52b2b;
  --accent:      #2d72d9;
  --radius:      12px;
  --shadow:      0 8px 32px rgba(0,0,0,.5);
}

html, body {
  height: 100%;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1rem;
}

.hidden { display: none !important; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .15s, transform .1s;
  padding: .7rem 1.6rem;
}
.btn:active { transform: scale(.97); }
.btn-primary  { background: var(--accent); color: #fff; }
.btn-primary:hover { opacity: .88; }
.btn-secondary { background: #2a2a3a; color: #ddd; }
.btn-secondary:hover { opacity: .85; }
.btn-skip { background: transparent; color: var(--text-muted); border: 1.5px solid #c5bba8; padding: .65rem 1rem; }
.btn-skip:hover { background: #eee6d8; }

/* ── Loading ─────────────────────────────────────────────── */
#loading-screen {
  color: #aaa;
  font-size: 1.1rem;
  letter-spacing: .05em;
}

/* ── Start screen ────────────────────────────────────────── */
#start-screen {
  width: 100%;
  display: flex;
  justify-content: center;
}

.start-card {
  background: var(--bg2);
  border: 1px solid #30363d;
  border-radius: var(--radius);
  padding: 2.5rem 2rem;
  max-width: 440px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow);
}

.start-logo { font-size: 3rem; margin-bottom: .75rem; }

.start-card h1 {
  font-size: 1.8rem;
  color: #e6e6e6;
  margin-bottom: .5rem;
}

.start-sub {
  color: #8b949e;
  margin-bottom: 1.5rem;
  line-height: 1.5;
}

.rules-list {
  list-style: none;
  color: #c9d1d9;
  font-size: .92rem;
  margin-bottom: 2rem;
  text-align: left;
  display: inline-block;
}
.rules-list li { padding: .25rem 0; }
.rules-list li::before { content: '✓  '; color: var(--gold); font-weight: bold; }

/* ── Difficulty selector ─────────────────────────────────── */
.diff-selector {
  margin-bottom: 1.25rem;
  text-align: left;
}
.diff-selector-label {
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .08em;
  color: #8b949e;
  margin-bottom: .5rem;
  text-transform: uppercase;
}
.diff-options {
  display: flex;
  gap: .4rem;
}
.diff-opt {
  flex: 1;
  padding: .5rem .4rem;
  border: 1.5px solid #30363d;
  border-radius: 7px;
  background: transparent;
  color: #8b949e;
  font-size: .83rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
}
.diff-opt:hover { border-color: var(--accent); color: #c9d1d9; }
.diff-opt.active {
  border-color: var(--accent);
  background: rgba(45,114,217,.15);
  color: #79b8ff;
}

/* ── Filter panel ────────────────────────────────────────── */
.filter-panel {
  margin-bottom: 1.75rem;
  text-align: left;
}

.filter-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .6rem;
  gap: .5rem;
  flex-wrap: wrap;
}

.filter-mode-toggle {
  display: flex;
  gap: .3rem;
}

.fmode-btn {
  padding: .3rem .75rem;
  border: 1.5px solid #30363d;
  border-radius: 6px;
  background: transparent;
  color: #8b949e;
  font-size: .78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
}
.fmode-btn:hover { border-color: var(--accent); color: #c9d1d9; }
.fmode-btn.active {
  border-color: var(--accent);
  background: rgba(45,114,217,.15);
  color: #79b8ff;
}

/* Filter tag cloud */
.filter-tags-area {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  max-height: 140px;
  overflow-y: auto;
  padding: .1rem 0;
}

.filter-tag {
  padding: .3rem .75rem;
  border: 1.5px solid #30363d;
  border-radius: 99px;
  background: transparent;
  color: #8b949e;
  font-size: .8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.filter-tag:hover { border-color: #8b949e; color: #c9d1d9; }
.filter-tag.selected {
  border-color: var(--accent);
  background: rgba(45,114,217,.18);
  color: #79b8ff;
}

.filter-count {
  font-size: .78rem;
  color: #8b949e;
  margin-top: .5rem;
}

/* ── Game top bar ────────────────────────────────────────── */
#game-screen {
  width: 100%;
  max-width: 600px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.game-topbar {
  display: flex;
  flex-direction: column;
  gap: .4rem;
}

.progress-track {
  width: 100%;
  height: 5px;
  background: #21262d;
  border-radius: 99px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 99px;
  transition: width .4s ease;
  width: 0%;
}

.topbar-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: .875rem;
  color: #8b949e;
}

.btn-home {
  background: none;
  border: none;
  color: #8b949e;
  font-size: .8rem;
  cursor: pointer;
  padding: .2rem .4rem;
  border-radius: 5px;
  transition: color .15s, background .15s;
}
.btn-home:hover { color: #c9d1d9; background: #21262d; }

.topbar-info strong { color: #e6e6e6; }
.score-display { font-variant-numeric: tabular-nums; }

/* ── Passport card ───────────────────────────────────────── */
.passport-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.passport-banner {
  background: var(--card-header);
  padding: .85rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: var(--radius) var(--radius) 0 0;
}

.passport-label {
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .18em;
  color: rgba(255,255,255,.85);
  font-family: Georgia, 'Times New Roman', serif;
}

/* Difficulty badge */
.diff-badge {
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .1em;
  padding: .2rem .65rem;
  border-radius: 99px;
  text-transform: uppercase;
}
.diff-badge.easy   { background: #d4edda; color: var(--easy); }
.diff-badge.medium { background: #fde8c0; color: var(--medium); }
.diff-badge.hard   { background: #f8d7da; color: var(--hard); }

/* Passport body */
.passport-body {
  padding: 1.25rem 1.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.pp-section-title {
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .16em;
  color: var(--card-header);
  margin-bottom: .6rem;
  font-family: Georgia, serif;
}

/* Club list */
.clubs-list {
  display: flex;
  flex-direction: column;
  gap: .3rem;
}

.club-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: .92rem;
  gap: 1rem;
}

.club-name {
  color: var(--text);
  font-weight: 500;
  flex: 1;
}

.club-years {
  color: var(--text-muted);
  font-size: .82rem;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* Divider */
.pp-divider {
  border: none;
  border-top: 1px solid #d9d0c0;
  margin: 0;
}

/* International */
.intl-info {
  font-size: .92rem;
  color: var(--text);
}

.intl-row {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.intl-country { font-weight: 600; }
.intl-caps    { color: var(--text-muted); }
.intl-period  { color: var(--text-muted); font-size: .83rem; }
.intl-none    { color: var(--text-muted); font-style: italic; }

/* Guess area */
.guess-area {
  display: flex;
  flex-direction: column;
  gap: .75rem;
  margin-top: .25rem;
}

.input-row {
  display: flex;
  gap: .5rem;
}

.autocomplete-wrapper {
  position: relative;
  flex: 1;
}

#guess-input {
  width: 100%;
  padding: .65rem .9rem;
  border: 2px solid #c5bba8;
  border-radius: 8px;
  font-size: .95rem;
  background: #fff;
  color: var(--text);
  outline: none;
  transition: border-color .15s;
}
#guess-input:focus { border-color: var(--accent); }

.autocomplete-list {
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1.5px solid #c5bba8;
  border-radius: 0 0 8px 8px;
  box-shadow: 0 6px 16px rgba(0,0,0,.12);
  z-index: 200;
  overflow: hidden;
}

.ac-item {
  padding: .5rem .9rem;
  font-size: .9rem;
  color: var(--text);
  cursor: pointer;
  transition: background .1s;
}
.ac-item:hover,
.ac-item.active { background: #e8f0fe; }

/* Feedback */
.feedback {
  border-radius: 8px;
  padding: .75rem 1rem;
  font-size: .92rem;
  font-weight: 500;
  display: flex;
  flex-direction: column;
  gap: .2rem;
}
.feedback.correct { background: #d4edda; color: var(--correct); }
.feedback.wrong   { background: #f8d7da; color: var(--wrong); }
.feedback.skipped { background: #e8e4dc; color: #666; }

.feedback-label { font-weight: 700; font-size: .8rem; letter-spacing: .06em; }
.feedback-name  { font-size: 1rem; color: #111; }

/* ── Score screen ────────────────────────────────────────── */
#score-screen {
  width: 100%;
  display: flex;
  justify-content: center;
}

.score-card {
  background: var(--bg2);
  border: 1px solid #30363d;
  border-radius: var(--radius);
  padding: 2rem 1.75rem;
  max-width: 520px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow);
}

.score-actions {
  display: flex;
  flex-direction: column;
  gap: .6rem;
  margin-top: .25rem;
}

.score-card h2 {
  color: #c9d1d9;
  font-size: 1.3rem;
  margin-bottom: 1rem;
  letter-spacing: .05em;
}

.final-score-display {
  font-size: 4rem;
  font-weight: 800;
  color: #e6e6e6;
  line-height: 1;
  margin-bottom: .5rem;
}

.out-of { font-size: 2rem; color: #8b949e; font-weight: 400; }

.score-message {
  color: #8b949e;
  margin-bottom: 1.5rem;
  font-size: .95rem;
}

/* Results breakdown */
.results-list {
  text-align: left;
  margin-bottom: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: .4rem;
  max-height: 260px;
  overflow-y: auto;
}

.result-row {
  display: flex;
  align-items: center;
  gap: .75rem;
  font-size: .875rem;
  padding: .35rem .5rem;
  border-radius: 6px;
}
.result-row.correct { background: rgba(31,122,69,.12); color: #c9d1d9; }
.result-row.wrong   { background: rgba(181,43,43,.12); color: #c9d1d9; }

.result-icon { font-size: 1rem; flex-shrink: 0; }
.result-name { flex: 1; font-weight: 500; }
.result-guess { color: #8b949e; font-size: .8rem; }

/* ── Privacy link ────────────────────────────────────────── */
.privacy-link {
  margin-top: 1.25rem;
  font-size: .75rem;
  color: #484f58;
}
.privacy-link a { color: #484f58; text-decoration: underline; }
.privacy-link a:hover { color: #8b949e; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 480px) {
  body { padding: .75rem; align-items: flex-start; padding-top: 1.25rem; }
  .passport-body { padding: 1rem; }
  .club-row { flex-direction: column; gap: 0; }
  .club-years { margin-top: -.1rem; }
  .input-row { flex-direction: column; }
  #submit-btn { width: 100%; }
}
