/* ---------- Reset & base ---------- */
* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Poppins', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  background-color: #3c3c3a; /* darker grey for the outer thirds */
  color: #e8e8e6;
  min-height: 100vh;
}

/* ---------- Color tokens ---------- */
:root {
  --accent: #f5b942;
  --accent-light: #ffe9bf;
  --accent-dark: #e0a12e;
  --accent-soft-text: #ffc48a; /* lighter, more orange-leaning, for text on the dark panel */
  --text-dark: #3a3a3a;
  --page-bg: #3c3c3a;      /* dark grey, outer columns */
  --panel-bg: #4d4c47;     /* a bit lighter than the page background, still dark */
  --panel-text: #e8e8e6;   /* light body text on the dark panel */
  --ad-bg: #47473f;        /* slightly lifted from page bg, still dark */
}

/* ---------- Page grid: left ads / game / right ads ---------- */
.page-grid {
  display: grid;
  grid-template-columns: 31% 38% 31%;
  min-height: 100vh;
  align-items: start;
}

/* ---------- Ad columns (left / right thirds) ---------- */
.ad-column {
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 28px;
}

.ad-column-left {
  padding: 0 40px 0 20px; /* smaller outer gap, bigger inner gap (away from game) */
  align-items: flex-start;
}

.ad-column-right {
  padding: 0 20px 0 40px; /* mirrored: bigger inner gap, smaller outer gap */
  align-items: flex-end;
}

.ad-slot {
  width: 100%;
  max-width: 220px;
  min-height: 190px;
  background-color: var(--ad-bg);
  border: 1px dashed var(--accent);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ad-label {
  color: var(--accent-light);
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  opacity: 0.85;
}

/* ---------- Game column (roughly 35-40% width, pulled toward the top) ---------- */
.game-column {
  grid-column: 2 / 3;
  background-color: var(--panel-bg);
  color: var(--panel-text);
  margin: 0 12px 0;
  padding: 10px 24px 24px;
  border-radius: 0 0 10px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.game-header {
  position: relative;
  width: 100%;
}

/* ---------- Hamburger menu toggle ---------- */
.menu-toggle {
  position: absolute;
  top: 0;
  right: 0;
  width: 32px;
  height: 28px;
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  padding: 0;
}

.menu-toggle span {
  display: block;
  height: 2px;
  width: 100%;
  background-color: var(--accent-soft-text);
  border-radius: 2px;
}

/* ---------- Dropdown nav menu ---------- */
.nav-menu {
  position: absolute;
  top: 32px;
  right: 0;
  z-index: 20;
  background-color: #232320;
  border: 1px solid var(--accent);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 170px;
}

.nav-menu[hidden] {
  display: none;
}

.nav-menu-item {
  background: none;
  border: none;
  color: #ffffff;
  font-family: inherit;
  font-size: 0.85rem;
  text-align: left;
  padding: 10px 14px;
  cursor: pointer;
}

.nav-menu-item:hover {
  background-color: rgba(245, 185, 66, 0.18);
  color: var(--accent-soft-text);
}

.nav-menu-item + .nav-menu-item {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.game-header h1 {
  color: var(--accent-soft-text);
  font-weight: 600;
  font-size: 1.5rem;
  margin: 0 0 6px;
}

/* ---------- Modal overlay ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.modal-overlay[hidden] {
  display: none;
}

.modal-box {
  position: relative;
  background-color: var(--panel-bg);
  color: var(--panel-text);
  border-radius: 10px;
  border: 1px solid var(--accent);
  padding: 28px 26px;
  max-width: 380px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
}

.modal-box h2 {
  color: var(--accent-soft-text);
  font-size: 1.2rem;
  margin: 0 0 14px;
}

.modal-text {
  font-size: 0.88rem;
  line-height: 1.45;
  margin: 0 0 10px;
  color: var(--panel-text);
}

.modal-note {
  font-size: 0.75rem;
  color: #a8a7a2;
  margin: 12px 0 0;
  text-align: center;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: none;
  border: none;
  color: #a8a7a2;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
}

.modal-close:hover {
  color: var(--accent-soft-text);
}

/* ---------- Archive paywall box ---------- */
.paywall-box {
  background-color: #e8e2d3;
  color: #2b2a27;
  border-radius: 10px;
  padding: 22px 20px;
  text-align: center;
}

.paywall-heading {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 8px;
}

.paywall-sub {
  font-size: 0.85rem;
  margin: 0 0 6px;
  line-height: 1.4;
}

.paywall-note {
  font-size: 0.72rem;
  color: #6b6a63;
  margin: 0 0 16px;
}

.paywall-btn {
  display: block;
  width: 100%;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: 6px;
  padding: 10px;
  cursor: pointer;
  margin-bottom: 10px;
}

.paywall-btn.primary {
  background-color: var(--accent);
  color: #4a3410;
  border: none;
}

.paywall-btn.primary:hover {
  background-color: var(--accent-dark);
}

.paywall-btn.secondary {
  background: none;
  border: 1px solid var(--accent-dark);
  color: #4a3410;
}

.paywall-btn.secondary:hover {
  background-color: rgba(224, 161, 46, 0.12);
}

/* ---------- Account login form ---------- */
.account-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.account-form label {
  font-size: 0.8rem;
  color: var(--panel-text);
  margin-top: 6px;
}

.account-form input {
  padding: 8px 10px;
  font-family: inherit;
  font-size: 0.88rem;
  border: 2px solid var(--accent-light);
  border-radius: 6px;
  outline: none;
}

.account-form input:focus {
  border-color: var(--accent);
}

.account-submit {
  margin-top: 14px;
  padding: 9px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: #4a3410;
  background-color: var(--accent);
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

.account-submit:hover {
  background-color: var(--accent-dark);
}

/* ---------- Statistics panel ---------- */
.stats-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  text-align: center;
}

.stats-item {
  flex: 1 1 70px;
  min-width: 70px;
  background-color: #232320;
  border-radius: 8px;
  padding: 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.footer-links {
  display: flex;
  gap: 14px;
  margin-top: 18px;
}

.footer-link {
  display: inline-block;
  font-size: 0.72rem;
  color: #999894;
  text-decoration: underline;
}

.footer-link:hover {
  color: var(--accent-soft-text);
}

.stats-value {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--accent-soft-text);
}

.stats-label {
  font-size: 0.72rem;
  color: #d8d7d2;
}

.tagline {
  color: #cfcfca;
  font-size: 0.85rem;
  line-height: 1.35;
  margin: 0 0 14px;
  max-width: 94%;
}

/* ---------- Pie chart: black ring with a little white space around it ---------- */
.pie-chart-wrapper {
  background-color: #ffffff;
  border: 3px solid #1a1a1a;
  border-radius: 50%;
  padding: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

#flagPieChart {
  border-radius: 50%;
  display: block;
}

/* ---------- Status & guess counter ---------- */
.status-message {
  min-height: 1.1em;
  font-weight: 500;
  color: var(--panel-text);
  margin: 6px 0 2px;
  font-size: 0.92rem;
}

.guesses-left {
  margin: 0;
  font-size: 0.88rem;
  color: var(--panel-text);
}

.guesses-left span {
  color: var(--accent-soft-text);
  font-weight: 600;
}

.tried-list {
  font-size: 0.72rem;
  color: #a8a7a2;
  margin: 4px 0 0;
  min-height: 1em;
}

.tried-list span {
  color: #d8d7d2;
}

.hints-clarifier {
  font-size: 0.72rem;
  color: #a8a7a2;
  margin: 8px 0 0;
}

.hint-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.72rem;
  color: #2b2a27;
  background-color: #e8e2d3;
  border-radius: 14px;
  padding: 6px 14px;
  margin: 4px 0 0;
}

.dismiss-btn {
  background: none;
  border: none;
  color: #6b6a63;
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
}

.dismiss-btn:hover {
  color: #2b2a27;
}

/* ---------- Guess row: input + button side by side ---------- */
.guess-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
  max-width: 320px;
}

#autocompleteContainer {
  position: relative;
  flex: 1;
  min-width: 0;
}

#guessInput {
  width: 100%;
  padding: 8px 12px;
  font-family: inherit;
  font-size: 0.9rem;
  border: 2px solid var(--accent-light);
  border-radius: 6px;
  outline: none;
  transition: border-color 0.15s ease;
}

#guessInput:focus {
  border-color: var(--accent);
}

#guessInput:disabled {
  background-color: #f2f2f2;
  color: #999;
}

#autocompleteList {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  margin: 4px 0 0;
  padding: 4px 0;
  list-style: none;
  border: 1px solid var(--accent-light);
  background: #fff;
  max-height: 160px;
  overflow-y: auto;
  width: 100%;
  z-index: 10;
  border-radius: 6px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
  text-align: left;
}

#autocompleteList li {
  padding: 7px 12px;
  cursor: pointer;
  font-size: 0.88rem;
  color: #1a1a1a;
}

#autocompleteList li:hover {
  background-color: var(--accent-light);
}

/* ---------- Submit button ---------- */
#submitGuessBtn {
  margin-top: 0;
  padding: 8px 20px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: #4a3410;
  background-color: var(--accent);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.15s ease;
  white-space: nowrap;
}

#submitGuessBtn:hover:not(:disabled) {
  background-color: var(--accent-dark);
}

#submitGuessBtn:disabled {
  background-color: #d8d8d8;
  color: #a3a3a3;
  cursor: not-allowed;
}

/* ---------- Hints ---------- */
.hints-section {
  width: 100%;
  max-width: 380px;
  margin-top: 10px;
  text-align: left;
}

.hints-section h3 {
  color: var(--accent-soft-text);
  font-size: 0.92rem;
  font-weight: 600;
  margin: 0 0 6px;
  border-bottom: 2px solid var(--accent-light);
  padding-bottom: 5px;
}

#hintsList {
  list-style: none;
  margin: 0;
  padding: 0;
}

.hint-row {
  padding: 5px 0;
  font-size: 0.92rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.hint-label {
  color: var(--panel-text);
}

.hint-value {
  color: var(--accent-soft-text);
  font-weight: 700;
}

/* ---------- Bottom banner ad bar (full width, spans all 3 columns) ---------- */
.bottom-tab {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 56px;
  background-color: var(--ad-bg);
  border-top: 1px dashed var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---------- Responsive: stack on small screens ---------- */
@media (max-width: 900px) {
  .page-grid {
    grid-template-columns: 1fr;
  }
  .game-column {
    grid-column: 1;
  }
  .ad-column {
    height: auto;
    flex-direction: row;
    justify-content: center;
    padding: 16px;
    gap: 16px;
  }
  .ad-slot {
    min-height: 100px;
    max-width: 45%;
  }
}
