/* Theme Park (id "themepark", premium): a British seaside-meets-big-park evening. A candyfloss pink and teal dusk over
   the sea, a big wheel turning behind the player, a huge wooden and steel coaster with a train riding it, a helter
   skelter, a carousel, stalls, bunting and warm bulbs. The app: painted fairground signs with chasing bulbs round the
   edge, stall-awning cards, ride-ticket tiles, a boardwalk bottom bar with bunting.
   The scene is SCENES.themepark in theme-themepark.js; its style items use the code "tp". */

:root {
  /* one bulb in each corner and two along each edge tile: the first of each pair lit in A, the second in B */
  --tp-bulbs-a: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Cg fill='%23fff0a8' stroke='%231b1033' stroke-width='.9'%3E%3Ccircle cx='5' cy='5' r='3.2'/%3E%3Ccircle cx='35' cy='5' r='3.2'/%3E%3Ccircle cx='5' cy='35' r='3.2'/%3E%3Ccircle cx='35' cy='35' r='3.2'/%3E%3Ccircle cx='15' cy='5' r='3.2'/%3E%3Ccircle cx='15' cy='35' r='3.2'/%3E%3Ccircle cx='5' cy='15' r='3.2'/%3E%3Ccircle cx='35' cy='15' r='3.2'/%3E%3C/g%3E%3Cg fill='%238a5a2a' stroke='%231b1033' stroke-width='.9'%3E%3Ccircle cx='25' cy='5' r='3.2'/%3E%3Ccircle cx='25' cy='35' r='3.2'/%3E%3Ccircle cx='5' cy='25' r='3.2'/%3E%3Ccircle cx='35' cy='25' r='3.2'/%3E%3C/g%3E%3C/svg%3E");
  --tp-bulbs-b: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Cg fill='%238a5a2a' stroke='%231b1033' stroke-width='.9'%3E%3Ccircle cx='15' cy='5' r='3.2'/%3E%3Ccircle cx='15' cy='35' r='3.2'/%3E%3Ccircle cx='5' cy='15' r='3.2'/%3E%3Ccircle cx='35' cy='15' r='3.2'/%3E%3C/g%3E%3Cg fill='%23fff0a8' stroke='%231b1033' stroke-width='.9'%3E%3Ccircle cx='25' cy='5' r='3.2'/%3E%3Ccircle cx='25' cy='35' r='3.2'/%3E%3Ccircle cx='5' cy='25' r='3.2'/%3E%3Ccircle cx='35' cy='25' r='3.2'/%3E%3C/g%3E%3C/svg%3E");
  --tp-awning: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 18'%3E%3Cpath d='M0 0h20v9q0 8-10 8T0 9z' fill='%23e5343f' stroke='%231b1033' stroke-width='1.3'/%3E%3Cpath d='M20 0h20v9q0 8-10 8T20 9z' fill='%23fff1d6' stroke='%231b1033' stroke-width='1.3'/%3E%3C/svg%3E");
  --tp-bunting: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 96 16'%3E%3Cpath d='M0 1.5H96' stroke='%231b1033' stroke-width='1.4'/%3E%3Cpath d='M3 2h18L12 15z' fill='%23e5343f' stroke='%231b1033' stroke-width='1.2' stroke-linejoin='round'/%3E%3Cpath d='M27 2h18l-9 13z' fill='%23fff1d6' stroke='%231b1033' stroke-width='1.2' stroke-linejoin='round'/%3E%3Cpath d='M51 2h18l-9 13z' fill='%2319b5a8' stroke='%231b1033' stroke-width='1.2' stroke-linejoin='round'/%3E%3Cpath d='M75 2h18l-9 13z' fill='%23ffc93d' stroke='%231b1033' stroke-width='1.2' stroke-linejoin='round'/%3E%3C/svg%3E");
  --tp-ticket: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 26'%3E%3Cpath d='M3 3h34v6a4 4 0 0 0 0 8v6H3v-6a4 4 0 0 0 0-8z' fill='%23ffc93d' stroke='%231b1033' stroke-width='1.8' stroke-linejoin='round'/%3E%3Cpath d='M12 5v16' stroke='%231b1033' stroke-width='1.2' stroke-dasharray='2 2'/%3E%3Cpath d='M26 7l1.8 3.8 4.2.5-3 2.8.8 4.1-3.8-2-3.8 2 .8-4.1-3-2.8 4.2-.5z' fill='%23e5343f' stroke='%231b1033' stroke-width='1'/%3E%3C/svg%3E");
}

/* ---- colours ---- */
[data-theme="themepark"] {
  --bg-0: #0e3a50; --bg-1: #124a62; --bg-2: #1a5f78;
  --card: rgba(16, 48, 72, .94); --card-2: rgba(255, 241, 214, .09); --panel-edge: rgba(255, 201, 61, .55);
  --ink: #fff6e6; --ink-dim: #ffd9e6; --on-hot: #ffffff;
  --hot: #e5343f; --cool: #12a69c; --amber: #ffb81f; --gold: #ffb81f; --good: #3fdc84; --bad: #ff6a6a; --seen: #8fe8e0;
  --title-1: #fff6e6; --title-2: #ffc93d;
  --mine: rgba(229, 52, 63, .28); --mine-edge: rgba(229, 52, 63, .6); --fact-bg: rgba(255, 201, 61, .13); --fact-edge: rgba(255, 201, 61, .45);
  --shadow: 0 8px 24px rgba(6, 20, 34, .5);
  --scrim: rgba(8, 26, 42, .62); --off: rgba(255, 241, 214, .22); --press: rgba(0, 0, 0, .3);
  /* fairground paint for the ticket tiles */
  --s-general: #d62d3a; --s-geography: #12908a; --s-history: #a8602c; --s-science: #2f6fd0;
  --s-nature: #3a9440; --s-music: #d24a8c; --s-film_tv: #7d48c0; --s-sport: #d18a12;
  --s-arts_lit: #5a52c8; --s-food: #dc6230; --s-tech_games: #1f7fb8; --s-words: #15907a;
  /* bottom-bar icon colours (look3d.js TAB_ICONS): signwriter's red, teal, candyfloss, gold, cream */
  --tb-blue-1: #9ff0e6; --tb-blue-2: #0f9a90; --tb-pink-1: #ffc4dd; --tb-pink-2: #e0558f; --tb-green-1: #9ff0e6; --tb-green-2: #12a08c;
  --tb-gold-1: #fff0a8; --tb-gold-2: #eda412; --tb-purple-1: #d9c8ff; --tb-purple-2: #7a4ac8; --tb-red-1: #ff9c9c; --tb-red-2: #d0202e;
  --tb-cream-1: #fffaf0; --tb-cream-2: #f0d8ae; --tb-orange-1: #ffc48a; --tb-orange-2: #e0793f; --tb-brown-1: #d08a5a; --tb-brown-2: #7c3f22;
}
[data-theme="themepark"] #splash { background: linear-gradient(#0f5a70, #3fb0ae 45%, #ff9ec7 80%, #ffc4a0); }

/* ---- the scene ---- */
[data-theme="themepark"] #stage-bg { background:
  linear-gradient(#0c3a52 0%, #0f5a70 16%, #1f8f96 34%, #63bdb4 48%, #f0a8c8 60%, #ff9ec7 66%, #ffc4a0 72%, #7c3a66 73%); }
.tp-scene { position: absolute; inset: 0; overflow: hidden; --b: calc(var(--tabh) + env(safe-area-inset-bottom)); }
.tp-scene svg { display: block; width: 100%; height: 100%; overflow: visible; }
.tp-stars { position: absolute; inset: 0; }
.tp-stars i { position: absolute; width: 2px; height: 2px; border-radius: 50%; background: #fff; scale: var(--s); box-shadow: 0 0 3px rgba(255, 255, 255, .8); animation: tp-twinkle 4s ease-in-out infinite; }
@keyframes tp-twinkle { 50% { opacity: .2; } }
.tp-sunglow { position: absolute; left: 50%; bottom: calc(var(--b) + 26%); width: 150vmax; height: 34vh; transform: translateX(-50%); background: radial-gradient(45% 50% at 50% 60%, rgba(255, 226, 180, .75), rgba(255, 170, 190, .3) 55%, transparent 75%); }
.tp-cloud { position: absolute; top: var(--y); left: 0; width: var(--w); height: calc(var(--w) * .46); opacity: .92; animation: tp-drift var(--d) linear infinite; animation-delay: var(--t); }
@keyframes tp-drift { from { transform: translateX(-20rem); } to { transform: translateX(110vw); } }

/* one sheet in world units, as tall as the space above the bottom bar, centred; every piece is placed in it by percent */
.tp-world { position: absolute; left: 50%; bottom: var(--b); height: calc(100% - var(--b)); aspect-ratio: 880 / 660; transform: translateX(-50%); }
.tp-world > * { position: absolute; }
.tp-piece, .tp-pier { position: absolute; }
.tp-coaster { pointer-events: none; }
.tp-train, .tp-strings { left: 0; top: 0; }
.tp-sea { left: -200%; right: -200%; top: 64%; height: 7.6%; overflow: hidden; background: linear-gradient(#ffc7b0, #e9a6bc 22%, #5fb8bc 62%, #2f8f9c); }
.tp-sea .g { position: absolute; left: 50%; margin-left: calc((var(--x) - 50%) / 5); top: calc(20% + var(--x) / 2); width: calc(var(--w) / 5); height: 2px; border-radius: 2px;
  background: linear-gradient(90deg, transparent, #fff3d8, transparent); animation: tp-glint 6s ease-in-out infinite; animation-delay: var(--t); }
@keyframes tp-glint { 50% { opacity: .25; transform: translateX(1.2rem); } }
.tp-ground { left: -200%; right: -200%; top: 69.5%; bottom: -3rem; background:
  radial-gradient(30% 22% at 50% 92%, rgba(255, 196, 110, .5), transparent 72%),
  repeating-linear-gradient(90deg, rgba(27, 16, 51, .13) 0 2px, transparent 2px 2.6rem),
  linear-gradient(#b0587e 0%, #8c4470 34%, #5e2c5e 100%); box-shadow: inset 0 3px 0 #ffd3a8; }

/* the big wheel: the hub stays still, the rotor turns, each gondola turns back the other way to hang straight */
.tp-rotor { animation: tp-turn 70s linear infinite; }
@keyframes tp-turn { to { transform: rotate(360deg); } }
.tp-gon { position: absolute; width: 14.6%; height: 16.6%; margin-left: -7.3%; transform-origin: 50% 2%; animation: tp-turn 70s linear infinite reverse; }
.tp-rb { animation: tp-chase 1.1s steps(1) infinite; }
.tp-rb.b { animation-delay: -.55s; }
@keyframes tp-chase { 50% { opacity: .3; } }
.tp-lamp { animation: tp-lamp 3.5s ease-in-out infinite; filter: drop-shadow(0 0 2.5px #ffc860); }
.tp-lamp.c { fill: #ffb0d0; }
@keyframes tp-lamp { 50% { opacity: .55; } }
.tp-flag { animation: tp-sway 6s ease-in-out infinite alternate; }
html.art3d .tp-cf, html:not(.art3d) .tp-c3 { display: none; }
.tp-car[data-i="1"] .tp-c3 { filter: hue-rotate(38deg) brightness(1.1); }
.tp-car[data-i="2"] .tp-c3 { filter: hue-rotate(155deg); }
.tp-car[data-i="3"] .tp-c3 { filter: hue-rotate(-40deg) brightness(1.1); }
@keyframes tp-sway { from { transform: translateY(-1.5px); } to { transform: translateY(2px); } }

/* the carousel: the horses go round a drum, in front of it and behind, galloping up and down their poles */
.tp-part { position: absolute; }
.tp-roof { z-index: 5; }
.tp-deck { z-index: 0; }
.tp-horse { position: absolute; left: 50%; top: 30%; width: 20%; height: 58%; margin-left: -10%;
  animation: tp-carx 6s ease-in-out infinite alternate, tp-carz 12s linear infinite; animation-delay: var(--t), var(--t); }
.tp-horse svg { animation: tp-gallop 1.9s ease-in-out infinite alternate; animation-delay: var(--t2); }
@keyframes tp-carx { from { transform: translateX(-190%); } to { transform: translateX(190%); } }
@keyframes tp-carz { 0% { z-index: 3; scale: .86; } 25% { z-index: 3; scale: 1; } 49.9% { z-index: 3; scale: .86; }
  50% { z-index: 1; scale: -.86 .86; } 75% { z-index: 1; scale: -.72 .72; } 99.9% { z-index: 1; scale: -.86 .86; } 100% { z-index: 3; scale: .86; } }
@keyframes tp-gallop { from { transform: translateY(-6%); } to { transform: translateY(6%); } }

/* gulls and lost balloons */
.tp-gull { position: absolute; top: var(--y); left: 0; width: calc(1.5rem * var(--s)); height: calc(.6rem * var(--s)); animation: tp-gull var(--d) linear infinite; animation-delay: var(--t); }
@keyframes tp-gull { from { transform: translate(110vw, 0); } 50% { transform: translate(40vw, 3vh); } to { transform: translate(-3rem, -2vh); } }
.tp-balloon { position: absolute; left: var(--x); bottom: -6rem; width: 1.3rem; height: 2.7rem; animation: tp-rise var(--d) linear infinite; animation-delay: var(--t); }
@keyframes tp-rise { to { transform: translate(2.5rem, -115vh); } }

/* ---- the app ---- */
/* the title: "Party" in signwriter's gold with a red shadow, as painted over a ride */
[data-theme="themepark"] .logo .l1 { color: #fff6e6; text-shadow: 0 2px 0 #e5343f, 0 3px 8px rgba(8, 26, 42, .6); }
[data-theme="themepark"] .logo .l2 { color: transparent; background: linear-gradient(180deg, #fff6c0 10%, #ffc93d 52%, #f0861f 100%); -webkit-background-clip: text; background-clip: text;
  filter: drop-shadow(1.2px 0 0 #1b1033) drop-shadow(-1.2px 0 0 #1b1033) drop-shadow(0 1.2px 0 #1b1033) drop-shadow(0 -1.2px 0 #1b1033) drop-shadow(0 3px 0 #e5343f); }
[data-theme="themepark"] :is(.title, .tag, .home .dim, .label) { text-shadow: 0 2px 8px rgba(8, 26, 42, .75); }
[data-theme="themepark"] .hname .ptitle { filter: drop-shadow(0 0 1.5px #0c3a52) drop-shadow(0 0 1.5px #0c3a52) drop-shadow(0 1px 3px #0c3a52); }

/* main buttons: painted signs with a cream line, and bulbs round the edge chasing each other */
[data-theme="themepark"] .btn:not(.ghost):not(.small) { position: relative; overflow: visible; }
:root[data-theme="themepark"] .btn:not(.ghost) {
  background: linear-gradient(180deg, rgba(255, 255, 255, .28), rgba(255, 255, 255, 0) 45%, rgba(40, 0, 20, .16)), var(--hot);
  box-shadow: inset 0 0 0 2px rgba(255, 241, 214, .85), inset 0 0 0 3.5px rgba(27, 16, 51, .4), 0 5px 0 color-mix(in srgb, var(--hot) 55%, #1b1033), 0 12px 20px -6px rgba(8, 26, 42, .55); }
[data-theme="themepark"] .btn:not(.ghost):not(.small)::before, [data-theme="themepark"] .btn:not(.ghost):not(.small)::after {
  content: ''; position: absolute; inset: -3px; z-index: 2; pointer-events: none; box-sizing: border-box; background: none;
  border: 8px solid transparent; border-image: var(--tp-bulbs-a) 25% / 8px round; border-radius: 0; }
[data-theme="themepark"] .btn:not(.ghost):not(.small)::after { border-image-source: var(--tp-bulbs-b); animation: tp-bulbs 1s steps(1) infinite; }
@keyframes tp-bulbs { 0% { opacity: 1; } 50% { opacity: 0; } }

/* cards: a stall, with a striped awning along the top and a gold line */
[data-theme="themepark"] .panel { position: relative; margin-top: .55rem; }
:root[data-theme="themepark"] :is(.panel, .sheetbox) { background: linear-gradient(180deg, rgba(255, 255, 255, .07), rgba(255, 255, 255, 0) 40%), var(--card);
  box-shadow: inset 0 0 0 1.5px rgba(255, 201, 61, .55), 0 14px 28px -10px rgba(6, 20, 34, .7); }
[data-theme="themepark"] .panel::before { content: ''; position: absolute; left: -2px; right: -2px; top: -.55rem; height: 1rem; pointer-events: none; z-index: 1;
  background: var(--tp-awning) 0 0 / 2.2rem 1rem round no-repeat; filter: drop-shadow(0 2px 2px rgba(6, 20, 34, .5)); }

/* Head to Head tiles: ride tickets in fairground paint, notched at the sides, with a tear line and a star */
[data-theme="themepark"] .topic { position: relative; overflow: visible; border: 0;
  background: radial-gradient(circle at 0 50%, transparent 7px, transparent 7.5px) , linear-gradient(170deg, color-mix(in srgb, var(--sc) 78%, #fff6e6), var(--sc) 55%, color-mix(in srgb, var(--sc) 72%, #1b1033));
  -webkit-mask: radial-gradient(circle 7px at 0 50%, transparent 98%, #000), radial-gradient(circle 7px at 100% 50%, transparent 98%, #000); -webkit-mask-composite: source-in; mask: radial-gradient(circle 7px at 0 50%, transparent 98%, #000), radial-gradient(circle 7px at 100% 50%, transparent 98%, #000); mask-composite: intersect;
  box-shadow: inset 0 0 0 2px rgba(255, 241, 214, .75), inset 0 -4px 0 rgba(27, 16, 51, .25); }
[data-theme="themepark"] .topic::after { content: ''; position: absolute; top: .25rem; right: .3rem; width: 1.5rem; height: 1rem; pointer-events: none; background: var(--tp-ticket) center / contain no-repeat; }
[data-theme="themepark"] .topic span, [data-theme="themepark"] .topic small { text-shadow: 0 1px 3px rgba(27, 16, 51, .6); }

/* the bottom bar: the boardwalk, with bunting strung along it */
[data-theme="themepark"] #tabbar { overflow: visible; background: repeating-linear-gradient(90deg, rgba(27, 16, 51, .32) 0 2px, transparent 2px 3.6rem), linear-gradient(180deg, #a55a30, #7c3f22 70%, #5c2c18); border-top: 2px solid #1b1033; box-shadow: 0 -8px 20px -8px rgba(6, 20, 34, .6); }
[data-theme="themepark"] #tabbar::before { content: ''; position: absolute; left: 0; right: 0; top: -2px; height: 15px; pointer-events: none; background: var(--tp-bunting) 0 0 / 96px 15px repeat-x; }
[data-theme="themepark"] #tabbar button.homebtn::before { background: linear-gradient(180deg, #a55a30, #7c3f22); box-shadow: 0 -2px 0 #1b1033; }
[data-theme="themepark"] #tabbar button { color: #fff1d6; }
[data-theme="themepark"] #tabbar button.on { color: #ffc93d; }

/* ---- Theme Park style items (code "tp") ---- */
/* chat bubble "Candyfloss": a soft pink puff with a teal edge */
html body .bubble.bub-tp.bub-tp { color: #4a1838; border: 2px solid #19b5a8;
  background: radial-gradient(circle at 16% 26%, #fff 0 9%, transparent 26%), radial-gradient(circle at 80% 72%, #ffe3ef 0 14%, transparent 34%), linear-gradient(170deg, #ffd3e6, #ffa9cf); }
html body .bubble.bub-tp.bub-tp small { color: #7a2c5a; opacity: 1; }

/* answer buttons "Fairground Signs": a painted board in the answer's colour, cream lining, bulbs round the edge */
body.btns-tp .abtn, .btns-tp-demo { position: relative; overflow: visible !important; color: #fff !important; text-shadow: 0 1px 2px rgba(27, 16, 51, .7) !important; border: 2px solid #1b1033 !important; border-radius: 10px !important;
  background: linear-gradient(180deg, rgba(255, 255, 255, .24), rgba(255, 255, 255, 0) 45%, rgba(27, 16, 51, .2)), var(--c) !important;
  box-shadow: inset 0 0 0 2px #fff1d6, 0 5px 0 color-mix(in srgb, var(--c) 50%, #1b1033), 0 10px 16px -6px rgba(8, 26, 42, .55) !important; }
body.btns-tp .abtn::before, body.btns-tp .abtn::after, .btns-tp-demo::before { content: ''; position: absolute; inset: -4px; pointer-events: none; box-sizing: border-box; border: 7px solid transparent; border-image: var(--tp-bulbs-a) 25% / 7px round; }
body.btns-tp .abtn::after { border-image-source: var(--tp-bulbs-b); animation: tp-bulbs 1s steps(1) infinite; }
body.btns-tp .abtn:active { transform: translateY(4px); box-shadow: inset 0 0 0 2px #fff1d6, 0 1px 0 color-mix(in srgb, var(--c) 50%, #1b1033) !important; }
.btns-tp-demo { --c: #e5343f; }

@media (prefers-reduced-motion: reduce) {
  [data-theme="themepark"] .tp-scene *, [data-theme="themepark"] .btn::after, body.btns-tp .abtn::after { animation: none !important; }
  .tp-gull, .tp-balloon { display: none; }
}
/* wide screens: the world stays centred and the sea and prom carry on either side */
@media (min-aspect-ratio: 1/1) { .tp-cloud { top: calc(var(--y) * .7); } }

/* the win celebration: its pieces are drawn in style-bundles.js, so they need the falling look here */
.confetti.fx-tp i { position: absolute; top: -12%; width: calc(2.4rem * var(--s, 1)); height: auto; background: none; animation: fall 3.4s linear infinite; }
/* v2 */
