/* =====================================================================
   PANDAPUTTPUTT — the kid view (puttputt.html only).
   A Saturday at the putt-putt golf & games place: turf greens, a wooden
   sign, mini-golf flags, a token machine and prize tickets. Built
   mobile-first for an iPad in a third grader's hands — big things to
   press, games right at the top, nothing that needs a hover.

   This page deliberately does NOT load style.css: the main site is
   "ink & ivory, one voice" and this is recess. The .hg-* rules here
   re-skin the same hero-game.js DOM that index.html uses, so the two
   pages must never load each other's stylesheet (the class names
   collide on purpose).

   Type roles:
     Lilita One — signage (chunky, friendly, painted-sign energy)
     Fredoka    — everything else (round, extremely kid-legible)
   ===================================================================== */

:root {
    --turf: #2E9E4F;
    --turf-mowed: #27893F;
    --turf-deep: #1E6E36;
    --sky-top: #7ED3F7;
    --sky-bottom: #C8EEFF;
    --card: #FFFDF5;
    --ink: #1E3A2A;
    --flag: #FF5A47;
    --flag-deep: #D8402F;
    --sun: #FFD23F;
    --orange: #FF9F1C;
    --wood: #B0793F;
    --wood-deep: #8A5C2C;
    --ticket: #FF7BAC;
    --token: #E8B93D;
    --token-deep: #C79A26;
    --ball: #FFFFFF;
    --sq-light: #F3EBD3;
    --sq-dark: #3E7C4F;
    --sign: 'Lilita One', 'Trebuchet MS', 'Comic Sans MS', system-ui, sans-serif;
    --body: 'Fredoka', 'Trebuchet MS', system-ui, sans-serif;
    --pop: cubic-bezier(0.16, 1, 0.3, 1);
}

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

html { scroll-behavior: smooth; }

body {
    font-family: var(--body);
    font-weight: 500;
    color: var(--ink);
    line-height: 1.45;
    overflow-x: hidden;
    -webkit-tap-highlight-color: transparent;
    /* Mowed turf stripes run the whole page under everything. */
    background: repeating-linear-gradient(
        90deg,
        var(--turf) 0 72px,
        var(--turf-mowed) 72px 144px
    );
}

a { color: inherit; }

:focus-visible {
    outline: 4px solid var(--sun);
    outline-offset: 3px;
    border-radius: 8px;
}

/* Every tappable thing squashes like a stepped-on golf ball. */
.hole:active,
.token-tile:active,
.hg-btn:active:not(:disabled),
.hg-start:active,
.giftshop-link:active {
    transform: scale(0.95);
}

/* =====================================================================
   THE SKY + ENTRANCE SIGN
   ===================================================================== */

.sky {
    position: relative;
    background: linear-gradient(180deg, var(--sky-top) 0%, var(--sky-bottom) 78%, var(--turf) 78.5%);
    padding: 18px 18px 0;
    overflow: hidden;
    text-align: center;
}

.sun {
    position: absolute;
    top: -34px;
    right: -34px;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: radial-gradient(circle, #FFE688 0%, var(--sun) 65%);
    box-shadow: 0 0 60px 22px rgba(255, 210, 63, 0.55);
    animation: sunSpin 40s linear infinite;
}

/* Sun rays: a dashed conic ring, cheap and cheerful. */
.sun::after {
    content: '';
    position: absolute;
    inset: -22px;
    border-radius: 50%;
    background: repeating-conic-gradient(
        rgba(255, 210, 63, 0.65) 0deg 8deg,
        transparent 8deg 24deg
    );
    -webkit-mask: radial-gradient(circle, transparent 58%, #000 59%);
    mask: radial-gradient(circle, transparent 58%, #000 59%);
}

@keyframes sunSpin { to { transform: rotate(360deg); } }

.cloud {
    position: absolute;
    background: #FFFFFF;
    border-radius: 99px;
    opacity: 0.9;
}

.cloud::before,
.cloud::after {
    content: '';
    position: absolute;
    background: #FFFFFF;
    border-radius: 50%;
    bottom: 0;
}

.cloud-1 { top: 30px; left: 6%; width: 92px; height: 26px; animation: cloudDrift 60s linear infinite; }
.cloud-1::before { width: 34px; height: 34px; left: 14px; }
.cloud-1::after { width: 24px; height: 24px; left: 46px; }

.cloud-2 { top: 84px; left: 55%; width: 70px; height: 20px; opacity: 0.7; animation: cloudDrift 85s linear infinite reverse; }
.cloud-2::before { width: 26px; height: 26px; left: 10px; }
.cloud-2::after { width: 18px; height: 18px; left: 36px; }

@keyframes cloudDrift {
    from { transform: translateX(-140px); }
    to { transform: translateX(100vw); }
}

.grownups-link {
    position: relative;
    z-index: 2;
    display: inline-block;
    float: right;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--ink);
    background: rgba(255, 255, 255, 0.75);
    border-radius: 99px;
    padding: 7px 14px;
    text-decoration: none;
}

/* The big wooden entrance sign on two posts. */
.signboard {
    position: relative;
    z-index: 1;
    display: inline-block;
    clear: both;
    margin: 34px auto 0;
    background: linear-gradient(180deg, var(--wood) 0%, var(--wood-deep) 100%);
    border: 5px solid var(--wood-deep);
    border-radius: 26px;
    padding: 20px 26px 22px;
    box-shadow:
        inset 0 0 0 3px rgba(255, 253, 245, 0.35),
        0 12px 0 rgba(0, 0, 0, 0.12);
}

/* Two posts running down into the turf. */
.signboard::before,
.signboard::after {
    content: '';
    position: absolute;
    top: 90%;
    width: 18px;
    height: 90px;
    background: var(--wood-deep);
    border-radius: 0 0 6px 6px;
    z-index: -1;
}

.signboard::before { left: 16%; }
.signboard::after { right: 16%; }

.sign-ball {
    width: 74px;
    height: 74px;
    object-fit: contain;
    background: var(--ball);
    border-radius: 50%;
    border: 4px solid var(--ink);
    margin-bottom: 10px;
    animation: ballBounce 2.6s ease-in-out infinite;
}

@keyframes ballBounce {
    0%, 100% { transform: translateY(0); }
    40% { transform: translateY(-9px); }
    55% { transform: translateY(0); }
    65% { transform: translateY(-4px); }
    75% { transform: translateY(0); }
}

.sign-title {
    font-family: var(--sign);
    font-weight: 400;
    font-size: clamp(2.1rem, 9vw, 3.6rem);
    line-height: 1;
    letter-spacing: 0.01em;
    color: #FFFDF5;
    text-shadow: 3px 3px 0 var(--turf-deep);
}

.sign-title .putt { color: var(--sun); }

.sign-sub {
    font-weight: 600;
    font-size: clamp(1rem, 4vw, 1.25rem);
    color: #FFF3D6;
    margin-top: 8px;
}

/* The sign's posts need turf to stand in before the first section. */
.sky-turf {
    height: 64px;
}

/* =====================================================================
   SECTIONS + HOLE SIGNS
   ===================================================================== */

.course-wrap {
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 16px;
}

.section { padding: 10px 0 44px; }

.hole-sign {
    font-family: var(--sign);
    font-weight: 400;
    font-size: clamp(1.5rem, 6vw, 2.2rem);
    color: #FFFDF5;
    text-align: center;
    text-shadow: 2px 3px 0 var(--turf-deep);
    margin-bottom: 6px;
}

.section-note {
    text-align: center;
    font-weight: 600;
    color: #EAFBEF;
    margin-bottom: 22px;
}

/* =====================================================================
   THE FRONT 6 — hole cards
   ===================================================================== */

.holes {
    display: grid;
    grid-template-columns: 1fr;
    gap: 22px;
}

.hole {
    position: relative;
    display: flex;
    flex-direction: column;
    background: var(--card);
    border: 4px solid var(--ink);
    border-radius: 24px;
    overflow: visible;
    text-decoration: none;
    box-shadow: 0 8px 0 rgba(0, 0, 0, 0.18);
    transition: transform 0.25s var(--pop), box-shadow 0.25s var(--pop);
    touch-action: manipulation;
}

.hole:hover { transform: translateY(-5px) rotate(-0.4deg); box-shadow: 0 13px 0 rgba(0, 0, 0, 0.18); }

/* The numbered flag planted on each card. */
.hole-flag {
    position: absolute;
    top: -16px;
    left: 14px;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: var(--sign);
    font-size: 0.85rem;
    letter-spacing: 0.05em;
    color: #FFFDF5;
    background: var(--flag);
    border: 3px solid var(--flag-deep);
    border-radius: 99px;
    padding: 6px 14px;
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.15);
}

.hole-flag svg { width: 16px; height: 16px; }

.hole-screen {
    border-radius: 20px 20px 0 0;
    overflow: hidden;
    border-bottom: 4px solid var(--ink);
    background: var(--turf-deep);
}

.hole-screen img {
    display: block;
    width: 100%;
    height: 180px;
    object-fit: cover;
    object-position: top center;
}

.hole-screen img.is-centered { object-position: center; }

.hole-body {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 16px 18px 18px;
    flex: 1;
}

.hole-name {
    font-family: var(--sign);
    font-weight: 400;
    font-size: 1.45rem;
    color: var(--ink);
}

.hole-note {
    font-size: 1.02rem;
    font-weight: 500;
    color: #4A6353;
    flex: 1;
}

.hole-putt {
    align-self: flex-start;
    margin-top: 10px;
    font-family: var(--sign);
    font-size: 1.05rem;
    letter-spacing: 0.04em;
    color: #FFFDF5;
    background: linear-gradient(180deg, var(--turf) 0%, var(--turf-deep) 100%);
    border: 3px solid var(--turf-deep);
    border-radius: 99px;
    padding: 10px 26px;
    box-shadow: 0 5px 0 rgba(0, 0, 0, 0.18);
}

.hole:hover .hole-putt,
.hole:active .hole-putt {
    background: linear-gradient(180deg, var(--orange) 0%, #E58608 100%);
    border-color: #E58608;
}

/* =====================================================================
   TICKET STRIP DIVIDERS
   ===================================================================== */

.ticket-strip {
    overflow: hidden;
    background: var(--ticket);
    border-top: 4px dashed #FFFDF5;
    border-bottom: 4px dashed #FFFDF5;
    margin: 0 -16px 34px;
    padding: 10px 0;
    white-space: nowrap;
}

.ticket-track {
    display: inline-block;
    font-family: var(--sign);
    font-size: 0.85rem;
    letter-spacing: 0.16em;
    color: #FFFDF5;
    text-shadow: 1px 2px 0 rgba(0, 0, 0, 0.15);
    animation: ticketRoll 30s linear infinite;
}

/* The track holds two identical halves; sliding one half's width loops seamlessly. */
@keyframes ticketRoll { to { transform: translateX(-50%); } }

/* =====================================================================
   THE TOKEN MACHINE — Firestore grid (built by puttputt.js)
   ===================================================================== */

.token-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 18px;
}

.token-loading,
.token-offline {
    grid-column: 1 / -1;
    text-align: center;
    font-family: var(--sign);
    font-size: 1.05rem;
    letter-spacing: 0.03em;
    color: #EAFBEF;
    text-shadow: 1px 2px 0 var(--turf-deep);
    padding: 30px 12px;
}

.token-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 18px 10px 16px;
    background: var(--card);
    border: 4px solid var(--ink);
    border-radius: 22px;
    box-shadow: 0 6px 0 rgba(0, 0, 0, 0.18);
    text-decoration: none;
    text-align: center;
    position: relative;
    opacity: 0; /* popIn animates in, staggered by puttputt.js */
    transition: transform 0.25s var(--pop), box-shadow 0.25s var(--pop);
    touch-action: manipulation;
}

.token-tile:hover { transform: translateY(-4px); box-shadow: 0 10px 0 rgba(0, 0, 0, 0.18); }

@keyframes popIn {
    from { opacity: 0; transform: scale(0.7) translateY(16px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

/* A gold arcade token with an engraved ring; the app icon is the stamp. */
.token-coin {
    width: 76px;
    height: 76px;
    border-radius: 50%;
    background: radial-gradient(circle at 32% 28%, #F7D775 0%, var(--token) 55%, var(--token-deep) 100%);
    border: 3px solid var(--token-deep);
    box-shadow: inset 0 0 0 5px rgba(255, 253, 245, 0.4), 0 3px 0 rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6E4F0E;
}

.token-coin svg { width: 38px; height: 38px; }

.token-name {
    font-weight: 700;
    font-size: 1rem;
    line-height: 1.2;
    color: var(--ink);
}

.token-badge {
    position: absolute;
    top: -12px;
    right: 10px;
    font-family: var(--sign);
    font-size: 0.68rem;
    letter-spacing: 0.06em;
    padding: 5px 10px;
    border-radius: 99px;
    border: 3px solid rgba(0, 0, 0, 0.15);
    color: #FFFDF5;
    text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.2);
    transform: rotate(4deg);
}

.token-badge--hot { background: var(--flag); }
.token-badge--new { background: var(--orange); }

/* =====================================================================
   THE PRACTICE GREEN — playable Light or Dark demo
   (same hero-game.js DOM contract as index.html, putt-putt skin)
   ===================================================================== */

.green-card {
    max-width: 460px;
    margin: 0 auto;
    background: var(--card);
    border: 4px solid var(--ink);
    border-radius: 26px;
    padding: 20px 20px 18px;
    box-shadow: 0 8px 0 rgba(0, 0, 0, 0.18);
}

.hg { position: relative; }

.hg-top {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.hg-title {
    font-family: var(--sign);
    font-weight: 400;
    font-size: 1.2rem;
}

.hg-tag {
    font-family: var(--body);
    font-weight: 700;
    font-size: 0.68rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #FFFDF5;
    background: var(--flag);
    padding: 4px 10px;
    border-radius: 99px;
    vertical-align: middle;
    margin-left: 6px;
}

.hg-meta {
    font-weight: 700;
    font-size: 0.95rem;
    color: #4A6353;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.hg-meta strong { color: var(--flag); font-size: 1.2rem; margin-left: 2px; }

.hg-stage { position: relative; }

.hg-board-row { display: flex; gap: 6px; }

.hg-ranks {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    font-weight: 700;
    font-size: 0.7rem;
    color: #4A6353;
}

.hg-board {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    aspect-ratio: 1 / 1;
    border-radius: 14px;
    overflow: hidden;
    border: 3px solid var(--ink);
}

.hg-sq { position: relative; }
.hg-sq.is-light { background: var(--sq-light); }
.hg-sq.is-dark { background: var(--sq-dark); }

.hg-sq.flash-good::after,
.hg-sq.flash-bad::after {
    content: '';
    position: absolute;
    inset: 0;
    animation: hgFlash 0.5s ease-out forwards;
}
.hg-sq.flash-good::after { background: var(--sun); }
.hg-sq.flash-bad::after { background: var(--flag); }

@keyframes hgFlash {
    from { opacity: 0.95; }
    to { opacity: 0; }
}

.hg-files {
    display: flex;
    justify-content: space-around;
    font-weight: 700;
    font-size: 0.7rem;
    color: #4A6353;
    margin-top: 4px;
    padding-left: 14px; /* optical: offset for the rank label column */
}

.hg-call {
    font-family: var(--sign);
    font-size: 2.8rem;
    text-align: center;
    line-height: 1;
    margin: 14px 0 12px;
    min-height: 1em;
    color: var(--turf-deep);
}

.hg-btns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.hg-btn {
    font-family: var(--sign);
    font-size: 1.1rem;
    letter-spacing: 0.06em;
    padding: 16px 0 14px;
    border-radius: 18px;
    border: 3px solid var(--ink);
    box-shadow: 0 5px 0 rgba(0, 0, 0, 0.22);
    cursor: pointer;
    transition: transform 0.1s ease;
    touch-action: manipulation;
}

.hg-btn:disabled { opacity: 0.45; cursor: default; }

.hg-btn--light { background: var(--sq-light); color: var(--ink); }
.hg-btn--dark { background: var(--sq-dark); color: #FFFDF5; }

/* Countdown bar. */
.hg-barwrap {
    height: 12px;
    border-radius: 99px;
    background: #E4DEC9;
    border: 2px solid var(--ink);
    margin-top: 16px;
    overflow: hidden;
}

.hg-bar {
    height: 100%;
    width: 100%;
    border-radius: 99px;
    background: linear-gradient(90deg, var(--sun) 0%, var(--orange) 100%);
    transform-origin: left center;
}

/* Idle / finished overlay sits over the board only. */
.hg-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    text-align: center;
    padding: 16px;
    border-radius: 14px;
    background: rgba(255, 253, 245, 0.94);
}

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

.hg-overlay-title {
    font-family: var(--sign);
    font-size: 1.6rem;
    color: var(--ink);
}

.hg-overlay-sub {
    font-size: 0.95rem;
    font-weight: 500;
    color: #4A6353;
    max-width: 22em;
    line-height: 1.45;
}

.hg-start {
    font-family: var(--sign);
    font-size: 1.15rem;
    letter-spacing: 0.05em;
    padding: 14px 36px 12px;
    border-radius: 99px;
    border: 3px solid var(--flag-deep);
    box-shadow: 0 5px 0 rgba(0, 0, 0, 0.22);
    cursor: pointer;
    background: linear-gradient(180deg, var(--flag) 0%, var(--flag-deep) 100%);
    color: #FFFDF5;
    animation: startWiggle 2.2s ease-in-out infinite;
    transition: transform 0.1s ease;
    touch-action: manipulation;
}

@keyframes startWiggle {
    0%, 88%, 100% { transform: rotate(0deg) scale(1); }
    91% { transform: rotate(-2.5deg) scale(1.05); }
    94% { transform: rotate(2.5deg) scale(1.05); }
    97% { transform: rotate(-1.5deg) scale(1.02); }
}

.hg-foot {
    display: block;
    text-align: center;
    margin-top: 14px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #4A6353;
    text-decoration: underline;
}

/* =====================================================================
   FOOTER — exit through the gift shop
   ===================================================================== */

.pp-footer {
    text-align: center;
    padding: 8px 18px 46px;
    color: #EAFBEF;
}

.pp-footer p { font-weight: 600; margin-bottom: 14px; text-shadow: 1px 2px 0 var(--turf-deep); }

.giftshop-link {
    display: inline-block;
    font-family: var(--sign);
    font-size: 1rem;
    color: var(--ink);
    background: var(--sun);
    border: 3px solid var(--ink);
    border-radius: 99px;
    padding: 12px 26px 10px;
    box-shadow: 0 5px 0 rgba(0, 0, 0, 0.2);
    text-decoration: none;
    transition: transform 0.15s ease;
}

/* =====================================================================
   BIGGER SCREENS (the iPad landscape / desktop enhancement)
   ===================================================================== */

@media (min-width: 600px) {
    .holes { grid-template-columns: repeat(2, 1fr); }
    .hole-screen img { height: 200px; }
    .course-wrap { padding: 0 24px; }
    .ticket-strip { margin-left: -24px; margin-right: -24px; }
}

@media (min-width: 1000px) {
    .holes { grid-template-columns: repeat(3, 1fr); }
    .token-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}

/* =====================================================================
   MOTION SAFETY
   ===================================================================== */

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .sun, .cloud, .sign-ball, .ticket-track, .hg-start {
        animation: none;
    }
    .token-tile { opacity: 1 !important; animation: none !important; }
    .hole, .token-tile, .hole:hover, .token-tile:hover { transform: none; transition: none; }
}
