/* Kingdom Party UI: chunky, bright, rounded. */
@font-face { font-family: 'Lilita One'; src: url(../fonts/lilita-one.woff2) format('woff2'); font-display: swap; }
:root {
  --ink: #2a1640; --ink2: #4b2d73; --paper: #fffaf0; --gold: #ffcf3a; --gold2: #f09a12; --sky: #5fb5ff;
  --red: #e8463c; --blue: #3d8ef0; --green: #3fbf5a; --yellow: #f5c022; --purple: #7b4bd6;
  --r: 18px; --shadow: 0 6px 0 rgba(42, 22, 64, .35);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #2a1640; color: var(--ink); font-family: 'Nunito', system-ui, sans-serif; font-weight: 600; -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; touch-action: none; }
#gl { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
#ui, #hud, #fx { position: fixed; inset: 0; pointer-events: none; }
#ui { z-index: 5; } #hud { z-index: 4; } #fx { z-index: 8; }
#ui > *, #fx > * { pointer-events: auto; }
#fx > .banner, #fx > .toast, #fx > .float, #fx > .hint, #fx > .pickflash { pointer-events: none; }
h1, h2, h3, .btn, .tag, kbd, .pdot { font-family: 'Lilita One', 'Nunito', sans-serif; font-weight: 400; letter-spacing: .5px; }
h2 { font-size: clamp(24px, 3.4vw, 38px); margin: 0 0 14px; color: var(--ink); }
h3 { margin: 0 0 8px; font-size: 22px; color: var(--ink2); }
a { color: var(--purple); }
kbd { display: inline-block; min-width: 26px; padding: 2px 8px; border-radius: 8px; background: #fff; border: 2px solid var(--ink); box-shadow: 0 3px 0 var(--ink); font-size: .9em; color: var(--ink); text-align: center; }
.muted { opacity: .7; }

/* ---------- buttons ---------- */
.btn { font-size: 21px; color: var(--ink); background: #fff; border: 3px solid var(--ink); border-radius: 16px; padding: 10px 22px; box-shadow: 0 5px 0 var(--ink); cursor: pointer; transition: transform .08s, box-shadow .08s, background .15s; outline: none; white-space: nowrap; }
.btn:hover, .btn.focus { background: #fff3c4; transform: translateY(-2px); box-shadow: 0 7px 0 var(--ink); }
.btn.focus { outline: 4px solid rgba(255, 255, 255, .85); outline-offset: 3px; }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink); }
.btn.gold { background: linear-gradient(#ffe066, var(--gold)); }
.btn.gold:hover, .btn.gold.focus { background: linear-gradient(#fff0a0, #ffd84f); }
.btn.danger { background: #ffd9d4; }
.btn.big { font-size: 28px; padding: 12px 34px; }
.btn.small { font-size: 17px; padding: 6px 14px; border-width: 2px; box-shadow: 0 3px 0 var(--ink); border-radius: 12px; }
.btn.on { background: var(--ink2); color: #fff; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.row { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin-top: 18px; }
.col { display: flex; flex-direction: column; gap: 12px; align-items: stretch; }
.seg { display: inline-flex; gap: 6px; flex-wrap: wrap; }

/* ---------- screens and panels ---------- */
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 16px; overflow: auto; animation: fadeIn .25s ease; }
.screen.title { justify-content: flex-start; padding: 4vh 16px 2vh; background: linear-gradient(rgba(42, 22, 64, .25), transparent 30%, transparent 65%, rgba(42, 22, 64, .55)); }
@keyframes fadeIn { from { opacity: 0; transform: scale(.98); } }
.panel, .card { background: var(--paper); border: 4px solid var(--ink); border-radius: 26px; box-shadow: 0 10px 0 rgba(42, 22, 64, .55), 0 20px 50px rgba(0, 0, 0, .3); padding: 22px 26px; max-width: min(560px, 94vw); text-align: center; }
.panel.wide { max-width: min(1000px, 96vw); width: 100%; }
.panel p { font-size: 17px; line-height: 1.45; margin: 0 0 10px; }
.cols { display: grid; grid-template-columns: 1.2fr 1fr; gap: 26px; text-align: left; }
@media (max-width: 760px) { .cols { grid-template-columns: 1fr; } }
.dialog { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(30, 14, 50, .35); animation: fadeIn .2s ease; padding: 14px; }
.dialog .card { min-width: min(380px, 92vw); }
.dialog .card p { font-size: 18px; margin: 0 0 8px; }
.field { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin: 12px 0; font-size: 18px; font-weight: 800; text-align: left; }
.field input[type=range] { width: 52%; accent-color: var(--purple); }
.tag { display: inline-block; background: var(--purple); color: #fff; border-radius: 99px; padding: 3px 14px; font-size: 16px; margin-bottom: 8px; box-shadow: 0 3px 0 var(--ink); }

/* ---------- title ---------- */
.logo { text-align: center; filter: drop-shadow(0 8px 0 rgba(42, 22, 64, .55)); animation: bob 3s ease-in-out infinite; }
.logo-crown { width: clamp(70px, 10vw, 110px); display: block; margin: 0 auto -8px; transform: rotate(-6deg); }
.logo h1 { margin: 0; line-height: .85; font-size: clamp(56px, 10vw, 118px); }
.logo h1 span { display: block; color: #fff; -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; text-shadow: 0 6px 0 var(--ink); }
.logo h1 span:last-child { color: var(--gold); transform: rotate(-3deg) translateX(.3em); }
@keyframes bob { 50% { transform: translateY(-8px); } }
.menu { display: flex; flex-direction: column; gap: 14px; align-items: center; }
.screen.title .menu { margin-top: auto; margin-bottom: 2.5vh; }
@media (min-aspect-ratio: 4/3) { .screen.title .menu { flex-direction: row; flex-wrap: wrap; justify-content: center; align-items: center; } .screen.title .menu .row { margin: 0; } .screen.title .menu .btn.big { min-width: 220px; } }
.menu .btn.big { min-width: 280px; }
.foot { color: #fff; font-size: 14px; text-shadow: 0 2px 2px rgba(0, 0, 0, .5); }
.foot a { color: var(--gold); }

/* ---------- setup ---------- */
.slots { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 760px) { .slots { grid-template-columns: repeat(2, 1fr); } }
.slot { border: 3px solid var(--ink); border-radius: 18px; padding: 12px; background: #fff; box-shadow: inset 0 -8px 0 var(--pc); }
.slot-h { font-family: 'Lilita One'; font-size: 22px; color: var(--pc); -webkit-text-stroke: 1px var(--ink); margin-bottom: 8px; }
.slot-k { font-size: 14px; margin-top: 10px; min-height: 40px; }
.slot-k kbd { font-size: 12px; padding: 0 5px; min-width: 0; box-shadow: 0 2px 0 var(--ink); }
.opts { display: flex; gap: 30px; justify-content: center; flex-wrap: wrap; margin-top: 10px; }
.pdot { display: inline-block; background: var(--pc); color: #fff; border: 2px solid var(--ink); border-radius: 10px; padding: 0 8px; -webkit-text-stroke: 0; text-shadow: 0 2px 0 rgba(0, 0, 0, .35); font-size: .85em; vertical-align: middle; }

/* ---------- hero select ---------- */
.select .grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 10px; max-height: 58vh; overflow: auto; padding: 6px; }
.hero { position: relative; border: 3px solid var(--ink); border-radius: 16px; background: #3c2a5c; padding: 0; overflow: hidden; cursor: pointer; box-shadow: 0 4px 0 var(--ink); transition: transform .1s; font: inherit; }
.hero img { width: 100%; aspect-ratio: 1; display: block; object-fit: cover; }
.hero span { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(42, 22, 64, .82); color: #fff; font-size: 12.5px; font-weight: 800; padding: 3px 2px; line-height: 1.15; }
.hero:hover, .hero.focus { transform: translateY(-3px) scale(1.04); outline: 4px solid var(--gold); z-index: 1; }
.hero.taken { opacity: .3; filter: grayscale(1); }
.pickflash { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; animation: pop .9s ease forwards; }
.pickflash img { width: 180px; border-radius: 26px; border: 6px solid var(--pc); box-shadow: 0 10px 0 var(--ink); }
.pickflash b { font-family: 'Lilita One'; font-size: 36px; color: #fff; -webkit-text-stroke: 2px var(--ink); paint-order: stroke fill; margin-top: 8px; }
@keyframes pop { 0% { transform: translate(-50%, -50%) scale(.4); opacity: 0; } 20% { transform: translate(-50%, -50%) scale(1.1); opacity: 1; } 80% { opacity: 1; } 100% { transform: translate(-50%, -50%) scale(1); opacity: 0; } }
.lu { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin: 6px 0; }
.lu-p { display: flex; flex-direction: column; align-items: center; width: 120px; }
.lu-p img { width: 104px; height: 104px; border-radius: 20px; border: 4px solid var(--pc); box-shadow: 0 5px 0 var(--ink); background: #3c2a5c; }
.lu-p b { font-family: 'Lilita One'; font-weight: 400; font-size: 17px; margin-top: 6px; line-height: 1.1; }
.lu-p small { opacity: .7; }

/* ---------- minigame intro / results ---------- */
.intro-screen { justify-content: flex-end; padding-bottom: 4vh; background: linear-gradient(transparent 40%, rgba(42, 22, 64, .4)); }
.panel.intro { max-width: min(720px, 96vw); }
.ctls { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; align-items: center; }
.ctl { display: flex; gap: 14px; align-items: center; font-size: 16px; flex-wrap: wrap; justify-content: center; }
.readies { display: flex; gap: 10px; justify-content: center; margin-top: 8px; }
.rd { display: flex; flex-direction: column; align-items: center; font-size: 13px; font-weight: 800; opacity: .55; transition: .2s; }
.rd img { width: 58px; height: 58px; border-radius: 14px; border: 3px solid var(--pc); background: #3c2a5c; }
.rd.ok { opacity: 1; transform: translateY(-4px); }
.rd.ok span { color: var(--green); }
.res-screen, .final-screen { justify-content: flex-end; padding-bottom: 3vh; }
.final-screen { justify-content: flex-end; align-items: flex-end; padding: 2vh 2vw; }
.final-screen .panel.final { max-width: min(430px, 94vw); }
.final .res { min-width: 0; }
@media (max-aspect-ratio: 1/1) { .final-screen { align-items: center; } }
.res { display: flex; flex-direction: column; gap: 8px; min-width: min(440px, 88vw); }
.rs { display: grid; grid-template-columns: 50px 46px 1fr auto; align-items: center; gap: 10px; background: #fff; border: 3px solid var(--ink); border-radius: 14px; padding: 4px 12px 4px 6px; box-shadow: inset 6px 0 0 var(--pc); text-align: left; }
.rs .pl { font-family: 'Lilita One'; font-size: 22px; text-align: center; }
.rs.p0 { background: #fff3c4; transform: scale(1.03); }
.rs.p0 .pl { color: var(--gold2); }
.rs img { width: 42px; height: 42px; border-radius: 10px; background: #3c2a5c; }
.rs b { font-weight: 800; }
.rw { font-family: 'Lilita One'; font-size: 19px; display: flex; align-items: center; gap: 4px; }
.panel.results, .panel.final { padding: 16px 20px; }
.final h2 { margin-bottom: 10px; }

/* ---------- free play list ---------- */
.mglist { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; text-align: left; max-height: 62vh; overflow: auto; padding: 6px; }
.mgcard { font: inherit; text-align: left; background: #fff; border: 3px solid var(--ink); border-radius: 18px; padding: 12px 14px; box-shadow: 0 5px 0 var(--ink); cursor: pointer; display: flex; flex-direction: column; gap: 4px; transition: transform .1s; color: var(--ink); }
.mgcard b { font-family: 'Lilita One'; font-weight: 400; font-size: 22px; }
.mgcard small { color: var(--purple); font-weight: 800; }
.mgcard span { font-size: 14px; line-height: 1.35; opacity: .85; }
.mgcard:hover, .mgcard.focus { transform: translateY(-3px); background: #fff3c4; outline: 4px solid var(--gold); }
.mgcard.rnd { background: linear-gradient(#f2e8ff, #fff); }

/* ---------- how to ---------- */
.legend { list-style: none; padding: 0; margin: 10px 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; font-size: 15px; }
.sp { display: inline-flex; width: 28px; height: 28px; border-radius: 50%; align-items: center; justify-content: center; color: #fff; font-style: normal; font-family: 'Lilita One'; border: 2px solid var(--ink); margin-right: 6px; vertical-align: middle; font-size: 15px; }
.sp.b { background: #3d7ff0; } .sp.r { background: #e0443c; } .sp.e { background: #9a5cf0; } .sp.l { background: #37c26b; } .sp.d { background: #3a3340; } .sp.s { background: #f3c13a; }
.keys { border-collapse: collapse; width: 100%; font-size: 15px; }
.keys td, .keys th { padding: 5px; border-bottom: 2px dashed rgba(42, 22, 64, .15); text-align: left; }

/* ---------- board HUD ---------- */
.hud-board .turnbox { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); background: var(--paper); border: 3px solid var(--ink); border-radius: 16px; padding: 4px 18px; box-shadow: var(--shadow); display: flex; gap: 8px; align-items: baseline; font-family: 'Lilita One'; }
.tb-l { font-size: 16px; color: var(--ink2); } .tb-n { font-size: 26px; }
.pcard { position: absolute; width: 210px; display: grid; grid-template-columns: 58px 1fr; grid-template-rows: auto auto; column-gap: 8px; background: var(--paper); border: 3px solid var(--ink); border-radius: 18px; padding: 6px 10px 6px 6px; box-shadow: var(--shadow), inset 0 -6px 0 var(--pc); transition: transform .2s; }
.pcard.active { transform: scale(1.08); outline: 4px solid #fff; }
.pcard img { grid-row: span 2; width: 58px; height: 58px; border-radius: 12px; border: 3px solid var(--pc); background: #3c2a5c; }
.pc-name { font-weight: 800; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; align-self: end; }
.pc-stats { display: flex; gap: 12px; font-family: 'Lilita One'; font-size: 24px; align-items: center; }
.pc-stats span { display: flex; align-items: center; gap: 4px; }
.pc-rank { position: absolute; top: -12px; right: -10px; background: var(--pc); color: #fff; font-family: 'Lilita One'; border: 3px solid var(--ink); border-radius: 12px; padding: 0 7px; font-size: 16px; text-shadow: 0 2px 0 rgba(0, 0, 0, .3); }
.p0 { top: 10px; left: 10px; } .p1 { top: 10px; right: 10px; } .p2 { bottom: 12px; left: 10px; } .p3 { bottom: 12px; right: 10px; }
.ico-coin, .ico-crown { display: inline-block; width: 22px; height: 22px; vertical-align: middle; background-size: contain; background-repeat: no-repeat; background-position: center; }
.ico-coin { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='10' fill='%23ffcf3a' stroke='%232a1640' stroke-width='2.5'/%3E%3Crect x='10' y='6' width='4' height='12' rx='1.5' fill='%23f09a12'/%3E%3C/svg%3E"); }
.ico-crown { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 20'%3E%3Cpath d='M2 18 L3.5 5 L8.5 11 L12 2 L15.5 11 L20.5 5 L22 18 Z' fill='%23ffcf3a' stroke='%232a1640' stroke-width='2' stroke-linejoin='round'/%3E%3C/svg%3E"); }

/* ---------- minigame HUD ---------- */
.mg-hud { position: absolute; top: 8px; left: 0; right: 0; display: flex; justify-content: center; align-items: flex-start; gap: 14px; }
.mg-chips { display: flex; gap: 8px; }
.chip { display: flex; align-items: center; gap: 6px; background: var(--paper); border: 3px solid var(--ink); border-radius: 14px; padding: 3px 10px 3px 3px; box-shadow: var(--shadow), inset 0 -5px 0 var(--pc); font-family: 'Lilita One'; font-size: 24px; min-width: 86px; }
.chip img { width: 38px; height: 38px; border-radius: 10px; border: 2px solid var(--pc); background: #3c2a5c; }
.chip small { font-size: 13px; opacity: .6; }
.chip.out { opacity: .5; filter: grayscale(.8); }
.mg-timer { font-family: 'Lilita One'; font-size: 34px; background: var(--ink); color: #fff; border-radius: 16px; padding: 2px 16px; box-shadow: var(--shadow); min-width: 64px; text-align: center; }

/* ---------- FX ---------- */
.banner { position: absolute; left: 0; right: 0; top: 34%; text-align: center; animation: bannerIn .35s cubic-bezier(.2, 1.6, .4, 1); }
.banner.out { animation: bannerOut .35s ease forwards; }
.banner-t { font-family: 'Lilita One'; font-size: clamp(40px, 7vw, 86px); color: #fff; -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; text-shadow: 0 7px 0 var(--ink); line-height: 1; padding: 0 12px; }
.banner-s { display: inline-block; margin-top: 12px; font-size: clamp(16px, 2.2vw, 24px); font-weight: 800; background: var(--paper); border: 3px solid var(--ink); border-radius: 14px; padding: 4px 16px; box-shadow: var(--shadow); }
.banner.small .banner-t { font-size: clamp(30px, 5vw, 58px); }
.banner.gold .banner-t { color: var(--gold); } .banner.red .banner-t { color: #ff6b5e; } .banner.purple .banner-t { color: #c9a6ff; }
.banner.count .banner-t { font-size: clamp(80px, 16vw, 180px); }
.banner.go .banner-t { color: var(--gold); }
@keyframes bannerIn { from { transform: scale(.3); opacity: 0; } }
@keyframes bannerOut { to { transform: scale(1.3); opacity: 0; } }
.toast { position: absolute; left: 50%; bottom: 120px; transform: translateX(-50%); background: var(--paper); border: 3px solid var(--ink); border-left: 10px solid var(--c, var(--purple)); border-radius: 14px; padding: 8px 18px; font-weight: 800; box-shadow: var(--shadow); transition: opacity .4s; }
.toast.out { opacity: 0; }
.float { position: absolute; transform: translate(-50%, -50%); font-family: 'Lilita One'; font-size: 40px; -webkit-text-stroke: 2px var(--ink); paint-order: stroke fill; text-shadow: 0 4px 0 var(--ink); animation: floatUp 1.3s ease forwards; }
@keyframes floatUp { 0% { transform: translate(-50%, -20%) scale(.5); opacity: 0; } 15% { transform: translate(-50%, -60%) scale(1.15); opacity: 1; } 100% { transform: translate(-50%, -160%) scale(1); opacity: 0; } }
.hint { position: absolute; left: 50%; bottom: 26%; transform: translateX(-50%); background: var(--paper); border: 3px solid var(--ink); border-radius: 16px; padding: 8px 18px; font-size: 18px; box-shadow: var(--shadow); white-space: nowrap; animation: fadeIn .2s; }
.roulette .rl { display: flex; flex-direction: column; gap: 6px; margin: 6px 0; }
.rl-i { font-family: 'Lilita One'; font-size: 22px; padding: 6px 16px; border-radius: 12px; border: 3px solid transparent; transition: background .05s; }
.rl-i.on { background: var(--gold); border-color: var(--ink); transform: scale(1.05); }
.rl-hint { font-size: 15px !important; opacity: .7; }
.award .lu-p small { font-family: 'Lilita One'; font-size: 18px; opacity: 1; color: var(--purple); }

/* ---------- loading ---------- */
#loading { position: fixed; inset: 0; z-index: 20; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; background: radial-gradient(circle at 50% 40%, #6a3fc0, #2a1640 70%); transition: opacity .5s; }
#loading.gone { opacity: 0; pointer-events: none; }
#loading .logo h1 { font-size: clamp(48px, 9vw, 96px); }
#loading .bar { width: min(340px, 70vw); height: 22px; border: 3px solid #fff; border-radius: 99px; overflow: hidden; background: rgba(255, 255, 255, .15); }
#loading .bar i { display: block; height: 100%; width: 0; background: linear-gradient(var(--gold), var(--gold2)); transition: width .3s; }
#loading .msg { color: #fff; font-weight: 800; }

/* ---------- pause, fps ---------- */
#pausebtn { position: fixed; z-index: 7; bottom: 10px; left: 50%; transform: translateX(-50%); width: 48px; height: 48px; border-radius: 14px; border: 3px solid var(--ink); background: var(--paper); box-shadow: var(--shadow); font-family: 'Lilita One'; font-size: 22px; cursor: pointer; color: var(--ink); }
#fps { position: fixed; z-index: 9; bottom: 6px; left: 50%; transform: translateX(-50%); color: #fff; font: 12px monospace; background: rgba(0, 0, 0, .45); padding: 2px 6px; border-radius: 6px; pointer-events: none; }

/* ---------- touch pad ---------- */
#touchpad { position: fixed; inset: 0; z-index: 6; pointer-events: none; display: none; }
body[data-touch="pad"] #touchpad, body[data-touch="a"] #touchpad { display: block; }
body[data-touch="a"] .tp-stick { display: none; }
.tp-stick { position: absolute; left: 4vw; bottom: 7vh; width: 140px; height: 140px; border-radius: 50%; background: rgba(255, 255, 255, .22); border: 3px solid rgba(255, 255, 255, .6); pointer-events: auto; touch-action: none; }
.tp-knob { position: absolute; left: 50%; top: 50%; width: 64px; height: 64px; margin: -32px; border-radius: 50%; background: rgba(255, 255, 255, .85); border: 3px solid var(--ink); }
.tp-btn { position: absolute; pointer-events: auto; touch-action: none; border-radius: 50%; border: 4px solid var(--ink); font-family: 'Lilita One'; color: #fff; box-shadow: 0 6px 0 var(--ink); text-shadow: 0 2px 0 rgba(0, 0, 0, .3); }
.tp-a { right: 5vw; bottom: 9vh; width: 104px; height: 104px; background: var(--green); font-size: 40px; }
.tp-b { right: calc(5vw + 120px); bottom: 5vh; width: 70px; height: 70px; background: var(--red); font-size: 26px; display: none; }
.tp-btn.on { transform: translateY(5px); box-shadow: 0 1px 0 var(--ink); }

/* ---------- small screens ---------- */
@media (max-width: 760px), (max-height: 520px) {
  .pcard { width: 150px; grid-template-columns: 40px 1fr; padding: 4px 6px 4px 4px; border-radius: 14px; }
  .pcard img { width: 40px; height: 40px; border-radius: 9px; }
  .pc-name { font-size: 11px; }
  .pc-stats { font-size: 18px; gap: 8px; }
  .ico-coin, .ico-crown { width: 16px; height: 16px; }
  .chip { font-size: 18px; min-width: 64px; padding: 2px 6px 2px 2px; }
  .chip img { width: 28px; height: 28px; }
  .mg-chips { gap: 4px; }
  .mg-timer { font-size: 24px; }
  .panel, .card { padding: 14px 16px; border-radius: 20px; }
  .btn.big { font-size: 22px; padding: 9px 22px; }
  .btn { font-size: 18px; padding: 8px 16px; }
  #pausebtn { width: 42px; height: 42px; }
  .menu .btn.big { min-width: 220px; }
  .panel p { font-size: 15px; }
}
@media (max-height: 520px) {
  .mg-hud { flex-wrap: nowrap; }
  .select .grid { max-height: 52vh; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); }
  .intro-screen { padding-bottom: 1vh; }
  .panel.intro p { font-size: 14px; margin-bottom: 4px; }
  .logo h1 { font-size: 52px; }
  .tp-stick { width: 120px; height: 120px; bottom: 5vh; }
  .tp-a { width: 88px; height: 88px; }
}
@media (max-width: 520px) {
  .hud-board .turnbox { top: 74px; }
  .select .grid { grid-template-columns: repeat(auto-fill, minmax(82px, 1fr)); }
  .hero span { font-size: 11px; }
  .field { flex-wrap: wrap; }
}

#fsbtn { position: fixed; z-index: 7; top: 10px; right: 10px; width: 44px; height: 44px; border-radius: 12px; border: 3px solid var(--ink); background: var(--paper); box-shadow: var(--shadow); font-size: 22px; line-height: 1; cursor: pointer; color: var(--ink); opacity: .85; }
#fsbtn:hover { opacity: 1; }
#fsbtn[hidden] { display: none; }
@media (max-width: 700px) { #fsbtn { width: 38px; height: 38px; font-size: 19px; top: 6px; right: 6px; } }

#a2hs { position: fixed; z-index: 60; left: 50%; bottom: 14px; transform: translateX(-50%); max-width: 92vw; padding: 10px 14px; border-radius: 14px; border: 3px solid var(--ink); background: var(--paper); box-shadow: var(--shadow); font: 700 14px/1.3 Nunito, sans-serif; color: var(--ink); text-align: center; }
#a2hs button { margin-left: 8px; padding: 4px 12px; border-radius: 10px; border: 2px solid var(--ink); background: #ffd24a; font: inherit; }

/* rotate-your-phone prompt: touch devices held upright */
#rotate { display: none; position: fixed; inset: 0; z-index: 100; align-items: center; justify-content: center; text-align: center; background: radial-gradient(circle at 50% 40%, #4a2a78, #2a1640 70%); color: #fff; font-family: 'Lilita One', system-ui, sans-serif; touch-action: none; }
#rotate .rot-card { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 24px; }
#rotate b { font-size: 30px; font-weight: 400; letter-spacing: .5px; }
#rotate span { font: 600 16px/1.3 Nunito, system-ui, sans-serif; opacity: .8; }
#rotate .rot-phone { width: 54px; height: 92px; border: 5px solid #ffd24a; border-radius: 12px; position: relative; animation: rotphone 2.2s ease-in-out infinite; }
#rotate .rot-phone::after { content: ''; position: absolute; left: 50%; bottom: 6px; width: 14px; height: 4px; margin-left: -7px; border-radius: 2px; background: #ffd24a; }
@keyframes rotphone { 0%, 15% { transform: rotate(0); } 55%, 85% { transform: rotate(-90deg); } 100% { transform: rotate(0); } }
@media (orientation: portrait) and (pointer: coarse) and (max-width: 820px) { #rotate { display: flex; } }
@media (prefers-reduced-motion: reduce) { #rotate .rot-phone { animation: none; transform: rotate(-90deg); } }
