/* Overleveringsspillet (game.php + assets_game.js). Scenen genbruger forsidens lag
   (assets_index.css); her er kun det, der er saerligt for spillet. */
.game-page { max-width: 56rem; }
.game-intro { color: var(--muted); margin: 0 0 0.75rem; }
.game-note { font-size: 0.85rem; background: #fff6e0; border: 1px solid #f0d9a0; border-radius: 0.5rem; padding: 0.5rem 0.75rem; }

.game-card {
    position: relative;
    background: #FCEEDD;
    border: 1px solid var(--hairline);
    border-radius: 1rem;
    padding: 0.75rem 1rem 1rem;
    overflow: hidden;
    -webkit-user-select: none;
    user-select: none;
}
.game-hud {
    display: flex;
    gap: 1.25rem;
    flex-wrap: wrap;
    font-size: 0.95rem;
}
.game-hud strong { font-variant-numeric: tabular-nums; font-size: 1.1rem; }
.game-hud-best { margin-left: auto; color: var(--muted); }

/* ---------- Scenen ---------- */
.game-stage { padding-top: 3.2rem; } /* plads til talebobler over storkene */
.game-scene.hero-scene { max-width: none; margin: 0 auto 0.5rem; }
.game-scene .hero-image { max-width: none; width: 100%; margin: 0; } /* forsiden begraenser billedet til 26rem */
.game-scene .hero-rope img { animation: none; } /* linen staar stille; ungen gaar paa den */

.game-chick {
    position: absolute;
    left: 43.2018%; top: 24.8848%; width: 13.0482%; height: 44.4700%;
    transform-origin: 48.7% 50%;
    pointer-events: none;
    will-change: transform;
}
.game-chick-clip { position: absolute; inset: 0; overflow: hidden; }
.game-chick-clip img {
    position: absolute; top: 0; left: 0;
    width: 4800%; height: 100%; max-width: none;
}
.game-chick-clip img.is-walking { animation: hero-frames 2.4s steps(48) infinite; }

.game-name {
    position: absolute;
    top: 52%;
    transform: translateX(-50%);
    font-size: clamp(0.7rem, 1.8vw, 0.85rem);
    font-weight: 700;
    color: #fff;
    padding: 0.1rem 0.55rem;
    border-radius: 999px;
    white-space: nowrap;
    pointer-events: none;
}
.game-name-left { left: 16.5%; background: #2D3561; }
.game-name-right { left: 83.5%; background: #D97A4E; }

/* Taleboblen: vises 1 sekund ved storken, ungen skal over til. */
.game-bubble {
    --icon: clamp(24px, 4.6vw, 36px);
    position: absolute;
    top: -14%;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    max-width: 46%;
    padding: 8px 10px;
    background: #fff;
    border: 3px solid #2b2b2b;
    border-radius: 14px;
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.15);
    opacity: 0;
    transform: scale(0.6);
    transition: opacity 0.12s, transform 0.12s;
    pointer-events: none;
    z-index: 30;
}
.game-bubble.is-on { opacity: 1; transform: scale(1); }
.game-bubble.is-left { left: 21%; transform-origin: 0 100%; }
.game-bubble.is-right { right: 21%; transform-origin: 100% 100%; }
.game-bubble::after {
    content: "";
    position: absolute;
    bottom: -14px;
    width: 18px;
    height: 18px;
    background: #fff;
    border: 3px solid #2b2b2b;
    border-top: 0;
    border-left: 0;
    transform: rotate(45deg) skew(12deg, 12deg);
}
.game-bubble.is-left::after { left: 10px; transform: rotate(60deg) skew(10deg, 10deg); }
.game-bubble.is-right::after { right: 10px; transform: rotate(30deg) skew(10deg, 10deg); }
.game-bubble-icon { width: var(--icon); height: var(--icon); }
.game-bubble-icon svg { display: block; width: 100%; height: 100%; }
.game-icon svg { display: block; width: 100%; height: auto; } /* kvadratisk via viewBox */

.game-flash {
    position: absolute;
    left: 50%;
    top: 4%;
    transform: translate(-50%, 0) scale(0.8);
    font-weight: 800;
    font-size: clamp(1rem, 3vw, 1.4rem);
    color: #2D3561;
    background: rgba(255, 255, 255, 0.9);
    padding: 0.25rem 0.8rem;
    border-radius: 999px;
    opacity: 0;
    transition: opacity 0.15s, transform 0.15s;
    pointer-events: none;
    z-index: 31;
}
.game-flash.is-on { opacity: 1; transform: translate(-50%, 0) scale(1); }
.game-flash.is-ok { color: #1f7a3f; font-size: clamp(1.4rem, 4vw, 2rem); }

/* ---------- Ikonerne (de 8 ting) ---------- */
.game-icons {
    display: grid;
    grid-template-columns: repeat(8, minmax(0, 1fr));
    gap: 0.5rem;
    margin: 0.25rem 0 0.9rem;
}
/* Hoejden kommer fra ikonets bredde (viewBox 16x16), ikke fra aspect-ratio, som aeldre
   Safari ikke kender - ellers faar SVG'en browserens standardhoejde paa 150 px. */
.game-icon {
    display: block;
    width: 100%;
    min-width: 0;
    margin: 0;
    padding: 14%;
    line-height: 0;
    -webkit-appearance: none;
    appearance: none;
    background: #fff;
    border: 2px solid #d9c9b0;
    border-radius: 0.6rem;
    cursor: pointer;
    transition: transform 0.08s, border-color 0.15s, background 0.15s;
    -webkit-tap-highlight-color: transparent;
}
.game-icon:hover { border-color: #2D3561; }
.game-icon:active { transform: scale(0.93); }
.game-icon.is-correct { background: #e3f6e8; border-color: #2e9e57; }
.game-icon.is-wrong { background: #fde3e1; border-color: #d93a2b; animation: game-shake 0.35s; }
.game-icon.is-missing { border-color: #e39b18; border-style: dashed; animation: game-pulse 0.6s 3; }
@keyframes game-shake {
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}
@keyframes game-pulse { 50% { transform: scale(1.08); } }

/* ---------- Tidslinjen (7 dage, pilen peger paa den aktive dag) ---------- */
.game-timeline {
    position: relative;
    overflow: hidden;
    border-radius: 0.6rem;
    background: #fff;
    border: 1px solid #e3d5bf;
    padding-bottom: 1.1rem;
}
.game-timeline::before {
    content: "";
    position: absolute;
    left: calc(100% * 3 / 7);
    width: calc(100% / 7);
    top: 0;
    bottom: 0;
    background: rgba(45, 53, 97, 0.08);
    border-left: 2px solid #2D3561;
    border-right: 2px solid #2D3561;
    pointer-events: none;
}
.game-timeline-track { display: flex; width: 100%; will-change: transform; }
.game-day {
    position: relative;
    flex: 0 0 calc(100% / 7);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.4rem 0.1rem 0.3rem;
    font-size: clamp(0.65rem, 1.8vw, 0.85rem);
    border-right: 1px solid #f0e6d6;
}
.game-day-name { font-weight: 700; }
.game-day-date { color: var(--muted); font-size: 0.85em; }
.game-day-bar { display: flex; width: 80%; height: 6px; margin-top: 4px; border-radius: 3px; overflow: hidden; }
.game-day-bar i { flex: 1; }
.game-day-bar .side-left { background: #2D3561; }
.game-day-bar .side-right { background: #D97A4E; }
.game-day-swap { position: absolute; top: 2px; right: 4px; font-size: 0.8em; color: #D97A4E; }
.game-timeline-arrow {
    position: absolute;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    color: #2D3561;
    font-size: 0.9rem;
    line-height: 1.1rem;
}

/* ---------- Start / slut ---------- */
.game-overlay {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(252, 238, 221, 0.86);
    z-index: 40;
    padding: 1rem;
}
.game-overlay.is-on { display: flex; }
.game-panel {
    width: min(26rem, 100%);
    max-height: 100%;
    overflow-y: auto;
    background: #fff;
    border: 1px solid var(--hairline);
    border-radius: 1rem;
    padding: 1.1rem 1.25rem;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
}
.game-panel-title { font-family: Georgia, serif; font-size: 1.35rem; margin: 0 0 0.4rem; }
.game-panel-text { margin: 0 0 0.75rem; color: var(--muted); font-size: 0.92rem; }
.game-tops-line { font-size: 0.9rem; margin: 0 0 0.6rem; }
.game-tops-head { font-weight: 700; font-size: 0.85rem; margin: 0 0 0.3rem; text-align: left; }
.game-tops { margin: 0 0 0.9rem; padding-left: 1.4rem; text-align: left; font-size: 0.88rem; }
.game-tops li { display: flex; justify-content: space-between; padding: 0.12rem 0; }
.game-tops li.is-me { font-weight: 700; color: #2D3561; }
.game-muted { color: var(--muted); font-size: 0.85rem; }
.game-start { font-size: 1rem; padding: 0.6rem 1.6rem; }

@media (max-width: 560px) {
    .game-page h1 { font-size: 1.5rem; }
    .game-intro { font-size: 0.85rem; margin-bottom: 0.5rem; }
    .game-card { padding: 0.5rem 0.5rem 0.7rem; border-radius: 0.75rem; }
    .game-hud { gap: 0.75rem; font-size: 0.85rem; }
    /* Alle 8 ting paa een raekke, saa scene, ting og tidslinje kan ses paa een gang. */
    .game-icons { gap: 4px; margin: 0.15rem 0 0.6rem; }
    .game-icon { padding: 10%; border-width: 1.5px; border-radius: 0.45rem; }
    .game-stage { padding-top: 2.6rem; }
    .game-bubble { max-width: 60%; padding: 6px; }
}

/* Anonymt spil: navn til den anonyme topliste. */
.game-anon-save { display: flex; gap: 0.5rem; align-items: flex-end; margin: 0 0 0.8rem; text-align: left; }
.game-anon-save label { flex: 1; display: flex; flex-direction: column; gap: 0.2rem; font-size: 0.85rem; }
.game-anon-save input { padding: 0.45rem 0.6rem; font: inherit; border: 1px solid var(--hairline); border-radius: 0.45rem; }
