*{box-sizing:border-box}
body{margin:0;background:#0b111d;color:#f0f7fb;font:15px system-ui,sans-serif}
main{height:100dvh;max-width:570px;margin:auto;padding:12px;display:grid;grid-template-rows:auto auto minmax(140px,1fr) auto auto;gap:8px}
h1{font-size:clamp(1.3rem,5vw,1.9rem);margin:0}
details{background:#172538;border:1px solid #40536e;border-radius:10px;padding:8px 10px}
summary{font-weight:750;cursor:pointer}
.settings{display:grid;gap:7px;margin-top:8px}
textarea{width:100%;height:48px;resize:none}
textarea,select,button{font:inherit}
textarea,select{background:#0c1728;color:#f0f7fb;border:1px solid #5d7896;border-radius:7px;padding:6px}
.choice{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.arena{min-height:0;overflow:hidden;border:1px solid #405875;border-radius:14px;background:#101d30;display:grid;place-items:center}
canvas{display:block;width:100%;height:100%;object-fit:contain}
.arena.won{border-color:#ffe08b;box-shadow:0 0 20px #ffe08b40}
.buttons{display:flex;gap:8px}
button{min-height:44px;border:0;border-radius:10px;background:#daf5a6;color:#172716;padding:8px 12px;cursor:pointer;font-weight:800}
#action{flex:1}
#reset{background:#24364b;color:#e1f0ff}
button:disabled{opacity:.5}
button:focus-visible,textarea:focus-visible,select:focus-visible,summary:focus-visible{outline:3px solid #83deff;outline-offset:2px}
#status{margin:0;min-height:2.5em;text-align:center;font-weight:750;display:grid;place-items:center;font-size:.9rem}
@media(max-height:420px){main{height:auto;min-height:100dvh;grid-template-rows:auto auto 280px auto auto}}

.arena{position:relative}
.arena.won{animation:finish-glow .9s ease-out}
#results{
  position:absolute;z-index:1;inset:10px 10px auto;max-height:72%;overflow:auto;
  background:#17263af5;border:1px solid #bca66b;border-radius:12px;padding:12px;
  animation:results-in .35s .65s both;
}
#results h2{margin:0 0 9px;font-size:clamp(1rem,4vw,1.3rem);color:#ffe594;overflow-wrap:anywhere}
#results h3{margin:0 0 5px;font-size:.82rem;color:#c6d8e9}
#results ol{margin:0;padding-left:1.55rem}
#results li{padding:5px 3px;border-bottom:1px solid #3b5066;overflow-wrap:anywhere}
#results li::marker{color:var(--marble);font-weight:800}
#results strong{margin-left:.6em;color:#ffe594;font-size:.76rem}
@keyframes finish-glow{
  from{box-shadow:0 0 34px #ffe08ba0,inset 0 0 34px #ffe08b60}
  to{box-shadow:0 0 20px #ffe08b40}
}
@keyframes results-in{
  from{opacity:0;transform:translateY(-8px)}
  to{opacity:1;transform:translateY(0)}
}
@media(prefers-reduced-motion:reduce){.arena.won,#results{animation:none}}
