/* refreshed 8 Nov (phone kept the scene but lost the colours) */
/* Medieval Kingdom (id "medieval", premium): a storybook kingdom in full daylight (a light theme). A stone castle on its green mound with
   flags flying, a moat and drawbridge, a market town below, a knight riding the road. The app: dressed-stone buttons with gold rivets,
   parchment cards under a line of pennants, Head to Head tiles painted as heraldic shields, battlements along the bottom bar.
   The scene is SCENES.medieval in theme-medieval.js; its style items use the code "mk". */

:root {
  /* battlements along the top of the bottom bar, a pennant flying from every other merlon */
  --mk-ridge: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 96 18'%3E%3Cg stroke='%231b1033' stroke-width='1.300' stroke-linejoin='round'%3E%3Cpath d='M2 18V7h20v11z' fill='%23a9a59c'/%3E%3Cpath d='M26 18V10h20v8z' fill='%238d8a82'/%3E%3Cpath d='M50 18V7h20v11z' fill='%23a9a59c'/%3E%3Cpath d='M74 18V10h20v8z' fill='%238d8a82'/%3E%3C/g%3E%3Cpath d='M5 11h14M53 11h14M12 7v4M60 11v7M8 14v4' stroke='%236e6b64' stroke-width='.9'/%3E%3Cpath d='M12 7V1' stroke='%231b1033' stroke-width='1.300'/%3E%3Cpath d='M12 1l8 2-8 2z' fill='%23c22a30' stroke='%231b1033' stroke-width='.9' stroke-linejoin='round'/%3E%3Cpath d='M60 7V1' stroke='%231b1033' stroke-width='1.300'/%3E%3Cpath d='M60 1l8 2-8 2z' fill='%23eeb92e' stroke='%231b1033' stroke-width='.9' stroke-linejoin='round'/%3E%3C/svg%3E");
  /* the line of pennants strung across the top of a card */
  --mk-bunting: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 16'%3E%3Cpath d='M1 2Q60 7 119 2' fill='none' stroke='%231b1033' stroke-width='3'/%3E%3Cpath d='M1 2Q60 7 119 2' fill='none' stroke='%23c79a2e' stroke-width='1.500'/%3E%3Cg stroke='%231b1033' stroke-width='1.100' stroke-linejoin='round'%3E%3Cpath d='M6 2.600h13l-6.500 11z' fill='%23c22a30'/%3E%3Cpath d='M25 3.900h13l-6.500 11z' fill='%23eeb92e'/%3E%3Cpath d='M44 4.300h13l-6.500 11z' fill='%232f62b8'/%3E%3Cpath d='M63 4.300h13l-6.500 11z' fill='%23c22a30'/%3E%3Cpath d='M82 3.900h13l-6.500 11z' fill='%23eeb92e'/%3E%3Cpath d='M101 2.600h13l-6.500 11z' fill='%232f62b8'/%3E%3C/g%3E%3C/svg%3E");
  /* a little gold crown (a topic tile's top right) */
  --mk-crest: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 36 26'%3E%3Cpath d='M4 22L2 7l9 7 7-12 7 12 9-7-2 15z' fill='%23eeb92e' stroke='%231b1033' stroke-width='1.800' stroke-linejoin='round'/%3E%3Cpath d='M6 18h24' stroke='%23a8741a' stroke-width='1.600'/%3E%3Cg fill='%23c22a30' stroke='%231b1033' stroke-width='.8'%3E%3Ccircle cx='18' cy='13.500' r='2'/%3E%3Ccircle cx='10.500' cy='16' r='1.300'/%3E%3Ccircle cx='25.500' cy='16' r='1.300'/%3E%3C/g%3E%3C/svg%3E");
  /* iron bosses with a gold rim at a main button's corners, and the glint on them */
  --mk-corners-a: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Cg fill='%23c79a2e' stroke='%231b1033' stroke-width='1.200'%3E%3Ccircle cx='7.500' cy='7.500' r='5.500'/%3E%3Ccircle cx='32.500' cy='7.500' r='5.500'/%3E%3Ccircle cx='7.500' cy='32.500' r='5.500'/%3E%3Ccircle cx='32.500' cy='32.500' r='5.500'/%3E%3C/g%3E%3Cg fill='%2353525a'%3E%3Ccircle cx='7.500' cy='7.500' r='3'/%3E%3Ccircle cx='32.500' cy='7.500' r='3'/%3E%3Ccircle cx='7.500' cy='32.500' r='3'/%3E%3Ccircle cx='32.500' cy='32.500' r='3'/%3E%3C/g%3E%3C/svg%3E");
  --mk-corners-b: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Cg fill='%23fff6d6'%3E%3Ccircle cx='6.300' cy='6.300' r='1.300'/%3E%3Ccircle cx='31.300' cy='6.300' r='1.300'/%3E%3Ccircle cx='6.300' cy='31.300' r='1.300'/%3E%3Ccircle cx='31.300' cy='31.300' r='1.300'/%3E%3C/g%3E%3C/svg%3E");
}

/* ---- colours ---- */
[data-theme="medieval"] {
  --bg-0: #d8c9a4; --bg-1: #eadcb9; --bg-2: #f6ecd2;
  --card: rgba(246, 236, 210, .97); --card-2: rgba(120, 88, 44, .12); --panel-edge: #a98a58;
  --ink: #2e2214; --ink-dim: #6a5636; --on-hot: #ffffff;
  --hot: #b3262e; --cool: #2a5cab; --amber: #c98d10; --gold: #d39a18; --good: #2c8a3c; --bad: #c22a30; --seen: #2a5cab;
  --title-1: #2e2214; --title-2: #b3262e;
  --mine: #f0dca6; --mine-edge: #c9a45a; --fact-bg: #e9e2cc; --fact-edge: #bda877;
  --shadow: 0 1px 2px rgba(46, 34, 20, .1), 0 5px 14px rgba(70, 50, 20, .18);
  --scrim: rgba(46, 34, 20, .45); --off: #cfc1a0; --press: #d8c9a4;
  /* the shields' painted fields */
  --s-general: #b3262e; --s-geography: #2a7f6a; --s-history: #8a5a2a; --s-science: #2a5cab;
  --s-nature: #3f8a34; --s-music: #8a3a8f; --s-film_tv: #5a4aa8; --s-sport: #c98d10;
  --s-arts_lit: #a8324f; --s-food: #c8622a; --s-tech_games: #2f7f98; --s-words: #4a6a3a;
  /* the light-theme fixes theme-3d.css and app.css give Clean and Nevaeh's Jungle */
  --d3: .2;
  --r-common: #6a6252; --r-uncommon: #2c7a34; --r-rare: #1f55b8;
  --r-epic: #7030b0; --r-legendary: #b4620a; --r-mythic: #4b5468;
  /* bottom-bar icon colours (look3d.js TAB_ICONS): royal blue, crimson, meadow, gold, stone, parchment, oak */
  --tb-blue-1: #a8c8f4; --tb-blue-2: #2a5cab; --tb-pink-1: #f4b0a8; --tb-pink-2: #b3262e; --tb-green-1: #c4e89a; --tb-green-2: #3f8a34;
  --tb-gold-1: #ffe59a; --tb-gold-2: #d39a18; --tb-purple-1: #d8d4cc; --tb-purple-2: #7c7a74; --tb-red-1: #f4a898; --tb-red-2: #b3262e;
  --tb-cream-1: #fff6e0; --tb-cream-2: #dcc9a0; --tb-orange-1: #ffd28a; --tb-orange-2: #d0802a; --tb-brown-1: #b58a58; --tb-brown-2: #6e4a2a;
}
[data-theme="medieval"] #splash { background: linear-gradient(#7fbdec, #bfe0f4 46%, #9fd06a 62%, #4f9a3e); }
[data-theme="medieval"] .pname[style] { filter: drop-shadow(0 0 .8px #2e2214) drop-shadow(0 0 .8px #2e2214) drop-shadow(0 1.5px 0 rgba(46, 34, 20, .5)); }
[data-theme="medieval"] .hname .pname[style] { filter: drop-shadow(0 0 1.2px #2e2214) drop-shadow(0 0 1.2px #2e2214) drop-shadow(0 0 .6px #2e2214) drop-shadow(0 2px 0 rgba(46, 34, 20, .45)); }
[data-theme="medieval"] :is(.title, .tag, .home .dim, .label) { text-shadow: 0 0 4px #f6ecd2, 0 1px 6px #f6ecd2, 0 0 12px rgba(246, 236, 210, .9); }
[data-theme="medieval"] .hname .ptitle { filter: drop-shadow(0 0 1.5px #f6ecd2) drop-shadow(0 0 1.5px #f6ecd2) drop-shadow(0 1px 3px #f6ecd2); }

/* ---- the scene ---- */
[data-theme="medieval"] #stage-bg { background: #bfe0f4; }
.mk-scene { position: absolute; inset: 0; overflow: hidden; --b: calc(var(--tabh) + env(safe-area-inset-bottom)); pointer-events: none; }
.mk-scene img { display: block; -webkit-user-drag: none; }
.mk-sky { position: absolute; inset: 0; background: radial-gradient(30% 18% at 76% 10%, rgba(255, 252, 226, .95), rgba(255, 246, 200, .34) 50%, transparent 76%), linear-gradient(#4f9fe4, #84c2ef 26%, #bfe2f6 46%, #e2f1f4 52%, #8fc86a 53%); }
/* one sheet in world units, as tall as the space above the bottom bar, centred; every piece is placed in it by percent */
.mk-world { position: absolute; left: 50%; bottom: var(--b); height: calc(100% - var(--b)); aspect-ratio: 880 / 660; transform: translateX(-50%); }
.mk-world > * { position: absolute; }
.mk-layer { max-width: none; }
.mk-ground { position: absolute; left: 0; right: 0; bottom: 0; height: var(--b); background: linear-gradient(#6fb04a, #4f8f3a); }
/* the clouds: two copies of a strip, sliding for ever */
.mk-drift { left: -60%; width: 440%; overflow: hidden; }
.mk-drift i { position: absolute; inset: 0; background-repeat: repeat-x; background-size: 50% 100%; animation: mk-slide 170s linear infinite; }
.mk-drift.b i { animation-duration: 110s; }
@keyframes mk-slide { to { transform: translateX(-50%); } }
/* chimney smoke, rising and leaning with the wind */
.mk-smoke { width: 3.4%; aspect-ratio: 1; opacity: 0; animation: mk-rise 11s linear infinite; will-change: transform, opacity; }
.mk-smoke img { width: 100%; height: 100%; filter: blur(.8px); }
@keyframes mk-rise { 0% { transform: translate(0, 0) scale(.3) rotate(0); opacity: 0; } 8% { opacity: .8; } 60% { opacity: .5; } 100% { transform: translate(190%, -520%) scale(1.7) rotate(40deg); opacity: 0; } }
/* a picture strip of N frames, played by steps: flags, banners, sails, the riders' legs */
.mk-reel { background-repeat: no-repeat; background-size: calc(var(--n) * 100%) 100%; animation: mk-reel var(--t, 1s) steps(var(--n), jump-none) infinite; }
@keyframes mk-reel { from { background-position-x: 0%; } to { background-position-x: 100%; } }
/* the moat's ripples, three pictures fading through each other */
.mk-ripple { animation: mk-fade 6s linear infinite; }
.mk-ripple.b { animation-delay: -2s; }
.mk-ripple.c { animation-delay: -4s; }
@keyframes mk-fade { 0%, 100% { opacity: 0; } 16.700%, 33.300% { opacity: 1; } 50% { opacity: 0; } }
/* everything that moves about: the script places it, in world units */
.mk-mover { left: 0; top: 0; will-change: transform; }
.mk-mover i { display: block; width: 100%; height: 100%; }
.mk-mover .sh { position: absolute; left: 14%; right: 14%; bottom: -3%; height: 12%; border-radius: 50%; background: rgba(40, 50, 20, .34); filter: blur(2px); z-index: -1; }

/* ---- the app ---- */
/* no stage spotlights here: the light is the sun */
[data-theme="medieval"] .hbeam { display: none; }
/* the title: "Party" in cut stone, the second word in gilt, with a thick dark edge */
[data-theme="medieval"] .logo .l1 { color: #f6ecd2; text-shadow: 0 0 2px #2e2214, 0 2px 0 #4a4640, 0 3px 8px rgba(46, 34, 20, .6); }
[data-theme="medieval"] .logo .l2 { color: transparent; background: linear-gradient(180deg, #fff3b8 14%, #f2c64a 48%, #d39a18 54%, #9c6a10 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 #4a3010); }
[data-theme="medieval"] :is(.logo .beta, .codechip, .bigcode, .me .pts, .pl .sc, .stat b, .rank .pt, .crumb, .agree a, .linkbtn) { color: #8a1f26; }
[data-theme="medieval"] .passhead .chip.on, [data-theme="medieval"] .passon { color: #2c7a34; }

/* main buttons: a painted slab set in dressed stone, an iron boss with a gold rim at each corner */
[data-theme="medieval"] .btn:not(.ghost):not(.small) { position: relative; overflow: visible; }
:root[data-theme="medieval"] .btn:not(.ghost) { border-radius: 8px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .2), rgba(255, 255, 255, 0) 42%, rgba(30, 16, 8, .22)), var(--hot);
  box-shadow: inset 0 0 0 2px rgba(255, 240, 200, .4), inset 0 0 0 5px #8d8a82, inset 0 0 0 6px rgba(27, 16, 51, .55), 0 5px 0 #55524c, 0 12px 18px -6px rgba(46, 34, 20, .55); }
[data-theme="medieval"] .btn:not(.ghost):not(.small)::before, [data-theme="medieval"] .btn:not(.ghost):not(.small)::after {
  content: ''; position: absolute; inset: 1px; z-index: 2; pointer-events: none; box-sizing: border-box; background: none;
  border: 11px solid transparent; border-image: var(--mk-corners-a) 40% / 11px no-repeat; border-radius: 0; }
[data-theme="medieval"] .btn:not(.ghost):not(.small)::after { border-image-source: var(--mk-corners-b); animation: mk-glint 4.4s ease-in-out infinite; }
@keyframes mk-glint { 50% { opacity: .35; } }

/* cards: parchment with an inked line, a string of pennants across the top */
[data-theme="medieval"] .panel { position: relative; margin-top: .6rem; }
:root[data-theme="medieval"] :is(.panel, .sheetbox) { background: radial-gradient(90% 60% at 16% 0, rgba(255, 252, 236, .7), transparent 72%), radial-gradient(70% 50% at 100% 100%, rgba(150, 110, 50, .16), transparent 74%), var(--card);
  box-shadow: inset 0 0 0 1.5px rgba(169, 138, 88, .9), inset 0 0 0 4px rgba(246, 236, 210, .9), inset 0 0 0 5px rgba(169, 138, 88, .5), 0 12px 24px -10px rgba(46, 34, 20, .6); }
[data-theme="medieval"] .panel::before { content: ''; position: absolute; left: 6%; right: 6%; top: -.55rem; height: 1rem; pointer-events: none; z-index: 1;
  background: var(--mk-bunting) center / 100% 100% no-repeat; filter: drop-shadow(0 2px 2px rgba(46, 34, 20, .35)); }

/* Head to Head tiles: heraldic shields, each its own field with a gold edge and a broad band across the top, a crown in the corner */
[data-theme="medieval"] .topic { position: relative; overflow: visible; border: 0; border-radius: 12px 12px 46% 46% / 10px 10px 24% 24%;
  background: linear-gradient(180deg, rgba(255, 244, 214, .3) 0 22%, transparent 22.500%), radial-gradient(70% 60% at 26% 12%, rgba(255, 255, 255, .22), transparent 70%), linear-gradient(170deg, color-mix(in srgb, var(--sc) 84%, #fff4d6), var(--sc) 55%, color-mix(in srgb, var(--sc) 74%, #2a1a0e));
  box-shadow: inset 0 0 0 3px #d9ab3a, inset 0 0 0 4.5px rgba(27, 16, 51, .5), inset 0 -6px 0 rgba(42, 26, 14, .26); }
[data-theme="medieval"] .topic::after { content: ''; position: absolute; top: .3rem; right: .4rem; width: 1.45rem; height: 1.05rem; pointer-events: none; background: var(--mk-crest) center / contain no-repeat; }
[data-theme="medieval"] .topic span, [data-theme="medieval"] .topic small { text-shadow: 0 1px 3px rgba(30, 20, 8, .75); }

/* the bottom bar: a stone wall, battlements along its top, the home button lit like a brazier */
[data-theme="medieval"] #tabbar { overflow: visible; background: repeating-linear-gradient(0deg, rgba(40, 38, 34, .4) 0 1.5px, transparent 1.5px 1.5rem), repeating-linear-gradient(90deg, rgba(40, 38, 34, .3) 0 1.5px, transparent 1.5px 3.2rem), linear-gradient(180deg, #8d8a82, #76736c 60%, #5e5b55); border-top: 2px solid #1b1033; box-shadow: 0 -8px 20px -8px rgba(46, 34, 20, .6); }
[data-theme="medieval"] #tabbar::before { content: ''; position: absolute; left: 0; right: 0; top: -15px; height: 16px; pointer-events: none; background: var(--mk-ridge) 0 0 / 88px 16px repeat-x; }
[data-theme="medieval"] #tabbar button.homebtn::before { background: linear-gradient(180deg, #8d8a82, #76736c); box-shadow: 0 -2px 0 #1b1033, 0 -4px 14px rgba(255, 196, 80, .6); }
[data-theme="medieval"] #tabbar button { color: #fff6e0; text-shadow: 0 1px 2px rgba(27, 16, 51, .8); }
[data-theme="medieval"] #tabbar button.on { color: #ffd65a; }

/* ---- Medieval Kingdom style items (code "mk") ---- */
/* the win celebration: shields, crowns and pennants tumbling down (style-bundles.js draws them) */
.confetti.fx-mk i { position: absolute; top: -12%; width: calc(2.4rem * var(--s, 1)); height: auto; background: none; animation: fall 3.4s linear infinite; }
/* chat bubble "Parchment Scroll": a scroll with rolled ends and a red wax seal in the corner */
html body .bubble.bub-mk.bub-mk { position: relative; color: #2e2214; border: 2px solid #a98a58; border-radius: 6px;
  background: radial-gradient(9px 9px at calc(100% - 13px) calc(100% - 12px), #c22a30 0 6px, #8a1f26 6.500px 7.500px, transparent 8px), linear-gradient(90deg, rgba(120, 88, 44, .34), transparent 8px, transparent calc(100% - 8px), rgba(120, 88, 44, .34)), linear-gradient(170deg, #f8efd6, #ead9b0); }
html body .bubble.bub-mk.bub-mk small { color: #6a5636; opacity: 1; }

/* answer buttons "Heraldic Shields": a painted field in the answer's colour, parted by a pale bend, in a stone frame with gold-rimmed bosses */
body.btns-mk .abtn, .btns-mk-demo { position: relative; overflow: visible !important; color: #fff !important; text-shadow: 0 1px 2px rgba(30, 16, 8, .85) !important; border: 2px solid #1b1033 !important; border-radius: 10px 10px 16px 16px !important;
  background: linear-gradient(115deg, transparent 0 62%, rgba(255, 246, 214, .16) 62% 74%, transparent 74%), linear-gradient(180deg, rgba(255, 255, 255, .16), rgba(255, 255, 255, 0) 45%, rgba(30, 16, 8, .24)), var(--c) !important;
  box-shadow: inset 0 0 0 3px #d9ab3a, inset 0 0 0 4.5px rgba(27, 16, 51, .5), 0 5px 0 #55524c, 0 10px 14px -6px rgba(46, 34, 20, .55) !important; }
body.btns-mk .abtn::before, body.btns-mk .abtn::after, .btns-mk-demo::before { content: ''; position: absolute; inset: 1px; width: auto; height: auto; z-index: 2; background: none; border-radius: 0; opacity: 1; pointer-events: none; box-sizing: border-box; border: 12px solid transparent; border-image: var(--mk-corners-a) 40% / 12px no-repeat; }
body.btns-mk .abtn::after { border-image-source: var(--mk-corners-b); animation: mk-glint 4.4s ease-in-out infinite; }
body.btns-mk .abtn:active { transform: translateY(4px); box-shadow: inset 0 0 0 3px #d9ab3a, 0 1px 0 #55524c !important; }
.btns-mk-demo { --c: #b3262e; }

@media (prefers-reduced-motion: reduce) {
  [data-theme="medieval"] .mk-scene *, [data-theme="medieval"] .btn::after, body.btns-mk .abtn::after { animation: none !important; }
}

/* v2 */
