@import url('https://fonts.googleapis.com/css2?family=Fredoka+One&family=Nunito:wght@400;600;700&family=Noto+Sans+TC:wght@500;900&family=Huninn&display=swap');

:root {

  --bg: #FFF8F0;
  --card: #ffffff;

  --accent: #FF6B35;
  --accent2: #FFD166;

  --green: #06D6A0;

  --text: #2D2D2D;
  --muted: #888;

  --hole-bg: #5C3A1E;
  --hole-rim: #3B2007;

  --radius: 20px;

  --shadow:
    0 8px 32px rgba(0,0,0,0.10);

  /* CJK-safe font stack — Huninn covers Chinese but falls back to Noto Sans TC */
  --font-cjk: 'Huninn', 'Noto Sans TC', sans-serif;
}

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

/* ──────────────────────────────────────
   BODY — neutral, doesn't assume whack-mole is the only section
────────────────────────────────────── */

body {
  min-height: 100vh;
}

/* ──────────────────────────────────────
   ABOUT SECTION
────────────────────────────────────── */

.about-section {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-cjk);
  padding: 32px 20px 8px;
}

.about-wrap {
  max-width: 1200px;
  margin: auto;
}

.about-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 32px;
  display: flex;
  align-items: center;
  gap: 28px;
}

.about-avatar {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 4px solid var(--accent2);
}

.about-text {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.about-name {
  font-family: var(--font-cjk);
  font-size: 1.6rem;
  color: var(--accent);
  margin: 0;
}

.about-bio {
  color: var(--text);
  line-height: 1.85;
  margin: 0;
}

@media (max-width: 500px) {
  .about-card {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 24px 20px;
  }
}

/* ──────────────────────────────────────
   LINE STICKERS SECTION
────────────────────────────────────── */

.stickers-section {
  background: var(--bg);
  padding: 8px 20px 20px;
  font-family: var(--font-cjk);
}

.stickers-wrap {
  max-width: 1200px;
  margin: auto;
}

.stickers-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 32px;

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
}

.stickers-text {
  flex: 1;
}

.stickers-title {
  color: var(--accent);
  margin-bottom: 12px;
  font-size: 1.6rem;
}

.stickers-desc {
  color: var(--text);
  line-height: 1.8;
  margin-bottom: 18px;
}

.stickers-btn {
  display: inline-block;
  background: var(--accent);
  color: white;
  text-decoration: none;
  padding: 12px 18px;
  border-radius: 999px;
  font-weight: 700;
  transition:
    transform 0.15s ease,
    opacity 0.15s ease;
}

.stickers-btn:hover {
  opacity: 0.92;
  transform: translateY(-1px);
}

.stickers-preview {
  width: 220px;
  max-width: 100%;
  border-radius: 18px;
  display: block;
}

/* ──────────────────────────────────────
   WHACK SECTION — self-contained, carries its own bg/color/font
────────────────────────────────────── */

.whack-section {
  background: linear-gradient(
  180deg,
  #f7e3c3 0%,
  #fff7e8 100%
);
  color: var(--text);
  font-family: var(--font-cjk);
}

/* ──────────────────────────────────────
   PAGE WRAP — column: [top-row] then [leaderboards]
────────────────────────────────────── */

.page-wrap {
  max-width: 1200px;
  margin: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ──────────────────────────────────────
   TOP ROW — sidebar left, game right (original proportions)
────────────────────────────────────── */

.top-row {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}

/* ──────────────────────────────────────
   SIDEBAR — fixed 320px, same as original
────────────────────────────────────── */

.sidebar {
  width: 320px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

header {
  text-align: center;
}

header h1 {
  font-family: var(--font-cjk);
  color: var(--accent);
  font-size: 2.4rem;
}

.tagline {
  color: var(--muted);
  margin-top: 4px;
}

.header-img {
  display: block;
  width: 100%;
  max-width: 280px;
  height: auto;
  max-height: 220px;
  margin: 8px auto;
  border-radius: 16px;
}

/* ──────────────────────────────────────
   CARDS
────────────────────────────────────── */

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}

.card h3 {
  color: var(--accent);
  margin-bottom: 12px;
  font-family: var(--font-cjk);
}

/* ──────────────────────────────────────
   PLAYER ROW
────────────────────────────────────── */

.player-row {
  display: flex;
  gap: 10px;
}

.player-row input {
  flex: 1;
  border: 2px solid #eee;
  border-radius: 12px;
  padding: 12px;
  font-size: 1rem;
  font-family: var(--font-cjk);
  max-width: 240px;
}

.flag-select {
  border: 2px solid #eee;
  border-radius: 12px;
  padding: 8px;
  font-size: 1.5rem;
  cursor: pointer;
}

.features {
  padding-left: 20px;
  line-height: 1.8;
}

/* ──────────────────────────────────────
   DIFFICULTY BUTTONS
────────────────────────────────────── */

.difficulty-select {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.difficulty-btn {
  border: none;
  border-radius: 50px;
  padding: 10px 16px;
  font-weight: 700;
  cursor: pointer;
  font-family: 'Huninn', 'Noto Sans TC', 'Microsoft JhengHei', 'PingFang TC', sans-serif;
  font-size: 0.95rem;
  transition: transform 0.1s, box-shadow 0.1s;
}

.difficulty-btn.unlocked {
  background: #f0e8e0;
}

.difficulty-btn.locked {
  background: #ccc;
  opacity: 0.7;
  cursor: not-allowed;
}

.difficulty-btn.active {
  background: var(--accent2);
  box-shadow: 0 0 0 3px var(--accent);
}

.difficulty-btn.unlocked:not(.locked):hover {
  transform: translateY(-1px);
}

/* ──────────────────────────────────────
   GAME INFO STATS
────────────────────────────────────── */

.game-info {
  display: flex;
  justify-content: space-between;
  background: #FFF3E8;
  padding: 14px;
  border-radius: 14px;
  font-weight: 700;
}

/* ──────────────────────────────────────
   GAME AREA — takes all remaining space
────────────────────────────────────── */

.game-area {
  flex: 1;
  min-width: 0;
  width: 100%;
}

.game-card {
  background: white;
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  position: relative;
}

.game-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

/* ──────────────────────────────────────
   HOLES / MOLES
────────────────────────────────────── */

.hole {
  position: relative;
  aspect-ratio: 9/12;
  border-radius: 8px;
  overflow: hidden;
  background: var(--hole-bg);
  box-shadow:
    inset 0 8px 20px rgba(0,0,0,0.4),
    0 6px 0 var(--hole-rim);
}

.idle-img,
.mole,
.hit-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.idle-img { z-index: 1; }

.mole {
  z-index: 2;
  transform: translateY(100%);
  transition: transform 0.18s ease;
}

.hit-img { z-index: 3; }

.hole.up .mole {
  transform: translateY(0%);
}

.hidden {
  display: none !important;
}

/* ──────────────────────────────────────
   END OVERLAY — fixed fullscreen so it never clips or overlaps
────────────────────────────────────── */

.end-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
  overflow-y: auto;
}

.end-modal {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
  width: 100%;
  max-width: 480px;
  margin: auto;
}

.reward-image {
  width: 100%;
  max-width: 420px;
  height: auto;
  border-radius: 18px;
}

.end-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

/* ──────────────────────────────────────
   BUTTONS
────────────────────────────────────── */

.btn {
  border: none;
  border-radius: 50px;
  padding: 12px 18px;
  font-weight: 700;
  cursor: pointer;
  font-family: var(--font-cjk);
}

.btn-primary { background: var(--accent); color: white; }
.btn-next    { background: var(--green);  color: white; }
.btn-close   { background: #eee; }

/* ──────────────────────────────────────
   LEADERBOARDS — full width below top-row, side by side
────────────────────────────────────── */

.leaderboards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.lb-card ol {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.lb-card li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #fafafa;
  border-radius: 10px;
  padding: 10px;
}

.lb-rank {
  font-weight: 700;
  width: 40px;
  flex-shrink: 0;
}

.lb-name {
  flex: 1;
  font-weight: 700;
}

.lb-score {
  color: var(--green);
  font-weight: 700;
}

/* ──────────────────────────────────────
   COUNTDOWN
────────────────────────────────────── */

.countdown-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
}

#countdownText {
  color: white;
  font-size: 6rem;
  font-family: var(--font-cjk);
  animation: pop 0.7s ease;
}

@keyframes pop {
  0%   { transform: scale(0.5); opacity: 0; }
  100% { transform: scale(1);   opacity: 1; }
}

/* ──────────────────────────────────────
   RESPONSIVE
────────────────────────────────────── */

/* ── LANDSCAPE: tablets & phones in landscape (≤900px wide) ──
   Keep side-by-side but constrain game board to fit viewport height. */
@media (max-width: 900px) and (orientation: landscape) {

  .page-wrap {
    padding: 10px;
    gap: 10px;
  }

  .top-row {
    gap: 12px;
    align-items: center;
  }

  .sidebar {
    width: 180px;
    gap: 8px;
  }

  header h1 {
    font-size: 1.5rem;
  }

  .tagline {
    display: none;
  }

  .card {
    padding: 10px;
  }

  .card h3 {
    margin-bottom: 6px;
    font-size: 0.9rem;
  }

  .features {
    font-size: 0.8rem;
    line-height: 1.6;
  }

  .difficulty-btn {
    padding: 6px 10px;
    font-size: 0.8rem;
  }

  .difficulty-select {
    gap: 6px;
  }

  .game-info {
    padding: 8px 10px;
    font-size: 0.85rem;
  }

  .game-card {
    padding: 10px;
  }

  /* Board is a square that fits within the landscape viewport height */
  .game-board {
    gap: 6px;
    /* subtract page padding (20px) + game-card padding (20px) */
    height: calc(100svh - 40px);
    width: calc(100svh - 40px);
    max-width: 100%;
    margin: 0 auto;
  }

  .header-img {
    max-height: 100px;
  }

  .player-row input {
    padding: 6px 10px;
    font-size: 0.85rem;
  }

  .flag-select {
    padding: 4px 6px;
    font-size: 1.2rem;
  }
}

/* ── PORTRAIT: tablets & phones in portrait (≤900px wide) ──
   Stack: sidebar on top, game below, leaderboards below that. */
@media (max-width: 900px) and (orientation: portrait) {

  .top-row {
    flex-direction: column;
    align-items: stretch; /* ✅ both children stretch to full column width */
  }

  .sidebar {
    width: 100%; /* ✅ full width */
  }

  .game-area {
    width: 100%; /* ✅ matches sidebar exactly */
    min-width: 0;
    flex: none;  /* ✅ don't flex — just take full width like sidebar */
  }

  .game-card {
    padding: 12px;
    width: 100%;
  }

  .game-board {
    width: 100%;
    gap: 8px;
  }

  .leaderboards {
    grid-template-columns: 1fr;
  }
}

/* ── FALLBACK: narrow screens without orientation API support ── */
@media (max-width: 500px) {
    
    .top-row {
        flex-direction: column;
        align-items: stretch;
    }

    .about-bio {
      text-align: left;
    }

    .stickers-card {
      flex-direction: column;
      text-align: center;
      padding: 24px 20px;
    }

    .stickers-preview {
      width: 180px;
    }
    
    .sidebar {
        width: 100%;
    }
    
    .game-area {
        width: 100%;
        min-width: 0;
        flex: none;
    }
    
    .game-board {
        width: 100%;
        gap: 6px;
    }
    
    .game-card {
        padding: 10px;
        width: 100%;
    }
    
    .leaderboards {
        grid-template-columns: 1fr;
    }

    .site-footer {
      padding: 20px 16px 32px;
    }

    .footer-links {
      gap: 12px;
    }

    .footer-link {
      font-size: 0.9rem;
    }

    .footer-copy {
      font-size: 0.8rem;
    }
}

/* ──────────────────────────────────────
   FOOTER
────────────────────────────────────── */

.site-footer {
  background: var(--bg);
  padding: 24px 20px 40px;
  font-family: var(--font-cjk);
}

.site-footer::before {
  content: "";
  display: block;
  max-width: 1200px;
  margin: 0 auto 20px;
  border-top: 3px dashed #E8D5C4;
}

.footer-links {
  max-width: 1200px;
  margin: auto;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 18px;
}

.footer-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.95rem;
  transition:
    transform 0.15s ease,
    color 0.15s ease;
}

.footer-link:hover {
  color: #ff8a5c;
  transform: translateY(-1px);
}

.footer-copy {
  margin-top: 16px;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
}
