/* Additional collections. The classic card skin remains the original Memory skin. */
html,body{height:100%;min-height:0;overflow:hidden}
body{--memory-safe-top:env(safe-area-inset-top,0px);--memory-safe-right:env(safe-area-inset-right,0px);--memory-safe-bottom:env(safe-area-inset-bottom,0px);--memory-safe-left:env(safe-area-inset-left,0px);padding-top:var(--memory-safe-top);padding-bottom:var(--memory-safe-bottom);padding-left:max(8px,var(--memory-safe-left));padding-right:max(8px,var(--memory-safe-right))}
.app{position:relative;z-index:1;height:calc(100dvh - var(--memory-safe-top) - var(--memory-safe-bottom));min-height:0;grid-template-rows:auto auto minmax(0,1fr) auto}
main{width:100%;height:100%;min-width:0;min-height:0;place-items:center;padding:0}
.board{width:min(100%,var(--memory-board-size,500px));height:auto;aspect-ratio:1;max-width:640px;padding:16px;border-radius:22px;border-color:#ffffff12;box-shadow:0 18px 48px #0004}
.grid.memory{width:100%;height:100%;aspect-ratio:1;min-height:0;max-height:100%;gap:16px;overflow:visible}
.memory .cell{touch-action:manipulation;border-radius:12px;box-shadow:0 4px 10px #0004,inset 0 1px #ffffff18;transition:transform .2s ease,background .2s ease,filter .18s ease,box-shadow .18s ease}
.memory .cell:focus-visible{z-index:2;outline:3px solid var(--accent);outline-offset:2px}
.memory .memory-art{position:absolute;display:none;left:12%;top:12%;width:76%;height:76%;background-image:var(--memory-atlas);background-size:400% 200%;background-repeat:no-repeat;transform:rotateY(180deg);pointer-events:none}
.memory .open .memory-art{display:block}
.memory-art[data-slot="0"]{background-position:0% 0%}.memory-art[data-slot="1"]{background-position:33.333333% 0%}.memory-art[data-slot="2"]{background-position:66.666667% 0%}.memory-art[data-slot="3"]{background-position:100% 0%}.memory-art[data-slot="4"]{background-position:0% 100%}.memory-art[data-slot="5"]{background-position:33.333333% 100%}.memory-art[data-slot="6"]{background-position:66.666667% 100%}.memory-art[data-slot="7"]{background-position:100% 100%}
.scene{z-index:0;background-size:cover;background-position:center;background-repeat:no-repeat;transition:background-color .2s ease}
body[data-backdrop="ocean"] .scene{background-image:linear-gradient(#100a1b33,#100a1b77),url('assets/ocean.webp')}
body[data-backdrop="forest"] .scene{background-image:linear-gradient(#100a1b33,#100a1b77),url('assets/forest.webp')}
body[data-backdrop="cosmic"] .scene{background-image:linear-gradient(#100a1b33,#100a1b77),url('assets/cosmic.webp')}
body[data-backdrop="desert"] .scene{background-image:linear-gradient(#100a1b33,#100a1b77),url('assets/desert.webp')}
body:not([data-backdrop="classic"]) .scene i{opacity:0}
body:not([data-backdrop="classic"]) .app{filter:drop-shadow(0 2px 5px #0005)}
body:not([data-backdrop="classic"]) .app>header,body:not([data-backdrop="classic"]) .app>.stats,body:not([data-backdrop="classic"]) .app>footer{background:#17121dd9;border-radius:8px;padding:8px}
body:not([data-backdrop="classic"]) .board{background:#17121dcf}
.app>header{gap:12px;padding-bottom:10px}
.app>header .brand{font-size:28px;flex-shrink:0}
.app>header .sigil{width:36px;height:40px}
.app>header .actions{gap:6px;flex-shrink:0}
.app>header .actions .icon{width:44px;height:44px;min-width:44px;border-radius:10px}
.memory-top-tools{display:flex;align-items:center;flex-wrap:nowrap;gap:8px;margin-left:auto;padding:0}
.memory-top-tools button{display:inline-flex;align-items:center;justify-content:center;min-width:0;min-height:44px;gap:7px;padding:0 13px;border-radius:10px;font:600 14px/1.15 system-ui,-apple-system,sans-serif;box-shadow:0 3px 10px #0003}
.memory-top-tools button span{min-width:0;overflow-wrap:anywhere}
.memory-top-tools .primary{background:linear-gradient(135deg,#f4cf83,#d9ab50);box-shadow:0 3px 12px #d7a34224,inset 0 1px #fff7}
.memory-top-tools svg{width:17px;height:17px;flex:none;stroke:currentColor;fill:none;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.app>footer{padding-bottom:2px}
.memory-status{position:fixed;left:-10000px;top:0;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
.mc-preview-stage{container-type:size}
.memory-mini{position:relative;display:grid;place-items:center;width:100%;height:100%;min-height:0;aspect-ratio:auto;background-size:cover;background-position:center;border-radius:16px;overflow:hidden;padding:10px}
.memory-mini:before{content:'';position:absolute;inset:0;background:#130d1c35}
.memory-mini-grid{position:relative;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px;width:min(90cqw,125cqh,360px);padding:10px;border:1px solid #ffffff1a;border-radius:14px;background:#20152de8;box-shadow:0 10px 24px #0004}
.memory-mini-card,.memory-deck-sample{position:relative;aspect-ratio:1;border:1px solid #ffffff35;border-radius:8px;background:linear-gradient(145deg,#564361,#33223f);box-shadow:0 3px 8px #0005;overflow:hidden}
.memory-mini-card:before{content:'';position:absolute;inset:6px;border:1px solid #ffffff24;border-radius:5px;background:repeating-linear-gradient(45deg,transparent 0 7px,#ffffff08 8px 9px)}
.memory-mini-card.is-open,.memory-deck-sample{background:linear-gradient(145deg,#fff9df,#d8caa4)}
.memory-mini-card.is-open:before,.memory-deck-sample:before{background:none}
.memory-mini .memory-mark,.memory-deck-sample .memory-mark{display:block;transform:none;pointer-events:none;--accent2:#e586bd}
.memory-mini .mark-leaf,.memory-deck-sample .mark-leaf{transform:rotate(45deg)}
.memory-mini .memory-art,.memory-deck-sample .memory-art{position:absolute;display:block;inset:7%;width:86%;height:86%;background-image:var(--memory-atlas);background-size:400% 200%;background-repeat:no-repeat;pointer-events:none}
.memory-deck-samples{display:grid;grid-template-columns:repeat(3,1fr);gap:7px;padding:10px;width:100%;height:100%;align-items:center;background:linear-gradient(145deg,#392744,#1c1324)}
.memory-deck-sample{width:100%}
.memory-mini--classic{background:radial-gradient(ellipse at 20% 10%,#9e497950,transparent 70%),repeating-linear-gradient(135deg,transparent 0 23px,#ffffff07 24px 25px),#17121d}
.memory-cover-samples{position:relative;width:100%;height:100%;overflow:hidden;background:radial-gradient(ellipse at 50% 25%,#ffffff12,transparent 75%),#1f1729}
.memory-cover-sample{position:absolute;display:block;left:50%;top:50%;height:66%;max-width:40%;aspect-ratio:1;border-radius:10px;transform:translate(-50%,-50%);box-shadow:0 5px 12px #0005}
.memory-cover-sample:first-child{transform:translate(-100%,-42%) rotate(-12deg)}
.memory-cover-sample:nth-child(2){z-index:2}
.memory-cover-sample:last-child{transform:translate(0,-42%) rotate(12deg)}
[data-cover="classic"]{--memory-cover-hi:#584964;--memory-cover-lo:#33223f;--memory-cover-edge:#b095c35c;--memory-cover-line:#e0c5ed29}
[data-cover="sapphire"]{--memory-cover-hi:#28648f;--memory-cover-lo:#152e52;--memory-cover-edge:#85c8f266;--memory-cover-line:#a5dcff35}
[data-cover="emerald"]{--memory-cover-hi:#286b57;--memory-cover-lo:#153c31;--memory-cover-edge:#8cd1b966;--memory-cover-line:#b4e9d035}
[data-cover="ruby"]{--memory-cover-hi:#914760;--memory-cover-lo:#4b213b;--memory-cover-edge:#e49cb366;--memory-cover-line:#ffd0dc30}
[data-cover="gold"]{--memory-cover-hi:#a48243;--memory-cover-lo:#584125;--memory-cover-edge:#f2d18a77;--memory-cover-line:#ffe6b13b}
[data-cover="graphite"]{--memory-cover-hi:#505965;--memory-cover-lo:#242b36;--memory-cover-edge:#b5c4d366;--memory-cover-line:#d4e1eb2e}
.memory .cell:not(.open),.memory-mini-card:not(.is-open),.memory-cover-sample{background:linear-gradient(145deg,var(--memory-cover-hi,#584964),var(--memory-cover-lo,#33223f));border:1px solid var(--memory-cover-edge,#b095c35c);box-shadow:0 4px 10px #0004,inset 0 1px #ffffff1c}
.memory .cell:not(.open):before,.memory-mini-card:not(.is-open):before,.memory-cover-sample:before{content:'';position:absolute;inset:7px;border:1px solid var(--memory-cover-line,#e0c5ed29);border-radius:7px;background:repeating-linear-gradient(45deg,transparent 0 10px,#ffffff07 11px 12px);pointer-events:none}
.memory .cell.open:before{background:none;border-color:#766c4929;border-radius:7px}
.memory-cover-sample:before{inset:5px;border-radius:6px}
.help{padding-top:5px}
@media(max-width:620px){.app>header{gap:6px}.app>header .brand{flex:0 0 28px;gap:0}.app>header .brand>span{display:none}.app>header .sigil{width:28px;height:32px}.app>header .actions{gap:4px}.memory-top-tools{flex:1;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px;margin-left:0}.memory-top-tools button{padding:0 6px;gap:5px;font-size:12px}.memory-top-tools svg{width:15px;height:15px}}
@media(max-width:430px){.app{gap:9px;padding:7px 0}.board{padding:10px;border-radius:18px}.grid.memory{gap:11px}.memory .cell{border-radius:11px}.help{font-size:11px}.memory-mini{padding:6px}.memory-mini-grid{max-width:230px;gap:7px;padding:7px}.memory-mini-card:before{inset:4px}}
@media(min-width:600px) and (max-height:550px) and (orientation:landscape){.app{max-width:1100px;grid-template-columns:minmax(230px,32%) minmax(0,1fr);grid-template-rows:auto auto minmax(0,1fr);grid-template-areas:'head board' 'stats board' 'foot board';gap:10px 20px;padding:10px}.app>header{grid-area:head;display:grid;grid-template-columns:1fr auto;grid-template-areas:'brand actions' 'tools tools';gap:8px;padding-bottom:8px}.app>header .brand{grid-area:brand;gap:7px;font-size:20px}.app>header .brand>span{display:block}.app>header .sigil{width:28px;height:32px}.app>header .actions{grid-area:actions;gap:4px}.memory-top-tools{grid-area:tools;width:100%;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px;margin:0}.memory-top-tools button{padding:0 6px;gap:5px;font-size:12px}.memory-top-tools svg{width:15px;height:15px}.stats{grid-area:stats;gap:4px}.stat{padding:7px}.stat b{font-size:17px}main{grid-area:board}.app>footer{grid-area:foot;align-self:start}.help{font-size:11px}.board{max-width:500px;padding:10px}.grid.memory{gap:12px}}
@media(prefers-reduced-motion:reduce){.memory .cell,.scene{transition:none!important}}

/* Race collection: adaptive boards, quiet materials, clear progress. */
.app{grid-template-rows:auto auto auto minmax(0,1fr) auto;gap:8px}
.app>header{padding-bottom:3px}
.stats{grid-template-columns:repeat(4,minmax(0,1fr));gap:8px}
.stat{min-width:0;border-radius:10px;border-left:1px solid #ffffff16;padding:9px 12px;background:linear-gradient(130deg,#44324c80,#241a3080)}
.stat span{font:600 10px/1.2 system-ui,-apple-system,sans-serif;letter-spacing:.06em;color:#c7b6cf;overflow-wrap:anywhere;min-height:12px}
.stat b{font:600 20px/1.45 system-ui,-apple-system,sans-serif;font-variant-numeric:tabular-nums;white-space:nowrap}
.stat:nth-child(2) b{color:#f3cf91}
main{position:relative}
.board{aspect-ratio:auto;max-width:100%;max-height:100%;flex:none;overflow:visible;border:1px solid #ffffff10;border-radius:24px;background:linear-gradient(135deg,#30213783,#17111e99);box-shadow:0 18px 54px #0003,inset 0 1px #ffffff05}
.grid.memory{aspect-ratio:auto;perspective:1200px;max-width:100%;border:0;padding:0}
.memory .cell{min-width:0;min-height:0;width:100%;height:100%;aspect-ratio:1;padding:0;border-radius:clamp(8px,calc(var(--memory-card-size,70px) * .16),18px);overflow:visible;transition:transform .22s ease,background .2s ease,box-shadow .2s ease,filter .2s ease;isolation:isolate}
.memory .cell:not(.open),.memory-mini-card:not(.is-open),.memory-cover-sample{background:radial-gradient(ellipse at 24% 0%,#ffffff16,transparent 65%),linear-gradient(145deg,var(--memory-cover-hi,#584964),var(--memory-cover-lo,#33223f));box-shadow:0 3px 1px color-mix(in srgb,var(--memory-cover-lo,#33223f),#000 25%),0 7px 12px #0004,inset 0 1px #ffffff35,inset 0 -1px #0002;border-color:var(--memory-cover-edge,#b095c35c)}
.memory .cell:not(.open):before,.memory-mini-card:not(.is-open):before,.memory-cover-sample:before{inset:8%;border-radius:inherit;background:linear-gradient(125deg,#ffffff05,transparent 48%);border-color:var(--memory-cover-line,#e0c5ed29)}
.memory-back{inset:0;display:grid;place-items:center;pointer-events:none}
.memory-back b,.memory-mini-card:not(.is-open):after,.memory-cover-sample:after{content:'';position:absolute;width:22%;height:22%;left:39%;top:39%;border:1px solid var(--memory-cover-line,#e0c5ed29);border-radius:3px;transform:rotate(45deg);background:linear-gradient(135deg,#ffffff10,#ffffff00);box-shadow:inset 0 0 0 3px #0000000a,0 0 14px #ffffff04}
.memory-back b:after{content:'';position:absolute;inset:23%;border:1px solid var(--memory-cover-line,#e0c5ed29);border-radius:1px}
.memory .cell.open{background:radial-gradient(ellipse at 24% 0%,#fffdf4 0,#f5eaca 65%,#e0cf9f 100%);border:1px solid #fff1c9;box-shadow:0 3px 1px #9b875a,0 6px 16px #0003,inset 0 1px #fff;opacity:1;filter:none}
.memory .cell.open:before{inset:7%;border:1px solid #a2905833;background:none}
.memory .cell.done{opacity:.8;filter:saturate(.85);border-color:#d2debb;box-shadow:0 2px 1px #8a966d,0 4px 10px #0003,inset 0 1px #fff}
.memory .cell.done .memory-pair-check{display:block}
.memory-pair-check{position:absolute;display:none;width:17%;height:17%;right:8%;bottom:8%;border-radius:50%;background:#3e6a4f;transform:rotateY(180deg);box-shadow:0 1px 3px #0003;pointer-events:none}
.memory-pair-check:after{content:'';position:absolute;left:27%;top:18%;width:28%;height:44%;border:solid #f3f4df;border-width:0 1.5px 1.5px 0;transform:rotate(40deg)}
.memory .memory-art{left:6%;top:6%;width:88%;height:88%;overflow:hidden;filter:drop-shadow(0 2px 1px #62482820)}
.memory-symbol{position:absolute;display:none;left:23%;top:23%;width:54%;height:54%;transform:rotateY(180deg);fill:none;stroke:#a44f7d;stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round;filter:drop-shadow(0 2px 0 #ffffff80);pointer-events:none}
.memory .open .memory-symbol{display:block}
.memory-mini .memory-symbol,.memory-deck-sample .memory-symbol{display:block;transform:none}
.memory-mark{--accent2:#c2759e;filter:drop-shadow(0 3px 1px #61364430)}
.memory .cell:focus-visible{outline:3px solid #f5d38e;outline-offset:3px;z-index:3}
body[data-input="pointer"] .memory .cell:focus{outline:none}
.memory-session{display:flex;flex-direction:column;gap:6px;min-width:0;padding:0 3px;color:#d6c5dc;font:500 12px/1.35 system-ui,-apple-system,sans-serif}
.memory-session-title{display:flex;align-items:center;justify-content:space-between;gap:8px;min-width:0}
.memory-level-label{color:#dfc99f;font-weight:600}
.memory-mode-label{color:#c4b5cf}
.memory-racers{display:grid;grid-template-columns:1fr 1fr;gap:14px;padding-top:3px}
.memory-racers[hidden],.memory-connection[hidden],.memory-countdown[hidden]{display:none}
.memory-racer{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:4px 8px;min-width:0;align-items:center}
.memory-racer span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:11px}
.memory-racer b{font-size:12px;font-variant-numeric:tabular-nums;color:#f7ead4}
.memory-racer>i{grid-column:1/-1;display:block;height:4px;border-radius:4px;background:#ffffff12;overflow:hidden}
.memory-racer em{display:block;height:100%;width:0;border-radius:4px;background:#e4bd76;transition:width .2s ease}
.memory-racer-other em{background:#96d7cd}
.memory-connection{margin:0;font-size:11px;color:#f3cd86;text-align:center}
.memory-countdown{position:absolute;inset:0;z-index:5;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px;border-radius:22px;background:#171020bd;backdrop-filter:blur(6px);pointer-events:all;text-align:center}
.memory-countdown span{font:600 13px/1.3 system-ui,sans-serif;color:#e9d7b8;max-width:85%}
.memory-countdown b{font:700 clamp(60px,14vw,120px)/1 system-ui,sans-serif;color:#f5d38e;text-shadow:0 5px 35px #e6b96536}
.help{max-width:680px;margin:auto;padding:1px 4px 0;font:400 12px/1.4 system-ui,-apple-system,sans-serif;color:#b9a9c2}
body:not([data-backdrop="classic"]) .memory-session{background:#17121ddb;border-radius:10px;padding:7px 10px}
.mc-choice:disabled{cursor:default;opacity:.48;filter:saturate(.55)}
@media(hover:hover){.memory .cell:not(.open):not([aria-disabled="true"]):hover{filter:brightness(1.12);transform:translateY(-2px);box-shadow:0 4px 1px color-mix(in srgb,var(--memory-cover-lo),#000 25%),0 10px 18px #0004,inset 0 1px #ffffff40}}
@media(max-width:430px){.app{gap:7px;padding:7px 0}.stats{gap:5px}.stat{padding:7px 6px}.stat b{font-size:17px}.stat span{font-size:10px;letter-spacing:.01em}.memory-session{font-size:11px}.help{font-size:11px}.board{border-radius:18px}.memory-racers{gap:10px}.memory-racer span{font-size:10px}.memory-racer b{font-size:11px}}
@media(min-width:500px) and (max-height:550px) and (orientation:landscape){
 .app{max-width:1150px;grid-template-columns:minmax(190px,29%) minmax(0,1fr);grid-template-rows:auto auto auto minmax(0,1fr);grid-template-areas:'head board' 'stats board' 'race board' 'foot board';gap:8px 14px;padding:6px 0}
 .app>header{grid-area:head;display:grid;grid-template-columns:1fr auto;grid-template-areas:'brand actions' 'tools tools';gap:6px;padding:0}
 .app>header .brand{grid-area:brand;gap:6px;font-size:20px}.app>header .brand>span{display:block}.app>header .sigil{width:26px;height:30px}
 .app>header .actions{grid-area:actions;gap:4px}.memory-top-tools{grid-area:tools;width:100%;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px;margin:0}.memory-top-tools button{padding:0 5px;font-size:11px;gap:4px}.memory-top-tools svg{width:14px;height:14px}
 .stats{grid-area:stats;grid-template-columns:repeat(2,minmax(0,1fr));gap:5px}.stat{padding:4px 8px}.stat span{font-size:10px}.stat b{font-size:16px;line-height:1.25}
 .memory-session{grid-area:race;font-size:10px}.memory-racers{gap:7px}.memory-racer span{font-size:10px}.memory-racer b{font-size:10px}
 main{grid-area:board}.board{max-width:100%;max-height:100%}.app>footer{grid-area:foot;align-self:start;padding:0}.help{font-size:10px;line-height:1.35}
 body:not([data-backdrop="classic"]) .app>header,body:not([data-backdrop="classic"]) .app>.stats,body:not([data-backdrop="classic"]) .app>footer{padding:4px}
}
@media(max-width:650px) and (max-height:380px) and (orientation:landscape){.app{grid-template-columns:180px minmax(0,1fr);gap:5px 10px}.app>header .brand>span{font-size:16px}.app>header .brand small{font-size:10px}.app>header .sigil{display:none}.memory-top-tools svg{display:none}.memory-session-title{gap:3px}}
@media(prefers-reduced-motion:reduce){.memory .cell,.memory-racer em,.memory-countdown,.scene{transition:none!important;animation:none!important}}
