/* style.css — Paardenspel design system (v2)
   Tokens, thema's (dag/nacht), app-shell, hub, editor, overlays.
   Arena-specifieke stijlen staan verderop (race, springen, vangen, dressuur, memory, verzorgen). */

:root {
    --sky-top: #a8d8ff; --sky-mid: #cdeaff; --meadow: #eafbe0; --meadow-deep: #cdeeb6;
    --hill-far: #b6e29a; --hill-near: #9cd47e;
    --surface: #fffdf7; --surface-2: #ffffff; --surface-3: #f6f1e6;
    --text: #2f3b47; --muted: #76828c; --line: #e3dccd;
    --primary: #ff8a3d; --primary-dark: #d96f2a; --primary-soft: #ffd9bd; --primary-tint: #fff1e6;
    --green: #51b54f; --green-dark: #3c8c3b; --green-soft: #d9f2d3;
    --blue: #4f9be8; --blue-dark: #3577bd; --blue-soft: #d6eaff;
    --pink: #f25d93; --pink-dark: #c2487f; --pink-soft: #ffd9e7;
    --purple: #8f7be0; --purple-dark: #6f5ad6; --purple-soft: #e6e0fb;
    --gold: #ffd166; --gold-dark: #e0a800; --gold-soft: #fff1c2;
    --teal: #3fb8a8; --teal-dark: #2d8f82; --teal-soft: #d4f3ee;
    --brown: #b97f4c; --brown-soft: #f3e4cf;
    --overlay: rgba(255, 253, 247, .94);
    --shadow: 0 4px 14px rgba(60, 90, 40, .12);
    --shadow-lg: 0 14px 40px rgba(40, 60, 30, .22);
    --ring: 0 0 0 3px var(--primary-soft);
    --radius: 20px; --radius-s: 14px; --radius-xs: 10px;
    --tab-h: 66px;
    --header-h: 56px;
    --font: ui-rounded, 'Nunito', 'Quicksand', 'Trebuchet MS', 'Segoe UI', system-ui, sans-serif;
    color-scheme: light;
}

/* Nacht-thema: automatisch via het systeem, of handmatig via de knop in de balk. */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) { --dark: 1; }
}
:root[data-theme="dark"] { --dark: 1; }

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --sky-top: #0d1730; --sky-mid: #1a2a4d; --meadow: #1f3d2d; --meadow-deep: #16301f;
        --hill-far: #27503a; --hill-near: #1d4230;
        --surface: #1f2733; --surface-2: #283240; --surface-3: #313c4c;
        --text: #eef2f7; --muted: #a2adb9; --line: #3a4656;
        --primary-soft: #5a3a22; --primary-tint: #3a2c22;
        --green-soft: #22402a; --blue-soft: #233a55; --pink-soft: #4a2638; --purple-soft: #33305a;
        --gold-soft: #4a3d14; --teal-soft: #1e3f3b; --brown-soft: #3d3022;
        --overlay: rgba(31, 39, 51, .95);
        --shadow: 0 4px 16px rgba(0, 0, 0, .35);
        --shadow-lg: 0 14px 40px rgba(0, 0, 0, .5);
        --ring: 0 0 0 3px rgba(255, 138, 61, .45);
        color-scheme: dark;
    }
}
:root[data-theme="dark"] {
    --sky-top: #0d1730; --sky-mid: #1a2a4d; --meadow: #1f3d2d; --meadow-deep: #16301f;
    --hill-far: #27503a; --hill-near: #1d4230;
    --surface: #1f2733; --surface-2: #283240; --surface-3: #313c4c;
    --text: #eef2f7; --muted: #a2adb9; --line: #3a4656;
    --primary-soft: #5a3a22; --primary-tint: #3a2c22;
    --green-soft: #22402a; --blue-soft: #233a55; --pink-soft: #4a2638; --purple-soft: #33305a;
    --gold-soft: #4a3d14; --teal-soft: #1e3f3b; --brown-soft: #3d3022;
    --overlay: rgba(31, 39, 51, .95);
    --shadow: 0 4px 16px rgba(0, 0, 0, .35);
    --shadow-lg: 0 14px 40px rgba(0, 0, 0, .5);
    --ring: 0 0 0 3px rgba(255, 138, 61, .45);
    color-scheme: dark;
}

/* ---- basis ---- */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0; min-height: 100vh; min-height: 100dvh; color: var(--text);
    font-family: var(--font); line-height: 1.35;
    background: linear-gradient(180deg, var(--sky-top) 0%, var(--sky-mid) 30%, var(--meadow) 58%, var(--meadow-deep) 100%);
    background-attachment: fixed;
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior-y: none;
}
button { font-family: inherit; color: inherit; }
button, [role="button"] { touch-action: manipulation; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
h1, h2, h3 { line-height: 1.15; }
h2 { margin: .2rem 0 .6rem; font-size: 1.25rem; }
h3 { margin: 0 0 .6rem; font-size: 1rem; }
.muted { color: var(--muted); font-weight: normal; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- scenische achtergrond (puur CSS, geen externe bronnen) ---- */
.scenery { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.scenery .sun {
    position: absolute; top: 6%; right: 9%; width: 84px; height: 84px; border-radius: 50%;
    background: radial-gradient(circle, #fff7cc 0 42%, #ffe98f 60%, rgba(255,233,143,0) 72%);
    box-shadow: 0 0 70px 34px rgba(255,236,150,.4);
    animation: sunpulse 6s ease-in-out infinite;
}
@keyframes sunpulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.06); } }
.scenery .cloud {
    position: absolute; width: 64px; height: 22px; background: #fff; border-radius: 999px;
    opacity: .9; will-change: transform;
    box-shadow: 24px -12px 0 2px #fff, 50px 0 0 -3px #fff, 16px 7px 0 7px #fff, -18px 4px 0 1px #fff;
    animation: drift linear infinite;
}
.scenery .c1 { top: 12%; transform: scale(1.15); animation-duration: 64s; }
.scenery .c2 { top: 26%; transform: scale(.8);  opacity: .75; animation-duration: 86s; animation-delay: -30s; }
.scenery .c3 { top: 20%; transform: scale(1);   animation-duration: 74s; animation-delay: -55s; }
@keyframes drift { from { left: -22%; } to { left: 118%; } }
.scenery .bird { position: absolute; width: 26px; height: 10px; animation: birdfly linear infinite; }
.scenery .bird::before, .scenery .bird::after {
    content: ''; position: absolute; top: 0; width: 13px; height: 9px;
    border-top: 2.5px solid rgba(51,65,78,.5);
    border-radius: 50% 50% 0 0 / 100% 100% 0 0;
}
.scenery .bird::before { left: 0;  transform-origin: 100% 100%; animation: flapL .55s ease-in-out infinite alternate; }
.scenery .bird::after  { right: 0; transform-origin: 0 100%;    animation: flapR .55s ease-in-out infinite alternate; }
@keyframes flapL { from { transform: rotate(4deg); } to { transform: rotate(-16deg); } }
@keyframes flapR { from { transform: rotate(-4deg); } to { transform: rotate(16deg); } }
.scenery .b1 { top: 16%; animation-duration: 39s; }
.scenery .b2 { top: 9%; scale: .65; opacity: .7; animation-duration: 52s; animation-delay: -23s; }
@keyframes birdfly { from { left: -4%; } to { left: 106%; } }
.scenery .hills { position: absolute; left: -8%; right: -8%; bottom: 0; height: 40vh; }
.scenery .hills::before, .scenery .hills::after {
    content: ''; position: absolute; left: 0; right: 0; bottom: 0; border-radius: 50% 50% 0 0 / 100% 100% 0 0;
}
.scenery .hills::before { height: 26vh; background: var(--hill-far); opacity: .55; transform: scaleX(1.4); }
.scenery .hills::after  { height: 17vh; background: var(--hill-near); opacity: .6;  transform: scaleX(1.7) translateX(8%); }
/* sterren + maan 's nachts */
.scenery .stars { position: absolute; inset: 0 0 40% 0; opacity: 0; transition: opacity .6s; }
.scenery .stars {
    background-image:
        radial-gradient(1.5px 1.5px at 12% 18%, #fff 50%, transparent 60%),
        radial-gradient(1.5px 1.5px at 28% 40%, #fff 50%, transparent 60%),
        radial-gradient(2px 2px at 45% 12%, #fff 50%, transparent 60%),
        radial-gradient(1.5px 1.5px at 63% 30%, #fff 50%, transparent 60%),
        radial-gradient(2px 2px at 80% 22%, #fff 50%, transparent 60%),
        radial-gradient(1.5px 1.5px at 92% 48%, #fff 50%, transparent 60%),
        radial-gradient(1.5px 1.5px at 37% 60%, #fff 50%, transparent 60%),
        radial-gradient(1.5px 1.5px at 70% 55%, #fff 50%, transparent 60%),
        radial-gradient(1.5px 1.5px at 5% 70%, #fff 50%, transparent 60%),
        radial-gradient(1.5px 1.5px at 55% 75%, #fff 50%, transparent 60%);
    animation: twinkle 3s infinite;
}
.night .scenery .stars { opacity: .9; }
.night .scenery .sun {
    background: radial-gradient(circle at 40% 40%, #fffbe6 0 44%, #e9e4c8 60%, rgba(233,228,200,0) 72%);
    box-shadow: 0 0 60px 26px rgba(230,230,255,.18), inset -16px -8px 0 0 rgba(0,0,0,.08);
}
.night .scenery .cloud { opacity: .25; }
.night .scenery .bird { opacity: 0; }

/* ---- app-balk ---- */
.topbar {
    position: sticky; top: 0; z-index: 20; height: var(--header-h);
    display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: .5rem;
    padding: 0 .75rem; padding-top: env(safe-area-inset-top);
    background: color-mix(in srgb, var(--surface) 82%, transparent);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 2px 10px rgba(60,90,40,.08);
}
.topbar-left { display: flex; align-items: center; gap: .4rem; min-width: 0; }
.topbar-right { display: flex; align-items: center; justify-content: flex-end; gap: .4rem; }
.brand { font-size: 1.15rem; font-weight: 800; white-space: nowrap; letter-spacing: -.01em; }
.screen-title { font-weight: 800; font-size: 1.05rem; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.iconbtn {
    width: 40px; height: 40px; border-radius: 50%; border: 0; cursor: pointer; font-size: 1.15rem;
    display: grid; place-items: center; background: var(--surface-2); color: var(--text);
    box-shadow: 0 1px 3px rgba(0,0,0,.12); transition: transform .15s ease, background .15s;
}
.iconbtn:hover { transform: translateY(-1px); }
.iconbtn:active { transform: scale(.94); }
.iconbtn.back { font-size: 1.4rem; font-weight: 800; }
.coins {
    display: inline-flex; align-items: center; gap: .3rem; position: relative;
    background: var(--gold-soft); border: 2px solid var(--gold); border-radius: 999px;
    padding: .25rem .75rem; font-weight: 800; font-size: 1rem; white-space: nowrap; line-height: 1.2;
}
.coins.bump { animation: coinbump .5s cubic-bezier(.34,1.6,.5,1); }
@keyframes coinbump { 0% { transform: scale(1); } 40% { transform: scale(1.18); } 100% { transform: scale(1); } }
.coin-float {
    position: absolute; right: .3rem; top: -.2rem; font-weight: 800; color: var(--green-dark);
    pointer-events: none; animation: coinfloat 1.1s ease-out forwards; white-space: nowrap;
}
.night .coin-float { color: #8fe08c; }
@keyframes coinfloat { 0% { transform: translateY(0); opacity: 0; } 15% { opacity: 1; } 100% { transform: translateY(-28px); opacity: 0; } }

/* ---- tab-balk (onderaan) ---- */
.tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 25;
    display: grid; grid-template-columns: repeat(4, 1fr);
    padding: .3rem .5rem calc(.3rem + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--surface) 90%, transparent);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 -2px 14px rgba(60,90,40,.12);
}
.tab {
    border: 0; background: none; cursor: pointer; border-radius: 14px; padding: .35rem .2rem .3rem;
    display: grid; justify-items: center; gap: 1px; color: var(--muted); font-weight: 700; font-size: .7rem;
    transition: color .15s, background .15s, transform .15s;
}
.tab .tab-ico { font-size: 1.45rem; line-height: 1.2; transition: transform .2s cubic-bezier(.34,1.6,.5,1); }
.tab[aria-current="page"] { color: var(--primary-dark); background: var(--primary-tint); }
.tab[aria-current="page"] .tab-ico { transform: translateY(-2px) scale(1.12); }
.tab:active .tab-ico { transform: scale(.9); }
.night .tab[aria-current="page"] { color: #ffb27a; }
body.in-game .tabbar { display: none; }

/* ---- hoofdinhoud ---- */
main {
    max-width: 920px; margin: 0 auto; padding: .9rem .9rem calc(var(--tab-h) + env(safe-area-inset-bottom) + 1rem);
}
body.in-game main { padding-bottom: 1.2rem; }
.screen { display: grid; gap: .9rem; animation: screenin .25s ease-out; }
@keyframes screenin { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.card {
    background: var(--surface); border-radius: var(--radius); padding: 1rem 1.1rem;
    box-shadow: var(--shadow);
}
.card.tight { padding: .6rem; }

/* knoppen */
.btn {
    font: inherit; font-weight: 800; border: 0; border-radius: 14px; cursor: pointer;
    padding: .65rem 1.1rem; background: var(--surface-3); color: var(--text);
    transition: transform .12s ease, filter .12s ease, box-shadow .12s ease;
    display: inline-flex; align-items: center; justify-content: center; gap: .4rem; line-height: 1.2;
}
.btn:hover { filter: brightness(1.04); }
.btn:active { transform: translateY(1px) scale(.98); }
.btn.big {
    font-size: 1.15rem; padding: .85rem 1.5rem; background: var(--green); color: #fff;
    box-shadow: 0 4px 0 var(--green-dark);
}
.btn.big:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--green-dark); }
.btn.big:disabled { filter: grayscale(.7); opacity: .7; box-shadow: none; }
.btn.primary { background: var(--primary); color: #fff; box-shadow: 0 4px 0 var(--primary-dark); }
.btn.primary:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--primary-dark); }
.btn.ghost { background: transparent; border: 2px solid var(--line); }
.btn.danger { background: var(--pink-soft); color: var(--pink-dark); }
.btn.sm { font-size: .85rem; padding: .45rem .8rem; border-radius: 11px; }
.btn.block { width: 100%; }

/* ---- Stal (home) ---- */
.hero {
    position: relative; overflow: hidden; padding: 0;
    background: linear-gradient(180deg, var(--sky-mid) 0%, #e6f6ff 40%, #cdeeb0 66%, #a9df8f 100%);
}
.night .hero { background: linear-gradient(180deg, #1a2a4d 0%, #203658 42%, #244a35 66%, #1d3f2c 100%); }
.hero-scene { position: relative; height: 250px; display: flex; align-items: flex-end; justify-content: center; }
.hero-scene::after {
    content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 34px; z-index: 0;
    background:
        repeating-linear-gradient(90deg, rgba(255,255,255,.06) 0 16px, rgba(33,80,30,.05) 16px 32px),
        linear-gradient(180deg, #9ed47a, #86c563);
    box-shadow: inset 0 3px 5px -3px rgba(33,80,30,.4);
}
.night .hero-scene::after { background: linear-gradient(180deg, #3d7a4a, #2f6338); }
.hero-scene .horse-svg { position: relative; z-index: 1; width: min(300px, 78%); height: auto; margin-bottom: 10px; }
.hero-sun {
    position: absolute; top: 18px; right: 26px; width: 54px; height: 54px; border-radius: 50%;
    background: radial-gradient(circle, #fff7cc 0 42%, #ffe98f 60%, rgba(255,233,143,0) 72%);
    box-shadow: 0 0 36px 14px rgba(255,236,150,.45);
}
.night .hero-sun { background: radial-gradient(circle at 40% 40%, #fffbe6 0 44%, #e9e4c8 60%, transparent 72%); box-shadow: 0 0 30px 10px rgba(230,230,255,.2); }
.bubble {
    position: absolute; top: 16px; left: 16px; z-index: 2; max-width: 62%;
    background: var(--surface-2); color: var(--text); border-radius: 16px; border-bottom-left-radius: 4px;
    padding: .5rem .75rem; font-weight: 700; font-size: .9rem; box-shadow: var(--shadow);
    animation: bubblein .4s cubic-bezier(.34,1.5,.5,1);
}
.bubble::after {
    content: ''; position: absolute; left: 14px; bottom: -8px; border: 8px solid transparent;
    border-top-color: var(--surface-2); border-bottom: 0; border-left: 0;
}
@keyframes bubblein { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.hero-body { padding: .9rem 1.1rem 1.1rem; background: var(--surface); display: grid; gap: .7rem; }
.hero-title { margin: 0; font-size: 1.5rem; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.hero-title small { font-size: .85rem; color: var(--muted); font-weight: 700; }
.hero-actions { display: flex; gap: .6rem; flex-wrap: wrap; }
.hero-actions .btn { flex: 1; }

.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; }
.stat {
    background: var(--surface); border-radius: var(--radius-s); padding: .7rem .5rem; text-align: center;
    box-shadow: var(--shadow); display: grid; gap: 2px;
}
.stat b { font-size: 1.3rem; }
.stat span { font-size: .72rem; color: var(--muted); font-weight: 700; }

.nudge { display: flex; align-items: center; gap: .8rem; }
.nudge .nudge-ico { font-size: 2rem; }
.nudge .nudge-text { flex: 1; min-width: 0; }
.nudge .nudge-text b { display: block; }
.nudge .nudge-text span { font-size: .85rem; color: var(--muted); }

.progress { display: block; height: 10px; background: var(--surface-3); border-radius: 999px; overflow: hidden; box-shadow: inset 0 1px 2px rgba(0,0,0,.1); }
.progress > i { display: block; height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, var(--gold), var(--primary)); transition: width .4s ease; }

/* ---- Spelen (hub) ---- */
.game-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .75rem; }
@media (min-width: 640px) { .game-grid { grid-template-columns: repeat(3, 1fr); } }
.gcard {
    position: relative; text-align: left; border: 0; cursor: pointer; padding: .9rem .9rem .8rem;
    border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow);
    display: grid; gap: .35rem; align-content: start; overflow: hidden;
    transition: transform .18s cubic-bezier(.34,1.5,.5,1), box-shadow .18s;
}
.gcard:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.gcard:active { transform: scale(.97); }
.gcard::before {
    content: ''; position: absolute; top: -40px; right: -40px; width: 120px; height: 120px; border-radius: 50%;
    background: var(--tint); opacity: .9;
}
.gcard .gico {
    position: relative; width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center;
    font-size: 1.8rem; background: var(--tint); margin-bottom: .2rem;
}
.gcard .gtitle { font-weight: 800; font-size: 1.05rem; position: relative; }
.gcard .gdesc { font-size: .8rem; color: var(--muted); position: relative; }
.gcard .gmeta { display: flex; justify-content: space-between; align-items: center; gap: .4rem; font-size: .74rem; font-weight: 700; margin-top: .2rem; position: relative; }
.gcard .gbest { color: var(--muted); }
.gcard .gcoin { background: var(--gold-soft); border-radius: 999px; padding: 1px 7px; }
.gcard.new::after {
    content: 'NIEUW'; position: absolute; top: 10px; right: -26px; transform: rotate(40deg);
    background: var(--pink); color: #fff; font-size: .6rem; font-weight: 800; padding: 2px 30px; letter-spacing: .05em;
}

/* ---- Prijzen ---- */
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: .6rem; }
.badge {
    display: grid; justify-items: center; gap: .15rem; text-align: center; padding: .6rem .3rem;
    border-radius: var(--radius-s); background: var(--surface-3); font-size: .68rem; font-weight: 700; line-height: 1.15;
}
.badge .bico { font-size: 1.8rem; filter: grayscale(1); opacity: .35; }
.badge.earned { background: var(--gold-soft); box-shadow: inset 0 0 0 2px var(--gold); }
.badge.earned .bico { filter: none; opacity: 1; animation: medalpop .6s cubic-bezier(.34, 1.7, .5, 1); }
.badge .bname { color: var(--text); }
.badge .bhow { color: var(--muted); font-weight: 600; }
.unlock-list { display: grid; gap: .55rem; }
.unlock {
    display: grid; grid-template-columns: 44px 1fr auto; gap: .6rem; align-items: center;
    padding: .55rem .7rem; border-radius: var(--radius-s); background: var(--surface-3); cursor: pointer; border: 0; text-align: left;
}
.unlock .uico { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-size: 1.3rem; background: var(--surface-2); box-shadow: inset 0 0 0 2px var(--line); }
.unlock .uico.sw { box-shadow: inset 0 0 0 2px rgba(0,0,0,.1); }
.unlock .utext { min-width: 0; display: grid; gap: .25rem; }
.unlock .utext b { font-size: .92rem; }
.unlock .utext span { font-size: .74rem; color: var(--muted); }
.unlock .uprice { font-size: .8rem; font-weight: 800; background: var(--gold-soft); border-radius: 999px; padding: 2px 8px; white-space: nowrap; }
.unlock.ready { box-shadow: inset 0 0 0 2px var(--green); }
.unlock.ready .uprice { background: var(--green-soft); color: var(--green-dark); }

/* ---- Stylen (editor) ---- */
.editor-grid { display: grid; gap: .9rem; }
@media (min-width: 820px) {
    .editor-grid { grid-template-columns: 380px 1fr; align-items: start; }
    .preview-card { position: sticky; top: calc(var(--header-h) + 12px); }
}
.preview-card { padding: .5rem; }
@media (max-width: 819px) {
    .preview-card { position: sticky; top: calc(var(--header-h) + 6px); z-index: 6; }
}
.preview {
    position: relative; display: flex; justify-content: center; align-items: flex-end;
    height: 300px; overflow: hidden; border-radius: var(--radius-s); padding-bottom: 6px;
    background:
        radial-gradient(circle at 80% 18%, rgba(255,247,200,.85) 0 7%, rgba(255,243,180,0) 22%),
        linear-gradient(180deg, #cdeaff 0%, #e6f6ff 45%, #cdeeb0 68%, #a9df8f 100%);
}
.night .preview { background: radial-gradient(circle at 80% 18%, rgba(255,251,230,.6) 0 5%, transparent 16%), linear-gradient(180deg, #1a2a4d 0%, #203658 45%, #244a35 68%, #1d3f2c 100%); }
@media (max-width: 819px) { .preview { height: 200px; } }
.preview::after {
    content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 30px; z-index: 0;
    background:
        repeating-linear-gradient(90deg, rgba(255,255,255,.06) 0 16px, rgba(33,80,30,.05) 16px 32px),
        linear-gradient(180deg, #9ed47a, #86c563);
    box-shadow: inset 0 3px 5px -3px rgba(33,80,30,.4);
}
.night .preview::after { background: linear-gradient(180deg, #3d7a4a, #2f6338); }
.preview svg { position: relative; z-index: 1; max-width: 100%; height: auto; transition: width .2s ease; }
@media (max-width: 819px) { .preview svg { max-height: 185px; width: auto !important; } }
.preview-name {
    position: absolute; top: 10px; left: 10px; z-index: 2; background: var(--surface-2); color: var(--text);
    border-radius: 999px; padding: .25rem .7rem; font-weight: 800; font-size: .9rem; box-shadow: var(--shadow); max-width: 70%;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.preview-hint { position: absolute; top: 10px; right: 10px; z-index: 2; font-size: .72rem; font-weight: 700; color: var(--muted); background: var(--surface-2); border-radius: 999px; padding: .2rem .55rem; }

.chips {
    display: flex; gap: .4rem; overflow-x: auto; scrollbar-width: none; padding: .15rem .1rem .35rem;
    scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
    flex: 0 0 auto; scroll-snap-align: start; border: 2px solid transparent; cursor: pointer; white-space: nowrap;
    background: var(--surface); border-radius: 999px; padding: .45rem .85rem; font-weight: 800; font-size: .86rem;
    box-shadow: var(--shadow); transition: transform .15s, background .15s;
}
.chip:active { transform: scale(.96); }
.chip[aria-selected="true"] { background: var(--primary); color: #fff; box-shadow: 0 3px 0 var(--primary-dark); }
.chip .cnt { font-size: .7rem; opacity: .75; margin-left: .25rem; }

.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; margin-bottom: .7rem; }
.section-head h3 { margin: 0; font-size: 1.05rem; }
.section-head .muted { font-size: .78rem; }
.opts { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: .6rem; }
.opts.swatches { grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); }
.opt {
    position: relative; font: inherit; font-size: .84rem; font-weight: 700; cursor: pointer; min-height: 58px;
    border: 2px solid var(--line); background: var(--surface-2); border-radius: var(--radius-xs); padding: .5rem .4rem;
    display: grid; place-items: center; gap: .2rem; text-align: center; line-height: 1.2;
    transition: transform .15s cubic-bezier(.34,1.5,.5,1), border-color .15s, box-shadow .15s;
}
.opt:active { transform: scale(.95); }
.opt.sel { border-color: var(--primary); box-shadow: var(--ring); }
.opt.sel::after { content: '✓'; position: absolute; top: -8px; right: -8px; width: 22px; height: 22px; border-radius: 50%; background: var(--primary); color: #fff; font-size: .75rem; font-weight: 800; display: grid; place-items: center; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.opt.swatch { aspect-ratio: 1; min-height: 0; border-radius: 50%; padding: 0; border-width: 3px; border-color: rgba(0,0,0,.08); box-shadow: inset 0 -6px 10px rgba(0,0,0,.12), inset 0 4px 8px rgba(255,255,255,.35); }
.opt.swatch.sel { border-color: var(--primary); box-shadow: var(--ring), inset 0 -6px 10px rgba(0,0,0,.12); }
.opt .lock { font-size: 1.05rem; filter: drop-shadow(0 0 2px #fff); }
.opt .price {
    position: absolute; bottom: -9px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--gold);
    font-size: .64rem; font-weight: 800; border-radius: 999px; padding: 1.5px 7px; white-space: nowrap;
}
.night .opt .price { background: #0f1520; }
.opt.locked:not(.gated) { border-style: solid; }
.opt.gated { opacity: .6; border-style: dashed; }
.opt .price.req { background: var(--purple-dark); color: #fff; }
.opt.affordable .price { background: var(--green-dark); color: #fff; }
.opt.arming { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }

.basis { display: grid; gap: .9rem; }
.namerow { display: flex; align-items: center; gap: .6rem; }
.namerow label, .sizerow { font-weight: 800; font-size: .9rem; }
#horse-name {
    flex: 1; font: inherit; font-weight: 800; font-size: 1.05rem; padding: .5rem .8rem;
    border: 2px solid var(--line); border-radius: 12px; background: var(--surface-2); color: var(--text); min-width: 0;
}
#horse-name:focus { border-color: var(--primary); outline: none; box-shadow: var(--ring); }
.sizerow { display: flex; align-items: center; gap: .7rem; }
.sizerow input { flex: 1; accent-color: var(--primary); }
.basis-actions { display: flex; gap: .6rem; flex-wrap: wrap; }
.basis-actions .btn { flex: 1; }

/* ---- spelschermen (gezamenlijk) ---- */
.game-top { display: grid; gap: .6rem; }
.game-stats { font-size: .86rem; font-weight: 700; color: var(--muted); }
.howto { border-radius: var(--radius-s); background: var(--surface-3); padding: .1rem .8rem; }
.howto summary { cursor: pointer; font-weight: 800; font-size: .9rem; padding: .5rem 0; list-style: none; display: flex; align-items: center; gap: .4rem; }
.howto summary::-webkit-details-marker { display: none; }
.howto summary::after { content: '▾'; margin-left: auto; transition: transform .2s; color: var(--muted); }
.howto[open] summary::after { transform: rotate(180deg); }
.howto p { margin: 0 0 .7rem; font-size: .88rem; }
.keys { font-size: .74rem; color: var(--muted); }
.diffrow { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.diff {
    font: inherit; cursor: pointer; border: 2px solid var(--line); background: var(--surface);
    border-radius: var(--radius-s); padding: .5rem .6rem; display: grid; gap: 2px; text-align: left;
    transition: transform .15s, border-color .15s;
}
.diff:active { transform: scale(.97); }
.diff.sel { border-color: var(--primary); box-shadow: var(--ring); background: var(--primary-tint); }
.diff-label { font-weight: 800; font-size: .9rem; }
.diff-desc { font-size: .72rem; color: var(--muted); }
.arena-card { position: relative; }
.arena-start {
    position: absolute; inset: .6rem; z-index: 5; display: grid; place-items: center; border-radius: 14px;
    background: linear-gradient(180deg, rgba(255,255,255,.1), rgba(255,255,255,.35));
    transition: opacity .25s;
}
.arena-start:has(.btn:disabled) { opacity: 0; pointer-events: none; }
.arena-start .btn.big { font-size: 1.3rem; padding: 1rem 1.8rem; box-shadow: 0 5px 0 var(--green-dark), 0 10px 30px rgba(0,0,0,.2); animation: startpulse 1.8s ease-in-out infinite; }
@keyframes startpulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.04); } }
.results-inner { display: grid; gap: .3rem; justify-items: center; }
.results-inner h2 { margin: .1rem 0; font-size: 1.5rem; }
.results-inner .muted { margin: 0; font-size: .9rem; }
.results-medal {
    font-size: 3.6rem; position: relative; display: inline-block;
    animation: medalpop .6s cubic-bezier(.34, 1.7, .5, 1);
}
.results-medal::before {
    content: ''; position: absolute; inset: -34px; z-index: -1; border-radius: 50%;
    background: repeating-conic-gradient(rgba(255,205,80,.4) 0 14deg, rgba(255,205,80,0) 14deg 28deg);
    -webkit-mask: radial-gradient(circle, #000 18%, transparent 68%);
    mask: radial-gradient(circle, #000 18%, transparent 68%);
    animation: medalrays 18s linear infinite;
}
@keyframes medalrays { to { transform: rotate(360deg); } }
@keyframes medalpop {
    0% { transform: scale(.2) rotate(-15deg); opacity: 0; }
    60% { transform: scale(1.15) rotate(4deg); opacity: 1; }
    100% { transform: scale(1) rotate(0); }
}
.results-reward { font-size: 1.3rem; font-weight: 800; margin: .3rem 0 .8rem; }
.results-btns { display: flex; gap: .6rem; justify-content: center; flex-wrap: wrap; }
.tapbtn {
    position: sticky; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 10; width: 100%; padding: 1.2rem;
    font: inherit; font-size: 1.35rem; font-weight: 800; color: #fff; border: 0;
    border-radius: 18px; cursor: pointer; touch-action: none; user-select: none; -webkit-user-select: none;
}
.tapbtn:disabled { filter: grayscale(.8); opacity: .6; cursor: default; }

/* ---- sheet (onderste paneel / modaal) ---- */
.sheet { position: fixed; inset: 0; z-index: 40; display: grid; align-items: end; justify-items: center; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(20, 30, 20, .45); animation: fadein .2s; }
@keyframes fadein { from { opacity: 0; } }
.sheet-panel {
    position: relative; width: 100%; max-width: 520px; max-height: 88vh; overflow: auto;
    background: var(--surface); border-radius: 24px 24px 0 0; padding: .6rem 1.1rem calc(1.1rem + env(safe-area-inset-bottom));
    box-shadow: var(--shadow-lg); animation: sheetup .3s cubic-bezier(.34,1.3,.5,1);
}
@keyframes sheetup { from { transform: translateY(40px); opacity: 0; } }
@media (min-width: 640px) {
    .sheet { align-items: center; }
    .sheet-panel { border-radius: 24px; animation: sheetpop .25s cubic-bezier(.34,1.5,.5,1); }
    @keyframes sheetpop { from { transform: scale(.9); opacity: 0; } }
}
.sheet-grip { width: 44px; height: 5px; border-radius: 999px; background: var(--line); margin: 0 auto .6rem; }
@media (min-width: 640px) { .sheet-grip { display: none; } }
.sheet-body { display: grid; gap: .7rem; justify-items: center; text-align: center; }
.sheet-body h2 { margin: 0; font-size: 1.3rem; }
.sheet-body p { margin: 0; }
.sheet-preview {
    width: 100%; height: 190px; border-radius: var(--radius-s); overflow: hidden; display: flex; align-items: flex-end; justify-content: center;
    background: linear-gradient(180deg, #cdeaff 0%, #e6f6ff 50%, #cdeeb0 72%, #a9df8f 100%);
}
.night .sheet-preview { background: linear-gradient(180deg, #1a2a4d 0%, #203658 50%, #244a35 72%, #1d3f2c 100%); }
.sheet-preview svg { height: 180px; width: auto; }
.sheet-btns { display: grid; gap: .5rem; width: 100%; }
.sheet-btns .btn { width: 100%; }
.pricebox { display: inline-flex; gap: .4rem; align-items: center; background: var(--gold-soft); border-radius: 999px; padding: .3rem .9rem; font-weight: 800; }
.steps { display: grid; gap: .55rem; text-align: left; width: 100%; }
.step { display: flex; gap: .7rem; align-items: center; background: var(--surface-3); border-radius: var(--radius-s); padding: .6rem .8rem; }
.step .sico { font-size: 1.6rem; }
.step b { display: block; }
.step span { font-size: .85rem; color: var(--muted); }

/* ---- toast & confetti ---- */
#toast {
    position: fixed; top: calc(var(--header-h) + 10px); left: 50%; transform: translateX(-50%) translateY(-20px);
    z-index: 45; background: var(--text); color: var(--surface); font-weight: 800; font-size: .92rem;
    padding: .6rem 1.1rem; border-radius: 999px; opacity: 0; pointer-events: none;
    transition: all .25s ease; max-width: 92vw; text-align: center; box-shadow: var(--shadow-lg);
}
.night #toast { background: #ffd9bd; color: #2f3b47; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.confetti {
    position: fixed; top: -14px; width: 10px; height: 14px; z-index: 50;
    border-radius: 2px; animation: confall linear forwards;
}
@keyframes confall { to { transform: translateY(105vh) rotate(540deg); } }

/* ---- drijvende wolken in de minispel-arena's ---- */
.bg-cloud {
    position: absolute; left: -60px; width: 46px; height: 16px; background: #fff; border-radius: 999px;
    opacity: .8; z-index: 0; pointer-events: none;
    box-shadow: 16px -8px 0 1px #fff, 34px 0 0 -3px #fff, 10px 5px 0 5px #fff;
    animation: arenadrift linear infinite;
}
@keyframes arenadrift { from { left: -60px; } to { left: 112%; } }
#jump-arena, #catch-arena { isolation: isolate; }
#jump-arena::before, #catch-arena::before {
    content: ''; position: absolute; top: 14px; right: 18px; width: 52px; height: 52px;
    border-radius: 50%; z-index: 0; pointer-events: none;
    background: radial-gradient(circle, #fff7cc 0 42%, rgba(255,233,143,0) 72%);
}
.bg-cloud.jc1 { top: 14%; animation-duration: 27s; }
.bg-cloud.jc2 { top: 32%; transform: scale(.72); opacity: .6; animation-duration: 36s; animation-delay: -14s; }
.bg-cloud.cc1 { top: 9%;  animation-duration: 31s; }
.bg-cloud.cc2 { top: 22%; transform: scale(.8); opacity: .65; animation-duration: 40s; animation-delay: -18s; }

/* ================= arena's ================= */
/* ---- race ---- */

.track-card { position: relative; padding: .6rem .8rem; }
#track {
    position: relative; border-radius: 12px; overflow: hidden;
    background:
        repeating-linear-gradient(90deg, rgba(255,255,255,.05) 0 32px, rgba(33,80,30,.05) 32px 64px),
        linear-gradient(180deg, #b3e08e, #9ed47a);
    box-shadow: inset 0 8px 14px -8px rgba(33,80,30,.35), inset 0 -6px 12px -8px rgba(33,80,30,.3);
}
/* houten hek langs de bovenrand van de baan */
#track::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 7px; z-index: 4;
    background: linear-gradient(180deg, #d6a570, #b97f4c);
    box-shadow: 0 1px 0 rgba(0,0,0,.18), 0 3px 5px -2px rgba(0,0,0,.25);
}
/* parallax: tijdens de race schuift de grond (en de struiken) voorbij */
#track.racing { animation: groundscroll .55s linear infinite; }
@keyframes groundscroll {
    from { background-position: 0 0, 0 0; }
    to   { background-position: -64px 0, 0 0; }
}
#track-deco { position: absolute; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
#track-deco .far, #track-deco .near {
    position: absolute; left: 0; right: 0; bottom: 0; background-repeat: repeat-x;
}
#track-deco .far { /* verre struiken — traag (diepte) */
    height: 24px;
    background-image:
        radial-gradient(14px 14px at 14px 26px, rgba(96,150,72,.5) 0 99%, transparent 100%),
        radial-gradient(20px 20px at 46px 28px, rgba(112,170,86,.45) 0 99%, transparent 100%);
    background-size: 80px 24px;
}
#track-deco .near { /* voorgrond-graspollen — snel */
    height: 12px; opacity: .85;
    background-image: radial-gradient(circle at 9px 13px, #5f9e44 0 6px, transparent 7px);
    background-size: 28px 12px;
}
#track.racing #track-deco .far  { animation: decofar  2.4s linear infinite; }
#track.racing #track-deco .near { animation: deconear 1.0s linear infinite; }
@keyframes decofar  { to { background-position-x: -80px; } }
@keyframes deconear { to { background-position-x: -28px; } }
.startline {
    position: absolute; top: 0; bottom: 0; left: 86px; z-index: 1;
    border-left: 3px dashed rgba(255,255,255,.8);
}
.start-label {
    position: absolute; top: -4px; left: 90px; font-size: .68rem; font-weight: bold;
    color: #fff; background: #6f9c54; border-radius: 6px; padding: 1px 6px;
}
.finishline {
    position: absolute; top: 0; bottom: 0; right: 14px; width: 12px;
    background: conic-gradient(#33414e 90deg, #fff 90deg 180deg, #33414e 180deg 270deg, #fff 270deg);
    background-size: 12px 12px; border-radius: 3px;
}
.finish-label { position: absolute; top: -8px; right: 4px; font-size: 1.3rem; }
.lane { position: relative; height: 66px; border-bottom: 2px dashed rgba(255,255,255,.55); overflow: hidden; }
.lane:last-child { border-bottom: 0; }
/* opstuivend stof bij galopperende paarden */
.horse-wrap.running::after {
    content: ''; position: absolute; left: 4px; bottom: 5px; width: 18px; height: 11px;
    border-radius: 50%; z-index: -1;
    background: radial-gradient(circle, rgba(180,150,110,.55), rgba(180,150,110,0) 70%);
    animation: dustpuff .42s ease-out infinite;
}
@keyframes dustpuff {
    0% { transform: scale(.3) translateX(0); opacity: .7; }
    100% { transform: scale(1.4) translateX(-18px); opacity: 0; }
}
.lane-name {
    position: absolute; top: 3px; left: 6px; z-index: 2; font-size: .72rem; font-weight: bold;
    background: rgba(255,255,255,.85); border-radius: 6px; padding: 0 .4rem;
}
.horse-wrap { position: absolute; left: 0; bottom: 2px; will-change: transform; }
.horse-wrap svg { height: 100%; width: auto; display: block; }
#countdown {
    position: absolute; inset: 0; z-index: 5; display: grid; place-items: center;
    font-size: 4.5rem; font-weight: bold; color: #ff8a3d; text-shadow: 0 3px 0 #fff;
}
#results {
    position: absolute; inset: 0; z-index: 6; display: grid; place-items: center;
    background: var(--overlay); border-radius: 18px; text-align: center;
}


#tapzone { background: linear-gradient(180deg, #ffb35c, #ff8a3d); box-shadow: 0 6px 0 #d96f2a; }
#tapzone:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 3px 0 #d96f2a; }
#tapzone.pulse { animation: tappulse .18s ease-out; }
@keyframes tappulse { 0% { transform: scale(1); } 40% { transform: scale(.96); } 100% { transform: scale(1); } }

/* ---- paard-animaties ---- */
.horse-svg .leg { transform-box: fill-box; transform-origin: 50% 6%; }
.running .leg-f1, .running .leg-b2 { animation: gal .38s infinite ease-in-out; }
.running .leg-f2, .running .leg-b1 { animation: galB .38s infinite ease-in-out; }
@keyframes gal  { 0%,100% { transform: rotate(-24deg); } 50% { transform: rotate(20deg); } }
@keyframes galB { 0%,100% { transform: rotate(20deg); } 50% { transform: rotate(-24deg); } }
.running .horse-inner { animation: bob .38s infinite; }
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
/* kop knikt apart mee op de galop — scharniert op de onderkant van de nek */
.horse-svg .head-g { transform-box: fill-box; transform-origin: 20% 94%; }
.running .head-g { animation: headnod .38s infinite ease-in-out; }
@keyframes headnod { 0%,100% { transform: rotate(-1.5deg); } 50% { transform: rotate(2deg); } }
/* idle-leven: knipperende ogen en een oor dat af en toe flikt */
.horse-svg .eye-g { transform-box: fill-box; transform-origin: 50% 50%; animation: blink 4.6s infinite; }
@keyframes blink {
    0%, 91%, 100% { transform: scaleY(1); }
    94%, 96% { transform: scaleY(.08); }
}
.horse-svg .ear-g { transform-box: fill-box; transform-origin: 45% 92%; animation: eartwitch 5.4s infinite; }
@keyframes eartwitch {
    0%, 56%, 66%, 100% { transform: rotate(0); }
    59% { transform: rotate(-15deg); }
    63% { transform: rotate(8deg); }
}
.horse-svg .tail-g {
    transform-box: fill-box; transform-origin: 90% 10%;
    animation: wag 2.4s infinite ease-in-out;
}
@keyframes wag { 0%,100% { transform: rotate(0deg); } 50% { transform: rotate(8deg); } }
.sparkle { animation: twinkle 1.5s infinite; }
@keyframes twinkle { 0%,100% { opacity: 1; } 50% { opacity: .15; } }
.floaty { transform-box: fill-box; transform-origin: 50% 50%; animation: floaty 2.8s infinite ease-in-out; }
@keyframes floaty { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
.horse-svg .wing-g { transform-box: fill-box; transform-origin: 95% 80%; animation: flap 1.6s infinite ease-in-out; }
@keyframes flap { 0%,100% { transform: rotate(0deg); } 50% { transform: rotate(-7deg); } }

/* ---- sprongparcours ---- */

.jump-card { padding: .6rem; position: relative; }
#jump-arena {
    position: relative; height: 280px; overflow: hidden; border-radius: 14px;
    background: linear-gradient(180deg, #cdeeff 0%, #e7f8ff 55%, #bfe9a8 55%, #a9df8f 100%);
    border: 2px solid var(--arena-line, #b5d9a0);
}
#jump-arena::after {
    content: ''; position: absolute; left: 0; right: 0; bottom: 26px; height: 3px;
    background: repeating-linear-gradient(90deg, #6f9c54 0 14px, #8fbf6e 14px 28px);
}
#jump-horse {
    position: absolute; left: 30px; bottom: 26px; width: 122px; z-index: 3;
    will-change: transform;
}
#jump-horse svg { width: 122px; height: auto; display: block; transition: transform .12s ease; transform-origin: 50% 100%; }
#jump-horse.duck svg { transform: scaleY(.58) scaleX(1.06); }
#jump-horse .horse-shadow { display: none; }  /* losse grondschaduw i.p.v. de meespringende */
#jump-shadow {
    position: absolute; left: 91px; bottom: 22px; width: 84px; height: 15px; z-index: 1;
    border-radius: 50%; background: rgba(50,40,30,.3); transform: translateX(-50%);
}
#jump-obs { position: absolute; inset: 0; z-index: 2; }
.obstacle {
    position: absolute; bottom: 26px; border-radius: 7px 7px 0 0;
    background: var(--oc); box-shadow: inset 0 0 0 3px rgba(0,0,0,.14);
    display: flex; align-items: flex-start; justify-content: center;
    background-image: repeating-linear-gradient(45deg, rgba(255,255,255,.22) 0 7px, transparent 7px 14px);
}
.obstacle span { font-size: 1.25rem; margin-top: -20px; filter: drop-shadow(0 1px 1px rgba(0,0,0,.2)); }
.obstacle.air { border-radius: 999px; align-items: center; box-shadow: inset 0 0 0 3px rgba(255,255,255,.3); }
.obstacle.air span { margin-top: 0; }
#jump-score {
    position: absolute; top: 8px; left: 50%; transform: translateX(-50%); z-index: 4;
    font-size: 2.4rem; font-weight: bold; color: #33414e; text-shadow: 0 2px 0 #fff;
}
#jump-over {
    position: absolute; inset: 0; z-index: 6; display: grid; place-items: center;
    background: var(--overlay); border-radius: 14px; text-align: center;
    overflow: auto; padding: 1rem .8rem 1.2rem;
}
#jump-over 
#jump-over h2 { margin: .1rem 0 .3rem; }
#jump-over 
.tap-row { position: sticky; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 10; display: flex; gap: .6rem; }
#jump-tap, #jump-duck, #rhythm-tap { flex: 1; min-width: 0; background: linear-gradient(180deg, #7cc4ff, #4f9be8); box-shadow: 0 6px 0 #3577bd; }
#jump-duck { background: linear-gradient(180deg, #9ccc65, #6fa84f); box-shadow: 0 6px 0 #557f3c; }
#rhythm-tap { background: linear-gradient(180deg, #ff8fb6, #f25d93); box-shadow: 0 6px 0 #c2487f; }
#jump-tap:disabled, #jump-duck:disabled, #rhythm-tap:disabled, #tapzone:disabled { box-shadow: 0 6px 0 #9aa0a8; }
/* indruk-effect bij muis/vinger — anders voelt de knop stroef */
#jump-tap:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 3px 0 #3577bd; }
#jump-duck:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 3px 0 #557f3c; }
#rhythm-tap:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 3px 0 #c2487f; }
#rhythm-tap.pulse { animation: tappulse .18s ease-out; }

/* ---- wortels vangen ---- */

.catch-card { padding: .6rem; }
#catch-arena {
    position: relative; height: 380px; overflow: hidden; border-radius: 14px;
    background: linear-gradient(180deg, #bfe7ff 0%, #e7f8ff 60%, #bfe9a8 60%, #a9df8f 100%);
    border: 2px solid var(--arena-line, #b5d9a0); touch-action: none; cursor: grab;
}
#catch-hud {
    position: absolute; top: 8px; left: 12px; right: 12px; z-index: 4;
    display: flex; justify-content: space-between; pointer-events: none;
    font-size: 1.4rem; font-weight: bold; text-shadow: 0 2px 0 #fff;
}
#catch-horse {
    position: absolute; bottom: 6px; left: 0; width: 120px; z-index: 2;
    will-change: transform; pointer-events: none;
}
#catch-horse svg { width: 100%; height: auto; display: block; }
#catch-horse.ouch { animation: ouch .45s; }
@keyframes ouch {
    0%, 100% { filter: none; }
    35% { filter: brightness(1.5) saturate(.4) drop-shadow(0 0 8px #ff5e5e); }
}
.citem {
    position: absolute; left: 0; top: 0; z-index: 1; font-size: 2.1rem;
    will-change: transform; pointer-events: none;
    filter: drop-shadow(0 2px 2px rgba(0,0,0,.18));
}
.cpop {
    position: absolute; z-index: 3; font-weight: bold; font-size: 1.15rem;
    color: #33414e; text-shadow: 0 1px 0 #fff; pointer-events: none;
    animation: cpop .6s ease-out forwards;
}
@keyframes cpop {
    0% { transform: translateY(0) scale(.7); opacity: 1; }
    100% { transform: translateY(-34px) scale(1.25); opacity: 0; }
}
#catch-over {
    position: absolute; inset: 0; z-index: 6; display: grid; place-items: center;
    background: var(--overlay); border-radius: 14px; text-align: center; padding: 1rem;
}

/* ---- dressuur (ritme) ---- */

.rhythm-card { padding: .8rem; position: relative; }
#rhythm-stage {
    position: relative; height: 200px; border-radius: 14px; overflow: hidden;
    background: linear-gradient(180deg, #ffeaf4 0%, #fff6fa 58%, #e8d9b8 58%, #ddc89e 100%);
    border: 2px solid #ecc9da;
}
/* spotlights + vlaggetjeslijn maken van de piste een echte show */
#rhythm-stage::before {
    content: ''; position: absolute; inset: 0; z-index: 0; pointer-events: none;
    background:
        conic-gradient(from 208deg at 15% -8%, transparent 0 10deg, rgba(255,255,255,.5) 10deg 30deg, transparent 30deg),
        conic-gradient(from 122deg at 85% -8%, transparent 0 10deg, rgba(255,255,255,.5) 10deg 30deg, transparent 30deg);
    animation: beamglow 3.4s ease-in-out infinite;
}
@keyframes beamglow { 0%, 100% { opacity: .5; } 50% { opacity: 1; } }
#rhythm-stage::after {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 16px; z-index: 2; pointer-events: none;
    background:
        conic-gradient(from 330deg at 50% 100%, #ff8fb6 0 60deg, transparent 60deg) 0 3px / 30px 13px repeat-x,
        conic-gradient(from 330deg at 50% 100%, #7cc4ff 0 60deg, transparent 60deg) 15px 3px / 30px 13px repeat-x,
        linear-gradient(180deg, #c2487f 0 3px, transparent 3px);
}
#rhythm-horse { position: absolute; left: 50%; bottom: 6px; transform: translateX(-50%); width: 185px; }
#rhythm-horse svg { width: 100%; height: auto; display: block; }
#rhythm-horse.step { animation: rstep .32s ease-out; }
@keyframes rstep {
    0%, 100% { transform: translateX(-50%) translateY(0) rotate(0); }
    40% { transform: translateX(-50%) translateY(-16px) rotate(-4deg); }
}
#rhythm-judge {
    position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 3;
    font-size: 1.5rem; font-weight: bold; text-shadow: 0 2px 0 #fff;
    animation: judgepop .5s ease-out;
}
@keyframes judgepop {
    0% { transform: translateX(-50%) scale(.6); opacity: .4; }
    35% { transform: translateX(-50%) scale(1.15); opacity: 1; }
}
#rhythm-combo { position: absolute; top: 10px; right: 12px; z-index: 3; font-weight: bold; color: #c2487f; }
#rhythm-track {
    position: relative; height: 74px; margin-top: .7rem; border-radius: 999px; overflow: hidden;
    background: linear-gradient(180deg, #fff, #f4eee0); border: 2px solid #e0d2b4;
}
#rhythm-target {
    position: absolute; top: 50%; left: 56px; width: 52px; height: 52px;
    transform: translate(-50%, -50%); border: 4px dashed #ff8a3d; border-radius: 50%; z-index: 1;
}
#rhythm-target.hitflash { animation: tflash .3s; }
@keyframes tflash {
    0% { box-shadow: 0 0 0 0 rgba(255,138,61,.7); }
    100% { box-shadow: 0 0 0 18px rgba(255,138,61,0); }
}
.rnote {
    position: absolute; top: 50%; left: 0; margin-top: -17px; font-size: 1.7rem;
    will-change: transform; z-index: 2;
}
.rnote.missed { opacity: .25; }
#rhythm-over {
    position: absolute; inset: 0; z-index: 6; display: grid; place-items: center;
    background: var(--overlay); border-radius: 18px; text-align: center; padding: 1rem;
}

/* ---- memory ---- */

.memory-card { padding: .8rem; position: relative; }
#memory-info { font-weight: 800; text-align: center; margin-bottom: .6rem; }
#memory-grid {
    display: grid; gap: .5rem; grid-template-columns: repeat(var(--cols, 4), 1fr);
    max-width: 520px; margin: 0 auto;
}
.mcard { aspect-ratio: 3 / 4; perspective: 600px; border: 0; background: none; padding: 0; cursor: pointer; font: inherit; }
.mcard-in {
    position: relative; display: block; width: 100%; height: 100%;
    transform-style: preserve-3d; transition: transform .35s;
}
.mcard.open .mcard-in, .mcard.matched .mcard-in { transform: rotateY(180deg); }
.mface {
    position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden;
    border-radius: 12px; display: grid; place-items: center;
    font-size: clamp(1.5rem, 6.5vw, 2.3rem);
}
.mface.back {
    background:
        radial-gradient(rgba(255,255,255,.3) 2.5px, transparent 3px) 0 0 / 16px 16px,
        linear-gradient(135deg, #ffb35c, #ff8a3d);
    color: #fff;
    box-shadow: inset 0 0 0 3px rgba(255,255,255,.35);
}
.mcard:not(.open):not(.matched):hover .mcard-in { transform: rotateY(0) translateY(-4px); }
.mface.front { background: var(--surface-2); border: 2px solid #ffd9bd; transform: rotateY(180deg); }
.mcard.matched .mface.front { background: #f0fbe8; border-color: #8fbf6e; box-shadow: 0 0 0 3px #cdeab4; }
.mcard.matched { cursor: default; }
.mcard.matched .mcard-in { animation: matchpop .5s ease-out; }
@keyframes matchpop {
    0%, 100% { transform: rotateY(180deg) scale(1); }
    45% { transform: rotateY(180deg) scale(1.13) rotate(3deg); }
}
#memory-over {
    position: absolute; inset: 0; z-index: 6; display: grid; place-items: center;
    background: var(--overlay); border-radius: 18px; text-align: center; padding: 1rem;
}

/* ---- verzorgen ---- */

.care-card { padding: .8rem; }
#care-stage {
    position: relative; height: 300px; border-radius: 14px; overflow: hidden;
    background: linear-gradient(180deg, #f3e6cf 0%, #efe0c2 58%, #d8c39a 58%, #c9b184 100%);
    border: 2px solid #d8c39a; touch-action: none; cursor: grab;
    background-image:
        repeating-linear-gradient(90deg, rgba(120,90,50,.08) 0 2px, transparent 2px 26px);
}
#care-stage:active { cursor: grabbing; }
#care-stage::before { /* stalraam met warm zonlicht */
    content: ''; position: absolute; top: 16px; left: 18px; width: 58px; height: 46px; z-index: 0;
    border-radius: 6px; pointer-events: none;
    background:
        linear-gradient(90deg, transparent 0 27px, #a98652 27px 31px, transparent 31px),
        linear-gradient(180deg, transparent 0 21px, #a98652 21px 25px, transparent 25px),
        linear-gradient(160deg, #fff3c4, #ffe28a);
    box-shadow: 0 0 0 5px #a98652, 0 0 28px 10px rgba(255,236,150,.5);
}
#care-stage::after { /* stalvloer-rand */
    content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 42%;
    background: repeating-linear-gradient(0deg, rgba(120,90,50,.10) 0 3px, transparent 3px 22px);
    pointer-events: none;
}
#care-horse {
    position: absolute; left: 50%; bottom: 4px; transform: translateX(-50%);
    width: 270px; z-index: 1; pointer-events: none;
}
#care-horse svg { width: 100%; height: auto; display: block; }
#care-horse.chomp { animation: chomp .32s ease-out; }
@keyframes chomp { 0%,100% { transform: translateX(-50%) scale(1); } 45% { transform: translateX(-50%) scale(1.04,.96); } }
#care-horse.bounce { animation: carejoy .5s ease-out; }
@keyframes carejoy { 0%,100% { transform: translateX(-50%) translateY(0); } 35% { transform: translateX(-50%) translateY(-14px); } }
#care-overlay { position: absolute; inset: 0; z-index: 3; }
.dirt {
    position: absolute; width: 34px; height: 30px; z-index: 3; cursor: pointer;
    background:
        radial-gradient(circle at 35% 30%, #8a5a30 0 38%, transparent 40%),
        radial-gradient(circle at 70% 65%, #6e4523 0 34%, transparent 36%),
        radial-gradient(circle at 55% 45%, #7a4f29 0 60%, transparent 62%);
    filter: drop-shadow(0 1px 1px rgba(0,0,0,.25));
    touch-action: none;
}
.dirt { transition: opacity .12s, scale .12s; }
.dirt.pop { animation: dirtpop .3s ease-out forwards; pointer-events: none; }
.klit {
    position: absolute; z-index: 3; cursor: pointer; font-size: 1.5rem;
    filter: drop-shadow(0 1px 1px rgba(0,0,0,.3)); touch-action: none;
    transition: opacity .12s, scale .12s; user-select: none; -webkit-user-select: none;
}
.klit.pop { animation: dirtpop .3s ease-out forwards; pointer-events: none; }
.fly {
    position: absolute; z-index: 4; cursor: pointer; font-size: 1.3rem;
    animation: flybuzz .7s infinite; touch-action: none; user-select: none; -webkit-user-select: none;
    filter: drop-shadow(0 1px 1px rgba(0,0,0,.25));
}
@keyframes flybuzz {
    0%, 100% { transform: translate(0,0) rotate(0); }
    25% { transform: translate(3px,-4px) rotate(8deg); }
    50% { transform: translate(-3px,2px) rotate(-6deg); }
    75% { transform: translate(2px,3px) rotate(4deg); }
}
.fly.shoo { animation: flyshoo .5s ease-in forwards; pointer-events: none; }
@keyframes flyshoo { to { transform: translate(60px,-90px) scale(.4); opacity: 0; } }
#tool-row { display: flex; gap: .6rem; justify-content: center; margin-top: .9rem; }
.tool {
    font: inherit; font-size: 1.5rem; line-height: 1; cursor: pointer;
    display: grid; gap: 3px; justify-items: center;
    border: 2px solid var(--line); background: var(--surface-2); border-radius: 16px; padding: .5rem .9rem;
    box-shadow: 0 3px 0 var(--line);
}
.tool.sel { border-color: #ff8a3d; box-shadow: var(--ring), 0 3px 0 var(--line); }
.tool .tool-name { font-size: .62rem; font-weight: bold; color: var(--muted); }
@keyframes dirtpop { to { transform: scale(1.7) rotate(18deg); opacity: 0; } }
.care-spark {
    position: absolute; z-index: 4; font-size: 1.1rem; pointer-events: none;
    animation: carespark .7s ease-out forwards;
}
@keyframes carespark { 0% { transform: translateY(0) scale(.5); opacity: 1; }
    100% { transform: translateY(-26px) scale(1.2); opacity: 0; } }
#care-mood {
    position: absolute; top: 8px; left: 50%; transform: translateX(-50%); z-index: 4;
    font-size: 1.9rem; pointer-events: none; filter: drop-shadow(0 1px 2px rgba(0,0,0,.15));
}
.meters { display: grid; gap: .5rem; margin: .9rem .2rem .2rem; }
.meter { display: grid; grid-template-columns: 6.6rem 1fr; align-items: center; gap: .6rem; font-weight: 800; font-size: .86rem; }
.bar { height: 16px; background: var(--surface-3); border-radius: 999px; overflow: hidden; box-shadow: inset 0 1px 2px rgba(0,0,0,.12); }
.bar > i { display: block; height: 100%; width: 0; border-radius: 999px; transition: width .3s ease; }
#clean-fill { background: linear-gradient(90deg, #7cc4ff, #4f9be8); }
#food-fill  { background: linear-gradient(90deg, #ffd166, #ff9f43); }
#happy-fill { background: linear-gradient(90deg, #ff8fab, #ff5e8a); }
#food-row { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1rem; justify-content: center; }
.food {
    font: inherit; font-size: 1.8rem; line-height: 1; cursor: pointer;
    border: 2px solid var(--line); background: var(--surface-2); border-radius: 16px; padding: .5rem .7rem;
    box-shadow: 0 3px 0 var(--line);
}
.food:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--line); }
.food:disabled { filter: grayscale(.6); opacity: .55; cursor: default; box-shadow: none; }
.food .food-name { display: block; font-size: .62rem; font-weight: bold; color: var(--muted); margin-top: 2px; }
#care-done {
    position: absolute; inset: 0; z-index: 6; display: grid; place-items: center;
    background: var(--overlay); border-radius: 14px; text-align: center; padding: 1rem;
}
#care-done 
#care-hint { text-align: center; font-size: .8rem; color: var(--muted); margin-top: .7rem; min-height: 1.1rem; }


/* ================= nacht-aanpassingen arena's ================= */
.night { --arena-line: #3a4656; }
.night .track-card, .night .jump-card, .night .catch-card, .night .rhythm-card, .night .memory-card, .night .care-card { --arena-line: #3a4656; }
.night #rhythm-track { background: linear-gradient(180deg, #313c4c, #283240); border-color: #3a4656; }
.night .lane-name { background: rgba(31,39,51,.85); color: #eef2f7; }
.night .mface.front { border-color: #5a3a22; }
.night .mcard.matched .mface.front { background: #22402a; border-color: #51b54f; box-shadow: 0 0 0 3px #2e5a38; }
.night #memory-info, .night #care-hint { color: var(--text); }

/* ================= toegankelijkheid ================= */
@media (prefers-reduced-motion: reduce) {
    .scenery .cloud, .scenery .bird, .scenery .sun, .scenery .stars, .bg-cloud, .arena-start .btn.big,
    .results-medal::before, .screen { animation: none !important; }
    *, *::before, *::after { transition-duration: .01ms !important; }
}
@media (min-width: 820px) {
    main { padding-top: 1.2rem; }
    .tabbar { left: 50%; right: auto; transform: translateX(-50%); width: min(560px, 96vw); bottom: 14px; border-radius: 22px; padding: .35rem .5rem; box-shadow: var(--shadow-lg); }
    .tab { padding: .4rem .5rem .35rem; }
}

/* start-knop van Vangen staat ín de arena (die vangt pointer-events) */
#catch-arena .arena-start { inset: 0; }
/* smalle telefoons: compactere balk */
@media (max-width: 400px) {
    .brand { font-size: 1rem; }
    .iconbtn { width: 36px; height: 36px; font-size: 1rem; }
    .coins { padding: .2rem .55rem; font-size: .92rem; }
    .topbar { padding: 0 .5rem; }
}
/* feedback-knop boven de tab-balk houden */
.mf-fab { bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 14px) !important; }
.mf-panel { bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 74px) !important; max-width: calc(100vw - 40px); }
body.in-game .mf-fab { bottom: 20px !important; }
body.in-game .mf-panel { bottom: 80px !important; }
@media (min-width: 820px) { .preview-hint { display: none; } }
