/* ============================================================
   Gnomes vs Capybaras · Morning Grove
   Built on the GvC Brand Kit palette, in soft Orisinal tones.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@600;700&family=Playfair+Display:ital,wght@0,500;0,700;1,400;1,500;1,700&family=Lato:wght@400;700&display=swap');

:root {
  /* brand palette (per GvC Brand Kit) */
  --forest-green: #2A4A1E;
  --moss-green:   #4A7230;
  --moss-soft:    #6f9657;
  --gold:         #C9921A;
  --warm-gold:    #E8B84B;
  --parchment:    #F5E6C8;
  --cream:        #FAF6ED;
  --bark-brown:   #5C3D1E;
  --deep-brown:   #2C1A0E;
  --ruby:         #8B2020;
  --mushroom:     #9B6E4A;
  --mist:         #D6C9A8;

  /* soft tone derivatives */
  --page-top:    #FAF6ED;
  --page-mid:    #F5E6C8;
  --page-bottom: #EDD9B0;
  --paper:       #FFFCF3;
  --paper-soft:  #F8EDD3;

  --ink:        var(--deep-brown);
  --ink-soft:   var(--bark-brown);
  --muted:      var(--mushroom);

  --hairline:   rgba(92, 61, 30, 0.16);
  --hairline-2: rgba(92, 61, 30, 0.28);

  --shadow-soft: 0 22px 60px -28px rgba(44, 26, 14, 0.32);
  --shadow-tile: 0 12px 24px -16px rgba(44, 26, 14, 0.22);

  /* fonts */
  --font-display: "Cinzel", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-headline: "Playfair Display", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-body: "Lato", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { background: var(--page-top); }

body {
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  background:
    radial-gradient(120% 60% at 50% 0%, rgba(255, 255, 255, 0.6), transparent 60%),
    linear-gradient(180deg, var(--page-top) 0%, var(--page-mid) 55%, var(--page-bottom) 100%);
  background-attachment: fixed;
}

button {
  color: inherit;
  font: inherit;
  border: 0;
  background: transparent;
  cursor: pointer;
}

img, svg { display: block; }

/* ------------------------------------------------------------ */
/* shell                                                        */
/* ------------------------------------------------------------ */

.grove {
  width: min(100%, 620px);
  margin: 0 auto;
  padding: 28px 22px 60px;
  position: relative;
}

.screen { display: block; }
.hidden { display: none !important; }

/* ------------------------------------------------------------ */
/* masthead                                                     */
/* ------------------------------------------------------------ */

.masthead {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: end;
  gap: 14px;
  padding: 16px 4px 22px;
}

.brand-eyebrow {
  display: block;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.74rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--moss-green);
}

.brand-title {
  margin: 8px 0 8px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.1rem, 6vw, 2.8rem);
  line-height: 1;
  color: var(--forest-green);
  letter-spacing: 0.01em;
}

.brand-title em {
  font-family: var(--font-headline);
  font-style: italic;
  font-weight: 400;
  color: var(--gold);
}

.brand-tag {
  display: block;
  font-family: var(--font-headline);
  font-style: italic;
  font-weight: 400;
  font-size: 0.96rem;
  color: var(--bark-brown);
}

.round-cta {
  width: 50px;
  height: 50px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: var(--gold);
  color: var(--deep-brown);
  box-shadow: 0 10px 24px -10px rgba(201, 146, 26, 0.7);
  transition: transform 200ms ease, box-shadow 200ms ease, background 200ms ease;
}

.round-cta svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.round-cta:hover {
  background: var(--warm-gold);
  transform: translateY(-2px);
  box-shadow: 0 14px 28px -10px rgba(201, 146, 26, 0.85);
}

/* sun divider */
.sun-divider {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 14px;
  color: var(--gold);
  margin: 4px auto 22px;
}

.sun-divider span {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--hairline-2), transparent);
}

.sun-divider svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

/* ------------------------------------------------------------ */
/* tile grid                                                    */
/* ------------------------------------------------------------ */

.grid-stage { padding: 0; }

.character-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px 18px;
  padding: 4px 4px 12px;
}

.game-tile {
  min-width: 0;
  padding: 0;
  display: grid;
  gap: 10px;
  justify-items: center;
  text-align: center;
  color: var(--bark-brown);
  cursor: pointer;
  animation: bobTile 7s ease-in-out infinite;
}

.game-tile:nth-child(1)  { animation-delay: -0.0s; }
.game-tile:nth-child(2)  { animation-delay: -0.5s; }
.game-tile:nth-child(3)  { animation-delay: -1.0s; }
.game-tile:nth-child(4)  { animation-delay: -1.5s; }
.game-tile:nth-child(5)  { animation-delay: -2.0s; }
.game-tile:nth-child(6)  { animation-delay: -2.5s; }
.game-tile:nth-child(7)  { animation-delay: -3.0s; }
.game-tile:nth-child(8)  { animation-delay: -3.5s; }
.game-tile:nth-child(9)  { animation-delay: -4.0s; }
.game-tile:nth-child(10) { animation-delay: -4.5s; }
.game-tile:nth-child(11) { animation-delay: -5.0s; }
.game-tile:nth-child(12) { animation-delay: -5.5s; }
.game-tile:nth-child(13) { animation-delay: -6.0s; }
.game-tile:nth-child(14) { animation-delay: -6.5s; }
.game-tile:nth-child(15) { animation-delay: -7.0s; }

.tile-frame {
  width: 100%;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background:
    radial-gradient(120% 100% at 50% 0%, rgba(255, 252, 243, 0.75), transparent 70%),
    var(--tint, var(--parchment));
  box-shadow:
    inset 0 0 0 1px rgba(255, 252, 243, 0.6),
    var(--shadow-tile);
  transition: transform 220ms ease, box-shadow 220ms ease;
  position: relative;
  overflow: hidden;
}

.tile-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(80% 60% at 50% 110%, rgba(92, 61, 30, 0.07), transparent 70%);
  pointer-events: none;
}

.tile-art {
  width: 64%;
  height: 64%;
  color: var(--forest-green);
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  filter: drop-shadow(0 1px 0 rgba(255, 252, 243, 0.55));
  transition: transform 280ms ease;
}

.tile-art-img {
  width: 96%;
  height: 96%;
  object-fit: contain;
  stroke: none;
  fill: none;
  filter: saturate(0.92);
  mix-blend-mode: multiply;
}

/* resource badge — echoes the corner icons on the landmark cards */
.res-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(255, 252, 243, 0.92);
  box-shadow:
    inset 0 0 0 1px rgba(92, 61, 30, 0.16),
    0 3px 8px -4px rgba(44, 26, 14, 0.4);
  z-index: 2;
}

.res-badge img {
  width: 88%;
  height: 88%;
  object-fit: contain;
}

.res-badge svg {
  width: 16px;
  height: 16px;
}

.res-berries  svg { fill: var(--ruby); }
.res-courage  svg { fill: var(--moss-green); }
.res-crystals svg { fill: #7A4FA0; }

.tile-label {
  font-family: var(--font-headline);
  font-style: italic;
  font-weight: 500;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
  color: var(--bark-brown);
  transition: color 220ms ease;
}

.game-tile:hover .tile-frame,
.game-tile:focus-visible .tile-frame,
.game-tile.selected .tile-frame {
  transform: translateY(-3px);
  box-shadow:
    inset 0 0 0 1px rgba(255, 252, 243, 0.7),
    0 18px 30px -16px rgba(44, 26, 14, 0.34);
}

.game-tile:hover .tile-art,
.game-tile.selected .tile-art {
  transform: scale(1.06);
}

.game-tile.selected {
  color: var(--forest-green);
}

.game-tile.selected .tile-frame {
  box-shadow:
    inset 0 0 0 2px var(--gold),
    0 18px 32px -14px rgba(201, 146, 26, 0.45);
}

.game-tile.selected .tile-label {
  color: var(--forest-green);
  font-weight: 700;
}

.game-tile.selected .tile-art {
  color: var(--forest-green);
}

.game-tile:focus { outline: none; }

.game-tile:focus-visible .tile-frame {
  box-shadow:
    inset 0 0 0 2px var(--gold),
    0 0 0 3px rgba(201, 146, 26, 0.32);
}

/* ------------------------------------------------------------ */
/* portal footer                                                */
/* ------------------------------------------------------------ */

.portal-footer {
  margin: 26px auto 14px;
  padding: 22px 16px 6px;
  display: grid;
  justify-items: center;
  gap: 8px;
  text-align: center;
  border-top: 1px dashed var(--hairline-2);
}

.footer-eyebrow,
.overlay-eyebrow {
  margin: 0;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.74rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--moss-green);
}

.footer-title,
.overlay-title {
  margin: 2px 0 4px;
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 5vw, 2.1rem);
  font-weight: 700;
  line-height: 1.1;
  color: var(--forest-green);
}

.footer-title em,
.overlay-title em {
  font-family: var(--font-headline);
  font-style: italic;
  font-weight: 400;
  color: var(--forest-green);
}

.footer-hint,
.overlay-copy {
  margin: 0 auto;
  max-width: 36ch;
  font-family: var(--font-headline);
  font-style: italic;
  font-size: 1rem;
  color: var(--bark-brown);
  min-height: 2.6em;
}

.text-button {
  margin-top: 14px;
  min-height: 46px;
  padding: 0 22px 0 26px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--gold);
  color: var(--deep-brown);
  border-radius: 999px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.86rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  box-shadow: 0 12px 24px -12px rgba(201, 146, 26, 0.7);
  transition: transform 200ms ease, box-shadow 200ms ease, background 200ms ease;
}

.text-button svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

.text-button:hover {
  background: var(--warm-gold);
  transform: translateY(-2px);
  box-shadow: 0 16px 28px -12px rgba(201, 146, 26, 0.85);
}

.text-button:focus-visible {
  outline: 3px solid rgba(201, 146, 26, 0.4);
  outline-offset: 3px;
}

/* ------------------------------------------------------------ */
/* signature                                                    */
/* ------------------------------------------------------------ */

.signature {
  margin: 26px auto 0;
  text-align: center;
  font-family: var(--font-headline);
  font-style: italic;
  font-size: 0.88rem;
  letter-spacing: 0.06em;
  color: var(--mushroom);
}

/* ------------------------------------------------------------ */
/* music toggle                                                 */
/* ------------------------------------------------------------ */

.mute-toggle {
  position: fixed;
  right: 14px;
  bottom: 16px;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--paper);
  color: var(--forest-green);
  box-shadow:
    inset 0 0 0 1px var(--hairline-2),
    0 8px 18px -10px rgba(44, 26, 14, 0.45);
  opacity: 0.82;
  z-index: 50;
  transition: opacity 160ms ease, transform 160ms ease, color 160ms ease;
}

.mute-toggle:hover {
  opacity: 1;
  transform: translateY(-1px);
}

.mute-toggle svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mute-toggle .spk {
  fill: currentColor;
  stroke: none;
}

.mute-toggle .slash { display: none; }

.mute-toggle.is-muted { color: var(--muted); }
.mute-toggle.is-muted .wave { display: none; }
.mute-toggle.is-muted .slash { display: block; }

/* ------------------------------------------------------------ */
/* two clear cards fading beside the title                      */
/* ------------------------------------------------------------ */

.title-cards {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  pointer-events: none;
}

.banner-card {
  width: 46px;
  height: 78px;
  object-fit: cover;
  border-radius: 6px;
  box-shadow: 0 6px 14px -8px rgba(44, 26, 14, 0.4);
  opacity: 0;
  transform: translateY(4px) rotate(var(--tilt, 0deg));
  transform-origin: center bottom;
  transition: opacity 900ms ease, transform 900ms ease;
  pointer-events: auto;
  cursor: pointer;
  position: relative;
}

/* "clear" — translucent so they sit gently next to the title */
.banner-card.show {
  opacity: 0.62;
  transform: translateY(0) rotate(var(--tilt, 0deg));
}

/* expand and come fully into view on hover (snappy in, gentle out) */
.banner-card:hover {
  opacity: 1;
  transform: translateY(-6px) rotate(0deg) scale(2);
  box-shadow: 0 20px 36px -10px rgba(44, 26, 14, 0.55);
  z-index: 6;
  transition: opacity 200ms ease, transform 220ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

.banner-card:nth-child(1) { --tilt: -6deg; }
.banner-card:nth-child(2) { --tilt: 6deg; margin-bottom: 6px; }

@media (max-width: 430px) {
  .banner-card { width: 40px; height: 68px; }
}

/* ------------------------------------------------------------ */
/* bottom scrolling marquee                                     */
/* ------------------------------------------------------------ */

.marquee {
  margin: 28px auto 0;
  padding: 12px 0;
  overflow: hidden;
  white-space: nowrap;
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  background: rgba(255, 252, 243, 0.5);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent);
}

.marquee-track {
  display: inline-flex;
  align-items: center;
  will-change: transform;
  animation: marqueeScroll 110s linear infinite;
}

.marquee-item {
  font-family: var(--font-headline);
  font-style: italic;
  font-size: 0.98rem;
  color: var(--bark-brown);
  padding: 0 6px;
}

.marquee-sep {
  color: var(--gold);
  padding: 0 18px;
  font-style: normal;
}

.marquee-link {
  font-family: var(--font-body);
  font-style: normal;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--forest-green);
  text-decoration: none;
  border-bottom: 2px solid var(--gold);
  padding-bottom: 1px;
  pointer-events: auto;
}

.marquee-link:hover { color: var(--ruby); }

@keyframes marqueeScroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

@media (prefers-reduced-motion: reduce) {
  .marquee-track { animation-duration: 180s; }
}

/* ------------------------------------------------------------ */
/* game screen                                                  */
/* ------------------------------------------------------------ */

.game-stage {
  display: grid;
  gap: 16px;
  padding: 4px 0 12px;
}

.game-header {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  align-items: center;
  gap: 12px;
  padding: 6px 2px 4px;
}

.icon-button {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--paper);
  color: var(--forest-green);
  box-shadow:
    inset 0 0 0 1px var(--hairline-2),
    0 6px 14px -10px rgba(44, 26, 14, 0.3);
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease, color 180ms ease;
}

.icon-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-button:hover {
  transform: translateY(-1px);
  color: var(--gold);
  box-shadow:
    inset 0 0 0 1px var(--gold),
    0 10px 18px -10px rgba(201, 146, 26, 0.5);
}

.icon-button.restart {
  background: var(--moss-green);
  color: var(--cream);
  box-shadow:
    inset 0 0 0 1px rgba(255, 252, 243, 0.32),
    0 10px 22px -12px rgba(74, 114, 48, 0.7);
}

.icon-button.restart:hover {
  background: var(--forest-green);
  color: var(--warm-gold);
}

.game-title-wrap { text-align: center; }

.game-title-wrap h2 {
  margin: 2px 0 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.45rem, 4vw, 1.7rem);
  line-height: 1.1;
  color: var(--forest-green);
}

.game-title-wrap h2 em {
  font-family: var(--font-headline);
  font-style: italic;
  font-weight: 400;
  color: var(--forest-green);
}

.game-kicker {
  margin: 0;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--moss-green);
}

/* HUD */

.game-hud {
  display: grid;
  grid-template-columns: 1fr 1px 1fr 1px 1fr;
  align-items: center;
  padding: 14px 10px;
  background: var(--paper);
  border-radius: 18px;
  box-shadow:
    inset 0 0 0 1px var(--hairline),
    0 10px 22px -16px rgba(44, 26, 14, 0.25);
}

.game-hud > div:not(.hud-divider) {
  display: grid;
  justify-items: center;
  gap: 4px;
}

.hud-divider {
  width: 1px;
  height: 28px;
  background: var(--hairline-2);
  border-radius: 1px;
}

.eyebrow {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.66rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--mushroom);
}

.game-hud strong {
  font-family: var(--font-headline);
  font-style: italic;
  font-weight: 700;
  font-size: 1.45rem;
  color: var(--forest-green);
  line-height: 1;
}

/* canvas panel */

.canvas-panel {
  position: relative;
  border-radius: 22px;
  overflow: hidden;
  background: var(--paper);
  box-shadow:
    inset 0 0 0 1px var(--hairline),
    var(--shadow-soft);
}

#gameCanvas {
  width: 100%;
  height: auto;
  display: block;
  touch-action: none;
  background: var(--paper-soft);
}

.game-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 8px;
  padding: 28px;
  text-align: center;
  background: rgba(255, 252, 243, 0.93);
  backdrop-filter: blur(6px);
}

.overlay-title {
  font-size: clamp(1.7rem, 5vw, 2.2rem);
}

.game-note {
  padding: 14px 18px;
  background: var(--paper);
  border-radius: 18px;
  text-align: center;
  box-shadow:
    inset 0 0 0 1px var(--hairline),
    0 10px 20px -16px rgba(44, 26, 14, 0.22);
}

.game-note p {
  margin: 0;
  font-family: var(--font-headline);
  font-style: italic;
  font-size: 0.96rem;
  color: var(--bark-brown);
  line-height: 1.45;
}

/* ------------------------------------------------------------ */
/* gentle motion                                                */
/* ------------------------------------------------------------ */

@keyframes bobTile {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-3px); }
}

/* ------------------------------------------------------------ */
/* responsive                                                   */
/* ------------------------------------------------------------ */

@media (min-width: 560px) {
  .character-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 22px 16px;
  }
}

@media (max-width: 380px) {
  .grove { padding: 22px 16px 50px; }
  .character-grid { gap: 18px 14px; }
  .tile-label { font-size: 0.88rem; }
  .game-hud { padding: 12px 8px; }
  .game-hud strong { font-size: 1.25rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
