:root{font-family:Inter,ui-rounded,system-ui,sans-serif;color:#172033;background:#eef3f7;--blue:#1559c4;--red:#ef4456;--yellow:#ffd447}*{box-sizing:border-box}body{margin:0;min-height:100vh;display:grid;place-items:center}.shell{width:min(1050px,100%);min-height:min(720px,100vh);background:#fff;border-radius:24px;box-shadow:0 20px 60px #20304a22;padding:24px 30px}header{display:flex;justify-content:space-between;align-items:center;border-bottom:1px solid #dfe6ee;padding-bottom:13px}h1{margin:0;font-size:2rem}h1 span{color:var(--blue)}nav{display:flex;gap:7px}button,select,input{font:inherit;border:1px solid #cdd8e5;border-radius:10px;background:#fff;padding:.65rem .8rem}button{cursor:pointer}nav button.active,.primary{color:#fff;background:var(--blue);border-color:var(--blue)}.panel{display:grid;grid-template-columns:minmax(440px,1fr) 260px;gap:32px;padding:24px 0}.hidden{display:none}.game-area{display:grid;place-items:center}.status{text-align:center;margin-bottom:12px}.status strong,.status small{display:block}.status small{color:#718098}.board{width:min(100%,560px);aspect-ratio:7/6;padding:14px;display:grid;grid-template-columns:repeat(7,1fr);grid-template-rows:repeat(6,1fr);gap:8px;background:linear-gradient(145deg,#176bd8,#0d49a8);border-radius:20px;box-shadow:inset 0 -8px 0 #0a3a88,0 12px 25px #12366e2b}.cell{border:0;padding:0;border-radius:50%;background:#f2f6fa;box-shadow:inset 0 5px 9px #0a36794d;aspect-ratio:1}.cell.p1{background:radial-gradient(circle at 35% 30%,#ff8590,var(--red) 55%,#b91934)}.cell.p2{background:radial-gradient(circle at 35% 30%,#fff4a0,var(--yellow) 55%,#dda900)}.cell:not(.p1):not(.p2):hover{background:#dbe8f5}aside{display:flex;flex-direction:column;gap:8px;background:#f6f8fb;padding:20px;border-radius:16px}aside label{font-size:.76rem;font-weight:700;margin-top:5px}.seed{display:flex;gap:6px}.seed input{min-width:0;width:100%}.note{color:#65758b;font-size:.76rem;line-height:1.4}.arena-card{grid-column:1/-1;max-width:700px;margin:auto;text-align:center}.versus{display:flex;gap:15px;align-items:center;justify-content:center;margin:24px}.arena-card pre{text-align:left;white-space:pre-wrap;background:#101827;color:#d8e7ff;padding:18px;border-radius:12px;min-height:120px}dialog{max-width:480px;border:0;border-radius:18px;padding:28px;box-shadow:0 20px 60px #0004}dialog::backdrop{background:#17203399}#closeHelp{float:right;border:0;font-size:1.3rem}@media(max-width:760px){body{display:block}.shell{border-radius:0;padding:14px;min-height:100vh}header{align-items:flex-end}nav button{padding:.55rem}nav button:first-child,nav button:nth-child(2){font-size:0}nav button:first-child:after{content:'●';font-size:1rem}nav button:nth-child(2):after{content:'⚔';font-size:1rem}.panel{grid-template-columns:1fr;padding:12px 0;gap:14px}.game-area{order:1}.board{width:min(92vw,55vh);padding:8px;gap:5px}aside{order:2;display:grid;grid-template-columns:1fr 1fr;padding:12px}aside .primary,aside .note{grid-column:1/-1}.status{margin-bottom:5px}h1{font-size:1.55rem}}
.menu-panel{padding:42px 0 20px;max-width:820px;margin:auto}.menu-copy{text-align:center;margin-bottom:28px}.menu-copy h2{font-size:2rem;margin:.25rem 0}.menu-copy p:last-child{color:#65758b}.menu-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:14px}.menu-card{min-height:112px;text-align:left;padding:20px;display:flex;flex-direction:column;justify-content:center;gap:7px}.menu-card strong{font-size:1.2rem}.menu-card span{font-size:.82rem;opacity:.78}.menu-card:last-child{grid-column:1/-1}.close-dialog{float:right;border:0;font-size:1.3rem}aside h2{margin:0 0 4px}#labControls{display:flex;flex-direction:column;gap:8px}#labControls.hidden{display:none}#credits a{color:var(--blue);font-weight:700}@media(max-width:760px){.menu-panel{padding:24px 0}.menu-grid{grid-template-columns:1fr}.menu-card:last-child{grid-column:auto}nav button:first-child,nav button:nth-child(2){font-size:inherit}nav button:first-child:after,nav button:nth-child(2):after{content:none}#labControls{grid-column:1/-1}}
.setup-screen{min-height:610px;display:grid;place-items:center;padding:28px 0 10px}.setup-card{width:min(100%,520px);padding:34px;border:1px solid #dfe6ee;border-radius:22px;background:#f8fafc;box-shadow:0 20px 55px #20304a18;text-align:center}.setup-mark{font-size:3.1rem;line-height:1}.setup-card h2{font-size:2.4rem;margin:.15rem 0}.setup-card>p{color:#65758b;margin:.25rem 0 1.6rem}.setup-form{display:flex;flex-direction:column;gap:9px;text-align:left}.setup-form label{font-size:.8rem;font-weight:750;margin-top:5px}.setup-label{display:flex;align-items:center;gap:.35rem}.setup-label label{margin:0}.info-button{border:0;background:transparent;color:var(--blue);padding:.1rem .25rem;font-size:1.05rem}.play-button{margin-top:12px;text-align:center}.secondary-menu{display:flex;justify-content:center;flex-wrap:wrap;gap:7px;margin-top:18px;padding-top:15px;border-top:1px solid #dfe6ee}.secondary-menu button{padding:.45rem .65rem;font-size:.78rem}.app-footer{grid-column:1/-1;margin-top:12px;color:#718098;font-size:.72rem;text-align:center}.app-footer a{color:var(--blue);font-weight:750;text-decoration:none}.level-badge{padding:.65rem .8rem;border:1px solid #dbe4ef;border-radius:10px;background:#fff;color:#34445a;font-weight:750;text-align:center}.difficulty-body{max-height:58vh;overflow:auto}.difficulty-body section+section{border-top:1px solid #e4e9ef;margin-top:13px;padding-top:11px}.difficulty-body h3{margin:.2rem 0 .45rem;font-size:.95rem}.difficulty-body ul{list-style:none;margin:0;padding:0;columns:2;column-gap:22px}.difficulty-body li{break-inside:avoid;padding:.2rem 0;color:#526176;font-size:.82rem;border-bottom:1px dotted #d8dee7}@media(max-width:600px){.setup-screen{min-height:auto;padding:20px 0}.setup-card{padding:22px 16px}.difficulty-body ul{columns:1}}
.hidden{display:none!important}.board{overflow:hidden}.cell.chip-drop{position:relative;z-index:2;animation:chip-drop var(--drop-duration,420ms) cubic-bezier(.22,.72,.28,1.18) both;will-change:transform}@keyframes chip-drop{0%{transform:translateY(calc(-1 * var(--drop-distance)));filter:brightness(1.12)}76%{transform:translateY(5%)}89%{transform:translateY(-2%)}100%{transform:translateY(0);filter:none}}@media(prefers-reduced-motion:reduce){.cell.chip-drop{animation:none}}
body[data-screen="play"]{height:100dvh;min-height:0;overflow:hidden}body[data-screen="play"] .shell{height:100dvh;min-height:0;overflow:hidden;display:flex;flex-direction:column}body[data-screen="play"] header{flex:0 0 auto}body[data-screen="play"] #playPanel{flex:1;min-height:0;align-items:center;padding:clamp(8px,2vh,20px) 0}body[data-screen="play"] .game-area{height:100%;min-height:0;grid-template-rows:auto minmax(0,1fr)}body[data-screen="play"] .board{width:min(560px,calc((100dvh - 150px)*7/6),calc(100vw - 360px));max-width:100%;max-height:calc(100dvh - 150px)}body[data-screen="play"] aside{max-height:calc(100dvh - 110px);overflow:hidden}
@media(max-width:760px){body[data-screen="play"] .shell{padding:max(8px,env(safe-area-inset-top)) max(10px,env(safe-area-inset-right)) max(8px,env(safe-area-inset-bottom)) max(10px,env(safe-area-inset-left))}body[data-screen="play"] header{padding-bottom:8px}body[data-screen="play"] #playPanel{grid-template-rows:minmax(0,1fr) auto;gap:8px;padding:8px 0}body[data-screen="play"] .game-area{order:1}body[data-screen="play"] .board{width:min(94vw,calc((100dvh - 245px)*7/6));max-height:calc(100dvh - 245px);padding:clamp(5px,1.5vw,8px);gap:clamp(3px,1vw,5px)}body[data-screen="play"] aside{order:2;max-height:none;padding:8px 10px;gap:5px;grid-template-columns:auto 1fr}body[data-screen="play"] aside h2{font-size:1rem;align-self:center}body[data-screen="play"] .level-badge{padding:.45rem .55rem;font-size:.78rem}body[data-screen="play"] aside .primary{grid-column:1/2;padding:.48rem .65rem}body[data-screen="play"] aside .note{grid-column:2/3;margin:0;align-self:center}body[data-screen="play"] .status{margin-bottom:4px;font-size:.9rem}body[data-screen="play"] .status small{font-size:.72rem}}
@media(max-width:420px),(max-height:620px){body[data-screen="play"] .board{width:min(94vw,calc((100dvh - 220px)*7/6));max-height:calc(100dvh - 220px)}body[data-screen="play"] header h1{font-size:1.25rem}body[data-screen="play"] nav button{padding:.42rem .52rem}body[data-screen="play"] aside h2{display:none}body[data-screen="play"] aside{grid-template-columns:1fr 1fr}}
.arena-card{width:min(920px,100%);max-width:none}.arena-output{margin-top:18px;text-align:left}.arena-summary{display:flex;align-items:center;justify-content:space-between;gap:12px;margin:12px 0}.arena-summary label{font-size:.8rem}.arena-summary select{padding:.4rem}.table-scroll{overflow:auto;border:1px solid #dfe6ee;border-radius:12px}.arena-output table{width:100%;border-collapse:collapse;font-variant-numeric:tabular-nums}.arena-output th,.arena-output td{padding:.55rem .65rem;border-bottom:1px solid #e6ebf1;text-align:right;white-space:nowrap}.arena-output th:nth-child(2),.arena-output td:nth-child(2),.arena-output th:nth-child(3),.arena-output td:nth-child(3){text-align:left}.arena-output tbody tr:last-child td{border-bottom:0}.badge{display:inline-block;padding:.15rem .42rem;border-radius:999px;background:#e8eef6;color:#526176;font-size:.68rem}.badge.derived{background:#e8f2ff;color:#1559c4}.badge.control{background:#fff2cc;color:#795d00}.arena-output details{margin-top:12px}.arena-output summary{cursor:pointer;font-weight:700;font-size:.8rem}@media(max-width:760px){.arena-summary{align-items:flex-start;flex-direction:column}.arena-output th,.arena-output td{padding:.45rem}.arena-card{width:100%}}
.lab-control.mode-hidden{display:none!important}#strength option{font-variant-numeric:tabular-nums}
.strength-ranking{margin:14px 0;text-align:left}.strength-ranking summary{cursor:pointer;font-weight:700}.strength-ranking .table-scroll{margin-top:10px;max-height:330px}.strength-ranking table{width:100%;border-collapse:collapse;font-variant-numeric:tabular-nums}.strength-ranking th,.strength-ranking td{padding:.45rem .6rem;border-bottom:1px solid #e6ebf1;text-align:right}.strength-ranking th:nth-child(2),.strength-ranking td:nth-child(2){text-align:left}
.cell.winner{z-index:3;animation:winner-pulse .72s ease-in-out infinite alternate;outline:3px solid #fff;outline-offset:-3px}.cell.chip-drop.winner{animation:chip-drop var(--drop-duration,420ms) cubic-bezier(.22,.72,.28,1.18) both,winner-pulse .72s ease-in-out var(--drop-duration,420ms) infinite alternate}@keyframes winner-pulse{from{filter:brightness(1);transform:scale(1)}to{filter:brightness(1.24);transform:scale(.9)}}.result-dialog{width:min(420px,calc(100vw - 28px));text-align:center;padding:30px;border:1px solid #ffffff55;background:#fff;color:#172033}.result-dialog::backdrop{background:#10203bb8;backdrop-filter:blur(3px)}.result-icon{font-size:3.4rem;line-height:1;margin-bottom:.4rem}.result-dialog h2{font-size:1.8rem;margin:.25rem 0}.result-dialog p{color:#65758b;margin:.4rem 0 1.3rem}.result-actions{display:grid;grid-template-columns:1fr 1fr;gap:9px}.result-actions button{width:100%}@media(prefers-reduced-motion:reduce){.cell.winner,.cell.chip-drop.winner{animation:none}}
