:root{color-scheme:dark;--art:url("assets/poster-art.webp");--ink:#f8f4ff;--muted:#c1adcf;--line:#483252;--lime:#d7ff63;font-family:"DM Sans",system-ui,sans-serif}
*{box-sizing:border-box}
html,body{margin:0;height:100%;overflow:hidden}
body{color:var(--ink);background:radial-gradient(ellipse at 14% 30%,#342047 0,transparent 53%),radial-gradient(ellipse at 96% 85%,#251637 0,transparent 48%),#0c0912}
body::before{content:"";position:fixed;inset:0;pointer-events:none;opacity:.16;background-image:radial-gradient(#ac80c0 1px,transparent 1px);background-size:19px 19px}
button{font:inherit;color:inherit;cursor:pointer;touch-action:manipulation;-webkit-tap-highlight-color:transparent}
button:focus-visible,canvas:focus-visible{outline:3px solid var(--lime);outline-offset:3px}
button:active{transform:translateY(1px)}
.shell{position:relative;width:min(100%,934px);margin:auto;height:100%;height:100dvh;max-height:820px;padding:max(12px,env(safe-area-inset-top)) max(16px,env(safe-area-inset-right)) max(12px,env(safe-area-inset-bottom)) max(16px,env(safe-area-inset-left));display:grid;grid-template-rows:auto minmax(0,1fr);gap:12px}
.mast,.brand,.actions,.tray-label,.legend-row{display:flex;align-items:center}
.mast,.tray-label{justify-content:space-between}
.brand{gap:10px}
.seal{width:40px;height:40px;border:1px solid #b97dd0;border-radius:12px;background-image:var(--art);background-size:365%;background-position:67% 21%;box-shadow:0 0 14px #f256ef25}
h1{margin:0;font-size:clamp(22px,3vw,29px);line-height:.98;letter-spacing:-1.8px;font-weight:1000;font-style:italic;text-transform:uppercase}
.studio,.micro,h2,.key,.slot small{font-family:"IBM Plex Mono",ui-monospace,monospace;text-transform:uppercase}
.studio{display:block;margin-top:4px;font-size:9px;color:#d5b5dd;letter-spacing:1.15px}
.actions{gap:7px}
.action{background:#25192f;border:1px solid #52395f;border-radius:10px;min-width:42px;min-height:40px;padding:0 12px;display:grid;place-items:center;font-weight:800}
svg{width:19px;height:19px;fill:none;stroke:currentColor;stroke-linecap:round;stroke-linejoin:round;stroke-width:1.8}
.layout{min-height:0;display:grid;grid-template-columns:minmax(0,1.1fr) minmax(0,1fr);gap:16px}
.poster,.cabinet{border:1px solid var(--line);border-radius:22px;overflow:hidden}
.poster{isolation:isolate;position:relative;display:flex;flex-direction:column;justify-content:flex-end;background:#21132d}
.poster::before{content:"";position:absolute;inset:0 0 95px;background:var(--art) left top/cover no-repeat;z-index:-2}
.poster::after{content:"";position:absolute;inset:0;background:linear-gradient(0deg,#190f21 9%,#190f21fa 17%,#190f21c4 25%,transparent 48%);z-index:-1}
.legend{padding:24px}
h2{font-size:12px;letter-spacing:1.6px;margin:0 0 14px;color:var(--lime)}
.legend-row{justify-content:space-between;margin:6px 0;color:#fff;font-size:13px}
.key{font-size:11px;letter-spacing:.6px;color:#e0c9e7}
.cabinet{display:grid;grid-template-rows:auto minmax(0,1fr) auto;gap:10px;padding:12px 14px;background:linear-gradient(150deg,#281a32,#191121 63%,#211629)}
.hud,.slots{display:grid;gap:7px}
.hud{grid-template-columns:1.4fr repeat(3,.8fr) 1fr 1.1fr;gap:0;border:1px solid #49344f;border-radius:11px;background:#170f1e;padding:8px 0}
.stat{padding-left:12px;border-left:1px solid #3b2944;min-width:0}
.stat:first-child{border:0}
.micro{display:block;font-size:10px;letter-spacing:1.1px;color:var(--muted);font-weight:700;line-height:1.2}
.stat b{display:block;font-size:clamp(17px,2.4vh,25px);font-variant-numeric:tabular-nums;line-height:1.1}
.stat:first-child b{color:var(--lime)}
.arena{min-height:0;min-width:0;display:grid;place-items:center;position:relative}
#gameCanvas{display:block;touch-action:none;background:#110e1b;outline:1px solid #866c96;box-shadow:0 0 0 4px #100b18,0 0 0 5px #493553,0 6px 20px #09051170;width:100px;height:200px}
.tray-label{margin:0 1px 7px}
.tray-label strong{font-size:12px;letter-spacing:1.4px;color:var(--ink)}
.tray-label span{font-size:11px;color:var(--muted)}
#bonus{color:var(--lime);font-weight:750}
#pace,#playTime{font-size:clamp(14px,2vh,19px)}
.tray-window{display:grid;grid-template-columns:32px minmax(0,1fr) 32px;gap:5px}
.tray-arrow{border:1px solid #594060;border-radius:9px;background:#281b32;font-size:22px}
.tray-label{flex-wrap:wrap;gap:2px 6px}
.slots{grid-template-columns:repeat(3,minmax(0,1fr));touch-action:none;user-select:none}
.slots .slot{min-width:0;touch-action:none}
.slot{position:relative;height:clamp(43px,6.7vh,62px);border-radius:10px;border:1px solid #594060;background:linear-gradient(#35253e,#261a31);display:grid;place-items:center}
.slot:hover,.action:hover{border-color:#b281be}
.slot small{position:absolute;left:7px;top:5px;font-size:9px;color:#c9b4d3}
.slot canvas{height:100%;width:70%;max-width:82px;pointer-events:none}
dialog{color:var(--ink);width:min(355px,90vw);max-height:90dvh;overflow:auto;padding:26px;background:#25182f;border:1px solid #9164a0;border-radius:19px;box-shadow:0 16px 80px #090511}
dialog::before{content:"";display:block;height:clamp(64px,15vh,115px);margin:-26px -26px 19px;background:linear-gradient(0deg,#25182f,transparent 34%),var(--art) center 23%/cover}
dialog::backdrop{background:#0c0713ce}
dialog h2{font:900 27px/1.2 system-ui;letter-spacing:-1px;color:white;text-transform:none}
dialog p{font-size:14px;line-height:1.55;color:#dfd1e7}
dialog button{min-height:42px;border:0;border-radius:9px;padding:0 14px;font-weight:800;background:var(--lime);color:#20152a;margin:4px 5px 0 0}
dialog button.secondary{background:#42314c;color:white}
[hidden]{display:none!important}
@media(max-width:699px){.poster{display:none}.layout{grid-template-columns:1fr}.shell{max-width:448px;gap:9px}.cabinet{padding:10px;gap:10px;border-radius:17px}}
@media(max-height:510px) and (orientation:landscape){.poster{display:none}.layout{grid-template-columns:1fr}.shell{max-width:720px;gap:4px;padding-top:max(4px,env(safe-area-inset-top));padding-bottom:max(5px,env(safe-area-inset-bottom))}.cabinet{grid-template-columns:1fr 1fr;grid-template-rows:auto 1fr;gap:12px;padding:8px 14px}.arena{grid-column:1;grid-row:1/3}.hud,.tray{grid-column:2}.tray{align-self:center}.seal{width:32px;height:32px}.action{min-height:32px}.hud{gap:0}.stat{padding-left:5px}}

h1{color:#ffe782;text-shadow:1px 2px 0 #70347e}
@media(max-width:699px) and (orientation:portrait){
  .mast{position:relative;isolation:isolate;min-height:clamp(54px,8.4dvh,76px);border:1px solid #634270;border-radius:14px;padding:0 9px;overflow:hidden;background:#24132f}
  .mast::before{content:"";position:absolute;z-index:-1;inset:0;background:linear-gradient(90deg,#1e1029e8 5%,#23112f70 31%,transparent 49%,#1e1029aa 74%,#1e1029 100%),var(--art) 51% 24%/115% auto}
  .mast .seal{display:none}
  .brand{border-radius:5px;text-shadow:0 2px 4px #000}
  .action{min-width:36px;min-height:36px;padding:0 9px;background:#25192fe8}
  .actions{gap:4px}
}
.stat{padding-left:clamp(4px,1vw,8px)}
.cabinet{container-type:inline-size}
@container (max-width:315px){.hud{grid-template-columns:repeat(3,1fr);row-gap:5px}.stat:nth-child(4){border-left:0}}
#standings{width:min(465px,94vw);max-height:92dvh;padding:0;background:#150d24}
#standings::before{display:none}
.board-nav{display:flex;position:sticky;top:0;z-index:1;justify-content:space-between;align-items:center;padding:8px 14px;background:#160d23;border-bottom:1px solid #64417c}
.board-nav button{color:#dcc9ea;background:#35203e;margin:0 4px 0 0;min-height:36px}
.board-nav [aria-pressed=true]{background:#ffdf83;color:#2c1831}
.board-art{display:block;width:100%;height:auto}
.standings-body{padding:16px 18px 12px}
.standings-body h2{font:900 22px/1.1 system-ui;margin:0 0 4px;color:#ffe08a;letter-spacing:-.6px}
#boardCycle,#storageNote{font-size:12px;color:#cbb8db}
#boardCycle{margin:0 0 13px}
#standings table{width:100%;border-collapse:separate;border-spacing:0 4px;text-align:left;font-variant-numeric:tabular-nums}
#standings th{font:700 10px ui-monospace,monospace;text-transform:uppercase;color:#d8c4eb}
#standings th,#standings td{padding:6px 8px}
#standings td{background:#352246;border-block:1px solid #704191;overflow-wrap:anywhere}
#standings td:first-child{border-radius:7px 0 0 7px}
#standings td:last-child{border-radius:0 7px 7px 0}
#standings :is(th,td):last-child{text-align:right}
#standings tbody tr:first-child td{background:#48311d;color:#ffe398;border-color:#b48a4a}
#standings tbody tr:nth-child(2) td{color:#e6e4ff;background:#332c4b}
#standings tbody tr:nth-child(3) td{color:#ffcca2;background:#452a31}
#standings td[colspan]{text-align:center;font-size:14px}
#scoreForm{margin:14px 0}#scoreForm label{display:block;margin-bottom:5px}#scoreForm div{display:flex;gap:6px}
#scoreForm input{min-width:0;flex:1;border:1px solid #815794;background:#160d20;color:white;border-radius:8px;padding:6px;font:inherit}
#scoreForm button{margin:0}
@media(max-width:355px){.mast .action{min-width:30px;padding:0 5px}.mast .studio{font-size:8px}}
#matchStatus:not(:empty){color:#a7fff4;margin-bottom:4px;font:bold 11px system-ui}
body.home .shell{visibility:hidden}
body.home #standings{border-color:#975aac;box-shadow:0 0 50px #b753f129,0 20px 60px #080410}
body.home #standings[open]{display:flex;flex-direction:column;overflow:hidden}
body.home #standings::backdrop{background:radial-gradient(ellipse at 50% 14%,#40224d,#100b19 74%)}
body.home .board-art{height:auto;min-height:0;max-height:40dvh;object-fit:contain;background:#100920}
body.home .board-nav,body.home #homeActions{flex-shrink:0}
body.home .standings-body{overflow:auto;min-height:65px}
#homeActions{display:flex;gap:8px;padding:10px 16px max(12px,env(safe-area-inset-bottom));border-top:1px solid #64417c;background:#1c102a}
#homeActions button{margin:0;flex:1;min-height:44px}
#playHome{background:linear-gradient(120deg,#fff19d,#ffc54c);color:#2a1237}
#playHome.secondary{background:#42314c;color:#fff}
#matchChoice{position:fixed;inset:auto 0 max(4px,env(safe-area-inset-bottom));width:min(420px,96vw);margin:0 auto;padding:8px 12px;text-align:center;border-color:#c587d9}
#matchChoice::before{display:none}#matchChoice::backdrop{background:#110c181f}
#matchChoice h2{font-size:16px;margin:0}
#matchChoice small{color:#dfcbe7;font-size:11px}
.choices{display:flex;gap:6px}.choices button{flex:1;margin:4px 0;min-height:38px}
@media(min-width:700px) and (min-height:511px){#matchChoice{right:max(16px,calc((100vw - 900px)/2));left:auto;bottom:max(12px,calc(100dvh - 807px));width:min(40vw,410px)}}
@media(max-height:510px) and (orientation:landscape){#matchChoice{right:3vw;left:auto;bottom:8vh;width:43vw}body.home .board-art{max-height:23dvh}}
@media(orientation:portrait){body:has(#matchChoice[open]) .tray{min-height:92px}}

/* Give the grid first claim on the visible portrait viewport. */
@media (max-width:699px) and (orientation:portrait) {
  .shell {
    max-width:none; max-height:none;
    padding:max(3px,env(safe-area-inset-top)) max(5px,env(safe-area-inset-right)) max(4px,env(safe-area-inset-bottom)) max(5px,env(safe-area-inset-left));
    gap:4px;
  }
  .mast {min-height:40px;padding:0 5px 0 9px;border-radius:9px}
  .mast h1 {font-size:21px}.mast .studio {font-size:7px;margin-top:2px}
  .mast .actions {gap:2px}.mast .action {min-height:38px;min-width:38px;padding:0 8px;border:0;background:#20112bdc}
  .cabinet {padding:2px 1px;gap:3px;border:0;border-radius:0;background:transparent}
  .hud {grid-template-columns:minmax(0,1.5fr) repeat(3,minmax(0,.74fr)) minmax(0,1fr) minmax(0,1fr);row-gap:0;padding:3px 0;border-radius:7px}
  .hud .stat {padding-left:4px}.hud .stat:nth-child(4){border-left:1px solid #3b2944}
  .hud .micro {font-size:9px;letter-spacing:.35px}
  .hud .stat b {font-size:14px;line-height:1.1}
  .arena {overflow:hidden}
  #gameCanvas {position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);outline:1px solid #696187;box-shadow:0 0 0 2px #201831}
  .tray {min-width:0;display:grid;grid-template-columns:auto minmax(0,1fr);align-content:end;column-gap:7px;row-gap:3px}
  .tray-label {grid-row:1;grid-column:1;gap:4px;margin:0;align-items:center}
  .tray:has(#matchStatus:empty) .tray-label {grid-column:1/-1}
  #matchStatus {grid-row:1;grid-column:2;align-self:center;text-align:right}
  #matchStatus:not(:empty) {font-size:10px;margin:0}
  .tray:has(#matchStatus:not(:empty)) .tray-label {max-width:48vw}
  .tray:has(#matchStatus:not(:empty)) #swapHint[data-default] {display:none}
  #swapHint:empty,#bonus:empty {display:none}
  .tray-window {grid-column:1/-1;grid-template-columns:40px minmax(0,1fr) 40px}
  .slot {height:44px}
  .tray-label strong,.tray-label span {font-size:10px}
}
/* A short portrait viewport has room for the counters alongside the board. */
@media (max-width:699px) and (orientation:portrait) and (min-aspect-ratio: 54/100) {
  .cabinet {grid-template-columns:minmax(0,1fr) clamp(48px,13vw,64px);grid-template-rows:minmax(0,1fr) auto;column-gap:3px}
  .arena {grid-row:1;grid-column:1}
  .hud {grid-row:1;grid-column:2;display:flex;flex-direction:column;align-self:center;gap:0;padding:0}
  .hud .stat,.hud .stat:nth-child(4) {padding:6px 3px;border:0;border-bottom:1px solid #3b2944}
  .hud .stat:last-child {border-bottom:0}
  .hud .stat b {overflow-wrap:anywhere}
  .tray {grid-row:2;grid-column:1/-1}
}

.hud .micro,.tray-label strong {font-family:system-ui,sans-serif;font-weight:900;letter-spacing:.045em}
.hud .stat b {font-family:system-ui,sans-serif;font-weight:900;letter-spacing:-.035em}
#choiceTitle,#panelTitle,#boardTitle {font-style:italic;font-weight:950}
#standings #soundToggle{margin-left:auto;color:#e3d9ef;background:#34223e;font-size:12px}
#matrixBackdrop{position:fixed;inset:0;width:100%;height:100%;z-index:0;pointer-events:none;background:#061325}
body.home #matrixBackdrop{display:none}
.shell{z-index:1}
body:not(.home) .cabinet{background:transparent}
#gameCanvas{background:#0d1020}
#panel[data-record]::before{display:none}
#panel[data-record]{border-color:#ffbf53;background:linear-gradient(#3e184c,#21122d 65%)}
#winnerKiss{position:relative;display:grid;place-items:center;overflow:hidden;margin:-26px -26px 14px;background:radial-gradient(ellipse,#871960,#240f38 78%);border-bottom:2px solid #ffc764}
.kiss-scene{position:relative;max-width:100%;width:min(100%,35.6dvh);aspect-ratio:1404/1536}
.kiss-scene img{display:block;width:100%;height:100%}
#winnerKiss>span{position:absolute;bottom:5px;left:50%;transform:translateX(-50%);padding:2px 10px;border-radius:20px;background:#230b37e8;border:1px solid #fed76a;font-size:18px;letter-spacing:2px}
.kiss-scene::after{content:"";position:absolute;inset:0;pointer-events:none;background:repeating-conic-gradient(from 9deg at 62% 44%,transparent 0deg 18deg,#ffe49a88 19deg 22deg,transparent 23deg 32deg),radial-gradient(circle at 62% 44%,#fffbd7,transparent 54%);animation:recordBurst .6s ease-out both}
@keyframes recordBurst{0%{opacity:0;transform:scale(.35)}24%{opacity:.85}100%{opacity:0;transform:scale(1.25)}}
.kiss-bubbles i{position:absolute;z-index:1;left:61%;top:42%;font:normal clamp(18px,5vw,30px)/1 system-ui;--dx:32px;animation:kissRise 1.45s ease-out .18s 2 both}
.kiss-bubbles i:nth-child(2){--dx:65px;animation-delay:.38s}
.kiss-bubbles i:nth-child(3){--dx:4px;animation-delay:.57s}
.kiss-bubbles i:nth-child(4){--dx:43px;animation-delay:.77s}
@keyframes kissRise{0%{opacity:0;transform:translate(0,0) scale(.45)}18%{opacity:1}75%{opacity:.95}100%{opacity:0;transform:translate(var(--dx),-85px) rotate(-16deg) scale(1.22)}}
@media(prefers-reduced-motion:reduce){.kiss-scene::after,.kiss-bubbles i{animation:none;opacity:0}.kiss-bubbles i:first-child{opacity:1}}
#helloKiss,.score-pop{pointer-events:none}
#helloKiss{position:absolute;left:50%;top:45%;translate:-50% -50%;height:min(57%,345px);aspect-ratio:22/39;max-width:92%;overflow:hidden;border:2px solid #ffe09e;border-radius:15px;background:#251035;box-shadow:0 0 0 2px #612589,0 3px 18px #100418bd}
#helloKiss video{display:block;width:100%;height:100%;object-fit:contain}
#helloKiss b{position:absolute;inset:auto 0 0;text-align:center;padding:12% 0 5%;color:#fff3bc;background:linear-gradient(transparent,#240a3ced 85%);font:italic 950 clamp(17px,5vw,29px)/1 system-ui;text-shadow:0 2px 2px #501753}
.score-pop{--trim:#62f3ff;--deep:#054c80;--edge:#7a54ff;isolation:isolate;box-sizing:border-box;display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:clamp(4px,1.4vw,12px);width:min(94%,405px);padding:clamp(9px,2vw,14px) clamp(12px,3vw,22px);color:#fff;text-shadow:0 2px 2px #100725;filter:drop-shadow(0 3px 4px #10051cad)}
.score-pop[data-kind=column]{--trim:#c2ff68;--deep:#0a6648;--edge:#21ddeb}
.score-pop[data-kind=color]{--trim:#ff8ee7;--deep:#6d136c;--edge:#a57cff}
.score-pop[data-kind=chain]{--trim:#ffdf6e;--deep:#912b28;--edge:#ff6786}
#scorePop{position:absolute;left:50%;top:25%;translate:-50% -50%}
#endPop{position:relative;margin:7px auto}
.score-pop::before,.score-pop::after{position:absolute;content:"";inset:0;z-index:-1;clip-path:polygon(5% 0,100% 0,97% 52%,100% 100%,0 100%,2% 52%,0 26%);background:linear-gradient(110deg,#fff 0%,var(--trim) 22%,var(--edge) 70%,#fff 99%)}
.score-pop::after{inset:2px 4px;background:linear-gradient(106deg,transparent 0 22%,#ffffff15 22% 24%,transparent 24% 26%,#ffffff12 26% 27%,transparent 27%),linear-gradient(120deg,var(--deep),#170f32 69%,var(--deep));box-shadow:inset 0 3px #ffffff24}
.score-pop i{font:normal clamp(23px,7vw,38px)/1 system-ui}
.score-pop strong,.score-pop b,.score-pop small,.score-pop em{display:block}
.score-pop strong{color:var(--trim);font:italic 950 clamp(14px,4.9vw,26px)/1 system-ui;letter-spacing:-.055em;text-transform:uppercase}
.score-pop em{color:#fff;font:650 clamp(10px,2.5vw,12px)/1.2 system-ui;margin-top:4px}
.score-pop aside{text-align:right;border-left:1px solid var(--trim);padding-left:6px}
.score-pop b{font:italic 950 clamp(17px,5vw,27px)/1 system-ui;color:#fff3ae}
.score-pop small{font:750 10px/1.4 system-ui}

/* settings */
#settings::before{display:none}
.setting{display:flex;justify-content:space-between;align-items:center;gap:14px;padding:12px 0;border-top:1px solid #ffffff1a}
.setting b{display:block;color:#fff;font-size:15px}
.setting small{display:block;color:#cbb9d6;font-size:12px;line-height:1.4;margin-top:2px}
dialog button.toggle{min-width:62px;margin:0;background:#42314c;color:#fff;flex:none}
dialog button.toggle[aria-pressed=true]{background:var(--lime);color:#20152a}
#closeSettings{margin-top:14px;width:100%}
/* iPhone haptics: taps reach a hidden native switch through these labels */
.haptic-wrap{display:contents}
.haptic-cover{position:absolute;inset:0;border-radius:inherit}
.haptic-switch{position:fixed;left:0;top:0;width:1px;height:1px;margin:0;opacity:0;pointer-events:none}

/* How to play: basics first, details folded */
.help-basics{list-style:none;margin:0 0 12px;padding:0;display:grid;gap:10px}
.help-basics li{display:grid;grid-template-columns:30px minmax(0,1fr);gap:10px;align-items:start;font-size:14px;line-height:1.45;color:#dfd1e7}
.help-basics i{font-style:normal;display:grid;place-items:center;width:30px;height:30px;border-radius:8px;background:#3a2846;color:var(--lime);font-size:16px}
.help-basics b{color:#fff}
.help-keys{font-size:12px!important;color:#bba8c7!important}
@media(pointer:coarse){.help-keys{display:none}}
.help-more{margin:4px 0 12px;border-top:1px solid #ffffff1a;padding-top:10px}
.help-more summary{cursor:pointer;font-weight:800;color:#fff;font-size:14px;min-height:32px;display:flex;align-items:center;gap:8px;list-style:none}
.help-more summary::-webkit-details-marker{display:none}
.help-more summary::before{content:"";width:7px;height:7px;border-right:2px solid var(--lime);border-bottom:2px solid var(--lime);transform:rotate(-45deg);transition:transform .15s}
.help-more[open] summary::before{transform:rotate(45deg)}
.help-more ul{margin:6px 0 0;padding-left:18px;display:grid;gap:7px;font-size:13px;line-height:1.5;color:#dfd1e7}
/* first-game hint under the board */
#firstHint{position:absolute;left:50%;bottom:10px;transform:translateX(-50%);z-index:3;max-width:calc(100% - 16px);padding:7px 12px;border-radius:999px;background:#120b1ce6;border:1px solid #c6ff3d88;color:#fff;font:700 13px/1.2 system-ui,sans-serif;text-align:center;pointer-events:none;white-space:nowrap}
@media(max-width:360px){#firstHint{white-space:normal}}

/* way back to the website */
a.brand{color:inherit;text-decoration:none;border-radius:10px}
a.brand:focus-visible{outline:3px solid var(--lime);outline-offset:3px}
.studio .back{color:var(--lime);font-weight:700}
a.brand.embedded{pointer-events:none}
a.brand.embedded .back{display:none}
.tournament-run a.brand{pointer-events:none}
.tournament-run .studio .back{visibility:hidden}
.boards-home{flex-basis:100%;display:flex;align-items:center;justify-content:center;min-height:42px;margin-top:2px;border:1px solid #6b4f7a;border-radius:9px;background:#2a1d35;color:#fff;font-size:14px;font-weight:800;text-decoration:none}
a.brand:not(.embedded) .studio{color:var(--lime);font-size:10px;font-weight:700}
.tournament-run a.brand .studio{color:#d5b5dd}
.boards-home.embedded{display:none}
#homeActions{flex-wrap:wrap}
#panelHome{margin-top:10px}
#panelHome[hidden]{display:none}

/* Board celebrations. The ink silhouette sits behind the two-tone burst. */
.board-blast {
  --ink-edge: #311437;
  --burst-light: #ffed71;
  --burst-dark: #ff971e;
  --burst-shape: polygon(50% 0,57% 17%,73% 4%,74% 23%,95% 16%,87% 35%,100% 40%,89% 52%,100% 65%,82% 69%,88% 89%,68% 82%,61% 100%,50% 87%,35% 98%,31% 82%,11% 90%,17% 69%,0 66%,11% 52%,0 40%,15% 35%,6% 15%,27% 23%,28% 4%,44% 17%);
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  isolation: isolate;
  pointer-events: none;
  container-type: size;
}
#levelBlast { z-index: 5 }
.board-blast::before, .board-blast::after {
  content: "";
  position: absolute;
  width: min(82cqw, 68cqh, 320px);
  aspect-ratio: 1.12;
  clip-path: var(--burst-shape);
  background: var(--ink-edge);
  animation: blast-open .44s cubic-bezier(.18,.85,.28,1.18) both;
}
.board-blast::before { translate: 0 4px; scale: 1.055 }
.board-blast::after {
  background:
    radial-gradient(circle, #31143730 1px, transparent 1.5px) 0 0 / 6px 6px,
    repeating-conic-gradient(from 8deg, transparent 0deg 16deg, #fff8cb70 17deg 25deg, transparent 26deg 45deg),
    linear-gradient(160deg, var(--burst-light) 28%, var(--burst-dark) 76%);
}
.blast-stamp {
  z-index: 2;
  position: relative;
  display: grid;
  justify-items: center;
  width: 96%;
  color: #fff7cd;
  text-align: center;
  transform: rotate(-5deg);
  animation: stamp-land .44s cubic-bezier(.17,.86,.3,1.15) both;
}
.blast-stamp b {
  display: block;
  font: italic 1000 min(13cqw, 13cqh, 54px)/.97 system-ui, sans-serif;
  letter-spacing: -.065em;
  -webkit-text-stroke: .10em var(--ink-edge);
  paint-order: stroke fill;
  text-shadow: 0 .08em var(--ink-edge), .035em .12em var(--ink-edge);
}
.blast-level {
  display: table;
  margin: 0 auto .17em;
  padding: .2em .7em .24em;
  border: 2px solid var(--ink-edge);
  border-radius: 3px;
  background: #ad206f;
  box-shadow: 0 3px var(--ink-edge), inset 0 2px #ff8dcc;
  color: white;
  font: 950 .43em/1 system-ui, sans-serif;
  letter-spacing: .1em;
  -webkit-text-stroke: 0;
  text-shadow: none;
}
.blast-mark {
  --u: min(1.8cqw, 1.8cqh, 7px);
  display: block;
  width: calc(7 * var(--u));
  height: calc(4 * var(--u));
  margin-bottom: min(1.8cqh, 8px);
  filter: drop-shadow(0 -1px var(--ink-edge)) drop-shadow(0 2px var(--ink-edge));
}
/* A seven-block crown with a ruby set in its brim. */
.blast-mark::before {
  content: "";
  display: block;
  height: 100%;
  clip-path: polygon(0 0,15% 0,15% 27%,30% 27%,30% 48%,43% 48%,43% 0,57% 0,57% 48%,71% 48%,71% 27%,85% 27%,85% 0,100% 0,100% 72%,86% 72%,86% 100%,14% 100%,14% 72%,0 72%);
  background: linear-gradient(#ff38af 0 0) center 77% / var(--u) var(--u) no-repeat,
    repeating-linear-gradient(0deg, #e98110 0 2px, #ffda44 2px var(--u));
}
#slowBlast {
  --burst-light: #ccfcff;
  --burst-dark: #219bdd;
  --ink-edge: #20214f;
}
#slowBlast .blast-stamp { animation: slow-stamp 1.15s ease-out both }
#slowBlast::before, #slowBlast::after { width: min(76cqw, 62cqh, 265px) }
#slowBlast .blast-stamp b { color: #f3feff; font-size: min(12cqw, 12cqh, 49px) }
#slowBlast .blast-mark::before {
  clip-path: polygon(0 50%,47% 0,47% 44%,100% 0,100% 100%,47% 56%,47% 100%);
  background: linear-gradient(#fff 0 44%, #6bdfff 44% 75%, #237bd3 75%);
}
@keyframes blast-open {
  from { transform: rotate(-12deg) scale(.4); opacity: 0 }
  to { transform: rotate(0) scale(1); opacity: 1 }
}
@keyframes stamp-land {
  from { transform: rotate(-13deg) scale(.65); opacity: 0 }
  68% { transform: rotate(-3deg) scale(1.06); opacity: 1 }
  to { transform: rotate(-5deg) scale(1) }
}
@keyframes slow-stamp {
  0% { opacity: 0; transform: translateX(-42%) rotate(-9deg) }
  22%, 76% { opacity: 1; transform: rotate(-5deg) }
  100% { opacity: 0; transform: translateX(45%) rotate(-2deg) }
}

/* Fixed confetti pool: each shard is a tiny tiled game piece. */
.blast-confetti { position: absolute; inset: 0; z-index: 1 }
.blast-confetti i {
  --tile: clamp(4px, 2cqw, 8px);
  --color: #ff38af;
  --angle: 0deg;
  --reach: min(41cqw, 36cqh, 165px);
  --cut: polygon(0 0,100% 0,100% 50%,67% 50%,67% 100%,33% 100%,33% 50%,0 50%);
  position: absolute;
  top: 50%;
  left: 50%;
  width: calc(3 * var(--tile));
  height: calc(2 * var(--tile));
  clip-path: var(--cut);
  background:
    linear-gradient(90deg, #301737 1px, transparent 1px),
    linear-gradient(#fff9 1px, transparent 1px calc(100% - 1px), #311437 0),
    var(--color);
  background-size: var(--tile) var(--tile);
  transform: translate(-50%, -50%) rotate(var(--angle)) translateY(calc(-1 * var(--reach))) rotate(25deg);
  animation: shard-throw .92s cubic-bezier(.14,.75,.28,1) both;
}
.blast-confetti i:nth-child(3n + 2) {
  --color: #00deff;
  --cut: polygon(0 0,33% 0,33% 50%,100% 50%,100% 100%,0 100%);
  animation-duration: 1.12s;
}
.blast-confetti i:nth-child(3n) {
  --color: #b2ff63;
  --cut: polygon(33% 0,100% 0,100% 50%,67% 50%,67% 100%,0 100%,0 50%,33% 50%);
  animation-duration: .8s;
}
.blast-confetti i:nth-child(2)  { --angle: 29deg }
.blast-confetti i:nth-child(3)  { --angle: 57deg }
.blast-confetti i:nth-child(4)  { --angle: 87deg }
.blast-confetti i:nth-child(5)  { --angle: 119deg }
.blast-confetti i:nth-child(6)  { --angle: 152deg }
.blast-confetti i:nth-child(7)  { --angle: 184deg }
.blast-confetti i:nth-child(8)  { --angle: 214deg }
.blast-confetti i:nth-child(9)  { --angle: 240deg }
.blast-confetti i:nth-child(10) { --angle: 269deg }
.blast-confetti i:nth-child(11) { --angle: 299deg }
.blast-confetti i:nth-child(12) { --angle: 329deg }
@keyframes shard-throw {
  from { opacity: 0; transform: translate(-50%, -50%) rotate(var(--angle)) translateY(-1em) rotate(-75deg) scale(.6) }
  20% { opacity: 1 }
}

/* Give the victory title the center and the flying chip a clear path above it. */
.arena:has(#levelBlast:not([hidden])) #scorePop {
  top: auto;
  bottom: 2%;
  translate: -50% 0;
}
@media (max-height: 510px) and (orientation: landscape) {
  .arena:has(#slowBlast:not([hidden])) #scorePop {
    top: auto;
    bottom: 2%;
    translate: -50% 0;
  }
}

/* In-play award ticket. The game-over recap uses the original card. */
#scorePop {
  gap: 7px;
  width: min(94%, 355px);
  padding: 7px 9px;
  border: 3px solid #301535;
  border-radius: 8px;
  background: linear-gradient(115deg, #fff6 0 3%, transparent 3% 5%, #fff3 5% 7%, transparent 7%), var(--trim);
  box-shadow: inset 0 2px #fffc, 0 4px #301535;
  color: #301535;
  text-shadow: none;
  filter: none;
}
#scorePop::before, #scorePop::after { content: none }
#scorePop i {
  display: grid;
  place-items: center;
  width: 1.4em;
  aspect-ratio: 1;
  border: 2px solid #301535;
  border-radius: 6px;
  background: var(--deep);
  box-shadow: inset 0 2px #fff5, 0 2px #301535;
  font-size: clamp(17px, 4vw, 25px);
  transform: rotate(-6deg);
}
#scorePop strong, #scorePop em { color: #301535 }
#scorePop strong { font-size: clamp(15px, 4vw, 23px) }
#scorePop aside {
  padding: 4px 6px;
  border: 0;
  border-radius: 4px;
  background: #301535;
  color: white;
}
#scorePop b { color: #ffec82 }
#pointsFlight {
  position: fixed;
  z-index: 8;
  pointer-events: none;
  opacity: 0;
  display: inline-flex;
  align-items: center;
  gap: .25em;
  padding: .15em .42em .21em;
  white-space: nowrap;
  border: 3px solid #311437;
  border-radius: 7px;
  background: linear-gradient(#fff4a3 0 18%, #ffdf57 18% 76%, #ffae33 76%);
  box-shadow: 0 3px #311437;
  color: #311437;
  font: italic 1000 clamp(16px, 4vw, 22px)/1 system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
}
#pointsFlight::before {
  content: "";
  width: .65em;
  height: .65em;
  border: 2px solid #311437;
  border-radius: 2px;
  background: conic-gradient(#97f9ff 25%, #188ed9 0 50%, #00cce8 0 75%, #efffff 0);
  transform: rotate(45deg);
}
@media (prefers-reduced-motion: reduce) {
  .board-blast::before, .board-blast::after, .board-blast .blast-stamp,
  #slowBlast .blast-stamp, .blast-confetti i { animation: none }
  #pointsFlight { display: none }
}

/* Juicy countdown timer for Level 1 */
#playTime {
  font-size: clamp(20px, 6vw, 32px) !important;
  font-weight: 950;
  color: #ffe566;
  text-shadow: 0 0 10px #ff6ec7, 0 2px 0 #4a148c;
  letter-spacing: -0.03em;
  animation: timerPulse 1s ease-in-out infinite;
}
@keyframes timerPulse {
  0%, 100% { transform: scale(1); filter: brightness(1); }
  50% { transform: scale(1.12); filter: brightness(1.3); }
}
.hud .stat:last-child b {
  display: inline-block;
}
