:root {
  --gold: #D4AF37;
  --gold-light: #F0CC57;
  --gold-dim: rgba(212, 175, 55, 0.3);
  --bg: #0a0a0f;
  --surface: #14141e;
  --surface2: #1e1e2e;
  --text: #f0f0f0;
  --text-dim: #888;
  --success: #5cb85c;
  --error: #d9534f;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Montserrat', Arial, sans-serif;
  min-height: 100vh;
}

/* ── Header ── */
header {
  background: var(--surface);
  border-bottom: 2px solid var(--gold);
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

#header-left { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }

/* Logo: statue + title side by side */
.logo-wrap {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.oscar-statue {
  height: 64px;
  width: auto;
  flex-shrink: 0;
  filter: drop-shadow(0 0 8px rgba(212, 175, 55, 0.5));
}

h1 {
  color: var(--gold);
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
}

#how-to-play-btn {
  background: none;
  border: 1px solid var(--gold-dim);
  color: var(--gold);
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8rem;
  font-family: inherit;
}
#how-to-play-btn:hover { background: var(--gold-dim); }

/* ── Sub-info row (found count, lives below the category banner) ── */
#puzzle-sub {
  text-align: center;
  margin-top: -0.5rem;
  margin-bottom: 1.25rem;
}

#progress-info {
  font-size: 0.82rem;
  color: var(--text-dim);
}

/* Year sits inside the banner, same weight as category */
#ceremony-info {
  color: var(--gold-light);
  font-size: 1.05rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  white-space: nowrap;
}

.banner-sep {
  color: var(--gold-dim);
  font-size: 1.1rem;
  font-weight: 300;
}

#score-bar { text-align: right; }

.score-label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

#points-display {
  font-size: 2rem;
  color: var(--gold);
  font-weight: bold;
  font-family: 'Montserrat', Arial, sans-serif;
}

/* ── Main ── */
main {
  max-width: 960px;
  margin: 1.5rem auto;
  padding: 0 1rem;
}

/* ── Category banner ── */
#category-banner {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

#category-banner::before,
#category-banner::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--gold-dim));
}

#category-banner::after {
  background: linear-gradient(to left, transparent, var(--gold-dim));
}

#category-info {
  color: var(--gold-light);
  font-size: 1.05rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  white-space: nowrap;
  text-align: center;
}

#nominees-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

/* ── Nominee Cards ── */
.nominee-card {
  background: var(--surface);
  border: 1px solid var(--gold-dim);
  border-radius: 8px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  min-height: 160px;
  transition: border-color 0.25s;
}

.card-found {
  border-color: var(--gold);
  background: rgba(212, 175, 55, 0.08);
}

.card-hidden-inner {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding-bottom: 0.5rem;
}

.slot-number {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.mystery-icon {
  font-size: 2.8rem;
  color: var(--surface2);
  line-height: 1;
}

/* Revealed card */
.card-revealed-inner {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.card-name {
  font-size: 1rem;
  font-weight: bold;
  color: var(--text);
  line-height: 1.3;
}

.card-sub {
  font-size: 0.82rem;
  color: var(--text-dim);
  font-style: italic;
}

.winner-badge {
  margin-top: auto;
  color: var(--gold);
  font-size: 0.82rem;
  font-weight: bold;
}

/* Clue section */
/* Given-up card */
.card-given-up {
  border-color: rgba(180, 60, 60, 0.5);
  background: rgba(180, 60, 60, 0.06);
}

.gave-up-badge {
  margin-top: auto;
  color: #888;
  font-size: 0.78rem;
  font-style: italic;
}

/* Per-nominee give-up button */
.give-up-one-btn {
  display: block;
  width: 100%;
  margin-top: 0.5rem;
  background: none;
  border: 1px solid #444;
  color: #666;
  padding: 0.3rem 0.5rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.72rem;
  font-family: inherit;
  transition: color 0.2s, border-color 0.2s;
}
.give-up-one-btn:hover { color: var(--error); border-color: var(--error); }

.clue-section {
  margin-top: 0.6rem;
  border-top: 1px solid var(--gold-dim);
  padding-top: 0.5rem;
}

.clue-toggle {
  background: none;
  border: 1px solid var(--gold-dim);
  color: var(--gold);
  padding: 0.3rem 0.5rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.75rem;
  font-family: inherit;
  width: 100%;
  transition: background 0.2s;
}
.clue-toggle:hover { background: var(--gold-dim); }

.clue-list {
  margin-top: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.clue-list.hidden { display: none; }

.clue-item {
  padding: 0.35rem 0.5rem;
  border-radius: 4px;
  font-size: 0.78rem;
  line-height: 1.35;
}

.clue-unpurchased {
  background: var(--surface2);
  border: 1px solid rgba(212,175,55,0.15);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.4rem;
  transition: background 0.15s;
}
.clue-unpurchased:hover { background: rgba(212,175,55,0.1); }

.clue-label-name { color: var(--text-dim); flex: 1; }
.clue-cost { color: var(--gold); font-weight: bold; white-space: nowrap; }

.clue-purchased {
  background: rgba(212,175,55,0.07);
  border: 1px solid rgba(212,175,55,0.25);
}
.clue-purchased .clue-label-name {
  color: var(--gold-light);
  font-weight: bold;
  display: block;
  margin-bottom: 0.15rem;
}
.clue-value { color: var(--text); display: block; }

.clue-unavailable {
  color: var(--text-dim);
  opacity: 0.4;
  font-style: italic;
  font-size: 0.75rem;
}

.cant-afford {
  opacity: 0.45;
  cursor: not-allowed;
}
.cant-afford:hover { background: var(--surface2) !important; }

/* ── Card image (poster / person photo on reveal) ── */
.card-image {
  width: 100%;
  height: 130px;
  object-fit: cover;
  object-position: top center;
  border-radius: 5px 5px 0 0;
  margin: -1rem -1rem 0.65rem -1rem;   /* bleed to card edges */
  width: calc(100% + 2rem);
  display: block;
}

.card-img-loading {
  font-size: 0.75rem;
  color: var(--text-dim);
  text-align: center;
  padding: 0.4rem 0 0.2rem;
  font-style: italic;
}

/* ── Photo clue (inside clue panel) ── */
.clue-photo {
  display: block;
  width: 100%;
  max-height: 200px;
  object-fit: cover;
  object-position: top center;
  border-radius: 4px;
  margin-top: 0.5rem;
}

.clue-photo-wrap {
  flex-direction: column;
  align-items: flex-start;
}

.clue-photo-loading {
  color: var(--text-dim);
  font-size: 0.82rem;
  padding: 0.4rem 0;
  font-style: italic;
}

/* ── Guess section ── */
#guess-section {
  background: var(--surface);
  border: 1px solid var(--gold-dim);
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
}

#guess-row {
  display: flex;
  gap: 0.5rem;
  max-width: 520px;
  margin: 0 auto;
}

/* Wrapper gives the autocomplete list a positioning anchor */
#autocomplete-wrap {
  flex: 1;
  position: relative;
}

#guess-input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--gold-dim);
  color: var(--text);
  padding: 0.7rem 1rem;
  border-radius: 6px;
  font-size: 1rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}
#guess-input:focus { border-color: var(--gold); }
#guess-input::placeholder { color: var(--text-dim); }

/* ── Autocomplete dropdown ── */
#autocomplete-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--gold-dim);
  border-top: none;
  border-radius: 0 0 6px 6px;
  z-index: 100;
  max-height: 210px;
  overflow-y: auto;
  box-shadow: 0 6px 18px rgba(0,0,0,0.45);
}
#autocomplete-list.hidden { display: none; }

.ac-item {
  padding: 0.55rem 1rem;
  cursor: pointer;
  font-size: 0.95rem;
  color: var(--text);
  border-bottom: 1px solid rgba(255,255,255,0.04);
  user-select: none;
}
.ac-item:last-child { border-bottom: none; }
.ac-item:hover,
.ac-item.ac-selected {
  background: var(--gold-dim);
  color: var(--gold-light);
}

#guess-btn {
  background: var(--gold);
  color: #0a0a0f;
  border: none;
  padding: 0.7rem 1.4rem;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.2s;
}
#guess-btn:hover { background: var(--gold-light); }

#guess-feedback {
  text-align: center;
  margin-top: 0.6rem;
  min-height: 1.4rem;
  font-size: 0.9rem;
}
.feedback-success { color: var(--success); }
.feedback-error { color: var(--error); }

#action-row {
  text-align: center;
  margin-top: 0.75rem;
}

.action-hint {
  font-size: 0.82rem;
  color: var(--text-dim);
}

/* ── Modals ── */
.hidden { display: none !important; }

#game-complete, #how-to-play {
  position: fixed;
  inset: 0;
  z-index: 200;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal {
  background: var(--surface);
  border: 2px solid var(--gold);
  border-radius: 12px;
  padding: 2rem;
  max-width: 420px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}

.modal h2 {
  color: var(--gold);
  font-size: 1.4rem;
  margin-bottom: 1rem;
  text-align: center;
}

#result-body {
  text-align: center;
  line-height: 1.8;
  margin-bottom: 1.25rem;
}
#result-body p { margin-bottom: 0.4rem; }

.result-nominees {
  text-align: left;
  margin-top: 0.75rem;
  border-top: 1px solid var(--gold-dim);
  padding-top: 0.75rem;
}

.result-nominee {
  padding: 0.25rem 0;
  font-size: 0.9rem;
}

.modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}

#share-result, #close-modal, #close-htp {
  padding: 0.65rem 1.4rem;
  border-radius: 6px;
  font-size: 0.95rem;
  font-family: inherit;
  cursor: pointer;
  border: none;
}

#share-result {
  background: var(--gold);
  color: var(--bg);
  font-weight: bold;
}
#share-result:hover { background: var(--gold-light); }

#close-modal {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid #444;
}

#close-htp {
  background: var(--gold);
  color: var(--bg);
  font-weight: bold;
  display: block;
  width: 100%;
  margin-top: 1rem;
}

/* How to play content */
.htp-body { font-size: 0.9rem; line-height: 1.7; }
.htp-body p { margin-bottom: 0.75rem; }
.htp-body ul { margin: 0 0 1rem 1.2rem; }
.htp-body li { margin-bottom: 0.4rem; }
.htp-body h3 { color: var(--gold-light); margin: 1rem 0 0.4rem; font-size: 0.95rem; }
.htp-body table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.htp-body td { padding: 0.25rem 0.5rem; border-bottom: 1px solid rgba(255,255,255,0.05); }
.htp-body td:last-child { text-align: right; color: var(--gold); font-weight: bold; }

/* ── Responsive ── */
@media (max-width: 600px) {
  header { flex-direction: column; align-items: flex-start; }
  #score-bar { text-align: left; }
  #nominees-container { grid-template-columns: 1fr 1fr; }
}
