:root {
  --gold: #d4a237;
  --gold-dark: #b3831f;
  --navy: #1c2438;
  --navy-light: #2b3654;
  --cream: #faf3e2;
  --cream-dark: #f0e4c4;
  --ink: #24262c;
  --success: #3f8f5f;
  --danger: #b1462f;
  --radius: 14px;
  --max-width: 1080px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: 'Georgia', 'Times New Roman', serif;
  line-height: 1.5;
}

img { max-width: 100%; display: block; }

a { color: var(--navy); }

.wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

/* Nav */
.site-nav {
  background: var(--navy);
  color: var(--cream);
  border-bottom: 4px solid var(--gold);
}

.site-nav .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 14px;
  padding-bottom: 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.3rem;
  font-weight: bold;
  color: var(--gold);
  text-decoration: none;
  letter-spacing: 0.5px;
}

.brand img { width: 36px; height: 36px; border-radius: 50%; }

.site-nav nav {
  display: flex;
  gap: 22px;
}

.site-nav nav a {
  color: var(--cream);
  text-decoration: none;
  font-size: 0.95rem;
  border-bottom: 2px solid transparent;
  padding-bottom: 2px;
}

.site-nav nav a:hover,
.site-nav nav a.active {
  border-bottom-color: var(--gold);
  color: var(--gold);
}

#auth-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
}

.auth-disabled {
  color: #8b90a3;
  font-style: italic;
}

.auth-user {
  color: var(--cream);
}

#auth-control .btn.outline {
  border-color: var(--cream);
  color: var(--cream);
  padding: 4px 12px;
  font-size: 0.8rem;
}

#auth-control .btn.outline:hover {
  background: var(--cream);
  color: var(--navy);
}

.auth-dropdown {
  position: relative;
  display: inline-block;
}

.auth-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: white;
  border: 1px solid #e6dcc0;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
  min-width: 180px;
  padding: 6px;
  z-index: 20;
}

.auth-menu.hidden { display: none; }

.auth-menu button {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  color: var(--navy);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 0.85rem;
  font-weight: normal;
}

.auth-menu button:hover {
  background: var(--cream-dark);
  color: var(--navy);
}

.yt-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #ff0000;
  color: white !important;
  border-bottom: none !important;
  padding: 6px 14px;
  border-radius: 999px;
  font-weight: bold;
  font-size: 0.85rem !important;
}

.yt-btn:hover { background: #cc0000; }

.yt-btn .yt-icon { width: 16px; height: 16px; flex-shrink: 0; }

/* Footer */
.site-footer {
  background: var(--navy);
  color: #cbd0dd;
  margin-top: 60px;
  padding: 28px 0;
  font-size: 0.85rem;
}

.site-footer .wrap {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.site-footer a { color: var(--gold); }

/* Hero */
.hero {
  padding: 36px 0 10px;
  text-align: center;
}

.hero h1 {
  font-size: 2.1rem;
  margin: 0 0 6px;
  color: var(--navy);
}

.hero .tagline {
  color: #55596b;
  font-style: italic;
  margin-bottom: 18px;
}

/* Game */
.puzzle-meta {
  display: flex;
  justify-content: center;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  font-size: 0.95rem;
}

.puzzle-meta .pill {
  background: var(--navy);
  color: var(--gold);
  padding: 5px 14px;
  border-radius: 999px;
  font-weight: bold;
}

#game-status {
  text-align: center;
  min-height: 1.4em;
  margin-bottom: 14px;
  font-weight: bold;
  color: var(--navy-light);
}

.puzzle-board {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
}

.image-wrap {
  position: relative;
  flex: 1 1 420px;
  max-width: 480px;
  border: 4px solid var(--navy);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: crosshair;
  background: #ddd;
  aspect-ratio: 1 / 1;
}

.image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  user-select: none;
  -webkit-user-drag: none;
}

.image-wrap.shake {
  animation: shake 0.3s;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

.found-marker {
  position: absolute;
  border: 3px solid var(--success);
  background: rgba(63, 143, 95, 0.18);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  animation: pop 0.25s ease-out;
}

@keyframes pop {
  from { transform: translate(-50%, -50%) scale(0.4); opacity: 0; }
  to { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

.score-row {
  display: flex;
  justify-content: center;
  gap: 26px;
  margin: 18px 0;
  font-size: 1rem;
}

.score-row .label { color: #6b6f80; font-size: 0.75rem; display: block; text-align: center; }
.score-row .value { font-size: 1.4rem; font-weight: bold; color: var(--navy); text-align: center; }

/* Word Search */
.ws-layout {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
}

.ws-grid {
  display: grid;
  grid-template-columns: repeat(var(--ws-size, 12), 1fr);
  gap: 2px;
  background: var(--navy);
  border: 4px solid var(--navy);
  border-radius: var(--radius);
  flex: 0 0 auto;
  width: min(100%, 480px);
  aspect-ratio: 1 / 1;
  user-select: none;
  touch-action: none;
}

.ws-cell {
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 800;
  font-size: clamp(0.85rem, 3.4vw, 1.4rem);
  line-height: 1;
  color: var(--navy);
  cursor: pointer;
  border-radius: 2px;
}

.ws-cell.selecting { background: var(--gold); }
.ws-cell.found { background: var(--success); color: #fff; }

.ws-word-list {
  list-style: none;
  padding: 0;
  margin: 0;
  flex: 1 1 200px;
  max-width: 260px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ws-word-list li {
  font-weight: bold;
  color: var(--navy);
  padding: 6px 12px;
  background: var(--cream-dark);
  border-radius: var(--radius);
  text-align: center;
}

.ws-word-list li.found {
  color: #9aa0ab;
  text-decoration: line-through;
  background: transparent;
}

.info-section {
  margin-top: 60px;
  max-width: 620px;
  margin-left: auto;
  margin-right: auto;
}

.how-to-play {
  padding-left: 22px;
  color: #444;
  margin: 0 0 30px;
}

.how-to-play li { margin-bottom: 8px; }

.info-copy {
  color: #555;
  margin: 0 0 16px;
}

.stats-panel {
  display: flex;
  justify-content: center;
  gap: 26px;
  flex-wrap: wrap;
  margin: 24px 0 10px;
  padding: 18px;
  background: var(--cream-dark);
  border-radius: var(--radius);
}

.stats-panel .label { color: #6b6f80; font-size: 0.75rem; display: block; text-align: center; }
.stats-panel .value { font-size: 1.4rem; font-weight: bold; color: var(--navy); text-align: center; }

.hidden { display: none; }

.leaderboard-list {
  list-style: none;
  padding: 0;
  max-width: 620px;
  margin: 0 auto;
}

.leaderboard-list li {
  display: flex;
  align-items: center;
  gap: 14px;
  background: white;
  border: 1px solid #e6dcc0;
  border-radius: 10px;
  padding: 12px 18px;
  margin-bottom: 10px;
}

.leaderboard-list .rank {
  font-weight: bold;
  color: var(--gold-dark);
  min-width: 32px;
}

.medal-icon {
  vertical-align: middle;
  margin-right: 4px;
  flex-shrink: 0;
}

.leaderboard-list .name {
  font-weight: bold;
  color: var(--navy);
  flex: 1;
}

.leaderboard-list .streak {
  color: #666;
  font-size: 0.9rem;
}

.share-panel {
  max-width: 480px;
  margin: 20px auto 0;
  background: white;
  border: 2px dashed var(--gold-dark);
  border-radius: var(--radius);
  padding: 18px;
  text-align: center;
}

.share-panel.hidden { display: none; }

.share-panel button, .share-panel .btn { margin: 4px; }

.share-panel pre {
  white-space: pre-wrap;
  background: var(--cream-dark);
  padding: 12px;
  border-radius: 8px;
  font-family: inherit;
  text-align: left;
  font-size: 0.9rem;
}

button, .btn {
  font-family: inherit;
  background: var(--gold);
  color: var(--navy);
  border: none;
  padding: 10px 18px;
  border-radius: 999px;
  font-weight: bold;
  cursor: pointer;
  font-size: 0.95rem;
  text-decoration: none;
  display: inline-block;
}

button:hover, .btn:hover { background: var(--gold-dark); color: white; }

button:disabled, button:disabled:hover {
  background: #ccc;
  color: #777;
  cursor: not-allowed;
}

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

/* Cards (shop / membership) */
.section-title {
  text-align: center;
  margin: 46px 0 8px;
  color: var(--navy);
}

.section-sub {
  text-align: center;
  color: #666;
  margin-bottom: 26px;
  font-style: italic;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 20px;
}

.card {
  background: white;
  border-radius: var(--radius);
  border: 1px solid #e6dcc0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

.card .card-img {
  aspect-ratio: 3 / 4;
  background: var(--cream-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #b3a373;
  font-size: 0.85rem;
  font-style: italic;
  overflow: hidden;
}

.card .card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card .card-body {
  padding: 14px 16px 18px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.card h3 { margin: 0 0 6px; font-size: 1.05rem; color: var(--navy); }
.card .price { font-weight: bold; color: var(--gold-dark); margin: 6px 0 12px; }
.card .card-cta { margin-top: auto; }

.placeholder-badge {
  display: inline-block;
  background: var(--danger);
  color: white;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 8px;
  border-radius: 4px;
  margin-bottom: 8px;
}

.disclosure {
  max-width: 700px;
  margin: 0 auto 30px;
  font-size: 0.8rem;
  color: #777;
  text-align: center;
  padding: 12px;
  background: var(--cream-dark);
  border-radius: 8px;
}

/* Membership */
.tier-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
  max-width: 900px;
  margin: 0 auto;
  align-items: start;
}

.tier-card {
  position: relative;
  background: var(--navy);
  color: var(--cream);
  border-radius: var(--radius);
  padding: 30px 28px;
  border: 3px solid var(--gold);
}

.tier-card--mail {
  border-color: var(--cream);
}

.tier-badge {
  position: absolute;
  top: -12px;
  left: 28px;
  background: var(--cream);
  color: var(--navy);
  font-size: 0.7rem;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 4px 10px;
  border-radius: 999px;
}

.tier-card h3 { color: var(--gold); font-size: 1.4rem; margin-top: 0; }
.tier-card .tier-price { font-size: 1.8rem; font-weight: bold; margin: 6px 0 20px; }
.tier-card .tier-price span { font-size: 0.9rem; font-weight: normal; opacity: 0.75; }

.tier-card ul { padding-left: 20px; margin: 0 0 24px; }
.tier-card li { margin-bottom: 10px; }

.waitlist-form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.waitlist-form input {
  flex: 1;
  min-width: 160px;
  padding: 10px 14px;
  border-radius: 999px;
  border: none;
  font-family: inherit;
}

.waitlist-note {
  font-size: 0.75rem;
  opacity: 0.7;
  margin-top: 10px;
}

@media (max-width: 640px) {
  .site-nav .wrap { flex-direction: column; gap: 10px; }
  .site-nav nav { gap: 14px; flex-wrap: wrap; justify-content: center; }
  .hero h1 { font-size: 1.6rem; }
  .score-row { gap: 16px; }
}
