:root {
  --sky1: #8fdcff;
  --sky2: #eef8ff;
  --panel: rgba(255, 255, 255, 0.86);
  --blue-card: #5b7cff;
  --blue-card-dark: #415ee2;
  --yellow: #ffd84f;
  --pink: #ff8ccf;
  --pink-soft: #ffd8f0;
  --purple: #8368ff;
  --text: #24324d;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Trebuchet MS', 'Comic Sans MS', sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 20% 18%, rgba(255, 255, 255, 0.95) 0 70px, transparent 71px),
    radial-gradient(circle at 76% 16%, rgba(255, 255, 255, 0.95) 0 62px, transparent 63px),
    linear-gradient(to bottom, rgba(255,255,255,0) 66%, rgba(112, 201, 102, 0.45) 66%),
    linear-gradient(var(--sky1), var(--sky2));
}
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle, rgba(255,255,255,0.9) 0 2px, transparent 3px),
    radial-gradient(circle, rgba(255,255,255,0.8) 0 1.5px, transparent 2px);
  background-size: 160px 160px, 220px 220px;
  background-position: 20px 30px, 110px 80px;
  opacity: 0.55;
}
.app-shell {
  max-width: 1280px;
  margin: 0 auto;
  padding: 22px;
}
.title-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: linear-gradient(135deg, rgba(255,255,255,0.92), rgba(255,244,251,0.95));
  border-radius: 24px;
  padding: 18px 22px;
  box-shadow: 0 15px 30px rgba(0,0,0,0.1);
  margin-bottom: 20px;
  border: 3px solid rgba(255, 255, 255, 0.6);
}
.brand-lockup {
  display: flex;
  align-items: center;
  gap: 16px;
}
.brand-badge {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #5b7cff, #7c4cff);
  box-shadow: 0 8px 20px rgba(92, 95, 255, 0.28);
  overflow: hidden;
}
.brand-badge img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.brand-badge {
  text-decoration: none;
}
.brand-name {
  display: inline-block;
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #5f46d8;
  margin-bottom: 6px;
  text-decoration: none;
}
.brand-name:hover {
  text-decoration: underline;
}
.title-bar h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3rem);
  color: #24324d;
}
.title-bar p { margin: 6px 0 0; font-size: 1.05rem; color: #3c4b6a; }
.top-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}
button, .home-btn {
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--pink), #ffb3df);
  color: white;
  font-size: 1rem;
  font-weight: 800;
  padding: 12px 22px;
  cursor: pointer;
  box-shadow: 0 6px 0 #e06aac;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
button:active, .home-btn:active { transform: translateY(2px); box-shadow: 0 4px 0 #e06aac; }
.play-area {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 18px;
  align-items: start;
}
.board-wrap, .matched-column {
  background: linear-gradient(180deg, rgba(255,255,255,0.92), rgba(250,244,255,0.92));
  border-radius: 28px;
  padding: 18px;
  box-shadow: 0 15px 30px rgba(0,0,0,0.1);
  border: 3px solid rgba(255,255,255,0.5);
}
.stats-bar {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
  font-size: 1rem;
}
.stats-bar span {
  background: rgba(255,255,255,0.96);
  padding: 10px 14px;
  border-radius: 999px;
  color: #24324d;
  box-shadow: 0 4px 10px rgba(0,0,0,0.08);
}
.game-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 14px;
}
.card {
  background: transparent;
  border: none;
  padding: 0;
  perspective: 1000px;
  min-height: 150px;
}
.card-inner {
  position: relative;
  min-height: 150px;
  width: 100%;
  transform-style: preserve-3d;
  transition: transform 0.45s ease, translate 0.18s ease;
}
.card:hover .card-inner { translate: 0 -4px; }
.card.flipped .card-inner,
.card.matched .card-inner { transform: rotateY(180deg); }
.card-face {
  position: absolute;
  inset: 0;
  border-radius: 22px;
  backface-visibility: hidden;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 8px;
}
.card-front {
  background: linear-gradient(145deg, var(--blue-card), var(--blue-card-dark));
  box-shadow: inset 0 0 0 5px rgba(255,255,255,0.16), 0 10px 18px rgba(88, 102, 224, 0.25);
}
.card-front::before {
  content: '';
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: rgba(255,255,255,0.18);
  box-shadow:
    -34px 0 0 -10px rgba(255,255,255,0.16),
    34px 0 0 -10px rgba(255,255,255,0.16),
    0 -34px 0 -10px rgba(255,255,255,0.16),
    0 34px 0 -10px rgba(255,255,255,0.16);
}
.card-back {
  transform: rotateY(180deg);
  background: white;
  border: 4px solid #ffd86d;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 10px 20px rgba(255, 180, 80, 0.18);
}
.card-back img {
  max-width: 100%;
  max-height: 112px;
  object-fit: contain;
}
.word-card {
  font-size: 1.55rem;
  font-weight: 800;
  text-transform: capitalize;
  color: #24324d;
  text-shadow: 0 1px 0 rgba(255,255,255,0.35);
}
.card.matched .card-inner {
  animation: pop 0.55s ease;
}
.card.matched-slot {
  visibility: hidden;
  pointer-events: none;
}
@keyframes pop {
  0% { transform: rotateY(180deg) scale(1); }
  40% { transform: rotateY(180deg) scale(1.08); }
  100% { transform: rotateY(180deg) scale(1); }
}
.matched-column h2 {
  margin: 0 0 14px;
  text-align: center;
  color: #5f46d8;
  text-shadow: 0 1px 0 rgba(255,255,255,0.45);
}
.matched-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.match-chip {
  background: rgba(255,255,255,0.98);
  border-radius: 18px;
  padding: 12px;
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 10px;
  align-items: center;
  color: #24324d;
  box-shadow: inset 0 0 0 2px #ffdf8f;
}
.match-chip img {
  width: 56px;
  height: 56px;
  object-fit: contain;
}
@media (max-width: 980px) {
  .play-area { grid-template-columns: 1fr; }
  .matched-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  }
}
.victory-overlay {
  position: fixed;
  inset: 0;
  background: rgba(36, 50, 77, 0.45);
  display: grid;
  place-items: center;
  z-index: 50;
}
.victory-overlay.hidden {
  display: none;
}
.victory-card {
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(255,244,251,0.98));
  border-radius: 28px;
  padding: 28px;
  width: min(92vw, 420px);
  text-align: center;
  box-shadow: 0 18px 40px rgba(0,0,0,0.18);
  border: 3px solid rgba(255,255,255,0.6);
}
.victory-card h2 {
  margin: 0 0 10px;
  color: #5f46d8;
}
.victory-card p {
  margin: 0 0 18px;
  color: #41516f;
}
.victory-suggestions {
  margin: 0 0 20px;
  text-align: left;
}
.victory-suggestions h3 {
  margin: 0 0 12px;
  text-align: center;
  color: #5f46d8;
  font-size: 1.05rem;
}
.victory-game-suggestions {
  display: grid;
  gap: 10px;
}
.victory-game-card {
  display: grid;
  grid-template-columns: 44px 1fr;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(255,255,255,0.96);
  color: #24324d;
  text-decoration: none;
  box-shadow: inset 0 0 0 2px #d9dfff, 0 8px 18px rgba(91, 124, 255, 0.12);
}
.victory-game-card:hover {
  transform: translateY(-2px);
}
.victory-game-emoji {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: linear-gradient(135deg, #eef2ff, #fdf1fb);
  font-size: 1.4rem;
}
.victory-game-card strong {
  display: block;
  margin-bottom: 2px;
}
.victory-game-card span {
  font-size: 0.92rem;
  color: #55637f;
}
.victory-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}
@media (max-width: 720px) {
  .title-bar { flex-direction: column; align-items: flex-start; }
  .top-actions { width: 100%; flex-wrap: wrap; }
  .game-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Warm autumn palette for this game only. */
:root {
  --sky1: #efbd78;
  --sky2: #fff6e8;
  --blue-card: #b96938;
  --blue-card-dark: #7f4228;
  --pink: #d98a3c;
  --pink-soft: #f4d5aa;
  --purple: #87512d;
  --text: #4c3829;
}
body {
  background:
    radial-gradient(circle at 18% 16%, rgba(255, 255, 255, 0.78) 0 64px, transparent 65px),
    radial-gradient(circle at 80% 14%, rgba(255, 255, 255, 0.68) 0 56px, transparent 57px),
    linear-gradient(to bottom, rgba(255,255,255,0) 68%, rgba(118, 146, 76, 0.32) 68%),
    linear-gradient(145deg, var(--sky1), var(--sky2));
}
body::before { opacity: 0.22; }
.title-bar { background: linear-gradient(135deg, rgba(255,255,255,0.96), rgba(255,246,225,0.96)); }
.brand-badge { background: linear-gradient(135deg, #b96938, #d89442); box-shadow: 0 8px 20px rgba(151, 83, 36, 0.25); display: flex; align-items: center; justify-content: center; font-size: 2.25rem; line-height: 1; text-decoration: none; }
.brand-name, .matched-column h2, .victory-card h2, .victory-suggestions h3 { color: #87512d; }
.title-bar h1 { color: #4c3829; }
.title-bar p, .victory-card p { color: #5c4633; }
button, .home-btn { background: linear-gradient(135deg, #c16e35, #e09a45); box-shadow: 0 6px 0 #945126; }
button:active, .home-btn:active { box-shadow: 0 4px 0 #945126; }
.board-wrap, .matched-column { background: linear-gradient(180deg, rgba(255,255,255,0.95), rgba(255,248,235,0.95)); }
.stats-bar span, .word-card, .match-chip, .victory-game-card { color: #4c3829; }
.card-front { box-shadow: inset 0 0 0 5px rgba(255,255,255,0.16), 0 10px 18px rgba(111, 59, 28, 0.22); }
.card-back { border-color: #e3bd70; box-shadow: 0 10px 20px rgba(178, 119, 49, 0.18); }
.match-chip { box-shadow: inset 0 0 0 2px #edd49f; }
.victory-overlay { background: rgba(72, 48, 29, 0.46); }
.victory-card { background: linear-gradient(180deg, rgba(255,255,255,0.99), rgba(255,247,230,0.99)); }
.victory-game-card { box-shadow: inset 0 0 0 2px #ead7b5, 0 8px 18px rgba(151, 83, 36, 0.12); }
.victory-game-emoji { background: linear-gradient(135deg, #fff0d7, #f8dfbf); }
.card:focus-visible, a:focus-visible, button:focus-visible { outline: 3px solid #4c3829; outline-offset: 3px; }
@media (max-width: 420px) {
  .app-shell { padding: 10px; }
  .title-bar { padding: 16px; }
  .brand-lockup { width: 100%; gap: 12px; align-items: center; }
  .brand-lockup > div { min-width: 0; }
  .brand-badge { flex: 0 0 52px; width: 52px; height: 52px; }
  .title-bar h1 { font-size: clamp(1.55rem, 7vw, 1.75rem); line-height: 1.12; }
  .board-wrap, .matched-column { padding: 12px; }
  .game-grid { gap: 10px; }
  .card, .card-inner { min-height: 122px; }
  .card-back { gap: 6px; padding: 6px; }
  .card-back img { max-height: 70px; }
  .word-card { font-size: 1.25rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
