/* Mindclash: bright, friendly pixel-game UI. Cream panels, ink outlines with notched pixel corners, lime accents.
   Fonts: Nunito (bold, very readable) for text, Lilita One (chunky, clear game titles) for titles and big numbers. */
:root {
  --ink: #1d1b2f; --ink-2: #3a3656; --paper: #fff8e4; --paper-2: #f4e9c8; --paper-3: #e8d9ad;
  --lime: #d4ff1f; --lime-d: #92b800; --sky: #5ec8ff; --sky-d: #2f8fd0; --pink: #ff6fae; --gold: #ffc53d; --gold-d: #d68a00;
  --red: #ff5263; --violet: #9b6bff; --green: #3fcf6a; --muted: #6d6987; --text: #1d1b2f;
  --b: 3px;
  --font: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --pix: 'Lilita One', 'Nunito', system-ui, sans-serif;
  --ps: 0 calc(-1 * var(--b)) 0 0 var(--ink), 0 var(--b) 0 0 var(--ink), calc(-1 * var(--b)) 0 0 0 var(--ink), var(--b) 0 0 0 var(--ink);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; min-width: 0; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #8fd6ff; color: var(--text); font: 700 16px/1.3 var(--font); letter-spacing: 0; user-select: none; }
#view, #view canvas { position: fixed; inset: 0; display: block; }
img { image-rendering: pixelated; }
.muted { color: var(--muted); } .small { font-size: 14px; } .err { color: var(--red); font-size: 15px; min-height: 20px; }
.ellip { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 60vw; }
h2 { font: 400 31px/1 var(--font); margin: 0; letter-spacing: .03em; }
h3 { font: 400 23px/1 var(--font); margin: 0; }
a { color: var(--sky-d); }
b { font-weight: 900; }
.shadow { color: #fff; text-shadow: 3px 3px 0 var(--ink), -2px -2px 0 var(--ink), 2px -2px 0 var(--ink), -2px 2px 0 var(--ink); }
.px { border: 0; border-radius: 0; box-shadow: var(--ps), 0 calc(var(--b) + 5px) 0 0 rgba(29, 27, 47, .28); }

.logo { display: flex; align-items: center; justify-content: center; gap: .12em; font: 700 clamp(44px, 7vw, 84px)/.9 var(--pix); color: #fff; letter-spacing: .04em; white-space: nowrap;
  text-shadow: 0 6px 0 var(--ink), 4px 4px 0 var(--ink), -3px -3px 0 var(--ink), 3px -3px 0 var(--ink), -3px 3px 0 var(--ink); }
.logo span { color: var(--lime); }
.logo img { height: .85em; filter: drop-shadow(3px 4px 0 var(--ink)); animation: bob 2.4s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-6px) rotate(-4deg); } }

/* buttons */
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; letter-spacing: inherit; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 8px 20px; font-size: 19px; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
  background: var(--paper); color: var(--ink); transition: transform .06s, filter .12s;
  box-shadow: var(--ps), inset 0 -5px 0 0 var(--paper-3), 0 8px 0 0 rgba(29,27,47,.3); }
.btn:hover { filter: brightness(1.05); transform: translateY(-1px); }
.btn:active { transform: translateY(3px); box-shadow: var(--ps), inset 0 -2px 0 0 var(--paper-3), 0 4px 0 0 rgba(29,27,47,.3); }
.btn.primary { background: var(--lime); box-shadow: var(--ps), inset 0 -5px 0 0 var(--lime-d), 0 8px 0 0 rgba(29,27,47,.3); }
.btn.big { padding: 11px 28px; font-size: 23px; }
.btn.small { padding: 5px 13px; font-size: 16px; }
.btn.wide { width: 100%; }
.btn:disabled { filter: grayscale(.8) brightness(.95); opacity: .6; pointer-events: none; }
.iconbtn { position: relative; width: 52px; height: 52px; background: var(--paper); display: grid; place-items: center; font-size: 20px; flex: none; }
.iconbtn img { width: 38px; height: 38px; object-fit: contain; }
.iconbtn.small { width: 38px; height: 38px; font-size: 16px; }
.iconbtn:hover { background: #fff; }
.badge { position: absolute; top: -8px; right: -8px; min-width: 22px; height: 22px; padding: 0 5px; background: var(--red); color: #fff; font: 400 14px/22px var(--font); font-style: normal; display: none; box-shadow: 0 0 0 3px var(--ink); }
.badge.on { display: block; }
.seg { display: inline-flex; gap: 3px; background: var(--paper-2); padding: 4px; }
.seg button { padding: 3px 12px; font-size: 17px; color: var(--muted); white-space: nowrap; }
.seg button.on { background: var(--ink); color: var(--lime); }

/* screens + panels */
.screen { position: fixed; inset: 0; z-index: 10; display: none; }
.screen.on { display: block; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; } }
.panel { background: var(--paper); padding: 18px; }
.center-panel { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(560px, calc(100% - 32px)); max-height: calc(100% - 32px); overflow: auto; display: flex; flex-direction: column; gap: 12px; }
.page { position: absolute; inset: 0; padding: max(16px, env(safe-area-inset-top)) 18px 24px; display: flex; flex-direction: column; gap: 18px; overflow: auto; }
.page.narrow { max-width: 820px; margin: 0 auto; }
.pagehead { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px; }
.pagehead h2 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.label { font-size: 18px; letter-spacing: .06em; text-transform: uppercase; margin: 6px 0; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 17px; }
input[type=text], input:not([type]) { background: #fff; color: var(--ink); border: var(--b) solid var(--ink); padding: 8px 10px; font: 400 18px var(--font); letter-spacing: .03em; outline: none; width: 100%; }
input:focus { background: #fbffe6; }
input[type=range] { width: 180px; accent-color: var(--ink); }
.row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 2px dashed var(--paper-3); font-size: 18px; }
.row:last-child { border: 0; }
.tag { font-style: normal; font-size: 14px; padding: 2px 8px; background: var(--paper-3); color: var(--ink); letter-spacing: .06em; white-space: nowrap; }
.tag.lime { background: var(--lime); } .tag.sky { background: var(--sky); }

/* boot + login */
.boot, .queue { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 18px; text-align: center; padding: 16px; }
/* start screen: logo at the top, bar + button at the bottom, so the 3 Minds in the plaza stay clear */
.boot { place-content: stretch; grid-template-rows: auto 1fr auto auto; gap: 10px; padding: max(18px, 4vh) 16px max(22px, 6vh); }
.boot .logo { font-size: clamp(34px, 9vw, 56px); }
.boot .bar { align-self: end; }
.boot .tapstart { margin-top: 0; }
.bootsite { position: absolute; top: 12px; right: 12px; z-index: 2; padding: 6px 12px; background: rgba(23, 18, 42, .7); color: #fff; font-weight: 900; font-size: 14px; text-decoration: none; box-shadow: 0 0 0 2px #000; }
.bootsite:hover { background: rgba(23, 18, 42, .9); }
.boot .bar { width: min(320px, 70vw); height: 18px; background: var(--paper); padding: 3px; }
.boot .bar i { display: block; height: 100%; width: 0; background: repeating-linear-gradient(90deg, var(--lime) 0 12px, var(--lime-d) 12px 14px); transition: width .3s; }
.login { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(500px, calc(100% - 32px)); max-height: calc(100% - 32px); overflow: auto; display: flex; flex-direction: column; gap: 12px; text-align: center; padding: 26px 22px; }
.login .logo { font-size: clamp(28px, 9.8vw, 61px); }   /* T60: 12vw overflowed the card at 375 px (CLASH cut off) */
.tagline { margin: 0 0 4px; font-size: 20px; color: var(--ink-2); }
.pitch { list-style: none; padding: 0; margin: 2px 0 10px; text-align: left; display: grid; gap: 10px; font-size: 16px; }
.pitch li { display: grid; grid-template-columns: 40px 1fr; gap: 10px; align-items: center; }
.pitch img { width: 40px; height: 40px; object-fit: contain; }
.fine { font-size: 14px; color: var(--muted); margin: 6px 0 0; }

/* ---------- lobby ---------- */
.topbar { position: absolute; top: max(14px, env(safe-area-inset-top)); left: 16px; right: 16px; display: flex; justify-content: space-between; align-items: center; z-index: 3; gap: 12px; }
.me { display: flex; gap: 10px; align-items: center; padding: 5px 16px 5px 5px; background: var(--paper); text-align: left; max-width: min(360px, 60vw); }
.me img { width: 50px; height: 50px; background: var(--paper-3); flex: none; }
.me-txt { min-width: 0; }
.me b { display: block; font-size: 20px; line-height: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-txt > span { display: block; font-size: 15px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbtns { display: flex; gap: 14px; }
.lobby { position: absolute; inset: 82px 16px max(16px, env(safe-area-inset-bottom)); display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; pointer-events: none; }
.lobby > * { pointer-events: auto; }
.col-play { container-type: inline-size; width: min(400px, 34vw); display: flex; flex-direction: column; gap: 16px; max-height: 100%; overflow: auto; padding: 4px 8px 14px 4px; }
.hub-logo { justify-content: flex-start; font-size: clamp(26px, 12cqw, 52px); margin: 0 0 2px; }
.mode { position: relative; min-height: 96px; padding: 10px 12px; text-align: left; display: flex; flex-direction: column; justify-content: flex-end; overflow: hidden; width: 100%;
  background: var(--bg) center / cover, var(--paper); transition: transform .1s; }
.mode::before { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 25%, rgba(29,27,47,.82)); }
.mode:hover { transform: translateY(-3px); }
.mode.big { min-height: 150px; }
.mode-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.mode.soon { min-height: 80px; filter: saturate(.7); }
.mode.soon::after { content: '🔒'; position: absolute; right: 8px; top: 6px; font-size: 17px; }
.mode-txt { position: relative; color: #fff; text-shadow: 2px 2px 0 var(--ink), -1px -1px 0 var(--ink); min-width: 0; }
.mode-txt b { display: block; font-size: 23px; line-height: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mode.big .mode-txt b { font-size: 34px; }
.mode-txt span { display: block; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mode .tag { position: absolute; top: 10px; right: 10px; box-shadow: 0 0 0 3px var(--ink); }
.mode-ico { position: absolute; left: 10px; top: 10px; width: 50px; filter: drop-shadow(2px 3px 0 var(--ink)); }
.guest-note { font-size: 15px; background: #ffd6d6; border: 3px solid #e0393e; color: #5a1014; padding: 10px 12px; display: none; }
.trial-bar { position: absolute; left: 50%; bottom: 128px; transform: translateX(-50%); z-index: 6; max-width: calc(100% - 24px); background: #e0393e; color: #fff; font-size: 14px; padding: 7px 12px; border: 3px solid #1d1b2f; text-align: center; animation: trialPulse 1.6s ease-in-out infinite; }
.trial-bar a { color: #fff3b0; font-weight: bold; }
@keyframes trialPulse { 50% { box-shadow: 0 0 0 4px rgba(224,57,62,.35); } }
.col-board { width: min(430px, 33vw); height: 100%; display: flex; flex-direction: column; gap: 10px; padding: 14px;
  background: linear-gradient(180deg, #fffdf3, var(--paper) 30%); }
.col-board::before { content: ''; position: absolute; left: 10px; right: 10px; top: -10px; height: 10px; background: repeating-linear-gradient(90deg, var(--gold) 0 14px, var(--gold-d) 14px 28px); box-shadow: 0 0 0 3px var(--ink); }
.col-board { position: relative; }
img.vi { width: .9em; height: .9em; object-fit: contain; vertical-align: -.1em; margin-right: 4px; image-rendering: pixelated; }
.podium { display: grid; grid-template-columns: 1fr 1.15fr 1fr; gap: 8px; align-items: end; padding: 22px 2px 0; }
.pod { position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 0; cursor: pointer; text-align: center; }
.pod.open { cursor: default; }
.pod-crown { position: absolute; top: -26px; width: 40px; z-index: 2; animation: bob 2.4s ease-in-out infinite; filter: drop-shadow(2px 3px 0 var(--ink)); }
.pod-pfp { width: 64px; height: 64px; display: grid; place-items: center; background: var(--paper-3); box-shadow: 0 0 0 3px var(--ink); font-size: 31px; color: var(--muted); }
.pod.p1 .pod-pfp { width: 82px; height: 82px; box-shadow: 0 0 0 3px var(--ink), 0 0 0 7px var(--gold); }
.pod-pfp img { width: 100%; height: 100%; }
.pod.open .pod-pfp { background: repeating-linear-gradient(45deg, var(--paper-2) 0 6px, var(--paper-3) 6px 12px); }
.pod-nm { max-width: 100%; font-size: 16px; line-height: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 4px; }
.pod-vl { font-size: 16px; color: var(--ink-2); white-space: nowrap; }
.pod.open .pod-nm, .pod.open .pod-vl { color: var(--muted); }
.pod-base { width: 100%; display: grid; place-items: center; color: #fff; font-size: 27px; line-height: 1; box-shadow: 0 0 0 3px var(--ink), inset 0 -6px 0 rgba(0,0,0,.18), inset 0 4px 0 rgba(255,255,255,.35);
  text-shadow: 2px 2px 0 var(--ink); margin-top: 6px; }
.pod.p1 .pod-base { height: 66px; background: var(--gold); } .pod.p2 .pod-base { height: 46px; background: #b9c2d6; } .pod.p3 .pod-base { height: 32px; background: #e0935c; }
.pod.mine-row .pod-nm { color: #3a9a00; }
.pod:not(.open):hover .pod-pfp { transform: translateY(-3px); }
.board-head { display: flex; align-items: center; gap: 10px; }
.board-head img { width: 40px; } .board-head h3 { flex: 1; }
.board-list { list-style: none; margin: 0; padding: 0; overflow: auto; display: flex; flex-direction: column; gap: 4px; min-height: 0; flex: 1; }
.brow { display: grid; grid-template-columns: 34px 40px 1fr auto; gap: 8px; align-items: center; padding: 4px 6px; background: var(--paper-2); cursor: pointer; font-size: 17px; }
.brow:hover { background: #fff; }
.brow .rk { text-align: center; font-size: 19px; color: var(--muted); }
.brow:nth-child(1) .rk { color: var(--gold-d); } .brow:nth-child(2) .rk { color: #8a8fa0; } .brow:nth-child(3) .rk { color: #c0723f; }
.brow img { width: 40px; height: 40px; box-shadow: 0 0 0 2px var(--ink); background: var(--paper-3); }
.brow .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brow .vl { font-size: 19px; white-space: nowrap; }
.brow.mine-row { background: #f3ffc2; }
.board-me .brow { box-shadow: 0 0 0 3px var(--lime-d); }
.board-empty { color: var(--muted); padding: 10px; font-size: 16px; }
#tags { position: fixed; inset: 0; z-index: 9; pointer-events: none; }
.nametag { position: absolute; transform: translate(-50%, -100%); background: var(--paper); padding: 1px 8px; font-size: 15px; white-space: nowrap; box-shadow: var(--ps); }
.nametag i { font-style: normal; color: var(--muted); }
.bubble { position: absolute; transform: translate(-50%, -100%); background: #fff; padding: 4px 12px; font-size: 17px; white-space: nowrap; box-shadow: var(--ps), 0 6px 0 rgba(29,27,47,.25); animation: pop2 .3s cubic-bezier(.3,1.6,.5,1); }
.bubble::after { content: ''; position: absolute; left: 50%; bottom: -9px; width: 10px; height: 10px; background: #fff; transform: translateX(-50%) rotate(45deg); box-shadow: 3px 3px 0 var(--ink); }
@keyframes pop2 { from { transform: translate(-50%, -60%) scale(.4); opacity: 0; } }

/* prep */
.mindgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 14px; padding: 6px; }
.mindgrid.big { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); max-height: 46vh; overflow: auto; }
.mind { position: relative; padding: 4px; background: var(--paper-2); cursor: pointer; box-shadow: 0 0 0 3px var(--paper-3); transition: transform .08s; }
.mind:hover { transform: translateY(-2px); }
.mind img { width: 100%; aspect-ratio: 1; display: block; }
.mind .tag { position: absolute; left: 7px; bottom: 7px; font-size: 13px; padding: 0 6px; background: var(--ink); color: #fff; }
.mind .order { position: absolute; top: -10px; right: -10px; width: 30px; height: 30px; background: var(--lime); color: var(--ink); font-size: 17px; display: none; place-items: center; box-shadow: 0 0 0 3px var(--ink); }
.mind.on { box-shadow: 0 0 0 3px var(--ink), 0 0 0 7px var(--lime); background: #f6ffd0; } .mind.on .order { display: grid; }
.prep-foot { display: flex; gap: 16px; align-items: center; justify-content: flex-end; flex-wrap: wrap; padding-bottom: 8px; }

/* queue */
.radar { position: relative; width: 170px; height: 170px; display: grid; place-items: center; }
.radar i { position: absolute; inset: 0; border: 4px solid #fff; border-radius: 50%; opacity: 0; animation: ping 2.4s infinite; }
.radar i:nth-child(2) { animation-delay: .8s; } .radar i:nth-child(3) { animation-delay: 1.6s; }
@keyframes ping { from { transform: scale(.4); opacity: .9; } to { transform: scale(1.4); opacity: 0; } }
.radar img { width: 100px; height: 100px; box-shadow: 0 0 0 4px var(--ink), 0 0 0 8px var(--lime); }
.qmsg { background: var(--paper); padding: 8px 14px; margin: 0; font-size: 17px; }

/* ---------- duel ---------- */
.duel-top { position: absolute; top: max(10px, env(safe-area-inset-top)); left: 12px; right: 12px; display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 12px; align-items: start; pointer-events: none; }
.plate { display: flex; gap: 10px; align-items: center; background: var(--paper); padding: 6px 8px; max-width: 400px; }
.rv-side { justify-self: end; text-align: right; }
.pfp { width: 56px; height: 56px; flex: none; background: var(--paper-3); }
.plate .info { flex: 1; min-width: 0; }
.plate b { font-size: 20px; line-height: 1; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stars { display: flex; gap: 3px; margin-top: 4px; } .rv-side .stars { justify-content: flex-end; }
.stars img { width: 24px; height: 22px; object-fit: contain; } .stars img.off { filter: grayscale(1) brightness(.7); opacity: .35; }
.pts { text-align: center; background: var(--ink); color: var(--lime); padding: 3px 9px; min-width: 56px; flex: none; }
.pts b { font-size: 25px; line-height: 1; } .pts span { font-size: 12px; letter-spacing: .1em; color: #c9c5e0; }
.mid { text-align: center; min-width: 100px; }
.roundlbl { font-size: 23px; line-height: 1; letter-spacing: .06em; white-space: nowrap; }
.timer { position: relative; width: 60px; height: 60px; margin: 4px auto 0; }
.timer svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.timer circle { fill: var(--paper); stroke: var(--ink); stroke-width: 6; }
.timer circle + circle { fill: none; stroke: var(--green); stroke-width: 4; stroke-dasharray: 107; transition: stroke-dashoffset .25s linear, stroke .3s; }
.timer span { position: absolute; inset: 0; display: grid; place-items: center; font-size: 23px; }
.timer.low circle + circle { stroke: var(--red); } .timer.low span { color: var(--red); animation: tick .5s steps(2) infinite; }
@keyframes tick { 50% { transform: scale(1.15); } }
.prize { position: absolute; left: 50%; top: calc(max(10px, env(safe-area-inset-top)) + 104px); transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.crownbox { position: relative; width: 112px; height: 94px; background: radial-gradient(circle at 50% 45%, #fffbe0, var(--paper) 70%); display: grid; place-items: center; }
.crownbox img { position: absolute; width: 96px; top: 2px; left: 8px; filter: drop-shadow(0 3px 0 rgba(29,27,47,.35)); }
.crownbox b { position: relative; top: 14px; font-size: 41px; line-height: 1; color: #fff; text-shadow: 3px 3px 0 var(--ink), -2px -2px 0 var(--ink), 2px -2px 0 var(--ink), -2px 2px 0 var(--ink); }
.crownbox.new { animation: drop .45s cubic-bezier(.3,1.6,.5,1); }
@keyframes drop { from { transform: translateY(-40px) scale(.6); opacity: 0; } }
.potline { background: var(--gold); padding: 2px 10px; font-size: 16px; display: none; white-space: nowrap; }
.potline.on { display: block; animation: drop .4s; }
.crownsleft { display: flex; gap: 5px; }
.crownsleft i { font-style: normal; width: 28px; height: 28px; display: grid; place-items: center; font-size: 17px; background: var(--paper); color: var(--ink); box-shadow: 0 0 0 2px var(--ink); }
.crownsleft i.now { background: var(--gold); transform: translateY(-3px); }
.rivalinfo { position: absolute; right: 12px; top: calc(max(10px, env(safe-area-inset-top)) + 90px); background: var(--paper); padding: 8px 10px; display: flex; flex-direction: column; gap: 6px; font-size: 15px; pointer-events: none; }
.ri-row { display: flex; align-items: center; gap: 8px; justify-content: space-between; } .ri-row > span { color: var(--muted); white-space: nowrap; }
.minis, .minispells { display: flex; gap: 3px; }
.minis i { font-style: normal; width: 22px; height: 28px; display: grid; place-items: center; font-size: 16px; background: #fff; box-shadow: 0 0 0 2px var(--ink); }
.minis i.used { background: var(--paper-3); color: #b7ab86; box-shadow: 0 0 0 2px #b7ab86; text-decoration: line-through; }
.minispells img { width: 28px; height: 28px; object-fit: contain; } .minispells img.used { filter: grayscale(1); opacity: .3; }
.ri-lock { display: none; background: var(--lime); text-align: center; padding: 1px 6px; animation: drop .3s; } .rivalinfo.locked .ri-lock { display: block; }
.duel-hint { background: var(--paper); padding: 3px 14px; font-size: 16px; line-height: 26px; min-height: 32px; text-align: center; pointer-events: none; visibility: hidden; max-width: min(640px, 94vw); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.duel-hint.on { visibility: visible; animation: fade .3s; } .duel-hint.warn { background: #ffe0e3; }
.duel-bottom { position: absolute; left: 0; right: 0; bottom: 0; padding: 10px 70px max(14px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; align-items: center; gap: 12px; }
.handrow { display: flex; align-items: center; justify-content: center; gap: 22px; }
.spells { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.sp { position: relative; display: flex; align-items: center; gap: 8px; padding: 4px 12px 4px 6px; background: var(--paper); text-align: left; transition: transform .08s, background .1s; }
.sp img { width: 42px; height: 42px; object-fit: contain; flex: none; }
.sp b { display: block; font-size: 19px; line-height: 1; white-space: nowrap; } .sp em { font-style: normal; display: block; font-size: 13px; color: var(--muted); white-space: nowrap; }
.sp:hover { transform: translateY(-2px); }
.sp.on { background: var(--lime); transform: translateY(-5px); }
.sp.used { filter: grayscale(1); opacity: .45; pointer-events: none; }
.sp.lockout { opacity: .4; pointer-events: none; }
.sp .lim { position: absolute; top: -12px; right: -6px; font-style: normal; font-size: 12px; background: var(--violet); color: #fff; padding: 0 5px; box-shadow: 0 0 0 2px var(--ink); white-space: nowrap; }
.hand { display: flex; gap: clamp(6px, 1.4vw, 12px); justify-content: center; }
.card { position: relative; width: clamp(44px, 9vw, 76px); aspect-ratio: 5 / 7; background: linear-gradient(180deg, #fff, var(--paper) 60%, var(--paper-2)); display: grid; place-items: center; transition: transform .12s, opacity .2s;
  box-shadow: var(--ps), 0 9px 0 0 rgba(29,27,47,.3); }
.card b { font-size: clamp(28px, 6.5vw, 47px); line-height: 1; color: var(--c); text-shadow: 2px 2px 0 var(--ink), -2px -2px 0 var(--ink), 2px -2px 0 var(--ink), -2px 2px 0 var(--ink); }
.card::before, .card::after { content: attr(data-v); position: absolute; font-size: clamp(11px, 2vw, 14px); color: var(--ink); line-height: 1; }
.card::before { top: 3px; left: 5px; } .card::after { bottom: 3px; right: 5px; transform: rotate(180deg); }
.card:hover { transform: translateY(-6px); }
.card.on { transform: translateY(-18px); background: linear-gradient(180deg, #fbffe0, #efffa0); box-shadow: var(--ps), 0 0 0 7px var(--lime), 0 16px 0 2px rgba(29,27,47,.25); }
.card.gone { visibility: hidden; width: 0; margin: 0 calc(-0.5 * clamp(6px, 1.4vw, 12px)); }
.card.lockout { opacity: .35; pointer-events: none; }
.card.pulse, .sp.pulse { animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: var(--ps), 0 0 0 8px var(--pink), 0 9px 0 0 rgba(29,27,47,.3); } }
.lockrow { display: flex; flex-direction: column; align-items: center; width: 230px; } .lock { width: 100%; }
.waiting { display: none; padding: 8px 12px; background: var(--paper); font-size: 17px; white-space: nowrap; }
.waiting::after { content: ''; animation: dots 1.2s steps(4) infinite; }
@keyframes dots { 0% { content: ''; } 25% { content: '.'; } 50% { content: '..'; } 75% { content: '...'; } }
#s-duel.locked .spells { visibility: hidden; } #s-duel.locked .lock { display: none; }
#s-duel.locked .card:not(.on) { opacity: .35; pointer-events: none; }
#s-duel.locked .card.on { pointer-events: none; }
#s-duel.locked .waiting { display: block; }
#s-duel.revealing .duel-bottom, #s-duel.revealing .duel-hint { opacity: 0; pointer-events: none; transition: opacity .2s; }
.corner { position: absolute; right: 12px; bottom: max(14px, env(safe-area-inset-bottom)); z-index: 3; }
.chatbtn { position: absolute; left: 12px; bottom: max(14px, env(safe-area-inset-bottom)); z-index: 3; }
.chatpick { position: absolute; left: 12px; bottom: calc(max(14px, env(safe-area-inset-bottom)) + 66px); z-index: 6; background: var(--paper); padding: 10px; width: min(380px, calc(100vw - 24px)); display: none; flex-direction: column; gap: 8px; }
.chatpick.on { display: flex; animation: drop .25s; }
.phrases { display: flex; flex-wrap: wrap; gap: 6px; }
.phrases button { background: #fff; padding: 3px 10px; font-size: 16px; box-shadow: 0 0 0 2px var(--ink); white-space: nowrap; }
.phrases button:hover { background: var(--lime); }
.phrases.small button { font-size: 15px; }

/* reveal */
.reveal { position: absolute; left: clamp(10px, 4vw, 70px); right: clamp(10px, 4vw, 70px); top: 50%; transform: translateY(-46%); display: none; align-items: center; justify-content: space-between; pointer-events: none; z-index: 5; }
.reveal.on { display: flex; }
.rv-col { display: flex; flex-direction: column; align-items: center; gap: 10px; transition: transform .3s, opacity .3s; }
.rv-who { background: var(--ink); color: #fff; padding: 1px 12px; font-size: 17px; letter-spacing: .1em; }
#rv0 .rv-who { background: var(--sky-d); } #rv1 .rv-who { background: var(--red); }
.rcard { position: relative; width: clamp(78px, 13vw, 124px); aspect-ratio: 5 / 7; perspective: 600px; animation: slidein .35s cubic-bezier(.3,1.4,.5,1); }
#rv1 .rcard { animation-name: slidein2; }
@keyframes slidein { from { transform: translateX(-60vw) rotate(-20deg); } } @keyframes slidein2 { from { transform: translateX(60vw) rotate(20deg); } }
.rc-face, .rc-back { position: absolute; inset: 0; backface-visibility: hidden; transition: transform .45s; box-shadow: 0 -4px 0 0 var(--ink), 0 4px 0 0 var(--ink), -4px 0 0 0 var(--ink), 4px 0 0 0 var(--ink), 0 12px 0 0 rgba(29,27,47,.35); }
.rc-back { background: url(assets/card_back.webp) center / cover, var(--ink-2); }
#rv0 .rc-back { background: var(--my-back, url(assets/card_back.webp)) center / cover, var(--ink-2); }   /* your own card back */
#rv1 .rc-back { background: var(--rival-back, url(assets/card_back.webp)) center / cover, var(--ink-2); }
.rc-face { background: linear-gradient(180deg, #fff, var(--paper) 60%, var(--paper-2)); display: grid; place-items: center; transform: rotateY(180deg); }
.rc-face b { font-size: clamp(55px, 12vw, 84px); line-height: 1; color: var(--c, var(--ink)); text-shadow: 3px 3px 0 var(--ink), -3px -3px 0 var(--ink), 3px -3px 0 var(--ink), -3px 3px 0 var(--ink); transition: transform .2s; }
.rcard.flip .rc-back { transform: rotateY(180deg); } .rcard.flip .rc-face { transform: rotateY(360deg); }
.rc-face b.bump { animation: bump .45s; } @keyframes bump { 40% { transform: scale(1.5) rotate(-6deg); } }
.rv-col.win .rc-face { background: linear-gradient(180deg, #fbffe0, #e7ff7a); box-shadow: 0 -4px 0 0 var(--ink), 0 4px 0 0 var(--ink), -4px 0 0 0 var(--ink), 4px 0 0 0 var(--ink), 0 0 0 9px var(--lime), 0 0 40px 14px rgba(212,255,31,.6); }
.rv-col.win { transform: scale(1.08); } .rv-col.lose { opacity: .55; transform: scale(.92); }
.rv-spell { min-height: 54px; display: flex; align-items: center; gap: 6px; }
.rv-spell .chip { display: flex; align-items: center; gap: 6px; background: var(--paper); padding: 4px 10px 4px 4px; font-size: 17px; white-space: nowrap; box-shadow: var(--ps); animation: drop .35s cubic-bezier(.3,1.6,.5,1); }
.rv-spell .chip img { width: 38px; height: 38px; object-fit: contain; }
.rv-spell .chip.x { filter: grayscale(1); opacity: .6; text-decoration: line-through; }
.rv-msg { position: absolute; left: 50%; bottom: max(30px, 7vh); transform: translateX(-50%); background: var(--paper); padding: 6px 18px; text-align: center; font-size: clamp(19px, 3vw, 25px); display: none; z-index: 6; max-width: min(620px, 90vw); }
.rv-msg.on { display: block; animation: drop .3s cubic-bezier(.3,1.6,.5,1); }
.rv-msg.good { background: var(--lime); } .rv-msg.bad { background: #ffd0d5; } .rv-msg.magic { background: #e6dbff; }
/* the turn result: big title + where the points came from */
.rv-msg.result { padding: 8px 26px 10px; } .rv-msg.result b { display: block; font-size: clamp(28px, 5.4vw, 44px); line-height: 1.05; letter-spacing: .04em; }
.rv-msg.result span { display: block; font-size: clamp(14px, 2.2vw, 18px); opacity: .8; }
.rv-msg.result.bad { background: var(--red); color: #fff; }
/* WIN / LOSE / TIE stamped on the revealed cards */
.rv-col.win .rcard::after, .rv-col.lose .rcard::after, .rv-col.tie .rcard::after { position: absolute; left: 50%; bottom: -12px; transform: translateX(-50%) rotate(-6deg); z-index: 3; padding: 1px 10px; font-size: clamp(16px, 2.6vw, 22px); font-weight: 900; letter-spacing: .08em; box-shadow: var(--ps); animation: drop .3s cubic-bezier(.3,1.6,.5,1); }
.rv-col.win .rcard::after { content: 'WIN'; background: var(--lime); color: var(--ink); }
.rv-col.lose .rcard::after { content: 'LOSE'; background: var(--red); color: #fff; }
.rv-col.tie .rcard::after { content: 'TIE'; background: #fff; color: var(--ink); }

/* tutorial coach */
.coach { position: absolute; left: 12px; top: calc(max(10px, env(safe-area-inset-top)) + 92px); z-index: 20; display: none; gap: 12px; align-items: flex-start; background: var(--paper); padding: 12px 14px; width: min(440px, 34vw); }
.coach.on { display: flex; animation: fade .3s; }
.coach-pfp { width: 76px; height: 76px; flex: none; box-shadow: 0 0 0 3px var(--ink); background: var(--paper-3); }
.coach b { font-size: 19px; color: var(--sky-d); } .coach p { margin: 2px 0 8px; font-size: 18px; line-height: 1.15; }
.coach .btn { float: right; }
.coach.wait .btn { display: none; }

/* banners + pops */
#banner { position: fixed; inset: 0; z-index: 25; display: grid; place-items: center; pointer-events: none; text-align: center; opacity: 0; transform: scale(1.3); transition: opacity .15s, transform .25s cubic-bezier(.3,1.5,.5,1); padding: 16px; }
#banner.on { opacity: 1; transform: scale(1); }
#banner .bt { font-size: clamp(50px, 13vw, 109px); line-height: .9; color: var(--lime); letter-spacing: .04em;
  text-shadow: 0 7px 0 var(--ink), 5px 5px 0 var(--ink), -4px -4px 0 var(--ink), 4px -4px 0 var(--ink), -4px 4px 0 var(--ink); }
#banner .bt.red { color: var(--red); } #banner .bt.white { color: #fff; } #banner .bt.gold { color: var(--gold); }
#banner small { display: inline-block; font-size: clamp(17px, 3vw, 23px); color: var(--ink); background: var(--paper); padding: 4px 14px; margin-top: 14px; letter-spacing: .05em; box-shadow: var(--ps); max-width: 90vw; }
#pops { position: fixed; inset: 0; z-index: 8; pointer-events: none; }
.pop { position: absolute; font-size: 33px; color: #fff; text-shadow: 3px 3px 0 var(--ink), -2px -2px 0 var(--ink), 2px -2px 0 var(--ink), -2px 2px 0 var(--ink); transform: translate(-50%, -50%); animation: pop 1.3s ease-out forwards; white-space: nowrap; }
.pop.crit { color: var(--lime); font-size: 47px; } .pop.gold { color: var(--gold); font-size: 42px; } .pop.status { font-size: 23px; color: #ffe46b; }
@keyframes pop { 0% { transform: translate(-50%, -10%) scale(.4); opacity: 0; } 14% { transform: translate(-50%, -60%) scale(1.12); opacity: 1; } 100% { transform: translate(-50%, -170%) scale(1); opacity: 0; } }
.flycrown { position: fixed; z-index: 26; width: 70px; pointer-events: none; transition: left .6s cubic-bezier(.5,0,.7,1), top .6s cubic-bezier(.3,-0.4,.7,1), transform .6s, opacity .2s .55s; filter: drop-shadow(3px 4px 0 var(--ink)); }
#toast { position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 30px); z-index: 70; padding: 8px 18px; background: var(--paper); font-size: 18px; opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none; max-width: 90vw; text-align: center; }
#toast.on { opacity: 1; transform: translate(-50%, 0); } #toast.bad { background: #ffe0e3; }
#tip { position: fixed; z-index: 80; max-width: 300px; padding: 10px 12px; background: var(--paper); font-size: 16px; line-height: 1.15; pointer-events: none; opacity: 0; transition: opacity .12s; }
#tip.on { opacity: 1; } #tip b { display: block; margin-bottom: 3px; font-size: 19px; }

/* result */
.result { text-align: center; align-items: center; padding-top: 26px; }
.r-crown { width: 96px; animation: bob 2s ease-in-out infinite; filter: drop-shadow(3px 4px 0 var(--ink)); }
.result.lost .r-crown { filter: grayscale(1) drop-shadow(3px 4px 0 var(--ink)); }
#r-title { font-size: clamp(55px, 14vw, 86px); line-height: .9; text-shadow: 4px 4px 0 var(--ink), -3px -3px 0 var(--ink), 3px -3px 0 var(--ink), -3px 3px 0 var(--ink); }
.r-score { font-size: 25px; color: var(--muted); }
.r-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: 100%; }
.r-stats div { background: var(--paper-2); padding: 10px 6px; } .r-stats b { display: block; font-size: clamp(17px, 6.4vw, 23px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .r-stats span { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.r-stats .r-note { grid-column: 1 / -1; margin: 0; font-size: 13px; line-height: 1.45; color: var(--ink-2, #555); text-align: center; }   /* T66p: points vs Dust, said plainly */
.r-stats .r-note b { display: inline; font-size: inherit; white-space: normal; }
.r-btns { display: flex; gap: 18px; justify-content: center; margin: 6px 0 4px; flex-wrap: wrap; }
.up { color: #3a9a00 !important; } .down { color: var(--red) !important; }

/* leaderboard page */
.live { font-size: 15px; color: var(--red); vertical-align: middle; letter-spacing: .08em; animation: blink 1.6s infinite; text-shadow: none; }
@keyframes blink { 50% { opacity: .35; } }
.lb { overflow: auto; }
.lb table { width: 100%; border-collapse: collapse; font-size: 19px; }
.lb th { text-align: left; font-size: 15px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 8px; border-bottom: 3px solid var(--ink); font-weight: 400; }
.lb td { padding: 6px 8px; border-bottom: 2px dashed var(--paper-3); }
.lb tr.mine-row td { background: #f3ffc2; }
.lb .pl { display: flex; align-items: center; gap: 10px; cursor: pointer; max-width: 360px; }
.lb .pl span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb .pl img { width: 44px; height: 44px; box-shadow: 0 0 0 2px var(--ink); background: var(--paper-3); flex: none; }
.lb .rank { font-size: 22px; color: var(--muted); } .lb tr:nth-child(1) .rank { color: var(--gold-d); } .lb tr:nth-child(2) .rank { color: #8a8fa0; } .lb tr:nth-child(3) .rank { color: #c0723f; }

/* profile */
.profile { display: grid; grid-template-columns: minmax(300px, 380px) 1fr; gap: 18px; align-items: start; }
.profile > .panel:last-child { grid-column: 1 / -1; }
.prof-card { display: flex; flex-direction: column; gap: 12px; }
.prof-top { display: flex; gap: 14px; align-items: center; }
.prof-top > img { width: 140px; height: 140px; box-shadow: 0 0 0 3px var(--ink); flex: none; }
.prof-id { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.pf-name { font-size: 33px; line-height: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pf-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pf-stats div { background: var(--paper-2); padding: 8px 10px; } .pf-stats b { display: block; font-size: 25px; line-height: 1; } .pf-stats span { font-size: 12px; color: var(--muted); text-transform: uppercase; }
.showcase { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.showcase img { width: 100%; aspect-ratio: 1; box-shadow: 0 0 0 3px var(--ink); background: var(--paper-3); }
.showcase .empty { aspect-ratio: 1; display: grid; place-items: center; background: var(--paper-2); color: var(--muted); font-size: 14px; text-align: center; }
#pf-edit { display: flex; flex-direction: column; gap: 10px; }
.history { display: flex; flex-direction: column; gap: 6px; }
.hrow { display: grid; grid-template-columns: 70px 1fr auto auto; gap: 10px; align-items: center; padding: 6px 10px; background: var(--paper-2); font-size: 17px; }
.hrow > span:nth-child(2) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hrow .res { font-size: 19px; letter-spacing: .04em; } .hrow .res.win { color: #3a9a00; } .hrow .res.loss { color: var(--red); } .hrow .res.draw { color: var(--muted); }
.hrow img { width: 30px; height: 30px; vertical-align: middle; margin-right: 6px; box-shadow: 0 0 0 2px var(--ink); }

/* friends drawer */
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(400px, 100vw); z-index: 50; background: var(--paper); padding: max(14px, env(safe-area-inset-top)) 14px 14px; display: flex; flex-direction: column; gap: 12px; transform: translateX(110%); transition: transform .25s; }
.drawer.on { transform: none; }
.drawer-head { display: flex; align-items: center; gap: 10px; } .drawer-head img { width: 42px; } .drawer-head h3 { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#fr-list-view { display: flex; flex-direction: column; gap: 10px; min-height: 0; flex: 1; }
.fr-add { display: flex; gap: 8px; }
.fr-list { display: flex; flex-direction: column; gap: 8px; overflow: auto; flex: 1; }
.frow { display: grid; grid-template-columns: 46px 1fr auto; gap: 10px; align-items: center; padding: 6px 8px; background: var(--paper-2); cursor: pointer; }
.frow img { width: 46px; height: 46px; box-shadow: 0 0 0 2px var(--ink); }
.frow .fn { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 18px; }
.frow .fs { font-size: 13px; color: var(--muted); }
.frow .dot { display: inline-block; width: 10px; height: 10px; margin-right: 5px; background: #b9b3cf; } .frow .dot.on { background: var(--green); }
.frow .new { background: var(--red); color: #fff; padding: 0 6px; font-size: 12px; }
.frow .acts { display: flex; gap: 6px; }
.frow .acts .btn { padding: 2px 10px; font-size: 15px; }
.fr-section { font-size: 15px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; margin-top: 4px; }
.fr-chat { display: none; flex-direction: column; gap: 10px; min-height: 0; flex: 1; }
.fr-chat.on { display: flex; } #fr-list-view.off { display: none; }
.fr-msgs { flex: 1; overflow: auto; display: flex; flex-direction: column; gap: 6px; padding: 6px; background: var(--paper-2); min-height: 120px; }
.msg { max-width: 80%; padding: 4px 10px; font-size: 16px; background: #fff; box-shadow: 0 0 0 2px var(--ink); align-self: flex-start; }
.msg.mine { align-self: flex-end; background: var(--lime); }
.msg time { display: block; font-size: 11px; color: var(--muted); }

/* codex */
.codex { overflow: auto; line-height: 1.2; font-size: 18px; }
.codex h3 { font-size: 25px; margin: 20px 0 8px; display: flex; align-items: center; gap: 8px; } .codex h3:first-child { margin-top: 0; }
.codex h3 img { width: 36px; height: 36px; object-fit: contain; }
.codex ul, .codex ol { padding-left: 24px; margin: 6px 0; } .codex li { margin: 6px 0; }
.spellrow { display: grid; grid-template-columns: 60px 1fr; gap: 12px; align-items: center; padding: 10px; background: var(--paper-2); margin: 8px 0; }
.spellrow img { width: 60px; height: 60px; object-fit: contain; }
.spellrow b { font-size: 22px; } .spellrow em { font-style: normal; font-size: 12px; background: var(--ink); color: var(--lime); padding: 1px 6px; margin-left: 6px; vertical-align: middle; }
.example { background: #eef9ff; padding: 10px 12px; margin: 8px 0; font-size: 17px; border-left: 6px solid var(--sky); }

/* modal */
.modal-wrap { position: fixed; inset: 0; z-index: 60; display: none; place-items: center; background: rgba(29,27,47,.45); }
.modal-wrap.on { display: grid; }
.modal { width: min(460px, calc(100% - 32px)); max-height: calc(100% - 32px); overflow: auto; text-align: center; display: flex; flex-direction: column; gap: 14px; }
.modal h3 { font-size: 28px; } .modal p { margin: 0; font-size: 17px; }
.modal img.wide { width: 100%; box-shadow: var(--ps); }
.modal { position: relative; } .modal-x { position: absolute; top: 8px; right: 8px; width: 30px; height: 30px; padding: 0; z-index: 2; }   .modal h3 { padding: 0 30px; }   /* T66: every pop-up has a ✕ */
.modal-btns { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; margin: 4px 0 6px; }

@media (max-width: 900px) {
  .lobby { inset: 76px 12px max(12px, env(safe-area-inset-bottom)); flex-direction: column; justify-content: flex-start; align-items: stretch; overflow: auto; padding-top: 34vh; gap: 18px; }
  .col-play, .col-board { width: auto; max-height: none; overflow: visible; }
  .col-board { height: auto; } .col-board .board-list { max-height: 360px; }
  .hub-logo { position: fixed; top: 78px; left: 0; right: 0; justify-content: center; font-size: 36px; pointer-events: none; }
  .profile { grid-template-columns: 1fr; }
  .hide-s { display: none; }
}
@media (max-width: 820px) {
  .plate { padding: 4px 6px; gap: 6px; } .pfp { width: 40px; height: 40px; } .plate b { font-size: 15px; } .pts { min-width: 42px; padding: 2px 6px; } .pts b { font-size: 20px; } .pts span { font-size: 11px; }
  .stars img { width: 17px; height: 16px; }
  .duel-top { gap: 6px; left: 8px; right: 8px; } .mid { min-width: 52px; } .roundlbl { font-size: 16px; } .timer { width: 48px; height: 48px; } .timer span { font-size: 19px; }
  .prize { left: 10px; transform: none; align-items: flex-start; top: calc(max(10px, env(safe-area-inset-top)) + 74px); }
  .crownbox { width: 92px; height: 78px; } .crownbox img { width: 80px; left: 6px; } .crownbox b { font-size: 33px; top: 12px; }
  .crownsleft i { width: 23px; height: 23px; font-size: 14px; }
  .rivalinfo { top: calc(max(10px, env(safe-area-inset-top)) + 74px); right: 8px; padding: 4px 6px; font-size: 12px; gap: 3px; }
  .rivalinfo .ri-row > span { display: none; } .ri-lock { font-size: 12px; padding: 1px 4px; }
  .minis i { width: 17px; height: 22px; font-size: 13px; } .minispells img { width: 21px; height: 21px; }
  .sp { flex-direction: column; gap: 1px; padding: 4px 6px; min-width: 72px; text-align: center; } .sp img { width: 30px; height: 30px; } .sp b { font-size: 15px; } .sp em { display: none; }
  .sp .lim { font-size: 11px; top: -10px; right: -4px; }
  .spells { gap: 9px; flex-wrap: nowrap; }
  .duel-bottom { gap: 9px; padding: 8px 10px max(12px, env(safe-area-inset-bottom)); }
  .handrow { flex-direction: column; gap: 10px; }
  .duel-hint { font-size: 15px; min-height: 28px; line-height: 22px; white-space: normal; }
  .lockrow { width: auto; } .lock { min-width: 220px; } .btn.big { font-size: 20px; padding: 9px 22px; }
  .reveal { top: 40%; } .rv-spell { min-height: 46px; } .rv-spell .chip img { width: 28px; height: 28px; } .rv-spell .chip { font-size: 14px; }
  .coach { left: 8px; right: 8px; width: auto; top: calc(max(8px, env(safe-area-inset-top)) + 54px); } .coach-pfp { display: none; } .coach p { font-size: 15px; } .coach { padding: 8px 12px; }   /* T69: at the top on phones: above the tray it hid your Mind */
  .chatpick { bottom: calc(max(14px, env(safe-area-inset-bottom)) + 62px); }
  .iconbtn { width: 46px; height: 46px; } .iconbtn img { width: 32px; height: 32px; }
  .topbtns { gap: 10px; }
}
@media (max-height: 700px) and (min-width: 821px) {
  .card { width: 58px; } .card b { font-size: 33px; }
}
@media (max-width: 480px) {
  .plate .pfp { display: none; } .plate { padding: 4px 6px; } .pts span { display: none; }
}

/* ---------- fonts: Lilita One for the logo, big titles and big numbers; everything you read is Nunito ---------- */
.logo, h2, h3, .mode-txt b, #banner .bt, #r-title, .card b, .rc-face b, .crownbox b, .pod-base, .pf-name, .roundlbl, .timer span, .pop {
  font-family: var(--pix); font-weight: 400 !important; letter-spacing: .02em; }
.btn, .seg button, .tag, .label, .rv-msg, .duel-hint, .waiting, .potline, .sp b, .me b, .coach b, .rv-who, .r-stats b, .pf-stats b, .pts b,
.brow .rk, .lb .rank, .pod-vl, .brow .vl, .live, .badge, .order, .sp .lim, .ri-lock, .board-tab span, .r-score, #banner small, .crownsleft i, .minis i,
.card::before, .card::after, .nametag, .bubble, .phrases button, .msg, .frow .fn {
  font-family: var(--font); font-weight: 800; letter-spacing: 0; }
.btn.big, .btn.primary, .tag, .label, .rv-who, .pts b, .r-stats b, .pf-stats b, .sp b { font-weight: 900; }
.label { letter-spacing: .04em; font-size: 15px; }
.tag { letter-spacing: .04em; }
.mode-txt span { font-size: 14px; font-weight: 800; }
.mode.wide-mode { min-height: 86px; }
.col-play { overflow-x: hidden; gap: 12px; scrollbar-width: thin; }
.mode.big { min-height: 128px; } .mode { min-height: 82px; } .mode.soon { min-height: 66px; }
@media (max-height: 760px) and (min-width: 901px) {
  .hub-logo { font-size: clamp(26px, 11cqw, 44px); } .mode.big { min-height: 108px; } .mode.wide-mode { min-height: 72px; } .mode { min-height: 70px; } .mode.soon { min-height: 56px; }
  .mode.big .mode-txt b { font-size: 30px; } .guest-note { font-size: 13px; padding: 7px 9px; }
}
.prep-note { margin: 4px 0 0; padding: 8px 10px; background: #eef9ff; border-left: 5px solid var(--sky); font-size: 15px; }
.prep-note:empty { display: none; }
p, li, .muted, .fine, .pitch, .coach p, .codex, .modal p, .guest-note { line-height: 1.4; }

/* ---------- windows: pop up over the lobby (or the duel) instead of replacing it ---------- */
.screen.window { z-index: 30; background: rgba(29, 27, 47, .62); }   /* no backdrop blur: it re-blurs the animated stage every frame */
.screen.window > .page { position: absolute; inset: auto; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(1000px, calc(100% - 28px));
  max-height: calc(100% - 28px); margin: 0; padding: 16px 18px 20px; background: var(--paper-2); overflow: auto; gap: 14px;
  box-shadow: var(--ps), 0 12px 0 0 rgba(29,27,47,.35); animation: winpop .22s cubic-bezier(.3,1.4,.5,1); }
.screen.window > .page.narrow { width: min(720px, calc(100% - 28px)); }
@keyframes winpop { from { transform: translate(-50%, -46%) scale(.94); opacity: 0; } }
.screen.window .pagehead { grid-template-columns: 1fr auto auto; position: sticky; top: -16px; z-index: 2; margin: -16px -18px 0; padding: 12px 14px 12px 18px; background: var(--ink); color: #fff; }
.screen.window .pagehead h2 { font-size: 26px; display: flex; align-items: center; gap: 10px; color: #fff; text-shadow: 2px 2px 0 rgba(0,0,0,.4); }
.screen.window .pagehead h2 img { width: 30px; height: 30px; object-fit: contain; }
.screen.window .pagehead .seg { background: var(--ink-2); } .screen.window .pagehead .seg button { color: #c9c5e0; }
.screen.window .pagehead .seg button.on { background: var(--lime); color: var(--ink); }
.closex { background: var(--red) !important; color: #fff; font-family: var(--pix); }
.closex:hover { filter: brightness(1.1); }
#tags.dim { opacity: 0; }
@media (min-width: 901px) { .profile { grid-template-columns: minmax(280px, 340px) 1fr; } }   /* T71z: was not in a media query, so it beat the phone rule (iPhone: profile two narrow columns, cut off) */

/* ---------- collapsible leaderboard ---------- */
.board-head .iconbtn.small { width: 32px; height: 32px; font-size: 22px; font-family: var(--pix); }
.board-tab { display: none; position: absolute; right: 0; top: 50%; transform: translateY(-50%); z-index: 4; flex-direction: column; align-items: center; gap: 8px;
  padding: 12px 8px; background: var(--paper); pointer-events: auto; }
.board-tab img { width: 34px; height: 34px; object-fit: contain; }
.board-tab span { font-size: 15px; letter-spacing: .1em; writing-mode: vertical-rl; }
.board-tab .tab-pfps { display: flex; flex-direction: column; gap: 6px; }
.board-tab .tab-pfps img { width: 34px; height: 34px; box-shadow: 0 0 0 2px var(--ink); background: var(--paper-3); }
.board-tab b { font-family: var(--pix); font-size: 22px; }
.board-tab:hover { background: #fff; }
#s-hub.board-closed .col-board { display: none; }
#s-hub.board-closed .board-tab { display: flex; }
.col-board { width: min(360px, 27vw); }

/* trial players: ranked is locked */
.mode.locked { filter: saturate(.55) brightness(.92); }
.mode.locked .tag { background: var(--gold); }

/* duel intro: only the banner + Minds while "DUEL!" shows */
#s-duel.intro .prize, #s-duel.intro .duel-bottom, #s-duel.intro .rivalinfo, #s-duel.intro .chatbtn { opacity: 0; pointer-events: none; }
#s-duel .prize, #s-duel .duel-bottom, #s-duel .rivalinfo { transition: opacity .3s; }
/* round change: a dimmed screen with the new round, the round score and both Minds */
#s-duel.roundchange .prize, #s-duel.roundchange .duel-bottom, #s-duel.roundchange .rivalinfo, #s-duel.roundchange .chatbtn { opacity: 0; pointer-events: none; }
#banner.dim { background: radial-gradient(circle, rgba(18,14,44,.6), rgba(10,8,28,.9)); }
.rs-vs { display: flex; align-items: center; justify-content: center; gap: clamp(12px, 4vw, 40px); margin-top: 22px; }
.rs-vs > i { font-style: normal; font-size: clamp(30px, 7vw, 54px); color: #fff; text-shadow: 3px 3px 0 var(--ink), -2px -2px 0 var(--ink), 2px -2px 0 var(--ink), -2px 2px 0 var(--ink); }
.rs-side { display: flex; flex-direction: column; align-items: center; gap: 6px; animation: rs-in .4s cubic-bezier(.3,1.5,.5,1) both; }
.rs-side.rival { animation-name: rs-in-r; }
.rs-side img { width: clamp(64px, 14vw, 104px); aspect-ratio: 1; image-rendering: pixelated; background: var(--paper); box-shadow: var(--ps); }
.rs-side.rival img { transform: scaleX(-1); }
.rs-side b { font-size: clamp(13px, 2.4vw, 18px); color: #fff; max-width: 30vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-shadow: 2px 2px 0 var(--ink); }
.rs-crowns img { width: clamp(20px, 3.4vw, 28px); margin: 0 2px; } .rs-crowns img.off { filter: grayscale(1) brightness(.5); opacity: .7; }
@keyframes rs-in { from { opacity: 0; transform: translateX(-60px); } }
@keyframes rs-in-r { from { opacity: 0; transform: translateX(60px); } }
#d-round.new { animation: round-pop .6s cubic-bezier(.3,1.5,.5,1); }
@keyframes round-pop { 0% { transform: scale(1.8); color: var(--lime); } 100% { transform: scale(1); } }

@media (max-width: 900px) {
  .board-tab { display: none !important; } #s-hub.board-closed .col-board { display: flex; }
  .board-head .iconbtn.small { display: none; }
  .col-board { width: auto; }
  .screen.window > .page { width: calc(100% - 16px); max-height: calc(100% - 16px); padding: 14px 12px 16px; }
  .screen.window .pagehead { margin: -14px -12px 0; top: -14px; padding: 10px 10px 10px 14px; }
  .screen.window .pagehead h2 { font-size: 22px; }
}
/* card digits: big and crisp in the pixel font (thin outline so they stay readable) */
.card b { font-size: clamp(32px, 4.8vw, 48px); font-weight: 700; text-shadow: 2px 3px 0 var(--ink), -1.5px -1.5px 0 var(--ink), 1.5px -1.5px 0 var(--ink), -1.5px 1.5px 0 var(--ink), 1.5px 1.5px 0 var(--ink); }
.card::before, .card::after { font-size: 13px; font-weight: 700; }
@media (max-height: 700px) and (min-width: 821px) { .card b { font-size: 36px; } }
@media (max-width: 520px) {
  #hub-tutorial { display: none; }
  .me { max-width: 46vw; }
  .mindgrid.big { grid-template-columns: repeat(3, 1fr); gap: 10px; }
}

/* start screen */
.tapstart { display: none; margin-top: 6px; animation: tappulse 1.2s ease-in-out infinite; }
.tapstart.on { display: inline-flex; }
@keyframes tappulse { 50% { transform: scale(1.06); } }
#s-boot { cursor: pointer; }

/* Mind Energy */
.mind .en { position: absolute; right: 7px; bottom: 7px; padding: 0 6px; font-size: 13px; font-weight: 900; background: var(--lime); color: var(--ink); box-shadow: 0 0 0 2px var(--ink); }
.mind .en.none { background: #ffd0d5; color: var(--red); }
.mind.tired { filter: grayscale(.85); opacity: .6; }
.mind.tired::after { content: 'RESTING'; position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%) rotate(-8deg); background: var(--ink); color: #fff; font-size: 12px; font-weight: 900; padding: 2px 8px; letter-spacing: .08em; }
.mind.loaner .tag { background: #7a4dff !important; letter-spacing: .06em; }
.loaner-badge { display: inline-block; background: #7a4dff; color: #fff; font-size: 10px; font-weight: 900; padding: 0 5px; margin-left: 4px; letter-spacing: .06em; vertical-align: middle; }

/* inventory */
.invbtn { font-size: 26px; }
.enbadge { display: none; position: absolute; bottom: -9px; left: 50%; transform: translateX(-50%); font-style: normal; font-size: 12px; font-weight: 900; padding: 0 5px; background: var(--lime); color: var(--ink); box-shadow: 0 0 0 2px var(--ink); white-space: nowrap; }
.enbadge.on { display: block; }
.nametag .ten { color: #3a9a00; font-weight: 900; }
.inv-sum { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.inv-sum > span { color: var(--muted); }
.inv-total { display: flex; gap: 10px; align-items: center; }
.inv-total i { font-style: normal; font-size: 30px; width: 52px; height: 52px; display: grid; place-items: center; background: var(--lime); box-shadow: 0 0 0 3px var(--ink); }
.inv-total b { display: block; font-family: var(--pix); font-weight: 400; font-size: 34px; line-height: 1; }
.inv-total b small { font-size: 20px; color: var(--muted); }
.inv-total span { font-size: 13px; color: var(--muted); }
.inv-facts { display: flex; flex-direction: column; gap: 2px; font-size: 14px; color: var(--ink-2); }
.inv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; padding: 4px; }
.inv-mind { background: var(--paper); padding: 8px; display: flex; flex-direction: column; gap: 6px; cursor: pointer; box-shadow: 0 0 0 3px var(--ink), inset 0 4px 0 var(--rar); transition: transform .1s; }
.inv-mind:hover { transform: translateY(-3px); }
.inv-img { position: relative; background: var(--paper-3); }
.inv-img img { width: 100%; aspect-ratio: 1; display: block; }
.inv-flag { position: absolute; left: 4px; top: 4px; font-style: normal; font-size: 10px; font-weight: 900; padding: 1px 5px; background: var(--gold); color: var(--ink); box-shadow: 0 0 0 2px var(--ink); }
.inv-flag.is-pfp { top: auto; bottom: 4px; background: var(--sky); }
.inv-name { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; }
.inv-name b { font-family: var(--pix); font-weight: 400; font-size: 20px; }
.inv-name span { font-size: 13px; font-weight: 900; color: var(--rar); }
.inv-en { display: flex; align-items: center; gap: 8px; }
.inv-en .enbar { flex: 1; display: flex; gap: 3px; }
.inv-en .enbar i { flex: 1; height: 12px; background: #e6dcc0; box-shadow: 0 0 0 2px var(--ink); }
.inv-en .enbar i.on { background: var(--lime); }
.inv-en span { font-size: 14px; font-weight: 900; white-space: nowrap; }
.inv-free { font-size: 12px; color: var(--muted); }
.inv-mind.tired .inv-img { filter: grayscale(.85); opacity: .7; }
.inv-empty { display: grid; justify-items: center; gap: 6px; text-align: center; padding: 30px 10px; }
.inv-chest { font-size: 54px; } .inv-empty span { color: var(--muted); max-width: 420px; }
.modal img.inv-big { width: 140px; height: 140px; margin: 0 auto; box-shadow: var(--ps); }
@media (max-width: 520px) { .inv-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; } .inv-total b { font-size: 28px; } }

/* animated bits run on the GPU (no repaint every frame) */
.logo img, .pod-crown, .r-crown, .tapstart, .card, .sp, .mode { will-change: transform; }
.lb td { vertical-align: middle; } .lb th:first-child, .lb td.rank { width: 48px; text-align: center; } .lb .lbv { white-space: nowrap; }

/* Mind Island */
.shopbtn, .stylebtn { font-size: 24px; }
.stylebtn { background: linear-gradient(180deg, #fff3b0, #ffd36a); }
.mode.island-mode { --bg: linear-gradient(#5ec8ff, #3b86d1); background-size: cover; background-position: center 40%; }
.mode.island-mode .badge { top: auto; bottom: 8px; right: 8px; background: var(--lime); color: var(--ink); font-size: 13px; padding: 0 6px; }
#s-island { background: #3b86d1; touch-action: none; user-select: none; }
#island-cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; }
.isl-top { position: absolute; top: 12px; left: 12px; right: 12px; display: flex; gap: 10px; align-items: center; pointer-events: none; }
.isl-top > * { pointer-events: auto; }
.isl-top .btn { padding: 10px 16px; font-size: 17px; }
.isl-res { display: flex; gap: 4px; background: var(--paper); padding: 6px; margin-right: auto; }
.isl-res span { display: flex; align-items: center; gap: 5px; padding: 3px 10px; background: var(--paper-2); font-size: 17px; white-space: nowrap; }
.isl-res b { font: 400 20px var(--pix); }
.isl-res .dust { background: #fff1b8; }
.isl-right { display: flex; gap: 10px; }
.isl-right .iconbtn { font-size: 24px; }
.isl-sub { position: absolute; top: 78px; left: 12px; display: flex; gap: 8px; flex-wrap: wrap; pointer-events: none; }
.isl-chip { background: rgba(255,248,228,.92); padding: 3px 10px; font-size: 13px; font-weight: 800; }
.isl-chip.bad { background: #ffd6d0; color: #a3271b; }
.isl-grow { pointer-events: auto; cursor: pointer; border: 0; font-family: inherit; background: #c9a6ff; color: #1d1b2f; box-shadow: 0 2px 0 #6b4fb0; }
.isl-grow:hover { background: #d9c0ff; }
.isl-grow[hidden] { display: none; }
.isl-bottom { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 10px; width: min(640px, calc(100% - 24px)); pointer-events: none; }
.isl-bottom > * { pointer-events: auto; }
.isl-tip { background: rgba(29,27,47,.84); color: #fff; padding: 6px 14px; font-size: 14px; font-weight: 700; text-align: center; box-shadow: none; }
.isl-tools { display: flex; gap: 6px; background: var(--paper); padding: 6px; }
.isl-tools button { position: relative; width: 84px; padding: 6px 4px 5px; border: 0; background: var(--paper-2); display: flex; flex-direction: column; align-items: center; gap: 2px; font: 800 14px var(--font); color: var(--ink); cursor: pointer; transition: transform .08s; }
.isl-tools button:hover { transform: translateY(-2px); }
/* T70a (phones): more tools hide to the right (Build, Adventure, Raid): the edge fades while there is more to scroll to */
.isl-tools.more { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 56px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 56px), transparent); }
.isl-tools.less.more { -webkit-mask-image: linear-gradient(to right, transparent, #000 40px, #000 calc(100% - 56px), transparent); mask-image: linear-gradient(to right, transparent, #000 40px, #000 calc(100% - 56px), transparent); }
.isl-tools.less:not(.more) { -webkit-mask-image: linear-gradient(to right, transparent, #000 40px); mask-image: linear-gradient(to right, transparent, #000 40px); }
.isl-tools button.on { background: var(--lime); box-shadow: 0 0 0 3px var(--ink); }
.isl-tools i { font-style: normal; font-size: 26px; line-height: 30px; height: 30px; display: grid; place-items: center; }
.isl-tools i img { width: 28px; height: 32px; image-rendering: pixelated; object-fit: contain; }
.isl-tools em { font-style: normal; color: var(--muted); }
.isl-tools .badge { top: -8px; right: -6px; display: none; background: var(--lime); color: var(--ink); }
.isl-tools .badge.on { display: block; }
.isl-tools .badge:empty { display: none; }
.isl-seeds { display: none; flex-direction: column; gap: 4px; background: var(--paper); padding: 6px; width: min(360px, 100%); }
.isl-seeds.on { display: flex; }
/* long lists (build menu, seeds) scroll inside the box instead of running off the screen */
.isl-seeds { max-height: min(46vh, 420px); overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; touch-action: pan-y; }
.isl-seeds button { display: grid; grid-template-columns: 34px 1fr auto; grid-template-rows: auto auto; column-gap: 8px; align-items: center; text-align: left; padding: 5px 8px; border: 0; background: var(--paper-2); cursor: pointer; font-family: var(--font); color: var(--ink); }
.isl-seeds button.on { background: #eaffb0; box-shadow: inset 0 0 0 2px var(--ink); }
.isl-seeds button.none { opacity: .55; }
.isl-seeds img { grid-row: 1 / 3; width: 30px; height: 34px; image-rendering: pixelated; object-fit: contain; }
.isl-seeds b { font-size: 15px; } .isl-seeds span { font-size: 12px; color: var(--muted); grid-column: 2; }
.isl-seeds em { grid-row: 1 / 3; grid-column: 3; font: 400 20px var(--pix); font-style: normal; }
.isl-seeds .buy { display: block; text-align: center; font-weight: 800; background: var(--gold); }
@media (max-width: 720px) {
  .isl-top { top: 8px; left: 8px; right: 8px; gap: 6px; flex-wrap: wrap; }
  .isl-top .lbl { display: none; }
  .isl-top .btn { padding: 8px 12px; }
  .isl-res { order: 3; width: 100%; justify-content: space-between; padding: 4px; }
  .isl-res span { padding: 2px 6px; font-size: 14px; } .isl-res b { font-size: 16px; }
  .isl-right { margin-left: auto; gap: 6px; } .isl-right .iconbtn { width: 44px; height: 44px; font-size: 20px; }
  .isl-sub { top: 112px; left: 8px; } .isl-chip { font-size: 11px; }
  .isl-tools button { width: 60px; font-size: 12px; } .isl-tools i { font-size: 22px; }
  .isl-tip { font-size: 12px; padding: 5px 10px; }
}
/* shop */
.shop-bar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 10px 14px; }
.shop-bar > span:first-child { font: 400 24px var(--pix); }
.shop-bar .muted { flex: 1 1 100%; order: 9; font-size: 13px; }   /* the note goes on its own line under the balances (it was squeezed into a thin column) */
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; padding: 4px; }
.shop-card { display: grid; grid-template-columns: 64px 1fr; gap: 10px; background: var(--paper); padding: 10px; align-items: center; }
.shop-card.soon { opacity: .7; }
.shop-img { width: 64px; height: 64px; background: var(--paper-2); display: grid; place-items: center; }
.shop-img img { width: 44px; height: 50px; image-rendering: pixelated; object-fit: contain; }
.shop-img i { font-style: normal; font-size: 36px; }
.shop-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.shop-txt b { font: 400 20px var(--pix); }
.shop-txt span { font-size: 13px; color: var(--muted); }
.shop-txt > em { font-style: normal; font-size: 13px; font-weight: 800; }
.shop-btns { grid-column: 1 / 3; display: flex; gap: 8px; flex-wrap: wrap; }
.shop-btns .btn { flex: 1; white-space: nowrap; }
.shop-grid .inv-empty { grid-column: 1 / -1; }
/* inventory items */
.items-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; }
.item { background: var(--paper); padding: 8px; display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; }
.item-img { width: 56px; height: 56px; background: var(--paper-2); display: grid; place-items: center; }
.item-img img { width: 38px; height: 44px; image-rendering: pixelated; object-fit: contain; }
.item-img img.seedimg { width: 26px; height: 30px; filter: saturate(.6); }
.item-img i { font-style: normal; font-size: 30px; }
.item b { font-size: 13px; line-height: 1.1; } .item em { font: 400 18px var(--pix); font-style: normal; }
.items-foot { display: flex; gap: 10px; justify-content: center; margin-top: 14px; }
.mode-row .mode.wide-mode .mode-txt b { font-size: 21px; }

/* ---- the prize: hidden 1-15 values, made big and obvious ---- */
.prize { gap: 6px; }
.prizetag { background: var(--ink); color: var(--gold); padding: 2px 12px; font-size: 14px; letter-spacing: .18em; box-shadow: 0 0 0 2px var(--gold); }
.crownbox { width: 132px; height: 112px; box-shadow: 0 0 0 3px var(--ink), 0 0 0 6px var(--gold), 0 0 26px 8px rgba(255,197,61,.55); animation: prizeGlow 1.6s ease-in-out infinite; }
.crownbox img { width: 112px; left: 10px; }
.crownbox b { top: 12px; font-size: 48px; }
.crownbox small { position: absolute; bottom: 4px; left: 0; right: 0; text-align: center; font-size: 11px; letter-spacing: .14em; color: var(--ink); font-weight: 900; }
.crownbox[data-tier="mid"] { box-shadow: 0 0 0 3px var(--ink), 0 0 0 6px #ff9f1c, 0 0 34px 12px rgba(255,159,28,.6); }
.crownbox[data-tier="high"] { box-shadow: 0 0 0 3px var(--ink), 0 0 0 6px #ff4d6d, 0 0 46px 18px rgba(255,77,109,.6); animation: prizeGlow .8s ease-in-out infinite; }
.crownbox[data-tier="high"] b { font-size: 56px; color: #fff3b0; }
@keyframes prizeGlow { 50% { filter: brightness(1.12); transform: scale(1.04); } }
.crownbox.new { animation: drop .45s cubic-bezier(.3,1.6,.5,1), prizeGlow 1.6s ease-in-out .45s infinite; }
.crownsleft i.done { opacity: .45; text-decoration: line-through; }
.crownsleft i.hid { background: #3a3656; color: #8f8ab0; }
.crownsleft i.upnext { position: relative; background: #3a3656; color: #fff; }
.crownsleft i.upnext em { position: absolute; top: 100%; margin-top: 3px; left: 50%; transform: translateX(-50%); font-style: normal; font-size: 10px; font-weight: 900; padding: 1px 4px; white-space: nowrap; box-shadow: 0 0 0 2px var(--ink); }
.crownsleft i.upnext.t-low em { background: #9be05a; color: var(--ink); } .crownsleft i.upnext.t-mid em { background: #ffc53d; color: var(--ink); } .crownsleft i.upnext.t-high em { background: #ff4d6d; color: #fff; }
.crownsleft i.upnext.t-high { box-shadow: 0 0 0 2px var(--ink), 0 0 10px 3px rgba(255,77,109,.7); }
@media (max-height: 560px) { .crownbox { width: 100px; height: 86px; } .crownbox img { width: 86px; left: 7px; } .crownbox b { font-size: 36px; } .crownbox[data-tier="high"] b { font-size: 42px; } .prizetag { font-size: 11px; } }

/* ---- ranked stake banner ---- */
.prep-note .stake { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; }
.prep-note .stake b { padding: 3px 10px; font-size: 18px; box-shadow: 0 0 0 2px var(--ink); white-space: nowrap; }
.prep-note .stake .sx { background: var(--ink); color: var(--gold); } .prep-note .stake .sw { background: #9be05a; color: var(--ink); }
.prep-note .stake .sl { background: #ff6a5a; color: #fff; } .prep-note .stake .se { background: #fff3b0; color: var(--ink); }
.prep-note small { display: block; color: var(--muted); }

/* ---- island build menu + building popup ---- */
.isl-build button img { width: 40px; height: 40px; object-fit: contain; image-rendering: pixelated; }
.isl-build button span + span { color: var(--ink); font-weight: 800; }
.isl-bmenu { display: none; align-items: center; gap: 8px; background: var(--paper); padding: 6px 8px; margin-bottom: 6px; }
.isl-bmenu.on { display: flex; }
.isl-bmenu img { width: 40px; height: 40px; object-fit: contain; image-rendering: pixelated; }
.isl-bmenu div { display: flex; flex-direction: column; min-width: 0; } .isl-bmenu div span { font-size: 12px; color: var(--muted); }
.isl-bmenu div span.bm-up { color: var(--ink); font-weight: 800; } .isl-bmenu .bm-up em { font-style: normal; color: #2f9e44; }
.isl-bmenu button { border: 0; padding: 6px 10px; background: var(--paper-2); font: 800 14px var(--font); cursor: pointer; box-shadow: 0 0 0 2px var(--ink); }

/* ---- raids ---- */
#s-raid { background: #3b86d1; }
#raid-cv { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; touch-action: none; }
.raid-top { position: absolute; top: max(8px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 12px; background: var(--paper); padding: 6px 12px; white-space: nowrap; max-width: 96vw; }
.raid-top b { font-size: 16px; overflow: hidden; text-overflow: ellipsis; max-width: 34vw; }
.raid-stars i { font-style: normal; color: #c9c3d6; font-size: 22px; } .raid-stars i.on { color: #ffc53d; text-shadow: 0 0 6px rgba(255,197,61,.8); }
.raid-pct { font: 400 20px var(--title, inherit); min-width: 44px; text-align: right; }
.raid-time { font-weight: 900; font-size: 18px; min-width: 44px; } .raid-time.low { color: var(--red); }
.raid-loot { font-weight: 800; }
.raid-bottom { position: absolute; left: 0; right: 0; bottom: max(8px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; }
.raid-tip { background: rgba(29,27,47,.85); color: #fff; padding: 4px 12px; font-weight: 800; font-size: 14px; }
.raid-tip:empty { display: none; }
.raid-bar { display: flex; gap: 6px; background: var(--paper); padding: 6px; pointer-events: auto; align-items: stretch; }
.raid-bar button { width: 70px; border: 0; background: var(--paper-2); display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px; font: 800 12px var(--font); cursor: pointer; }
.raid-bar button img { height: 44px; image-rendering: pixelated; }
.raid-bar button b { font-size: 26px; line-height: 44px; }
.raid-bar button.on { background: var(--lime); box-shadow: 0 0 0 3px var(--ink); }
.raid-bar button.used { opacity: .35; filter: grayscale(1); cursor: default; }
.raid-bar .sep { width: 2px; background: var(--ink); opacity: .2; margin: 4px 4px; }
@media (max-width: 600px) {   /* T66: phone: every troop and spell fits on screen (Brawler and Bolt were off the edges, not tappable); the top bar wraps */
  .raid-bar { max-width: calc(100vw - 8px); box-sizing: border-box; overflow-x: auto; gap: 3px; padding: 4px; }
  .raid-bar button { width: 46px; flex: none; padding: 3px 1px; font-size: 10px; } .raid-bar button img { height: 32px; } .raid-bar button b { font-size: 20px; line-height: 32px; }
  .raid-bar .sep { margin: 4px 1px; }
  #s-raid .raid-top { flex-wrap: wrap; white-space: normal; justify-content: center; gap: 4px 10px; width: calc(100vw - 16px); box-sizing: border-box; }
  #s-raid .raid-top > b { max-width: 70vw; flex-basis: 100%; text-align: center; }
}
.raidbtn { background: #ff6a5a; color: #fff; }
.raid-stars.big { font-size: 44px; color: #ffc53d; text-align: center; letter-spacing: 6px; }
h3.raid-result { text-align: center; }
/* ---- army picker + raid bar v2 ---- */
.army-cap { font-size: 16px; margin: 4px 0 8px; } .army-cap b { font-size: 22px; } .army-cap small { display: block; font-size: 12px; margin-top: 4px; }
.army-list { display: flex; flex-direction: column; gap: 6px; }
.army-row { display: grid; grid-template-columns: 34px 1fr auto 28px auto; align-items: center; gap: 8px; background: var(--paper-2); padding: 4px 8px; }
.army-row img { width: 30px; height: 40px; object-fit: contain; image-rendering: pixelated; }
.army-row small { display: block; color: var(--muted); font-size: 12px; } .army-row em { font-style: normal; font-weight: 900; font-size: 18px; text-align: center; }
.army-hero { display: flex; align-items: center; gap: 10px; margin-top: 8px; padding: 6px 8px; background: #fff3b0; box-shadow: 0 0 0 2px var(--ink); }
.army-hero img { height: 44px; image-rendering: pixelated; } .army-hero small { display: block; color: var(--muted); }
.raid-bar button { position: relative; }
.raid-bar button em { position: absolute; top: 2px; right: 4px; font-style: normal; font-weight: 900; font-size: 13px; }
.raid-bar button.hero { background: #fff3b0; }
.raid-bar button.ready { animation: cryPulse .8s ease-in-out infinite; }
@keyframes cryPulse { 50% { box-shadow: 0 0 0 3px #ffc53d, 0 0 14px 4px rgba(255,197,61,.8); } }
.raid-loot-won b { font-size: 26px; color: #c98a00; }

/* ---- adventure ---- */
#s-adv { background: #3b86d1; }
#adv-cv { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; touch-action: none; }
.adv-hp { display: flex; align-items: center; gap: 4px; } .adv-hp .bar { width: 90px; height: 10px; background: #3a3656; box-shadow: 0 0 0 2px var(--ink); display: block; }
.adv-hp .bar i { display: block; height: 100%; background: linear-gradient(180deg, #ff8a7a, #e0303a); transition: width .2s; }
.adv-bag { display: flex; gap: 8px; font-size: 14px; } .adv-bag b { font-size: 15px; }
@media (max-width: 600px) {   /* T66: phone: the adventure bar wraps to two rows (name was '…', HP cut, loot ran into the timer) */
  .adv-top { flex-wrap: wrap; white-space: normal; justify-content: center; gap: 4px 10px; width: calc(100vw - 16px); box-sizing: border-box; }
  .adv-top > b { max-width: 60vw; } .adv-top .adv-hp .bar { width: 64px; } .adv-top .adv-bag { order: 5; flex-basis: 100%; justify-content: center; font-size: 13px; }
}
.adv-ab { width: 110px !important; } .adv-ab.used { opacity: .5; } .adv-ab em { font-size: 16px !important; }
.advbtn { background: #4fae5a; color: #fff; }
.adv-loot { list-style: none; padding: 0; font-size: 18px; } .adv-loot b { color: #2f9a1a; }

/* raid + adventure live in the tool bar (the top bar ran out of room on phones) */
.isl-tools .tsep { width: 2px; background: var(--ink); opacity: .2; margin: 4px 2px; }
.isl-tools button.go { color: #fff; } .isl-tools button.go.adv { background: #4fae5a; } .isl-tools button.go.raid { background: #e0503a; }
.isl-tools button.go span { color: #fff; }
@media (max-width: 820px) { .isl-tools button { width: 62px; font-size: 12px; } .isl-tools i { font-size: 20px; height: 24px; line-height: 24px; } }

.isl-build .bm-head { grid-column: 1 / -1; font-weight: 900; font-size: 13px; padding: 4px 6px 0; color: var(--muted); }
.isl-build button.stored { background: #fff3b0; } .isl-build button.gem { background: linear-gradient(180deg, #e9e0ff, #d4c4ff); }

.shop-info { grid-column: 1 / -1; background: var(--paper-2); padding: 8px 12px; font-size: 14px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.shop-info.gemsinfo { background: linear-gradient(90deg, #efe6ff, #dccdff); }
.shop-card.gemcard { background: linear-gradient(180deg, #f6f0ff, #e6dbff); }
.btn.gem { background: #8a5cff; color: #fff; }
.isl-res .gems b { color: #7a4cff; }
#shop-tabs { flex-wrap: wrap; }

/* ---- world map ---- */
.wmap { position: relative; width: 440px; max-width: 100%; height: 260px; margin: 6px auto; border-radius: 6px; overflow: hidden;
  background: radial-gradient(circle at 30% 30%, #bfe8ff, #8fd0ff 50%, #e8d4ff); box-shadow: inset 0 0 0 3px var(--ink); }
.wmap .route { position: absolute; height: 0; border-top: 3px dashed rgba(29,27,47,.25); transform-origin: 0 0; }
.wmap .route.open { border-top-color: #ffc53d; }
.wmap .pin { position: absolute; transform: translate(-50%, -50%); border: 0; background: #7fd060; padding: 6px 10px; border-radius: 40% 40% 50% 50%; box-shadow: 0 0 0 2px var(--ink), 0 6px 0 2px #6b4428; cursor: pointer; display: flex; flex-direction: column; align-items: center; font: 800 12px var(--font); }
.wmap .pin b { font-size: 20px; } .wmap .pin em { font-style: normal; font-size: 11px; }
.wmap .pin.on { background: #d4ff1f; box-shadow: 0 0 0 3px var(--ink), 0 0 16px 4px rgba(212,255,31,.8), 0 6px 0 2px #6b4428; }
.wmap .pin.locked { background: #b9b6c4; filter: grayscale(.6); }
.wmap-desc { font-size: 14px; } .wmap-pot { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 14px; }

/* ---- world map screen ---- */
#s-map { background: #5fb8f0; }
#map-cv { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: grab; }
.map-panel { position: absolute; left: 50%; bottom: max(10px, env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; align-items: center; gap: 14px; background: var(--paper); padding: 8px 12px; max-width: 96vw; }
#map-info { display: flex; flex-direction: column; font-size: 13px; min-width: 0; max-width: 420px; } #map-info b { font-size: 17px; } #map-info span { color: var(--muted); }
.map-pot { display: flex; align-items: center; gap: 6px; font-size: 18px; white-space: nowrap; }
@media (max-width: 760px) { .map-panel { gap: 8px; padding: 6px; } #map-info { font-size: 11px; } #map-info b { font-size: 14px; } }
.army-none { background: #ffe0d8; padding: 6px 10px; font-weight: 800; box-shadow: 0 0 0 2px var(--ink); }

/* ---- admin ---- */
.codebox { display: flex; gap: 6px; } .codebox input { width: 140px; padding: 4px 8px; font: 700 14px var(--font); }
.adm { display: grid; grid-template-columns: minmax(240px, 1fr) 2fr; gap: 10px; }
.adm-search { display: flex; gap: 6px; } .adm-search input { flex: 1; padding: 6px 8px; font: 700 14px var(--font); }
.adm-row { display: flex; flex-direction: column; align-items: flex-start; width: 100%; text-align: left; border: 0; background: var(--paper-2); margin-top: 4px; padding: 6px 8px; cursor: pointer; font: 600 13px var(--font); }
.adm-row span { color: var(--muted); font-size: 12px; } .adm-row em, .adm-ban { color: var(--red); font-style: normal; font-weight: 900; }
.adm-box { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; background: var(--paper-2); padding: 8px; margin: 6px 0; }
.adm-box input { width: 110px; padding: 4px 6px; font: 700 13px var(--font); } .adm-box small { width: 100%; }
.adm-flags div { font-size: 12px; border-bottom: 1px solid rgba(0,0,0,.08); padding: 3px 0; }
.btn.red { background: var(--red); color: #fff; }
@media (max-width: 760px) { .adm { grid-template-columns: 1fr; } }
.items-h { margin: 12px 0 4px; font-size: 15px; }
.isl-build .bm-empty { grid-column: 1 / -1; padding: 10px; color: var(--muted); font-weight: 700; }
.items-note { margin-top: 10px; }
.paygems { display: flex; align-items: center; gap: 6px; cursor: pointer; color: #6a3cff; }

.gem-packs { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; margin: 8px 0; }
.gem-pack { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px; background: linear-gradient(180deg, #f3ecff, #dccdff); box-shadow: 0 0 0 2px var(--ink); text-align: center; }
.gem-pack b { font-size: 26px; } .gem-pack em { font-style: normal; font-weight: 900; font-size: 18px; color: #6a3cff; } .gem-pack small { color: #c43c8a; font-weight: 800; } .gem-pack strong { font-size: 13px; }
.army-facts { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 14px; margin-bottom: 4px; }

/* messages: in the middle of the screen, easy to see */
#toast { top: 42%; bottom: auto; transform: translate(-50%, calc(-50% + 12px)); z-index: 90; padding: 14px 24px; font-size: 20px; font-weight: 800; max-width: min(560px, 88vw); box-shadow: 0 0 0 3px var(--ink), 0 8px 0 3px rgba(29,27,47,.3), 0 0 0 100vmax rgba(29,27,47,0); }
#toast.on { transform: translate(-50%, -50%); }
#toast.bad { background: #ffe0e3; color: #8a1f2a; }

/* ---- lobby: the island is impossible to miss ---- */
.mode.island-big { --bg: linear-gradient(135deg, #7fd8ff, #b8f0a0); background-size: cover; background-position: center; min-height: 150px; box-shadow: 0 0 0 3px var(--ink), 0 0 0 6px #4fae5a, 0 7px 0 5px rgba(29,27,47,.3); }
.mode.island-big .mode-txt b { font-size: 32px; }
.mode.island-big.wants { animation: islGlow 1.6s ease-in-out infinite; }
@keyframes islGlow { 50% { box-shadow: 0 0 0 3px var(--ink), 0 0 0 6px #d4ff1f, 0 0 26px 8px rgba(212,255,31,.75); } }
.isl-chips { position: relative; display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.isl-chips span { background: rgba(29,27,47,.85); color: #fff; font-size: 13px; font-weight: 800; padding: 2px 8px; }
.mode-row.three { grid-template-columns: repeat(3, 1fr); gap: 10px; }
.mode-row.three .mode-txt b { font-size: 19px; }
.mode-row.three .mode-txt span { font-size: 12px; }
.mode[hidden] { display: none; }
/* ---- island coach ---- */
.isl-coach { display: none; position: absolute; left: 50%; top: 70px; transform: translateX(-50%); z-index: 12; width: min(520px, 92vw); background: var(--paper); padding: 10px 14px; }
.isl-coach.on { display: block; animation: drop .3s ease-out; }
.isl-coach p { margin: 2px 0 8px; font-size: 16px; font-weight: 700; line-height: 1.3; }
.isl-coach div { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.isl-coach em { margin-right: auto; color: var(--muted); font-style: normal; font-size: 13px; font-weight: 800; }
.coach-n { font-size: 12px; font-weight: 900; color: var(--muted); }
.coach-mark { animation: coachPulse 1s ease-in-out infinite; position: relative; z-index: 3; }
@keyframes coachPulse { 50% { box-shadow: 0 0 0 4px #d4ff1f, 0 0 20px 8px rgba(212,255,31,.8); transform: translateY(-3px); } }

/* lobby on small screens: the mode column must never collapse (Ranked + Island were hidden behind the leaderboard) */
@media (max-width: 1000px) { .col-play { flex: none; max-height: none; overflow: visible; } }
/* phones held sideways: modes on the left, leaderboard one tap away on the right */
@media (orientation: landscape) and (max-height: 540px) {
  .lobby { inset: 56px 10px max(6px, env(safe-area-inset-bottom)); flex-direction: row; align-items: stretch; justify-content: flex-start; padding-top: 0; overflow: hidden; gap: 10px; }
  .col-play { flex: none; width: min(460px, 62vw); max-height: 100%; overflow: auto; gap: 6px; padding: 2px 6px 8px 2px; }
  .hub-logo { display: none; }
  .mode.big { min-height: 84px; } .mode.island-big { min-height: 92px; }
  .mode.big .mode-txt b, .mode.island-big .mode-txt b { font-size: 24px; }
  .mode-txt span { font-size: 12px; } .mode-ico { width: 34px; }
  .mode-row.three .mode { min-height: 54px; } .mode-row.three .mode-txt b { font-size: 16px; }
  .guest-note { font-size: 12px; padding: 5px 8px; }
  #s-hub.board-closed .col-board { display: none; }
  #s-hub:not(.board-closed) .col-board { display: flex; flex: 1; min-width: 0; height: 100%; overflow: auto; }
  .board-tab { display: flex !important; }
  #s-hub:not(.board-closed) .board-tab { display: none !important; }
}

/* ---- talk to a Mind ---- */
#mindp { display: flex; flex-direction: column; gap: 8px; }
#mindp .drawer-head em { margin-left: auto; font-style: normal; font-size: 13px; font-weight: 800; color: var(--muted); }
.dh-ico { font-size: 24px; }
.mp-list { display: flex; gap: 6px; overflow-x: auto; flex: none; padding: 3px; scrollbar-width: thin; }
.mp-list button { position: relative; flex: none; width: 58px; padding: 3px; background: #fff; box-shadow: 0 0 0 2px var(--ink); border: 0; cursor: pointer; font: 800 11px var(--body, inherit); }
.mp-list button.on { background: var(--lime); }
.mp-list img { width: 36px; height: 36px; object-fit: contain; image-rendering: pixelated; display: block; margin: 0 auto; }
.mp-list span { display: block; overflow: hidden; }
.mp-list i { position: absolute; top: 0; right: 2px; font-style: normal; font-size: 13px; }
.mp-job { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; flex: none; }
.mp-job button { padding: 5px 2px; background: #fff; box-shadow: 0 0 0 2px var(--ink); border: 0; cursor: pointer; font: 800 12px inherit; line-height: 1.1; }
.mp-job button.on { background: var(--lime); }
.mp-job i { display: block; font-style: normal; font-size: 18px; }
.mp-desc { margin: 0; font-size: 13px; color: var(--muted); font-weight: 700; flex: none; }
#mp-chat { flex: 1; min-height: 120px; overflow: auto; display: flex; flex-direction: column; gap: 5px; }
.msg small { display: block; font-size: 12px; color: var(--muted); }

/* ---- chat, mail, reports ---- */
.fr-tools { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; } .fr-tools .btn { flex: 1 1 auto; }
.fr-note { display: block; font-size: 12px; margin: 6px 0 4px; text-align: center; }   /* T66o: own line (it was squeezed into a 1-word column) */
.rep-text { width: 100%; padding: 8px; font: 700 15px var(--font); box-sizing: border-box; resize: vertical; }
.letter { background: #fff; box-shadow: 0 0 0 2px var(--ink); padding: 8px 10px; margin-bottom: 8px; }
.letter summary { cursor: pointer; font-size: 16px; display: flex; gap: 6px; align-items: baseline; } .letter summary time { margin-left: auto; white-space: nowrap; } .letter.new summary b { color: #c2410c; } .letter-btns { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.letter h4 { margin: 0; font-size: 16px; } .letter time { font-size: 12px; color: var(--muted); } .letter p { margin: 4px 0; font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.iconbtn .badge { position: absolute; }
.adm-tabs { display: flex; flex-wrap: wrap; gap: 5px; margin: 8px 0; }
.adm-box input.wide { width: 100%; }
.adm-box input[type="datetime-local"] { width: 230px; } .adm-box input[type="checkbox"] { width: auto; }   /* T69q owner: the countdown box showed only the date */
.adm-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.adm-stats div { background: var(--paper-2); padding: 8px; } .adm-stats b { display: block; font-size: 26px; } .adm-stats span { font-size: 12px; color: var(--muted); font-weight: 800; }
.adm-h { margin: 14px 0 6px; font-size: 15px; } .adm-stats b small { font-size: 12px; color: var(--muted); }
.adm-report { background: var(--paper-2); padding: 8px; margin-bottom: 6px; } .adm-report.done { opacity: .55; } .adm-report p { margin: 4px 0; white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---- Mind Town, cup, AI keys ---- */
#town-cv { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; image-rendering: pixelated; }
.town-top { position: absolute; top: 8px; left: 8px; right: 8px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; background: var(--paper); padding: 6px 10px; font-weight: 800; font-size: 14px; }
#town-stay { color: var(--muted); font-size: 13px; }
.town-zoom { margin-left: auto; display: flex; gap: 5px; }
.town-side { position: absolute; left: 8px; bottom: 8px; width: min(400px, calc(100vw - 16px)); max-height: 56vh; display: flex; flex-direction: column; gap: 6px; background: var(--paper); padding: 8px; }
.town-side h4 { margin: 0; font-size: 15px; }
#town-feed { flex: 1; min-height: 60px; overflow: auto; font-size: 14px; overflow-wrap: anywhere; }
#town-feed .news { color: #8a5a00; font-weight: 800; }
.mode.town-tile { --bg: linear-gradient(135deg, #6c8f5a, #a8966a); min-height: 74px; }
.mode.cup-tile { --bg: linear-gradient(135deg, #7a5a22, #c79a3a); min-height: 74px; }
.mode.town-tile .mode-txt b, .mode.cup-tile .mode-txt b { font-size: 20px; }
.cup-row { display: flex; gap: 8px; align-items: center; padding: 3px 0; border-bottom: 1px solid rgba(0,0,0,.08); }
.cup-row span { flex: 1; font-weight: 800; } .cup-row em { font-style: normal; color: #b07a00; font-weight: 800; }
.ai-key { background: var(--paper-2); padding: 8px; } .ai-key code { display: block; margin-top: 4px; font-size: 13px; overflow-wrap: anywhere; user-select: all; }
.ai-row { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid rgba(0,0,0,.08); }
.ai-row small { grid-column: 1; color: var(--muted); } .ai-row label { font-size: 13px; font-weight: 800; } .ai-row button { grid-column: 2; grid-row: 1 / span 2; }
.mode.town-tile .mode-txt span, .mode.cup-tile .mode-txt span { font-size: 12px; white-space: nowrap; }

@media (max-height: 520px) { .town-side { width: min(250px, 42vw); max-height: 46vh; padding: 5px; gap: 3px; } .town-side h4 { display: none; } #town-feed { min-height: 34px; font-size: 12px; } .town-top { padding: 3px 6px; } }

/* phones held upright: nothing may fall off the edge */
@media (max-width: 560px) {
  .topbtns { flex-wrap: wrap; justify-content: flex-end; gap: 4px; max-width: 62vw; }
  .topbtns .iconbtn { width: 38px; height: 38px; }
  #hub-tutorial { display: none; }   /* the Tutorial tile in the lobby does the same; keeps the top bar to two short rows */
  .isl-bottom { left: 0; right: 0; width: 100%; transform: none; }
  .isl-tools { width: 100%; max-width: 100vw; justify-content: flex-start; overflow-x: auto; -webkit-overflow-scrolling: touch; box-sizing: border-box; }
  .isl-tools > * { flex: none; }
  .town-zoom { margin-left: 0; flex-wrap: wrap; }
  .town-top .tl { display: none; }   /* T66: phone: icon buttons (the title says what each does), one short row */
  .town-top { gap: 5px; padding: 4px 6px; } .town-top .btn.small { padding: 4px 9px; font-size: 15px; min-width: 38px; }
}
.town-side.folded .town-emotes { display: none; }

/* admin: how serious a problem is */
.adm-report.sev-critical { border-left: 5px solid #c0392b; } .adm-report.sev-high, .adm-report.sev-error { border-left: 5px solid #d98a1f; } .adm-report.sev-warning, .adm-report.sev-info { border-left: 5px solid #8a93a6; }
.legal-links { display: flex; gap: 12px; justify-content: center; font-size: 13px; font-weight: 800; margin-top: 8px; }
.legal-links a { color: inherit; }

/* ---- loading screen (loader.js): airship in pixel clouds + a card with tips ---- */
#loader { position: fixed; inset: 0; z-index: 40; display: none; place-items: center; background: #2b3f8f; }
#loader.on { display: grid; animation: fadein .25s; }
#loader canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; }
#loader .ld-card { position: relative; margin-top: 34vh; background: var(--paper); box-shadow: var(--ps); padding: 12px 20px 14px; width: min(440px, calc(100vw - 32px)); text-align: center; display: flex; flex-direction: column; gap: 6px; }
#loader .ld-title { font-size: clamp(19px, 4vw, 28px); letter-spacing: .03em; white-space: nowrap; }
#loader .ld-title::after { content: ''; animation: lddots 1.2s steps(4) infinite; }
@keyframes lddots { 0% { content: ''; } 25% { content: '.'; } 50% { content: '..'; } 75% { content: '...'; } }
#loader .ld-sub { font-size: 15px; color: var(--muted); min-height: 1.2em; }
#loader .ld-bar { height: 10px; background: #e3dccb; box-shadow: var(--ps); overflow: hidden; margin: 4px 0; }
#loader .ld-bar i { display: block; height: 100%; width: 30%; background: var(--lime); animation: ldbar 1.1s ease-in-out infinite; }
@keyframes ldbar { from { transform: translateX(-100%); } to { transform: translateX(340%); } }
#loader .ld-tip { font-size: 14px; margin: 0; min-height: 2.4em; }
@keyframes fadein { from { opacity: 0; } }
/* troop levels in Shop → Army */
.troop-lv { display: block; font-size: 12px; margin-top: 4px; color: var(--ink); } .troop-lv em { font-style: normal; color: #2f9e44; font-weight: 800; }
.troop-up { display: flex; gap: 4px; margin-top: 4px; flex-wrap: wrap; }
/* 📜 raid history */
.rlog { display: flex; flex-direction: column; gap: 6px; max-height: 46vh; overflow-y: auto; margin-top: 8px; }
.rlog-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; background: var(--paper-2); padding: 6px 10px; }
.rlog-row small { display: block; color: var(--muted); font-size: 12px; }
.rlog-tabs { margin-top: 8px; }
.linkbtn { border: 0; background: none; padding: 0; font: 900 15px var(--font); color: var(--sky-d); text-decoration: underline; cursor: pointer; }

/* ✏️ island edit mode: what is selected + bulk actions */
.isl-edit { display: none; flex-wrap: wrap; align-items: center; gap: 6px; background: var(--paper); padding: 6px 8px; margin-bottom: 6px; max-height: 30vh; overflow-y: auto; }
.isl-edit.on { display: flex; }
.isl-edit .ed-what { font-size: 13px; margin-right: 4px; }
.isl-edit button { border: 0; padding: 5px 9px; background: var(--paper-2); font: 800 13px var(--font); cursor: pointer; box-shadow: 0 0 0 2px var(--ink); }
.isl-edit button.go { background: var(--lime); }
.isl-edit button.gem { background: #d9c8ff; }
.isl-edit button.gem.go { background: #b48cff; color: #fff; }

/* ✨ cosmetics: profile frames (looks only) and the Style shop */
.fr-gold { box-shadow: 0 0 0 3px #ffd84a, 0 0 0 5px #8a5a00, 0 0 14px 3px rgba(255, 200, 60, .7) !important; }
.fr-frost { box-shadow: 0 0 0 3px #bfefff, 0 0 0 5px #2f8fd0, 0 0 14px 3px rgba(127, 214, 255, .75) !important; }
.fr-flame { box-shadow: 0 0 0 3px #ffb02e, 0 0 0 5px #c43c3c, 0 0 16px 4px rgba(255, 106, 26, .8) !important; animation: frflame 1.4s ease-in-out infinite; }
.fr-prism { box-shadow: 0 0 0 3px #fff, 0 0 0 6px #9b6bff, 0 0 18px 5px rgba(212, 255, 31, .7) !important; animation: frprism 3s linear infinite; }
@keyframes frflame { 50% { box-shadow: 0 0 0 3px #ffd84a, 0 0 0 5px #e8481c, 0 0 22px 7px rgba(255, 140, 40, .9); } }
@keyframes frprism { 0% { filter: hue-rotate(0deg); } 100% { filter: hue-rotate(360deg); } }
.cos-back { width: 54px; height: 81px; object-fit: cover; image-rendering: pixelated; box-shadow: var(--ps); }
.cos-pfp { width: 56px; height: 56px; image-rendering: pixelated; background: var(--paper-2); margin: 6px; }
.shop-card.owned { outline: 3px solid var(--lime); }
.cos-sky { width: 96px; height: 54px; object-fit: cover; image-rendering: pixelated; box-shadow: var(--ps); }
/* victory confetti (pixel squares + a few crowns) */
.confetti { position: fixed; inset: 0; z-index: 30; pointer-events: none; overflow: hidden; }
.confetti i { position: absolute; top: -20px; width: 8px; height: 8px; animation: confall linear forwards; }
.confetti i.crown { width: 22px; height: 18px; background: url(assets/crown.png) center / contain no-repeat; image-rendering: pixelated; }
@keyframes confall { to { transform: translate(var(--dx), 110vh) rotate(var(--r)); } }
/* name colours (cosmetic) */
.nm-gold { color: #ffc53d !important; text-shadow: 0 0 6px rgba(255, 200, 60, .6); }
.nm-neon { color: #d4ff1f !important; text-shadow: 0 0 6px rgba(212, 255, 31, .8), 0 0 12px rgba(94, 200, 255, .6); }
.nm-rainbow { background: linear-gradient(90deg, #ff5263, #ffc53d, #d4ff1f, #5ec8ff, #9b6bff, #ff5263); background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; color: transparent !important; animation: nmrain 3s linear infinite; }
@keyframes nmrain { to { background-position: 200% 0; } }
.cos-name { display: inline-block; font-size: 15px; padding: 10px 4px; max-width: 110px; overflow-wrap: anywhere; line-height: 1.15; }
/* auras (cosmetic): a pulsing glow around a picture */
.au-gold { animation: augold 1.8s ease-in-out infinite; }
.au-frost { animation: aufrost 1.8s ease-in-out infinite; }
.au-void { animation: auvoid 2.2s ease-in-out infinite; }
.au-prism { animation: auprism 2.4s linear infinite; }
@keyframes augold { 0%, 100% { filter: drop-shadow(0 0 4px #ffd84a); } 50% { filter: drop-shadow(0 0 12px #ffb02e) drop-shadow(0 0 4px #fff3a8); } }
@keyframes aufrost { 0%, 100% { filter: drop-shadow(0 0 4px #9fe6ff); } 50% { filter: drop-shadow(0 0 12px #5ec8ff) drop-shadow(0 0 4px #ffffff); } }
@keyframes auvoid { 0%, 100% { filter: drop-shadow(0 0 5px #6a3cff); } 50% { filter: drop-shadow(0 0 14px #9b6bff) drop-shadow(0 0 3px #1d1b2f); } }
@keyframes auprism { 0% { filter: drop-shadow(0 0 10px #ff5263); } 25% { filter: drop-shadow(0 0 10px #ffc53d); } 50% { filter: drop-shadow(0 0 10px #d4ff1f); } 75% { filter: drop-shadow(0 0 10px #5ec8ff); } 100% { filter: drop-shadow(0 0 10px #ff5263); } }
/* titles (cosmetic): small words under a name */
.cos-title, [data-title]::after { display: block; font-size: 10px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: #ffd84a !important; -webkit-text-fill-color: #ffd84a; background: none !important; text-shadow: 0 1px 0 #2b2340; animation: none; white-space: nowrap; }
[data-title]::after { content: '« ' attr(data-title) ' »'; }
.cos-name .cos-title { margin-top: 2px; }
.cos-trail { display: inline-block; font-size: 13px; padding: 16px 2px; white-space: nowrap; animation: trailbob 1.6s ease-in-out infinite; }
@keyframes trailbob { 50% { transform: translateX(4px); opacity: .75; } }

/* default card faces: a pixel frame in the card's colour, corner gems, a soft glow and a diamond pattern (no longer plain paper) */
.card, .rc-face {
  background:
    radial-gradient(circle at 50% 46%, color-mix(in srgb, var(--c, #8a7cff) 30%, #fff) 0 30%, transparent 31%),
    repeating-linear-gradient(45deg, rgba(29,27,47,.05) 0 3px, transparent 3px 9px),
    repeating-linear-gradient(-45deg, rgba(29,27,47,.05) 0 3px, transparent 3px 9px),
    linear-gradient(180deg, #fff, var(--paper) 60%, var(--paper-2));
}
.card { box-shadow: var(--ps), inset 0 0 0 3px #fff, inset 0 0 0 5px color-mix(in srgb, var(--c, #8a7cff) 75%, #1d1b2f), 0 9px 0 0 rgba(29,27,47,.3); }
.card.on { box-shadow: var(--ps), inset 0 0 0 3px #fff, inset 0 0 0 5px color-mix(in srgb, var(--c, #8a7cff) 75%, #1d1b2f), 0 0 0 7px var(--lime), 0 16px 0 2px rgba(29,27,47,.25); }
.card b, .rc-face b { position: relative; z-index: 1; }
.card i.gem, .rc-face i.gem { position: absolute; width: 6px; height: 6px; background: var(--c, #8a7cff); box-shadow: 0 0 0 2px #1d1b2f; transform: rotate(45deg); pointer-events: none; }
.card i.gem.a, .rc-face i.gem.a { top: 50%; left: 6px; } .card i.gem.b, .rc-face i.gem.b { top: 50%; right: 6px; }
.rc-face { box-shadow: 0 -4px 0 0 var(--ink), 0 4px 0 0 var(--ink), -4px 0 0 0 var(--ink), 4px 0 0 0 var(--ink), inset 0 0 0 5px #fff, inset 0 0 0 8px color-mix(in srgb, var(--c, #8a7cff) 75%, #1d1b2f), 0 12px 0 0 rgba(29,27,47,.35); }
/* a player's card (tap a Mind in Mind Town) */
.pcard { display: flex; align-items: center; gap: 14px; text-align: left; margin-bottom: 8px; }
.pcard img { width: 72px; height: 72px; image-rendering: pixelated; background: var(--paper-2); box-shadow: 0 0 0 3px var(--ink); }
.pcard h3 { margin: 0; } .pcard p { margin: 2px 0 0; }
/* 🧠 Your Mind: the Autopilot panel in the lobby (right side) */
.col-mind { width: min(330px, 27vw); max-height: 100%; overflow: auto; display: flex; flex-direction: column; gap: 8px; padding: 12px; margin-left: auto; background: linear-gradient(180deg, #f6f0ff, var(--paper) 40%); }
#s-hub.board-closed .col-mind { margin-right: 64px; }
.mp-head { display: flex; align-items: center; gap: 10px; } .mp-head > div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.mp-head img { width: 44px; height: 44px; image-rendering: pixelated; box-shadow: 0 0 0 3px var(--ink); background: var(--paper-2); }
.mp-head small { color: var(--muted); font-size: 12px; }
.col-mind.running .mp-head img { animation: tappulse 1.2s ease-in-out infinite; }
.col-mind.folded .mp-body { display: none; } .col-mind.folded #mp-fold { transform: rotate(-90deg); }
.mp-body { display: flex; flex-direction: column; gap: 8px; }
.mp-plan { font-weight: 800; font-size: 13px; background: #fff; padding: 6px 8px; box-shadow: 0 0 0 2px var(--ink); }
.mp-now:empty { display: none; } .mp-now { font-size: 13px; color: #6b3fd1; font-weight: 800; }
.mp-row { display: flex; gap: 8px; align-items: center; } .mp-row .btn.primary { flex: 1; }
.mp-presets { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 6px; }
.mp-preset { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 4px; border: 0; background: var(--paper-2); box-shadow: 0 0 0 2px var(--ink); font: 800 12px var(--font); cursor: pointer; color: var(--ink); }
.mp-preset i { font-style: normal; font-size: 20px; } .mp-preset.on { background: #e7ff7a; }
.mp-chat { max-height: 150px; min-height: 60px; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; background: #fff; padding: 6px; box-shadow: 0 0 0 2px var(--ink); }
.mp-line { font-size: 13px; padding: 4px 8px; max-width: 90%; } .mp-line.mind { background: #efe6ff; align-self: flex-start; } .mp-line.me { background: #eaffb0; align-self: flex-end; }
.mp-log { list-style: none; margin: 0; padding: 0; font-size: 12px; display: grid; gap: 3px; max-height: 160px; overflow-y: auto; }
.mp-log time { color: var(--muted); margin-right: 6px; font-weight: 800; }
.col-mind.locked .mp-row, .col-mind.locked .mp-presets, .col-mind.locked .fr-add, .col-mind.locked .label, .col-mind.locked .mp-chat, .col-mind.locked .mp-log { display: none; }
.mp-hm { display: grid; gap: 6px; padding: 6px 8px 0; font-size: 12px; } .mp-hm:empty { display: none; } .mp-hm p { margin: 0; }
.mp-hm-row { display: flex; gap: 4px; align-items: center; } .mp-hm-row select { flex: 1; min-width: 0; font: 800 12px var(--font); padding: 3px; }
.mp-cog { font-size: 11px; white-space: nowrap; }
.col-mind.folded .mp-hm { display: none; }
@media (max-width: 900px) { .col-mind, #s-hub.board-closed .col-mind { width: auto; margin: 0; max-height: none; overflow: visible; } }
/* 🤝 trade drawer */
#trade { z-index: 55; overflow-y: auto; } .tr-ico { font-size: 30px; }
.tr-list { list-style: none; margin: 0; padding: 8px; background: #fff; box-shadow: 0 0 0 2px var(--ink); display: grid; gap: 4px; min-height: 34px; }
.tr-row { display: grid; grid-template-columns: 1fr 96px auto; gap: 8px; align-items: center; padding: 4px 0; } .tr-row input { width: 100%; } .tr-row small { color: var(--muted); }
/* T67d: one bag look everywhere (inventory tiles in trades and gifts); search + kind chips instead of a small scroll box */

.bag-pick { display: flex; flex-direction: column; gap: 8px; margin: 6px 0; }
.bag-q { width: 100%; padding: 8px 10px; font: 600 14px var(--font); border: 2px solid var(--ink); background: #fff; }
.bag-chips { display: flex; flex-wrap: wrap; gap: 6px; } .bag-chips .btn { padding: 4px 10px; }
.item[aria-pressed="true"] { background: #f1ffd6; box-shadow: 0 0 0 3px var(--ink), 0 0 0 5px var(--lime); }
.tr-pic { display: inline-grid; place-items: center; width: 30px; height: 30px; margin-right: 6px; vertical-align: middle; font-style: normal; }
.tr-pic img, .tr-pic .pxi { width: 26px !important; height: 26px !important; object-fit: contain; image-rendering: pixelated; } .tr-pic i { font-size: 20px; font-style: normal; }
.gift-amt { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-weight: 700; } .gift-amt input { flex: 1; padding: 6px; }
.tr-state { display: grid; gap: 4px; font-weight: 800; font-size: 14px; } .tr-state .ok { color: #2f9e44; }
.tr-sum { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; text-align: left; } .tr-sum ul { list-style: none; padding: 0; margin: 4px 0; } .warn { color: #c0392b; font-weight: 800; }
.isl-bmenu .bm-lock { font-size: 12px; font-weight: 800; color: #8a5a00; background: #fff3b0; padding: 4px 8px; box-shadow: 0 0 0 2px var(--ink); max-width: 220px; }

/* 🧠 AI Minds dock: floats on every screen, folds into a bubble */
.mdock { position: fixed; right: 12px; bottom: 12px; z-index: 45; width: 340px; max-width: calc(100vw - 24px); }
.mdock.hide { display: none; }
.mdock .md-bubble { display: none; align-items: center; gap: 6px; margin-left: auto; padding: 8px 12px; border: 0; cursor: pointer; background: linear-gradient(135deg, #9b6bff, #5ec8ff); color: #fff; font: 900 14px var(--font); box-shadow: 0 0 0 3px var(--ink), 0 6px 0 var(--ink); }
.mdock .md-bubble b { font-size: 20px; } .mdock .md-bubble i { font-style: normal; background: var(--lime); color: var(--ink); padding: 0 6px; font-size: 11px; } .mdock .md-bubble i:empty { display: none; }
.mdock.on .md-bubble { animation: mdpulse 1.6s ease-in-out infinite; }
@keyframes mdpulse { 50% { box-shadow: 0 0 0 3px var(--ink), 0 6px 0 var(--ink), 0 0 18px 6px rgba(155, 107, 255, .7); } }
.mdock.min .md-bubble, .mdock.fight .md-bubble { display: flex; } .mdock.min .md-win, .mdock.fight .md-win { display: none; }
.mdock.isl { bottom: 84px; }
.md-win { background: var(--paper); box-shadow: 0 0 0 3px var(--ink), 0 8px 0 var(--ink); max-height: min(78vh, 640px); display: flex; flex-direction: column; }
.md-head { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: linear-gradient(135deg, #9b6bff, #5ec8ff); color: #fff; }
.md-head b { font-size: 15px; } .md-head small { flex: 1; opacity: .9; font-size: 11px; }
.md-tabs { display: flex; gap: 4px; padding: 6px 8px; overflow-x: auto; background: var(--paper-2); } .md-tabs:empty { display: none; }
.md-tab { position: relative; flex: none; display: grid; justify-items: center; gap: 1px; padding: 3px; border: 0; cursor: pointer; background: #fff; box-shadow: 0 0 0 2px var(--ink); font: 800 10px var(--font); }
.md-tab img { width: 34px; height: 34px; image-rendering: pixelated; } .md-tab.on { background: var(--lime); } .md-tab em { position: absolute; top: -4px; right: -4px; font-style: normal; background: #9b6bff; color: #fff; width: 14px; height: 14px; line-height: 14px; font-size: 11px; }
.md-tab.buy { background: #efe6ff; min-width: 46px; } .md-tab.buy b { font-size: 24px; line-height: 34px; }
.md-tab.run::after { content: ''; position: absolute; top: 2px; left: 2px; width: 7px; height: 7px; background: #3ddc5a; box-shadow: 0 0 0 1px var(--ink); animation: mdpulse 1.2s infinite; }
.md-body { padding: 8px 10px 10px; overflow-y: auto; display: grid; gap: 7px; font-size: 13px; }
.md-hero { display: flex; gap: 8px; align-items: center; } .md-hero img { width: 64px; height: 64px; image-rendering: pixelated; box-shadow: 0 0 0 2px var(--ink); flex: none; } .md-hero p { margin: 0; }
.md-or { display: grid; gap: 3px; font-size: 12px; font-weight: 800; } .md-or select { font: 800 13px var(--font); padding: 4px; }
.md-card { display: flex; gap: 8px; align-items: center; } .md-card img { width: 52px; height: 52px; image-rendering: pixelated; box-shadow: 0 0 0 2px var(--ink); }
.md-card div { display: grid; min-width: 0; } .md-card b { font-size: 15px; } .md-card small { font-size: 11px; color: var(--muted); }
.md-card .md-now { color: var(--ink); font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.md-row { display: flex; gap: 6px; flex-wrap: wrap; } .md-row .btn:first-child { flex: 1; }
.md-plan { background: #fff; padding: 6px 8px; box-shadow: 0 0 0 2px var(--ink); font-size: 12px; }
.md-presets { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 5px; }
.md-preset { display: flex; align-items: center; gap: 4px; padding: 5px; border: 0; cursor: pointer; background: #fff8e4; box-shadow: 0 0 0 2px var(--ink); font: 800 12px var(--font); text-align: left; }
.md-preset i { font-style: normal; font-size: 16px; } .md-preset.on { background: var(--lime); } .md-preset:hover { background: #fff1b8; }
.md-chat { display: flex; flex-direction: column; gap: 4px; max-height: 150px; overflow-y: auto; background: #fff; padding: 5px; box-shadow: 0 0 0 2px var(--ink); }
.md-foot { display: flex; gap: 6px; justify-content: space-between; }
.md-steps { margin: 6px 0; padding: 0; list-style: none; display: grid; gap: 4px; counter-reset: st; }
.md-steps li { display: grid; grid-template-columns: 26px 1fr; column-gap: 6px; background: #fff; padding: 5px 7px; box-shadow: 0 0 0 2px var(--ink); }
.md-steps i { grid-row: span 2; font-style: normal; font-size: 20px; align-self: center; } .md-steps span { font-size: 12px; color: var(--muted); }
.md-hist { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; max-height: 52vh; overflow-y: auto; font-size: 12px; }
.md-hist li { display: grid; grid-template-columns: 92px 22px 1fr; gap: 6px; align-items: center; background: #fff; padding: 3px 6px; }
.md-hist time { color: var(--muted); font-weight: 800; } .md-hist img { width: 22px; height: 22px; image-rendering: pixelated; }
/* 👁 Follow: watch a Mind play */
.mfollow { position: fixed; inset: 0; z-index: 46; display: none; place-items: center; background: rgba(29, 27, 47, .55); padding: 16px; }
.mfollow.on { display: grid; }
.mf-card { width: min(720px, 100%); display: grid; grid-template-columns: 1.1fr 1fr; background: var(--paper); box-shadow: 0 0 0 3px var(--ink), 0 10px 0 var(--ink); }
.mf-scene { position: relative; min-height: 280px; background: var(--scene) center / cover; image-rendering: pixelated; display: grid; place-items: end center; overflow: hidden; }
.mf-mind { width: 150px; height: 150px; image-rendering: pixelated; margin-bottom: 26px; filter: drop-shadow(0 6px 0 rgba(0, 0, 0, .35)); }
.mf-mind.walk { animation: mfwalk 1.2s ease-in-out infinite; }
@keyframes mfwalk { 0%, 100% { transform: translate(-30px, 0); } 25% { transform: translate(-10px, -6px); } 50% { transform: translate(30px, 0) scaleX(-1); } 75% { transform: translate(10px, -6px) scaleX(-1); } }
.mf-where { position: absolute; top: 8px; left: 8px; background: rgba(29, 27, 47, .8); color: #fff; padding: 3px 8px; font-weight: 800; font-size: 13px; }
.mf-info { padding: 10px 12px; display: grid; gap: 6px; align-content: start; } .mf-info b { font-size: 15px; }
.mf-now { margin: 0; font-weight: 800; background: #fff; padding: 6px 8px; box-shadow: 0 0 0 2px var(--ink); }
.mf-duel { display: flex; gap: 8px; align-items: center; justify-content: space-between; background: #2b2340; color: #fff; padding: 6px 8px; } .mf-duel b { font-size: 18px; color: var(--lime); }
.mf-log { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; font-size: 12px; max-height: 180px; overflow-y: auto; } .mf-log time { color: var(--muted); font-weight: 800; margin-right: 6px; }
@media (max-width: 640px) {
  .mdock { right: 8px; left: 8px; bottom: 8px; width: auto; } .mdock.min, .mdock.fight { left: auto; }
  .mf-card { grid-template-columns: 1fr; } .mf-scene { min-height: 190px; } .mf-mind { width: 110px; height: 110px; }
}
.md-head .iconbtn { color: var(--ink); }
/* dock: bigger, movable, the AI's thought */
.mdock.big { width: 480px; } .mdock.big .md-win { max-height: 90vh; } .mdock.big .md-chat { max-height: 340px; min-height: 200px; }
.mdock.moved { right: auto; bottom: auto; }
.md-head { cursor: grab; touch-action: none; user-select: none; } .md-head:active { cursor: grabbing; }
.md-bubble { touch-action: none; }
.md-chat { max-height: 240px; min-height: 120px; }
.md-think { color: #6a3cff !important; font-style: italic; white-space: normal !important; }
.md-trainbox { display: grid; gap: 8px; max-height: 60vh; overflow-y: auto; }
.md-train { border: 0; margin: 0; padding: 6px 8px; background: #fff; box-shadow: 0 0 0 2px var(--ink); display: grid; gap: 4px; }
.md-train legend { font-weight: 900; padding: 0 4px; background: var(--paper); }
.md-train label { display: grid; grid-template-columns: 120px 1fr; gap: 6px; align-items: center; font-size: 12px; font-weight: 800; }
.md-train select { font: 700 12px var(--font); padding: 3px; min-width: 0; }
/* Follow: the duel board and the AI's thought */
.mf-scene { flex-direction: column; }
.mf-bubble { position: absolute; top: 34px; left: 8px; right: 8px; background: #fff; color: var(--ink); padding: 5px 8px; font-size: 12px; font-weight: 800; box-shadow: 0 0 0 2px var(--ink); animation: drop .3s; }
.mf-card.duel .mf-mind { width: 90px; height: 90px; margin-bottom: 4px; }
.mf-board { position: relative; width: calc(100% - 16px); margin: 0 8px 8px; background: rgba(29, 27, 47, .88); color: #fff; padding: 6px 8px; display: grid; gap: 5px; font-size: 12px; }
.mf-crown { display: flex; align-items: center; gap: 8px; } .mf-crown b { font-size: 26px; color: #ffd84a; line-height: 1; } .mf-crown em { margin-left: auto; font-style: normal; color: var(--lime); }
.mf-vs { display: flex; justify-content: space-between; } .mf-vs b { color: var(--lime); font-size: 15px; }
.mf-hand { display: flex; flex-wrap: wrap; gap: 3px; }
.mf-c { display: inline-grid; place-items: center; width: 22px; height: 28px; background: #fff8e4; color: var(--ink); font-weight: 900; box-shadow: 0 0 0 2px #000; }
.mf-c.pick { background: var(--lime); transform: translateY(-4px); animation: mfpick 1s ease-in-out infinite; } .mf-c.win { background: #3ddc5a; } .mf-c.lose { background: #ff6b6b; }
@keyframes mfpick { 50% { transform: translateY(-7px); } }
.mf-spells i { font-style: normal; background: #9b6bff; padding: 0 5px; margin-right: 3px; }
.mf-acts { position: absolute; inset: 40% 0 auto; display: flex; justify-content: center; gap: 18px; font-size: 30px; pointer-events: none; }
.mf-acts i { font-style: normal; animation: mfpop 1.6s ease-in-out infinite; animation-delay: var(--d); }
@keyframes mfpop { 0%, 100% { transform: translateY(0) scale(.9); opacity: .6; } 50% { transform: translateY(-14px) scale(1.15); opacity: 1; } }

/* Mind Town chat: left side, bigger, with times and a filter */
.town-side-head { display: flex; align-items: center; gap: 6px; } .town-side-head h4 { flex: 1; }
.town-side-head .seg button { font-size: 11px; padding: 2px 6px; }
#town-feed { min-height: 160px; display: flex; flex-direction: column; gap: 2px; }
#town-feed > div { padding: 2px 4px; } #town-feed > div:nth-child(odd) { background: rgba(255, 255, 255, .5); }
#town-feed time { color: var(--muted); font-size: 11px; font-weight: 800; margin-right: 5px; }
#town-feed[data-show="chat"] .news, #town-feed[data-show="news"] .chat { display: none; }
.town-side.folded #town-feed, .town-side.folded .fr-add, .town-side.folded .seg { display: none; }
.town-side.folded { max-height: none; width: auto; }
/* cognition warnings: a big banner on every screen, and one inside the dock */
.mcog { position: fixed; top: 10px; left: 50%; transform: translateX(-50%); z-index: 48; display: none; align-items: center; gap: 10px; width: min(620px, calc(100vw - 16px)); padding: 10px 12px; background: #ffb02e; color: var(--ink); box-shadow: 0 0 0 3px var(--ink), 0 6px 0 var(--ink); animation: drop .3s; }
.mcog.on { display: flex; } .mcog.out { background: #ff5263; color: #fff; animation: mcogpulse 1.4s ease-in-out infinite; }
body:has(.screen.window.on) .mcog.on { display: none; }   /* T69k: it sat over the header of open windows (shop, island…); the AI panel shows the same warning, and it is back when the window closes */
.mcog > b { font-size: 28px; } .mcog > div { flex: 1; display: grid; } .mcog strong { font-size: 16px; } .mcog span { font-size: 13px; }
.mcog .iconbtn { color: var(--ink); font-weight: 900; }   /* the ✕ stays dark on the red "out" warning (it inherited white) */
@keyframes mcogpulse { 50% { box-shadow: 0 0 0 3px var(--ink), 0 6px 0 var(--ink), 0 0 22px 8px rgba(255, 82, 99, .8); } }
.md-cogwarn { display: grid; gap: 4px; padding: 8px; background: #ffb02e; box-shadow: 0 0 0 2px var(--ink); } .md-cogwarn.out { background: #ff5263; color: #fff; }
.md-cogwarn b { font-size: 15px; } .md-cogwarn span { font-size: 12px; }
#md-cog.low { color: #d62839; font-weight: 900; }
.md-cogline { display: block; width: 100%; margin: 4px 0 6px; padding: 4px 6px; border: 1px solid var(--ink); background: rgba(255,255,255,.06); color: inherit; font: 700 11px var(--font); text-align: left; cursor: pointer; }
.md-cogline u { opacity: .7; margin-left: 4px; }
.md-cogline.over { background: rgba(255,170,0,.18); }
.md-mode { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin: 0 0 6px; }
.md-mode button { border: 1px solid var(--ink); background: rgba(255,255,255,.06); color: inherit; font: 700 11px var(--font); padding: 4px 2px; cursor: pointer; line-height: 1.15; }
.md-mode button small { display: block; font-weight: 400; font-size: 9px; opacity: .8; }
.md-mode button.on { background: var(--lime); color: var(--ink); }
.md-cogtab { width: 100%; border-collapse: collapse; margin: 6px 0; font-size: 13px; }
.md-cogtab td { padding: 3px 4px; border-bottom: 1px solid rgba(255,255,255,.1); }
.md-cogtab td:first-child { opacity: .75; }
.md-add { border: 0; background: var(--lime); font: 900 11px var(--font); padding: 0 5px; cursor: pointer; box-shadow: 0 0 0 1px var(--ink); }
/* the folded dock is only its bubble (no empty frame around it) */
.mdock.px { box-shadow: none; background: none; }
.mdock.min, .mdock.fight { width: auto; }
/* readable text everywhere in the dock and Follow: nothing is cut off, it wraps */
.md-card div { min-width: 0; flex: 1; } .md-card small { font-size: 12px; overflow-wrap: anywhere; }
.md-card .md-now { white-space: normal; overflow: visible; text-overflow: clip; font-size: 13px; }
.md-think { display: block; font-size: 12px !important; line-height: 1.35; max-height: 9em; overflow-y: auto; }
.md-head small { font-size: 12px; } .md-tab span { font-size: 11px; } .md-tab img { width: 40px; height: 40px; }
.md-preset { font-size: 13px; line-height: 1.2; } .md-plan { font-size: 13px; line-height: 1.35; }
.mp-line { overflow-wrap: anywhere; line-height: 1.35; }
.mf-bubble { max-height: 45%; overflow-y: auto; line-height: 1.35; font-size: 13px; }
.mf-log li { line-height: 1.35; overflow-wrap: anywhere; } .mf-now { overflow-wrap: anywhere; }
.md-hist span { overflow-wrap: anywhere; line-height: 1.35; }
.md-train label { grid-template-columns: minmax(110px, 40%) 1fr; } .md-train select { width: 100%; white-space: normal; }
/* 👁 watching an AI play: a bar on top, and the duel hand cannot be played */
.watchbar { position: fixed; top: 8px; left: 50%; transform: translateX(-50%); z-index: 47; display: none; align-items: center; gap: 10px; padding: 6px 10px; background: linear-gradient(135deg, #9b6bff, #5ec8ff); color: #fff; width: min(640px, calc(100vw - 16px)); }
.watchbar.on { display: flex; } .watchbar span { flex: 1; font-size: 12px; opacity: .95; }
#s-duel.watch #d-hand, #s-duel.watch #d-spells, #s-duel.watch #d-lock { pointer-events: none; opacity: .8; }
.md-hist.buys li { grid-template-columns: 96px 22px 1fr; } .md-hist.buys li.real { background: #efe6ff; } .md-hist.buys i { font-style: normal; }
.adm-tx { font-size: 11px; overflow-wrap: anywhere; }
.mp-line.typing { font-style: italic; color: var(--muted); } .mp-line.typing i { animation: mdpulse 1s infinite; font-style: normal; } .mp-line.typing i:nth-child(2) { animation-delay: .2s; } .mp-line.typing i:nth-child(3) { animation-delay: .4s; }
.tos-ok { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; margin: 8px 0; text-align: left; } .tos-ok input { margin-top: 3px; }

/* Shop header: title, purchases, tabs, close (the close button never wraps away) */
#s-shop .pagehead { grid-template-columns: auto auto minmax(0, 1fr) auto; }
#s-shop .pagehead #shop-tabs { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; }
#s-shop .pagehead #shop-hist { white-space: nowrap; }
@media (max-width: 760px) { #s-shop .pagehead { grid-template-columns: 1fr auto auto; } #s-shop .pagehead #shop-tabs { grid-column: 1 / -1; grid-row: 2; } }
/* the AI Minds bubble: big, bright, always in its corner when folded; in windows and fights it stays out of the way */
.mdock .md-bubble { padding: 10px 16px; gap: 10px; animation: mdpulse 2.2s ease-in-out infinite; }
.mdock .md-bubble b { font-size: 26px; } .mdock .md-bubble span { display: grid; text-align: left; line-height: 1.1; }
.mdock .md-bubble strong { font-size: 16px; } .mdock .md-bubble small { font-size: 11px; font-weight: 800; opacity: .95; }
.mdock.win .md-bubble, .mdock.fight .md-bubble { padding: 6px 10px; } .mdock.win .md-bubble small, .mdock.fight .md-bubble small { display: none; }
.mdock.win .md-bubble { display: flex; } .mdock.win .md-win { display: none; }
.mdock.win, .mdock.fight, .mdock.min { left: auto !important; top: auto !important; right: 12px; bottom: 12px; width: auto; }
.mdock.isl.min, .mdock.isl.win { bottom: 84px; }
.mdock.duelscr.fight { top: 40vh !important; bottom: auto; right: 8px; }   /* duels: over the arena art, clear of cards, spells and the ☰ menu */
.mdock.duelscr.fight .md-bubble { padding: 6px; width: 52px; height: 52px; justify-content: center; position: relative; } .mdock.duelscr.fight .md-bubble span { display: none; }
.mdock.duelscr.fight .md-bubble i { position: absolute; top: -8px; right: -8px; padding: 0 4px; font-size: 10px; }
@media (max-width: 640px) { .mdock.moved:not(.min):not(.fight):not(.win) { width: calc(100vw - 16px); } }

/* admin: the list of all players */
.adm-table { overflow: auto; max-height: 62vh; } .adm-table table { width: 100%; border-collapse: collapse; font-size: 12px; }
.adm-table th, .adm-table td { padding: 4px 6px; border-bottom: 1px solid rgba(0, 0, 0, .1); text-align: left; white-space: nowrap; }
.adm-table th { position: sticky; top: 0; background: var(--paper-2); } .adm-table tr[data-pid] { cursor: pointer; } .adm-table tr[data-pid]:hover { background: #fff3c4; }
/* no more cut-off button text: small buttons may wrap to two lines, and shop buttons share the row fairly */
.btn.small { white-space: normal; overflow: visible; text-overflow: clip; text-align: center; padding: 5px 10px; line-height: 1.15; }
.shop-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.shop-btns { display: grid; grid-template-columns: repeat(auto-fit, minmax(78px, 1fr)); gap: 6px; }
.shop-btns .btn { min-width: 0; white-space: normal; font-size: 15px; padding: 6px 6px; }
.troop-up { display: grid; grid-template-columns: 1fr; gap: 5px; }
.troop-up .btn { width: 100%; font-size: 13px; white-space: normal; padding: 5px 8px; }
.troop-lv { line-height: 1.35; }
/* 🧠 AI Jobs: one big tap per job, a clear status, settings folded away */
.md-jobs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.md-job { display: grid; justify-items: center; gap: 2px; padding: 8px 4px; border: 0; cursor: pointer; background: #fff8e4; box-shadow: 0 0 0 2px var(--ink); font: 800 12px var(--font); line-height: 1.15; text-align: center; }
.md-job i { font-style: normal; font-size: 24px; } .md-job:hover { background: #fff1b8; } .md-job.on { background: var(--lime); box-shadow: 0 0 0 3px var(--ink); }
.md-status { display: grid; gap: 3px; padding: 8px 10px; background: #fff; box-shadow: 0 0 0 2px var(--ink); } .md-status.run { background: #f1ffe0; }
.md-status b { font-size: 15px; } .md-status .md-now { font-weight: 800; font-size: 13px; line-height: 1.35; overflow-wrap: anywhere; }
.md-set, .md-coach { background: #fff; box-shadow: 0 0 0 2px var(--ink); padding: 6px 8px; } .md-set summary, .md-coach summary { cursor: pointer; font-weight: 900; font-size: 13px; }
.md-set label { display: grid; gap: 3px; font-size: 12px; font-weight: 800; margin-top: 6px; } .md-set select, .md-set input { font: 700 13px var(--font); padding: 4px; width: 100%; }
.md-coach .md-chat { margin-top: 6px; } .md-pick { margin: 0; }
.md-tab em.job { background: var(--lime); color: var(--ink); width: auto; padding: 0 2px; font-size: 12px; }
@media (max-width: 420px) { .md-job { padding: 6px 2px; font-size: 11px; } .md-job i { font-size: 20px; } .md-mixhelp { font-size: 11px; line-height: 1.3; } }
@media (max-width: 330px) { .md-jobs { grid-template-columns: repeat(3, 1fr); } }
/* 📋 job plans: numbered jobs, the order strip, the job running now */
.md-jobhead { display: flex; align-items: center; justify-content: space-between; gap: 6px; } .md-jobhead .label { margin: 0; }
.md-mixhelp { line-height: 1.3; }
.md-job { position: relative; } .md-job .md-n { position: absolute; top: -6px; left: -6px; font-style: normal; background: var(--ink); color: #fff; width: 20px; height: 20px; display: grid; place-items: center; font-size: 12px; font-weight: 900; }
.md-job.now { animation: mdpulse 1.6s ease-in-out infinite; }
.md-order { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font-size: 12px; font-weight: 800; padding: 6px 8px; background: #fff; box-shadow: 0 0 0 2px var(--ink); }
.md-order span { padding: 1px 6px; background: #fff8e4; } .md-order span.now { background: var(--lime); } .md-order b { opacity: .6; }
.md-status b small { font-size: 12px; opacity: .7; }
/* 🔍 proof that a real AI plays */
.md-proof { display: grid; gap: 4px; max-height: 50vh; overflow-y: auto; background: #fff; padding: 8px 10px; box-shadow: 0 0 0 2px var(--ink); text-align: left; }
.md-proof h4 { margin: 6px 0 2px; font-size: 14px; } .md-proof ol { margin: 0; padding-left: 18px; display: grid; gap: 4px; font-size: 12px; line-height: 1.35; overflow-wrap: anywhere; }
.md-proof time { display: block; color: var(--muted); font-weight: 800; font-size: 11px; }
.md-away { display: grid; gap: 3px; padding: 8px 10px; background: #2b2340; color: #fff; box-shadow: 0 0 0 2px var(--ink); } .md-away.on { background: linear-gradient(135deg, #2b2340, #4b3a8a); }
.md-away span { font-size: 12px; opacity: .9; } .md-away .btn { justify-self: start; }
.refill-price { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 10px; border: 2px solid #2b2b2b; border-radius: 8px; background: #fffbe8; } .refill-price b { font: 400 22px var(--pix); display: flex; align-items: center; gap: 6px; } .refill-price small { opacity: .7; }
.refill-warn.big { font-size: 14px; margin: 8px 0; }
.refill-warn { margin: 4px 0; padding: 6px 8px; border: 2px solid #e0a000; background: #fff4cc; border-radius: 6px; font-size: 12px; line-height: 1.35; } .refill-warn b:first-child { display: block; color: #b26a00; }
.md-rate { font-weight: 700; color: #2d6a1f; } .md-rate .bad { color: #c62828; }
.md-rules { display: grid; gap: 4px; margin-top: 6px; padding-top: 6px; border-top: 2px dashed rgba(0,0,0,.15); } .md-rules label { display: grid; grid-template-columns: minmax(100px, 40%) 1fr; gap: 6px; align-items: center; font-size: 12px; font-weight: 800; } .md-rules select { width: 100%; font: 700 12px var(--font); padding: 3px; }
/* 👁 Follow: a live card (animated scene, steps of the round, thought, countdown, newest moments) */
.mf-card2 { width: min(860px, 100%); display: grid; grid-template-columns: 1.25fr 1fr; background: var(--paper); box-shadow: 0 0 0 3px var(--ink), 0 10px 0 var(--ink); max-height: calc(100vh - 32px); overflow: hidden; }
.mf-stage { position: relative; min-height: 360px; background: var(--scene) center / cover; image-rendering: pixelated; overflow: hidden; }
.mf-stage::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(20, 14, 40, .35), rgba(20, 14, 40, 0) 35%, rgba(20, 14, 40, .55)); pointer-events: none; }
.mf-stage > * { position: absolute; z-index: 1; }
.mf-where { top: 10px; left: 10px; background: rgba(20, 14, 40, .85); color: #fff; padding: 4px 10px; font-weight: 900; font-size: 13px; box-shadow: 0 0 0 2px #000; }
.mf-live { top: 10px; right: 10px; background: #000; color: #ff5a5f; font: 900 12px var(--font); padding: 3px 8px; letter-spacing: 1px; animation: mflive 1.2s steps(2) infinite; }
@keyframes mflive { 50% { opacity: .35; } }
.mf-hero { width: 128px; height: 128px; left: calc(50% - 64px); bottom: 26px; image-rendering: pixelated; filter: drop-shadow(0 8px 0 rgba(0, 0, 0, .4)); }
.mf-rival { width: 104px; height: 104px; right: 12%; bottom: 30px; image-rendering: pixelated; transform: scaleX(-1); filter: drop-shadow(0 8px 0 rgba(0, 0, 0, .4)); animation: mfbob 1.8s ease-in-out infinite reverse; }
.s-duel .mf-hero { left: 14%; }
.a-rest { animation: mfbreathe 3s ease-in-out infinite; } .a-island { animation: mfwork 0.9s ease-in-out infinite; } .a-duel { animation: mfbob 1.6s ease-in-out infinite; }
.a-raid { animation: mfmarch 0.7s steps(2) infinite; } .a-adventure { animation: mfwalk2 4s linear infinite; } .a-town { animation: mfbob 2.2s ease-in-out infinite; }
@keyframes mfbob { 50% { transform: translateY(-10px); } }
@keyframes mfbreathe { 50% { transform: scale(1.04, .96) translateY(3px); } }
@keyframes mfwork { 0%, 100% { transform: rotate(0); } 30% { transform: rotate(-8deg) translateY(-6px); } 60% { transform: rotate(6deg); } }
@keyframes mfmarch { 50% { transform: translateY(-6px) rotate(-3deg); } }
@keyframes mfwalk2 { 0% { transform: translateX(-110px); } 50% { transform: translateX(110px); } 50.01% { transform: translateX(110px) scaleX(-1); } 100% { transform: translateX(-110px) scaleX(-1); } }
.mf-fx { inset: 0; pointer-events: none; } .mf-fx i { position: absolute; left: var(--x); bottom: 40%; font-style: normal; font-size: 28px; animation: mffloat 2.4s ease-in-out infinite; animation-delay: var(--d); opacity: 0; }
@keyframes mffloat { 0% { transform: translateY(20px) scale(.6); opacity: 0; } 30% { opacity: 1; } 100% { transform: translateY(-70px) scale(1.1); opacity: 0; } }
.mf-thought { left: 10px; right: 10px; top: 46px; background: #fff; color: var(--ink); padding: 8px 10px; font: 800 13px/1.35 var(--font); box-shadow: 0 0 0 2px #000, 0 4px 0 #000; max-height: 38%; overflow-y: auto; animation: drop .3s; }
.mf-score { left: 10px; right: 10px; bottom: 8px; display: flex; justify-content: space-between; align-items: center; background: rgba(20, 14, 40, .88); color: #fff; padding: 4px 10px; font-weight: 800; font-size: 12px; }
.mf-score b { color: var(--lime); font-size: 20px; margin: 0 6px; } .mf-score em { font-style: normal; color: #ffd84a; font-weight: 900; text-align: center; display: grid; } .mf-score small { color: #cfc6ea; font-size: 10px; }
.mf-side { padding: 12px; display: grid; gap: 10px; align-content: start; overflow-y: auto; }
.mf-who { display: flex; gap: 8px; align-items: center; } .mf-who img { width: 40px; height: 40px; image-rendering: pixelated; box-shadow: 0 0 0 2px var(--ink); background: #fff; } .mf-who b { display: block; font-size: 16px; } .mf-who small { color: var(--muted); font-weight: 800; }
.mf-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; }
.mf-steps li { flex: 1 1 auto; text-align: center; padding: 4px 6px; font: 900 11px var(--font); background: #ece4cc; color: #8a8199; box-shadow: 0 0 0 2px rgba(0, 0, 0, .15); }
.mf-steps li.ok { background: #d7f5a6; color: var(--ink); } .mf-steps li.now { background: var(--lime); color: var(--ink); box-shadow: 0 0 0 2px var(--ink); animation: mfpulse 1s ease-in-out infinite; }
@keyframes mfpulse { 50% { transform: translateY(-2px); } }
.mf-nowbox { background: var(--ink); color: #fff; padding: 8px 10px; box-shadow: 0 4px 0 #000; } .mf-nowbox small { color: var(--lime); font-weight: 900; font-size: 11px; letter-spacing: 1px; }
.mf-nowbox p { margin: 3px 0 0; font-weight: 800; line-height: 1.35; overflow-wrap: anywhere; }
.mf-bar { height: 8px; background: rgba(255, 255, 255, .15); margin: 6px 0 2px; } .mf-bar i { display: block; height: 100%; background: var(--lime); transition: width 1s linear; }
.mf-feed { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 12px; }
.mf-feed li { display: grid; grid-template-columns: 34px 1fr; gap: 6px; padding: 4px 6px; background: #fff; box-shadow: 0 0 0 2px rgba(0, 0, 0, .12); line-height: 1.3; overflow-wrap: anywhere; }
.mf-feed li.new { box-shadow: 0 0 0 2px var(--ink); animation: drop .3s; } .mf-feed time { font-weight: 900; color: var(--muted); }
@media (max-width: 700px) { .mf-card2 { grid-template-columns: 1fr; overflow-y: auto; } .mf-stage { min-height: 230px; } .mf-hero { width: 96px; height: 96px; left: calc(50% - 48px); } .mf-rival { width: 80px; height: 80px; } }

/* 📣 invite link box */
.invite-link { background: #fff; color: var(--ink); padding: 10px 12px; margin: 8px 0; box-shadow: 0 0 0 3px var(--ink); word-break: break-all; font-weight: 800; font-size: 14px; user-select: all; }
.xtag { color: inherit; font-weight: 900; text-decoration: none; white-space: nowrap; } .xtag:hover { text-decoration: underline; }
/* 📣 lobby: invite friends + connect X, big and easy to find */
.share-row { display: grid; grid-template-columns: 1.3fr 1fr; gap: 10px; flex: none; align-items: start; }
.sharebtn b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; } .sharebtn span { white-space: nowrap; }
.sharebtn { display: grid; justify-items: start; gap: 1px; padding: 10px 14px; border: 0; cursor: pointer; text-align: left; color: #fff; background: linear-gradient(135deg, #ff7a3d, #ff3d8b); box-shadow: 0 0 0 3px var(--ink), 0 6px 0 var(--ink); font: 900 16px var(--font); line-height: 1.15; animation: mdpulse 2.4s ease-in-out infinite; }
.sharebtn span { font-size: 12px; font-weight: 800; opacity: .95; }
.sharebtn.xbtn { background: #111; animation: none; } .sharebtn.xbtn.done { background: #2b2340; } .sharebtn.xbtn.done span { color: var(--lime); }
.sharebtn:hover { filter: brightness(1.08); } .sharebtn:active { transform: translateY(3px); box-shadow: 0 0 0 3px var(--ink), 0 3px 0 var(--ink); }
@media (max-width: 640px) { .sharebtn { font-size: 15px; padding: 8px 10px; } .sharebtn span { font-size: 11px; } }
.invite-card { display: block; width: 100%; aspect-ratio: 1200 / 630; margin: 8px 0; box-shadow: 0 0 0 3px var(--ink); background: #120d24; }
/* 🧸 plaza toy: the hand shows over a Mind you can grab */
body.plaza-hover, body.plaza-hover #s-hub { cursor: grab; } body.plaza-grab, body.plaza-grab * { cursor: grabbing !important; user-select: none; }

/* quests */
.q-tabs { display: flex; gap: 6px; margin: 8px 0; }
.q-level { display: grid; grid-template-columns: auto 1fr; gap: 2px 8px; align-items: center; } .q-level small { grid-column: 1 / -1; color: var(--muted); font-size: 12px; }
.q-bar { display: block; height: 8px; background: #e6dfc8; box-shadow: 0 0 0 2px var(--ink); } .q-bar i { display: block; height: 100%; background: #58b046; }
.q-neu { margin-top: 8px; background: #efe6ff; box-shadow: 0 0 0 2px var(--ink); padding: 6px 8px; font-size: 14px; } .q-neu small { display: block; color: var(--muted); font-size: 11px; }
.quest { display: grid; grid-template-columns: 30px 1fr auto; gap: 8px; align-items: center; background: #fff; box-shadow: 0 0 0 2px var(--ink); padding: 7px 8px; margin-bottom: 8px; }
.quest > i { font-style: normal; font-size: 22px; text-align: center; } .quest b { display: block; font-size: 14px; } .quest small { display: block; font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.quest.ready { background: #f1ffd6; } .quest.got { opacity: .55; } .quest .q-bar { height: 5px; } .q-note { font-size: 12px; text-align: center; }
.q-prize { margin: -4px 0 8px; padding: 4px 10px; font-size: 12px; background: #fff3c4; border-left: 3px solid #e3a62a; }   /* T66r: prize looks still ahead in a quest line */
.q-buy { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 6px; }

/* quests v2: lines, check-in, prize looks */
.q-h { margin: 10px 0 6px; font-size: 15px; } .q-h small { color: var(--muted); font-size: 11px; font-weight: 400; }
.q-btns { display: flex; flex-direction: column; gap: 4px; align-items: stretch; }
.q-cats { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0 10px; }
.q-streak { font-size: 18px; margin: 4px 0 8px; } .q-streak small { color: var(--muted); font-size: 12px; }
.q-week { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; } .q-week .q-daycell:last-child { grid-column: 1 / -1; background: #fff3c9; }
.q-daycell { position: relative; background: #fff; box-shadow: 0 0 0 2px var(--ink); padding: 6px 8px; font-size: 12px; min-height: 52px; } .q-daycell b { display: block; font-size: 13px; }
.q-daycell.today { background: #f1ffd6; box-shadow: 0 0 0 3px #58b046; } .q-daycell.got { opacity: .55; } .q-daycell em { position: absolute; top: 4px; right: 6px; font-style: normal; color: #2d6a2f; }
.rar-rare { box-shadow: 0 0 0 2px #3f8ae0 !important; } .rar-epic { box-shadow: 0 0 0 2px #9b5de5 !important; } .rar-legendary { box-shadow: 0 0 0 2px #f5a623 !important; } .rar-mythic { box-shadow: 0 0 0 2px #ff3d8b, 0 0 10px #ff3d8b !important; }
.fr-jade { box-shadow: 0 0 0 3px #5fe08a, 0 0 0 5px #1f6a3f, 0 0 12px 3px rgba(95, 224, 138, .7) !important; }
.fr-royal { box-shadow: 0 0 0 3px #b98cff, 0 0 0 5px #4a2a8a, 0 0 14px 3px rgba(185, 140, 255, .8) !important; }
.fr-dragon { box-shadow: 0 0 0 3px #ff5a3a, 0 0 0 5px #7a1a0a, 0 0 16px 4px rgba(255, 90, 58, .85) !important; animation: frflame 1.4s ease-in-out infinite; }
.nm-ember { color: #ff8a3a !important; text-shadow: 0 0 6px rgba(255, 138, 58, .7); } .nm-royal { color: #c9a2ff !important; text-shadow: 0 0 6px rgba(155, 93, 229, .8); }
.au-jade { --au: #5fe08a; animation: auink 1.8s ease-in-out infinite; } .au-ember { --au: #ff7a3a; animation: auink 1.6s ease-in-out infinite; } .au-storm { --au: #7aa2ff; animation: auink 1.3s ease-in-out infinite; }
@keyframes auink { 0%, 100% { filter: drop-shadow(0 0 4px var(--au)); } 50% { filter: drop-shadow(0 0 12px var(--au)) drop-shadow(0 0 4px #ffffff); } }
.lv-badge { display: inline-block; font: 400 12px/1 var(--font); font-style: normal; background: #58b046; color: #fff; padding: 3px 5px; box-shadow: 0 0 0 2px var(--ink); vertical-align: middle; }

.q-set { background: #fff; box-shadow: 0 0 0 2px var(--ink); padding: 7px 8px; margin-bottom: 8px; } .q-set > b { display: block; font-size: 14px; } .q-set > small { display: block; font-size: 12px; color: var(--muted); }
.q-set.got { background: #f1ffd6; } .q-slots { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.q-slot { width: 52px; height: 52px; display: flex; flex-direction: column; align-items: center; justify-content: center; background: #ece6d2; border: 0; box-shadow: 0 0 0 2px var(--ink); cursor: pointer; filter: grayscale(1); opacity: .55; padding: 0; }
.q-slot i { font-style: normal; font-size: 22px; line-height: 1; } .q-slot small { font-size: 10px; } .q-slot.can { filter: none; opacity: 1; background: #fff8d8; } .q-slot.got { filter: none; opacity: 1; background: #d9f7b0; cursor: default; }
.q-mile { font-size: 11px; background: #fff; box-shadow: 0 0 0 2px var(--ink); padding: 3px 5px; } .q-mile.got { background: #d9f7b0; }
.au-phoenix { animation: auphoenix 1.6s linear infinite; } @keyframes auphoenix { 0% { filter: drop-shadow(0 0 6px #ff5a1f); } 50% { filter: drop-shadow(0 0 14px #ffd84a) drop-shadow(0 0 4px #fff); } 100% { filter: drop-shadow(0 0 6px #ff5a1f); } }
.fr-ash { box-shadow: 0 0 0 3px #8a8a96, 0 0 0 5px #2a2830, 0 0 12px 3px rgba(255, 120, 60, .6) !important; }

.wbal { display: flex; gap: 10px; align-items: center; justify-content: center; flex-wrap: wrap; margin: 6px auto 0; padding: 4px 10px; background: #fffbe8; color: var(--ink); border: 0; box-shadow: 0 0 0 2px var(--ink), 0 3px 0 2px rgba(0,0,0,.25); font: inherit; font-size: 13px; cursor: pointer; width: max-content; max-width: calc(100% - 16px); }
.wbal[hidden], .wb-neu-s[hidden], .wb-pts-s[hidden] { display: none; } .wbal span { white-space: nowrap; } .wbal:hover { background: #fff3c0; }
#trade .wbal { margin: 4px 0 6px; width: auto; max-width: none; }
.wb-info p { margin: 6px 0; font-size: 13px; }
#s-hub > .wbal { position: absolute; top: 66px; right: 12px; z-index: 6; margin: 0; }

.nm-mint { color: #7dffc4 !important; text-shadow: 0 0 5px rgba(125, 255, 196, .7); } .nm-frost { color: #bfeaff !important; text-shadow: 0 0 6px rgba(94, 200, 255, .9); }
.nm-toxic { color: #9dff4a !important; text-shadow: 0 0 6px rgba(80, 220, 40, .9), 0 0 2px #1a3a00; } .nm-crimson { color: #ff3a5a !important; text-shadow: 0 0 7px rgba(255, 30, 70, .8); }
.fr-mint { box-shadow: 0 0 0 3px #7dffc4, 0 0 0 5px #1d6a4a !important; } .fr-neon { box-shadow: 0 0 0 3px #d4ff1f, 0 0 0 5px #2a2030, 0 0 14px 3px rgba(94, 200, 255, .8) !important; }
.fr-void { box-shadow: 0 0 0 3px #6b3fc8, 0 0 0 5px #120a24, 0 0 16px 4px rgba(107, 63, 200, .9) !important; }
.au-toxic { --au: #9dff4a; animation: auink 1.4s ease-in-out infinite; } .au-crimson { --au: #ff3a5a; animation: auink 1.2s ease-in-out infinite; }

/* T10 shop redesign: rarity tags, pixel icons, featured, crafting, style filters */
.pxi { width: 40px; height: 40px; image-rendering: pixelated; } .pxi.big { width: 56px; height: 56px; }
.shop-img img.pxi { width: 44px; height: 44px; object-fit: contain; }
.rar-tag { display: inline-block; font-size: 10px; letter-spacing: .5px; text-transform: uppercase; padding: 0 5px; margin-bottom: 2px; color: #fff; background: #8a8698; }
.rar-tag.t-uncommon { background: #3fa34d; } .rar-tag.t-rare { background: #3f8ae0; } .rar-tag.t-epic { background: #9b5de5; } .rar-tag.t-legendary { background: #e0951a; } .rar-tag.t-mythic { background: linear-gradient(90deg, #ff3d8b, #7a5cff); }
.shop-card.rar-uncommon { box-shadow: 0 0 0 2px #3fa34d !important; }
.shop-card.rar-epic .shop-img, .shop-card.rar-legendary .shop-img, .shop-card.rar-mythic .shop-img { background: radial-gradient(circle, rgba(255, 216, 74, .45), var(--paper-2) 70%); }
.shop-hero { grid-column: 1 / -1; display: flex; gap: 12px; align-items: center; padding: 10px 14px; background: linear-gradient(90deg, #fff3c0, #ffe0f0); box-shadow: 0 0 0 2px var(--ink); }
.shop-hero b { display: block; font-size: 17px; } .shop-hero span { font-size: 13px; color: var(--muted); }
.shop-h { grid-column: 1 / -1; margin: 6px 0 0; font-size: 15px; } .shop-h small { color: var(--muted); font-weight: normal; font-size: 11px; }
.cos-mini { font-size: 12px; text-align: center; line-height: 1.1; }
.craft-needs span { white-space: nowrap; } .craft-needs .ok { color: #2e8a3a; } .craft-needs .miss { color: #b8323c; }
.shop-card.craft-wait { opacity: .78; } .shop-card.craft-ready { background: #f1ffd6; }
.chips { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; }
.chips .chip { font: inherit; font-size: 13px; padding: 3px 10px; border: 0; background: var(--paper); box-shadow: 0 0 0 2px var(--ink); cursor: pointer; }
.chips .chip.on { background: var(--ink); color: var(--lime); }
#shop-tabs { flex-wrap: wrap; max-width: 100%; } #shop-tabs button { font-size: 14px; padding: 3px 8px; }

/* T18 polish: Quests + Check-in */
#questd { width: min(460px, 100vw); } #questd #quest-list { overflow-y: auto; }
.q-tabs { flex-wrap: wrap; background: var(--ink); padding: 4px; gap: 4px; } .q-tabs .btn { flex: 1 1 auto; box-shadow: none; }
.q-level { grid-template-columns: 40px 1fr; background: linear-gradient(90deg, #fff3c0, #fff); box-shadow: 0 0 0 2px var(--ink); padding: 6px 8px; }
.q-level .q-lvnum { grid-row: 1 / span 3; width: 38px; height: 38px; display: grid; place-items: center; font-size: 20px; color: var(--ink); background: #ffd84a; box-shadow: 0 0 0 2px var(--ink), inset -3px -3px 0 #e0a81a; }
.q-level .q-bar, .q-level small { grid-column: 2; }
.quest > i { width: 30px; height: 30px; display: grid; place-items: center; background: var(--paper-2); box-shadow: 0 0 0 2px var(--ink); font-size: 18px; }
.quest.ready { animation: qready 1.6s ease-in-out infinite; } @keyframes qready { 50% { box-shadow: 0 0 0 2px var(--ink), 0 0 10px 2px rgba(120, 220, 60, .8); } }
.q-streak { display: flex; gap: 10px; align-items: center; background: linear-gradient(90deg, #ffe0c0, #fff); box-shadow: 0 0 0 2px var(--ink); padding: 8px 10px; font-size: 16px; }
.q-streak > div { flex: 1; } .q-streak b, .q-streak small { display: block; } .q-streak .q-bar { margin-top: 4px; } .q-streak .q-bar i { background: #ff8a3a; }
.q-flame { font-size: 30px; animation: qflame 1s ease-in-out infinite alternate; } @keyframes qflame { to { transform: scale(1.12) rotate(-4deg); } }
.q-week { grid-template-columns: repeat(4, 1fr); margin-top: 8px; } .q-week .q-daycell:last-child { grid-column: span 2; }
.q-daycell { text-align: center; padding: 6px 4px; } .q-daycell .pxi.ci { width: 28px; height: 28px; display: block; margin: 0 auto 2px; } .q-daycell span { display: block; font-size: 10px; line-height: 1.2; }
.q-daycell.today { animation: qready 1.6s ease-in-out infinite; } .q-week .q-daycell:last-child .pxi.ci { width: 36px; height: 36px; }
[data-checkin="1"].primary { font-size: 18px; padding: 8px 22px; }

/* 📋 T13 lobby Today card */
#hub-today { position: absolute; top: 100px; right: 12px; z-index: 6; width: 250px; background: #fffbe8; box-shadow: 0 0 0 2px var(--ink), 0 4px 0 2px rgba(0,0,0,.25); display: flex; flex-direction: column; }
#hub-today[hidden] { display: none; }
#hub-today button { font: inherit; border: 0; background: none; cursor: pointer; text-align: left; color: var(--ink); }
.today-head { display: flex; align-items: center; gap: 6px; padding: 5px 8px; font-size: 15px; background: var(--ink) !important; color: var(--lime) !important; }
.today-head i { font-style: normal; background: #ff4a5a; color: #fff; font-size: 11px; padding: 0 5px; } .today-head small { flex: 1; text-align: right; color: #c9c5e0; font-size: 10px; } .today-head span { color: #fff; }
.today-row { display: flex; gap: 8px; align-items: center; padding: 5px 8px; font-size: 13px; border-top: 1px dashed #d8cfae !important; }
.today-row b { width: 20px; text-align: center; } .today-row:hover { background: #fff3c0; }
.today-row.hot { background: #f1ffd6; font-weight: bold; } .today-row.hot::after { content: '●'; margin-left: auto; color: #58b046; animation: qflame .8s ease-in-out infinite alternate; }
@media (max-width: 700px) { #hub-today { top: auto; bottom: 10px; right: 10px; width: 220px; } }

.pxi.ri { width: 32px; height: 32px; } .q-slot .pxi.ri { width: 26px; height: 26px; } .q-slot:not(.can):not(.got) .pxi { filter: grayscale(1); }
.quest > .pxi.qi { width: 30px; height: 30px; padding: 2px; background: var(--paper-2); box-shadow: 0 0 0 2px var(--ink); box-sizing: border-box; }

/* T16 town emotes + plaza party */
.town-emotes { display: flex; gap: 4px; flex-wrap: wrap; padding: 4px 0; } .town-emotes .btn { font-size: 16px; padding: 2px 6px; min-width: 0; }
.town-party { background: #ffd84a; color: var(--ink); padding: 1px 8px; font-size: 13px; box-shadow: 0 0 0 2px var(--ink); animation: qflame .8s ease-in-out infinite alternate; }
.town-party[hidden] { display: none; }

.quest > i.qpx img.pxi { width: 24px; height: 24px; }
.topbtns .pxi.topi { width: 26px; height: 26px; }

/* 📖 Item Book + item pages */
.items-top { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.book-btn img.pxi, .bk-book h3 img.pxi { width: 22px; height: 22px; vertical-align: -5px; }
button.item { font: inherit; color: inherit; cursor: pointer; text-align: center; }
button.item:hover { transform: translateY(-2px); filter: brightness(1.05); }
.item-img img.pxi { width: 40px; height: 40px; }
.bk-page { text-align: center; min-width: min(380px, 80vw); }
.bk-art { width: 112px; height: 112px; margin: 0 auto 8px; display: grid; place-items: center; background: #f3e2b0; border: 3px solid #2a2030; box-shadow: inset 0 0 0 3px #fff6dc, 4px 4px 0 #2a2030; }
.bk-art .bk-big { width: 80px; height: 80px; image-rendering: pixelated; object-fit: contain; }
.bk-art .bk-emo { font-size: 54px; font-style: normal; }
.bk-page h3 { margin: 6px 0 2px; }
.bk-rar { font-style: normal; font-size: 12px; padding: 2px 8px; border: 2px solid #2a2030; background: var(--rar); color: #fff; vertical-align: 3px; }
.bk-lore { font-style: italic; opacity: .8; margin: 4px 0 8px; }
.bk-have { margin-bottom: 10px; }
.bk-row { display: grid; grid-template-columns: 130px 1fr; gap: 8px; text-align: left; padding: 6px 8px; border-top: 2px dashed rgba(42,32,48,.2); font-size: 14px; }
.modal:has(.bk-book) { width: min(760px, 94vw); max-width: none; }
.bk-book { width: 100%; }
.bk-book h3 small { font-size: 13px; font-weight: 600; }
.bk-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 10px; }
.bk-tabs button { font: inherit; font-size: 13px; padding: 4px 10px; border: 2px solid #2a2030; background: #fff6dc; cursor: pointer; }
.bk-tabs button.on { background: #d6ff3a; }
.bk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; max-height: 52vh; overflow: auto; padding: 4px; }
.bk-cell { font: inherit; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 4px; border: 3px solid #2a2030; background: #fff6dc; box-shadow: 3px 3px 0 #2a2030; cursor: pointer; }
.bk-cell img.pxi, .bk-cell img { width: 40px; height: 40px; image-rendering: pixelated; object-fit: contain; }
.bk-cell .bk-emo { font-size: 30px; font-style: normal; }
.bk-cell b { font-size: 12px; line-height: 1.15; }
.bk-cell em { font-style: normal; font-size: 12px; opacity: .75; }
.bk-cell.none img, .bk-cell.none .bk-emo { filter: grayscale(1) brightness(.6); opacity: .55; }

/* 🎨 T18 game UI skin (web/src/uiskin.js): pixel 9-slice frames. Only on when installSkin() ran (html.skin). */
.skin .panel { border: calc(var(--sk-panel-s) * 1px) solid transparent; border-image: var(--sk-panel) var(--sk-panel-s) stretch;
  background: var(--sk-paper) 0 0 / 48px 48px, var(--paper); background-clip: padding-box; box-shadow: 0 7px 0 0 rgba(29,27,47,.32); }
.skin .btn, .skin .iconbtn { border: calc(var(--sk-btn-s) * 1px) solid transparent; border-image: var(--sk-btn) var(--sk-btn-s) stretch; box-shadow: 0 5px 0 0 rgba(29,27,47,.3); }
.skin .btn:active, .skin .iconbtn:active { border-image-source: var(--sk-btnDown); box-shadow: 0 2px 0 0 rgba(29,27,47,.3); transform: translateY(3px); }
:where(.skin) .btn { padding: 2px 14px; } :where(.skin) .btn.big { padding: 5px 22px; } :where(.skin) .btn.small { padding: 0 8px; }
.skin .iconbtn { padding: 0; } .skin .iconbtn img { width: 32px; height: 32px; }
.skin .seg { border: calc(var(--sk-seg-s) * 1px) solid transparent; border-image: var(--sk-seg) var(--sk-seg-s) stretch; background: var(--ink-2); padding: 2px; gap: 4px; box-shadow: 0 5px 0 0 rgba(29,27,47,.3); }
.skin .seg button { color: rgba(255,248,228,.8); border: calc(var(--sk-btn-s) * 1px) solid transparent; padding: 0 7px; flex: none; }
.skin #s-shop .pagehead #shop-tabs { flex-wrap: wrap; overflow: visible; }
.skin .seg button.on { background: var(--lime); color: var(--ink); border-image: var(--sk-btn) var(--sk-btn-s) stretch; }
.skin .item.px, .skin .bk-cell, .skin .bk-art { border: calc(var(--sk-slot-s) * 1px) solid transparent; border-image: var(--sk-slot) var(--sk-slot-s) stretch; background: var(--paper); background-clip: padding-box; box-shadow: 0 4px 0 0 rgba(29,27,47,.25); }
.skin .item-img { background: var(--paper-2); box-shadow: inset 0 3px 0 rgba(29,27,47,.12); }
.skin .pagehead h2 { justify-self: start; background: var(--gold); border: calc(var(--sk-plate-s) * 1px) solid transparent; border-image: var(--sk-plate) var(--sk-plate-s) stretch; padding: 2px 10px; color: var(--ink); box-shadow: 0 5px 0 0 rgba(29,27,47,.3); }

/* 🎨 T18 step 2: drawers, island HUD, town panel, quest rows, Mind cards, lobby tiles */
.skin .drawer { border: calc(var(--sk-panel-s) * 1px) solid transparent; border-image: var(--sk-panel) var(--sk-panel-s) stretch; background: var(--sk-paper) 0 0 / 48px 48px, var(--paper); background-clip: padding-box; box-shadow: -6px 0 0 0 rgba(29,27,47,.3); }
.skin .isl-res, .skin .isl-tools, .skin .isl-seeds, .skin .isl-bmenu, .skin .isl-tip, .skin .isl-coach, .skin .town-side, .skin .mode {
  border: calc(var(--sk-hud-s) * 1px) solid transparent; border-image: var(--sk-hud) var(--sk-hud-s) stretch; background-clip: padding-box; box-shadow: 0 5px 0 0 rgba(29,27,47,.3); }
.skin .isl-res, .skin .isl-tools, .skin .isl-seeds, .skin .isl-bmenu, .skin .town-side { background-image: var(--sk-paper); background-size: 48px 48px; }
.skin .mode.island-big { box-shadow: 0 0 0 3px #4fae5a, 0 6px 0 3px rgba(29,27,47,.3); }
.skin .isl-tools button { border: calc(var(--sk-btn-s) * 1px) solid transparent; border-image: var(--sk-btn) var(--sk-btn-s) stretch; padding: 2px 2px 1px; }
.skin .isl-tools button.on { box-shadow: none; }
.skin .quest, .skin .inv-mind { border: calc(var(--sk-slot-s) * 1px) solid transparent; border-image: var(--sk-slot) var(--sk-slot-s) stretch; background-clip: padding-box; }
.skin .quest { box-shadow: 0 3px 0 0 rgba(29,27,47,.2); }
.skin .inv-mind { box-shadow: inset 0 4px 0 var(--rar), 0 4px 0 0 rgba(29,27,47,.25); }
.skin .quest.ready { animation: none; background-color: #f1ffd6; outline: 2px solid rgba(120,220,60,.9); outline-offset: 1px; }
:where(.skin) .mode { padding: 4px 6px; } .skin .mode-row.three .mode-txt b { font-size: 17px; } .skin .mode-row .mode.wide-mode .mode-txt b { font-size: 19px; }

/* 🎨 T18c owner fixes 2026-11-13 */
/* lobby HUD: balances + Today in the middle of the scene, never over the leaderboard */
.hub-hud { position: absolute; top: max(78px, calc(env(safe-area-inset-top) + 64px)); z-index: 6; display: flex; flex-direction: column; align-items: center; gap: 10px; pointer-events: none; }
.hub-hud > * { pointer-events: auto; }
.hub-hud.nar { left: auto; right: 8px; top: 66px; align-items: flex-end; }
#s-hub .hub-hud > .wbal { position: static; margin: 0; }
.hub-hud #hub-today { position: static; width: min(300px, 100%); }
/* balances = game currency bar */
.wbal { gap: 6px; padding: 3px; background: var(--ink-2); box-shadow: 0 5px 0 0 rgba(29,27,47,.3); }
.skin .wbal { border: calc(var(--sk-hud-s) * 1px) solid transparent; border-image: var(--sk-hud) var(--sk-hud-s) stretch; }
.wbal:hover { background: #4a4570; }
.wb-chip { display: flex; align-items: center; gap: 5px; padding: 2px 10px 2px 4px; background: rgba(0,0,0,.35); box-shadow: inset 0 2px 0 rgba(0,0,0,.35); }
.wb-chip b { font: 400 17px var(--pix); color: #fff; text-shadow: 2px 2px 0 var(--ink); }
.wb-chip img.wb-i { width: 22px; height: 22px; }
#trade .wbal { background: var(--ink-2); }
/* Today = game quest-log card */
#hub-today { background: transparent; box-shadow: 0 5px 0 0 rgba(29,27,47,.3); }
.skin #hub-today { border: calc(var(--sk-hud-s) * 1px) solid transparent; border-image: var(--sk-hud) var(--sk-hud-s) stretch; background: var(--sk-paper) 0 0 / 48px 48px, var(--paper); background-clip: padding-box; }
#hub-today .today-head { background: var(--gold) !important; color: var(--ink) !important; padding: 4px 8px; gap: 6px; font-size: 16px; box-shadow: inset 0 -3px 0 var(--gold-d), inset 0 2px 0 rgba(255,255,255,.5); }
.today-head b { font: 400 18px var(--pix); } .today-head img.td-i { width: 20px; height: 20px; }
.today-head i { background: #ff3b4e !important; box-shadow: 0 0 0 2px var(--ink); font-weight: 900; }
.today-head small { color: var(--ink) !important; opacity: .7; } .today-head span { color: var(--ink) !important; }
.today-rows { display: flex; flex-direction: column; padding: 4px; gap: 4px; }
#hub-today .today-row { border: 0 !important; background: #fff8e4; box-shadow: 0 0 0 2px #c9ab6a; padding: 4px 8px 4px 4px; font-size: 13px; font-weight: 800; position: relative; }
.today-row > i, .today-row > i.qpx { flex: none; width: 26px; height: 26px; display: grid; place-items: center; font-style: normal; background: var(--paper-2); box-shadow: 0 0 0 2px var(--ink); }
.today-row > i.qpx img.pxi { width: 20px; height: 20px; }
.today-row span { flex: 1; }
#hub-today .today-row.hot { background: #f1ffd6; box-shadow: 0 0 0 2px #58b046; } .today-row.hot::after { content: none; }
#hub-today .today-row:hover { background: #fff3c0; transform: translateX(2px); }
/* red dot = something to take here */
.rdot { flex: none; width: 10px; height: 10px; background: #ff3b4e; box-shadow: 0 0 0 2px var(--ink); animation: rdot 1s ease-in-out infinite alternate; }
@keyframes rdot { to { transform: scale(1.25); } }
#q-tabs .btn { position: relative; overflow: visible; }
#q-tabs .btn.dot::after, .q-cats .btn.dot::after, .quest.ready::after { content: ''; position: absolute; top: -5px; right: -5px; width: 11px; height: 11px; background: #ff3b4e; box-shadow: 0 0 0 2px var(--ink); animation: rdot 1s ease-in-out infinite alternate; z-index: 2; }
.quest.ready { position: relative; }
/* Quests = a big centred game window (was a narrow side drawer) */
#questd { left: 50%; top: 50%; right: auto; bottom: auto; width: min(780px, calc(100vw - 16px)); height: min(900px, calc(100vh - 16px)); transform: translate(-50%, -50%) scale(.94); opacity: 0; pointer-events: none; transition: transform .18s, opacity .18s; }
#questd.on { transform: translate(-50%, -50%); opacity: 1; pointer-events: auto; box-shadow: 0 0 0 100vmax rgba(29,27,47,.55); }
.skin #questd { box-shadow: none; } .skin #questd.on { box-shadow: 0 0 0 100vmax rgba(29,27,47,.55); }
#questd #quest-list { padding: 6px 6px 10px; }
#questd .quest { padding: 9px 10px; } #questd .quest b { font-size: 16px; } #questd .quest small { font-size: 13px; }
#questd .q-streak, #questd .q-level, #questd .q-neu { margin: 3px; }
#questd .q-week { padding: 3px; gap: 8px; } #questd .q-daycell { font-size: 13px; } #questd .q-daycell span { font-size: 12px; }
#questd .q-daycell b { font-size: 15px; }
@media (min-width: 700px) { #questd #quest-top { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: stretch; } }
.skin .board-head h3 { font-size: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; } .skin .board-head img { width: 32px; } .skin .board-head .live { display: none; } .skin .col-board::before { display: none; }
@media (max-width: 520px) { .wbal { gap: 3px; flex-wrap: nowrap; } .wb-chip { padding: 1px 5px 1px 2px; gap: 3px; } .wb-chip b { font-size: 13px; } .wb-chip img.wb-i { width: 16px; height: 16px; } }

/* 🎨 T18d lobby layout (UX pass) */
.hub-hud.desk { position: static; display: contents; }
#s-hub .hub-hud.desk > .wbal { position: fixed; z-index: 7; margin: 0; }
.hub-hud.desk > #hub-today { position: fixed; z-index: 6; width: 290px; }
@media (min-width: 901px) { .topbtns { gap: 8px; padding: 6px; background: rgba(29,27,47,.38); box-shadow: inset 0 0 0 2px rgba(29,27,47,.5); } }
@media (min-width: 901px) { .skin .topbtns .iconbtn { width: 50px; height: 50px; } }
.nametag.hubtag { display: flex; align-items: center; gap: 6px; padding: 2px 7px 3px; font-size: 14px; line-height: 1.1; box-shadow: 0 0 0 2px var(--ink), inset 0 -4px 0 var(--rc), 0 3px 0 2px rgba(29,27,47,.25); }
.nametag.hubtag b { font: 400 15px var(--pix); }
.nametag.hubtag .ten { font-size: 12px; background: #eaffc4; padding: 0 4px; box-shadow: 0 0 0 1px #3a9a00; }
.hub-hud.nar { left: 8px; right: 8px; align-items: center; gap: 6px; } .hub-hud.nar #hub-today { width: min(340px, 100%); }

/* 🎨 T18e retractable menu */
.topmore { position: relative; }
#hub-more.on { background: var(--lime); }
.more-menu { position: absolute; right: 0; top: calc(100% + 10px); z-index: 40; width: 210px; display: flex; flex-direction: column; gap: 6px; padding: 8px !important; }
.more-menu[hidden] { display: none; }
.more-menu .iconbtn.more-item { width: 100% !important; height: 44px !important; display: flex; justify-content: flex-start; gap: 10px; padding: 0 10px; font-size: 18px; }
.more-menu .iconbtn.more-item img { width: 26px; height: 26px; }
.more-menu .more-lbl { font: 400 17px var(--pix); color: var(--ink); }
.more-menu .badge { top: 50%; right: 10px; transform: translateY(-50%); }
@media (max-width: 900px) { #s-hub .topbtns { flex-wrap: nowrap; gap: 6px; } #s-hub .topbtns > .iconbtn, #hub-more { width: 44px !important; height: 44px !important; } #s-hub .topbtns .pxi.topi { width: 22px; height: 22px; } }
@media (max-width: 400px) { #s-hub .topbtns { gap: 4px; } #s-hub .topbtns > .iconbtn, #hub-more { width: 40px !important; height: 40px !important; } }   /* L11 phone check: the ☰ button ran 18 px past the bar */
#s-hub .topbar { z-index: 8; }   /* the ☰ menu opens over the balances bar and Today card */

/* 🎨 T18 step 3: pixel X buttons, leaderboard + profile cards, duel + adventure HUD, Mind Town tile name */
.skin .closex { font-size: 0 !important; background: var(--sk-xg) center / 27px 27px no-repeat, var(--red) !important; image-rendering: pixelated; }
.skin .brow { border: calc(var(--sk-slot-s) * 1px) solid transparent; border-image: var(--sk-slot) var(--sk-slot-s) stretch; background: var(--paper); background-clip: padding-box; box-shadow: 0 3px 0 0 rgba(29,27,47,.2); }
.skin .brow:hover { background: #fff3c0; } .skin .brow.mine-row { background: #f1ffd6; }
.skin .prof-card { border: calc(var(--sk-hud-s) * 1px) solid transparent; border-image: var(--sk-hud) var(--sk-hud-s) stretch; background: var(--sk-paper) 0 0 / 48px 48px, var(--paper); background-clip: padding-box; padding: 8px; box-shadow: 0 5px 0 0 rgba(29,27,47,.3); }
.skin .prof-top > img { box-shadow: 0 0 0 3px var(--ink), 0 0 0 6px var(--gold), 0 0 0 9px var(--ink); margin: 9px; }
.skin .duel-top .plate, .skin .raid-top, .skin .raid-bar { border: calc(var(--sk-hud-s) * 1px) solid transparent; border-image: var(--sk-hud) var(--sk-hud-s) stretch; background-clip: padding-box; box-shadow: 0 5px 0 0 rgba(29,27,47,.3); }
.skin .raid-top, .skin .raid-bar { background-image: var(--sk-paper); background-size: 48px 48px; }
.skin .raid-bar button { border: calc(var(--sk-slot-s) * 1px) solid transparent; border-image: var(--sk-slot) var(--sk-slot-s) stretch; background-clip: padding-box; }
.skin .raid-bar button.on { background-color: var(--lime); box-shadow: none; }
.skin .raid-tip { box-shadow: 0 0 0 2px var(--ink), 0 4px 0 2px rgba(29,27,47,.3); }
.mode.town-tile .mode-txt b { font-size: clamp(14px, 1.4vw, 20px) !important; text-overflow: clip; }
.mode.town-tile .mode-txt { overflow: visible; }

/* 🎨 T18: pixel icons in tab strips */
img.pxi.tabi { width: 18px; height: 18px; vertical-align: -3px; margin-right: 4px; image-rendering: pixelated; }

/* L12 gift picker = picture grid */
.gift-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 6px; max-height: 46vh; overflow: auto; padding: 4px; }
.gift-cell { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; background: var(--paper-2); border: 0; box-shadow: 0 0 0 2px #c9ab6a; cursor: pointer; font: inherit; }
.gift-cell img.pxi, .gift-cell > i { width: 32px; height: 32px; font-size: 26px; font-style: normal; }
.gift-cell b { font: 400 15px var(--pix); } .gift-cell small { font-size: 11px; line-height: 1.1; text-align: center; overflow: hidden; text-overflow: ellipsis; max-width: 100%; white-space: nowrap; }
.gift-cell.on { background: #f1ffd6; box-shadow: 0 0 0 3px var(--ink), 0 0 0 5px var(--lime); }

/* T22 town Mind picker */
.town-pick { position: absolute; top: 56px; right: 8px; z-index: 6; background: var(--paper); padding: 8px; max-width: min(340px, calc(100vw - 32px)); max-height: 60vh; overflow: auto; font-weight: 800; font-size: 13px; }
.town-pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 6px; margin-top: 6px; }
.town-pick-grid .slot { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px; border: 2px solid #3a3550; background: #1d1b2f; color: #fff; cursor: pointer; font: inherit; font-size: 11px; }
.town-pick-grid .slot.on { border-color: #d4ff1f; }
.town-pick-grid img { width: 52px; height: 52px; image-rendering: pixelated; }

/* T24 raid hero picker */
.army-hero { flex-wrap: wrap; }
.army-leads { display: flex; flex-wrap: wrap; gap: 4px; width: 100%; }
.army-leads .slot { padding: 2px; border: 2px solid var(--ink); background: #fff; cursor: pointer; }
.army-leads .slot.on { border-color: #6b8f00; box-shadow: 0 0 0 2px #d4ff1f; }
.army-leads img { width: 36px; height: 36px; image-rendering: pixelated; display: block; }

/* ===== owner 2026-11-16: the leaderboard sits in the play column; the AI Minds window is the right side panel ===== */
.col-play .col-board { width: auto !important; height: auto !important; flex: none !important; display: flex !important; min-height: 0; overflow: visible !important; margin-top: 8px; }
.col-play .col-board .board-list { max-height: 300px; overflow: auto; }
#s-hub .board-tab { display: none !important; }
#s-hub.board-closed .col-board > :not(.board-head) { display: none !important; }
#s-hub.board-closed .col-board .board-head { cursor: pointer; }
#s-hub .col-board .board-head .iconbtn.small { display: inline-flex !important; transition: transform .15s; }
#s-hub.board-closed .col-board .board-head #board-hide { transform: rotate(-90deg); }
@media (min-width: 901px) {
  .mdock.side:not(.min):not(.win):not(.fight) { left: auto !important; top: 82px !important; right: 16px; bottom: 16px; width: min(400px, 30vw); }
  .mdock.side.big:not(.min):not(.win):not(.fight) { width: min(820px, 58vw); }
  .mdock.side:not(.min):not(.win) .md-win { height: 100%; max-height: none; }
  .mdock.side:not(.min):not(.win) .md-head { cursor: default; }
  .mdock.side:not(.min):not(.win) .md-body { flex: 1; min-height: 0; }
  .mdock.side.big:not(.min) .md-chat { max-height: 46vh; min-height: 260px; }
  /* folded: a tab on the right edge, the middle of the screen */
  .mdock.side.min { left: auto !important; top: 50% !important; bottom: auto !important; right: 0 !important; transform: translateY(-50%); }
  .mdock.side.min .md-bubble { flex-direction: column; padding: 12px 8px; gap: 8px; }
  .mdock.side.min .md-bubble span { writing-mode: vertical-rl; transform: rotate(180deg); }
  .mdock.side.min .md-bubble small { display: none; }
}
@media (min-width: 901px) and (min-height: 700px) {   /* the board fills what is left of the column; its list scrolls inside */
  .col-play { height: 100%; }
  .col-play .col-board { flex: 1 1 0 !important; min-height: 330px; overflow: hidden !important; gap: 6px; padding: 10px; }
  .col-play #board-podium { zoom: .62; flex: none; }
  .col-play .col-board .board-list { flex: 1; min-height: 0; max-height: none; }
  #s-hub.board-closed .col-play .col-board { flex: none !important; min-height: 0; }
}
/* owner 2026-11-16: no leaderboard in the lobby, just a button that opens it as a pop-up */
#s-hub #board { display: none !important; }
.lb-tile { min-height: 58px; }

/* owner 2026-11-16: tile art for Mind City, Siege Cup and Leaderboard; the AI side panel is smaller and opens under the Today strip */
.mode.town-tile { --bg: url(assets/tile_city.webp); }
.mode.cup-tile { --bg: url(assets/tile_cup.webp); }
.mode.lb-tile { --bg: url(assets/tile_board.webp); }
@media (min-width: 901px) {
  .mdock.side:not(.min):not(.win):not(.fight) { top: 128px !important; width: min(360px, 26vw); }
  .mdock.side.big:not(.min):not(.win):not(.fight) { width: min(560px, 40vw); }
}

/* owner 2026-11-16: the folded AI Minds button is a tab on the right edge (middle) on every screen: lobby, city, island, adventure, Ranked */
.mdock.min, .mdock.win, .mdock.fight { left: auto !important; top: 50% !important; bottom: auto !important; right: 0 !important; transform: translateY(-50%); }
.mdock.min .md-bubble, .mdock.win .md-bubble, .mdock.fight:not(.duelscr) .md-bubble { flex-direction: column; padding: 12px 8px; gap: 8px; }
.mdock.min .md-bubble span, .mdock.win .md-bubble span, .mdock.fight:not(.duelscr) .md-bubble span { writing-mode: vertical-rl; transform: rotate(180deg); }
.mdock.min .md-bubble small, .mdock.win .md-bubble small, .mdock.fight .md-bubble small { display: none; }

/* owner 2026-11-16: lobby column order: Ranked, Island, [City · Cup · Leaderboard], [Classic · Practice · Tutorial], Invite / X */
.hub-row2 .mode { min-height: 64px !important; }
.hub-row2 .mode .mode-txt b { font-size: clamp(12px, 1vw, 16px) !important; white-space: nowrap; overflow: visible; text-overflow: clip; }
.hub-row2 .mode .mode-txt { overflow: hidden; }
.hub-row2 .mode .mode-txt span { font-size: 11px !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.col-play .share-row { margin-top: 2px; }

/* 🔧 T38: red how-to-fix labels in the AI dock + history */
.md-fix { display: block; margin-top: 4px; padding: 5px 7px; background: #ff5263; color: #fff; font-size: 12px; line-height: 1.35; box-shadow: 0 0 0 2px var(--ink); }
.md-fix.big { margin: 6px 0; font-size: 13px; }
.mode.lb-big { min-height: 150px; box-shadow: 0 0 0 3px var(--ink), 0 0 0 6px #ffc531, 0 7px 0 5px rgba(29,27,47,.3); }
.mode.lb-big .mode-txt b { font-size: 32px; }
.lb-big-pfps { display: flex; gap: 4px; margin-left: auto; margin-right: 8px; } .lb-big-pfps img { width: 40px; height: 40px; image-rendering: pixelated; box-shadow: 0 0 0 2px var(--ink); background: #fff; }
.lb-big-pfps img:first-child { width: 48px; height: 48px; box-shadow: 0 0 0 2px var(--ink), 0 0 0 4px #ffc531; }
@media (max-width: 700px) { .mode.lb-big { min-height: 92px; } .mode.lb-big .mode-txt b { font-size: 24px; } .lb-big-pfps img { width: 30px; height: 30px; } .lb-big-pfps img:first-child { width: 34px; height: 34px; } }
.skin .mode.lb-big { box-shadow: 0 0 0 3px #ffc531, 0 6px 0 3px rgba(29,27,47,.3); }
/* 🏝️ T38 island pixel icons (top bar, side buttons, tools) */
.isl-pi { width: 18px; height: 18px; image-rendering: pixelated; vertical-align: -3px; }
.iconbtn .isl-pi { width: 24px; height: 24px; vertical-align: middle; }
.isl-ti { width: 24px; height: 24px; image-rendering: pixelated; display: block; margin: 0 auto; }
.wb-chip .pxi { image-rendering: pixelated; }
/* 📚 T38 strategy library + roles */
#modal-btns .lib-go.hide { display: none; }
.md-easy { display: flex; gap: 6px; margin: 6px 0; } .md-easy .btn { flex: 1; }
.lib-tabs { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0; }
.lib-list { display: grid; gap: 8px; max-height: 52vh; overflow-y: auto; padding: 2px; }
.lib-card { display: grid; gap: 3px; padding: 8px; background: #fff8e6; box-shadow: 0 0 0 2px var(--ink); text-align: left; }
.lib-top { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.lib-win { font-style: normal; font-size: 12px; padding: 1px 6px; color: #fff; box-shadow: 0 0 0 2px var(--ink); white-space: nowrap; }
.lib-win.hi { background: #3fae4a; } .lib-win.mid { background: #e0a020; } .lib-win.lo { background: #8a8aa0; }
.roles { display: grid; gap: 6px; max-height: 55vh; overflow-y: auto; }
.role-row { display: grid; grid-template-columns: 40px 1fr minmax(120px, 48%); gap: 8px; align-items: center; text-align: left; }
.role-row img { width: 40px; height: 40px; image-rendering: pixelated; box-shadow: 0 0 0 2px var(--ink); }
.role-row span { display: grid; } .role-row small { font-size: 11px; opacity: .75; }
/* 🏆 T39 your rank row pinned on top of the leaderboard */
tr.you-row td { background: #fff3c4; font-size: 14px; }

/* T47e: currency/resource emoji in text drawn as the same pixel icons as the balances bar */
img.pxi.epx { width: 1.15em; height: 1.15em; vertical-align: -0.2em; margin: 0 1px; display: inline-block; }

/* ===== T50 SHOP REDESIGN (owner 2026-11-19: "align them like a professional shop"): vertical item tiles in an even grid,
   rarity colour strip + glow behind the icon, name centred, price button pinned to the bottom so every row lines up ===== */
#shop-grid { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; padding: 6px 4px 22px; align-items: stretch; }
#shop-grid .shop-card { --rc: #8a8698; display: flex; flex-direction: column; align-items: stretch; padding: 0; position: relative; overflow: hidden; background: #fffaf0; box-shadow: 0 0 0 2px var(--ink), 0 5px 0 0 rgba(29,27,47,.28) !important; outline: 0; transition: transform .12s ease, box-shadow .12s ease; }
#shop-grid .shop-card:hover { transform: translateY(-3px); box-shadow: 0 0 0 2px var(--ink), 0 8px 0 0 rgba(29,27,47,.22), 0 0 18px color-mix(in srgb, var(--rc) 55%, transparent) !important; }
#shop-grid .shop-card.rar-uncommon { --rc: #3fa34d; } #shop-grid .shop-card.rar-rare { --rc: #3f8ae0; } #shop-grid .shop-card.rar-epic { --rc: #9b5de5; }
#shop-grid .shop-card.rar-legendary { --rc: #f5a623; } #shop-grid .shop-card.rar-mythic { --rc: #ff3d8b; }
#shop-grid .shop-card::before { content: ''; display: block; height: 6px; flex: none; background: var(--rc); }
#shop-grid .shop-card.rar-mythic::before { background: linear-gradient(90deg, #ff3d8b, #7a5cff); }
#shop-grid .shop-card.owned { box-shadow: 0 0 0 3px var(--lime), 0 0 0 5px var(--ink), 0 5px 0 0 rgba(29,27,47,.28) !important; }
#shop-grid .shop-img { width: auto; height: 108px; flex: none; display: grid; place-items: center; background: radial-gradient(circle at 50% 58%, color-mix(in srgb, var(--rc) 38%, #fff) 0, color-mix(in srgb, var(--rc) 10%, #f3ead6) 68%); border-bottom: 2px solid rgba(29,27,47,.12); }
#shop-grid .shop-img img, #shop-grid .shop-img img.pxi { width: 64px; height: 64px; object-fit: contain; image-rendering: pixelated; filter: drop-shadow(0 4px 0 rgba(29,27,47,.25)); }
#shop-grid .shop-img i { font-size: 52px; }
#shop-grid .shop-img .cos-back { width: 58px; height: 87px; } #shop-grid .shop-img .cos-sky { width: 150px; height: 84px; }
#shop-grid .shop-img .cos-pfp { width: 64px; height: 64px; margin: 0; }
#shop-grid .shop-txt { flex: 1; padding: 10px 12px 8px; text-align: center; align-items: center; gap: 4px; }
#shop-grid .shop-txt b { font: 400 19px/1.08 var(--pix); }
#shop-grid .shop-txt span { font-size: 12.5px; line-height: 1.38; }
#shop-grid .shop-txt span b { font: inherit; font-weight: 800; color: var(--ink); }
#shop-grid .rar-tag { position: absolute; top: 12px; left: 8px; margin: 0; padding: 1px 6px; background: var(--rc); box-shadow: 0 2px 0 rgba(29,27,47,.3); }
#shop-grid .shop-card.rar-mythic .rar-tag { background: linear-gradient(90deg, #ff3d8b, #7a5cff); }
#shop-grid .shop-txt > em { position: absolute; top: 12px; right: 8px; padding: 1px 7px; font-size: 11px; background: rgba(29,27,47,.86); color: #fff; }
#shop-grid .shop-btns { margin-top: auto; padding: 0 10px 12px; display: flex; flex-wrap: wrap; gap: 6px; }
#shop-grid .shop-btns .btn { flex: 1 1 88px; min-width: 0; font-size: 15px; line-height: 1.15; padding: 7px 8px; white-space: normal; }
#shop-grid .shop-btns .btn.primary[data-buy] { flex-basis: 100%; }
#shop-grid .shop-btns .btn:only-child { flex-basis: 100%; }
#shop-grid .shop-btns .btn s { opacity: .6; margin-right: 4px; }
/* section headers and info strips span the whole row */
#shop-grid .shop-h { grid-column: 1 / -1; display: flex; align-items: baseline; gap: 10px; margin: 12px 0 -4px; padding: 0 0 6px; font: 400 24px var(--pix); border-bottom: 3px solid var(--ink); }
#shop-grid .shop-h small { font: 600 12px var(--sans, inherit); color: var(--muted); }
#shop-grid .shop-info { display: block; line-height: 1.45; padding: 10px 14px; box-shadow: 0 0 0 2px var(--ink); }
#shop-grid .shop-info::after { content: ''; display: table; clear: both; }
#shop-grid .shop-info > .btn { float: right; margin: 0 0 4px 12px; }
#shop-grid .shop-hero { padding: 12px 16px; }
#shop-grid .chips { margin-bottom: 2px; }
#shop-grid .inv-empty, #shop-grid .board-empty { grid-column: 1 / -1; }
@media (max-width: 560px) {
  #shop-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  #shop-grid .shop-img { height: 84px; } #shop-grid .shop-img img, #shop-grid .shop-img img.pxi { width: 50px; height: 50px; }
  #shop-grid .shop-txt { padding: 8px 8px 6px; } #shop-grid .shop-txt b { font-size: 16px; } #shop-grid .shop-txt span { font-size: 11.5px; }
  #shop-grid .shop-btns { padding: 0 8px 10px; } #shop-grid .shop-btns .btn { flex-basis: 100%; font-size: 13px; padding: 6px 4px; }
  #shop-grid .shop-info > .btn { float: none; display: block; margin: 8px 0 0; width: 100%; }
}

/* T51: admin reset confirmations */
.adm-warn { background: #ffe1dc; border: 2px solid #c0392b; padding: 8px 10px; color: #8a1d12; font-size: 13px; font-weight: 700; }
.adm-phrase { font-family: ui-monospace, Consolas, monospace; background: #fff3c4; color: var(--ink); padding: 2px 6px; border-radius: 4px; user-select: all; letter-spacing: .5px; }
#adm-phrase { font-family: ui-monospace, Consolas, monospace; text-transform: none; }

/* T52: bigger admin screen, grouped side menu, roles */
#s-admin > .page { width: min(1440px, calc(100% - 28px)); height: calc(100% - 40px); max-height: none; }
#s-admin .adm { grid-template-columns: 250px 1fr; gap: 12px; flex: 1; min-height: 0; align-items: stretch; }
#s-admin .adm-left, #s-admin .adm-right { min-height: 0; overflow: auto; }
#s-admin .adm-right { padding: 16px 20px; font-size: 15px; }
#s-admin .adm-right h3 { font-size: 22px; margin: 0 0 10px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.adm-nav { display: flex; flex-direction: column; gap: 3px; margin-top: 10px; }
.adm-nav h4 { margin: 10px 0 2px; font-size: 11px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--muted); }
.adm-tab { display: flex; align-items: center; gap: 6px; width: 100%; text-align: left; padding: 8px 10px; border: 2px solid transparent; background: transparent; font: 800 14px var(--font); color: var(--ink); cursor: pointer; }
.adm-tab:hover { background: var(--paper-2); }
.adm-tab.on { background: var(--lime); border-color: var(--ink); box-shadow: 2px 2px 0 var(--ink); }
.adm-tab b { margin-left: auto; background: var(--red); color: #fff; padding: 0 6px; font-size: 12px; }
.adm-tab b:empty { display: none; }
.adm-role { margin-top: 8px; font: 800 12px var(--font); } .adm-role span { padding: 2px 8px; background: var(--ink); color: var(--lime); }
#s-admin .adm-stats { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
#s-admin .adm-stats div { padding: 12px 14px; } #s-admin .adm-stats b { font-size: 32px; } #s-admin .adm-stats span { font-size: 13px; }
.adm-mail { display: grid; grid-template-columns: minmax(280px, 1fr) 1.4fr; gap: 16px; align-items: start; }
.adm-mail .adm-box textarea { width: 100%; }
.adm-mrow { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; background: var(--paper-2); padding: 8px 10px; margin-bottom: 6px; border-left: 5px solid #8a93a6; }
.adm-mrow.all { border-left-color: #2f7de1; } .adm-mrow.gift { border-left-color: #d98a1f; }
.adm-mrow p { grid-column: 1 / -1; margin: 0; font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--muted); }
.adm-mrow small { color: var(--muted); }
.adm-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 8px; } .adm-chips input { flex: 1; min-width: 140px; padding: 5px 8px; font: 700 13px var(--font); }
.adm-badge { padding: 1px 7px; font-size: 11px; font-weight: 900; background: var(--ink); color: #fff; } .adm-badge.mod { background: #2f7de1; } .adm-badge.owner { background: #d98a1f; }
@media (max-width: 900px) { #s-admin .adm { grid-template-columns: 1fr; } #s-admin .adm-left { max-height: 38vh; } .adm-mail { grid-template-columns: 1fr; } }
#s-admin .adm-search input { min-width: 0; width: 100%; }
#s-admin .adm-left { padding: 12px; }
.adm-nav { gap: 1px; } .adm-nav h4 { margin: 8px 0 1px; } .adm-tab { padding: 6px 10px; }

/* T54 live controls: banner strip + maintenance screen */
/* T72o (owner: "the banner covers a lot of the screen, make it like the TV news scroll at the bottom"): a thin ticker on the
   bottom edge; the text runs right to left (two copies, so the loop never jumps). Hidden in duels, raids and runs */
.game-banner { position: fixed; left: 0; right: 0; bottom: 0; z-index: 90; height: 28px; display: flex; align-items: stretch; background: rgba(26, 20, 48, .92); color: #fff; font: 800 14px/28px var(--font); border-top: 2px solid var(--lime); pointer-events: none; overflow: hidden; }
.game-banner .tk-tag { flex: none; padding: 0 12px; background: var(--lime); color: var(--ink); font-weight: 900; letter-spacing: 1px; }
.game-banner .tk-track { flex: 1; overflow: hidden; white-space: nowrap; -webkit-mask-image: linear-gradient(90deg, transparent, #000 24px, #000 calc(100% - 24px), transparent); mask-image: linear-gradient(90deg, transparent, #000 24px, #000 calc(100% - 24px), transparent); }
.game-banner .tk-move { display: inline-block; padding-left: 100%; animation: tk-run var(--tk-dur, 30s) linear infinite; }
.game-banner .tk-run { padding-right: 60px; } .game-banner b { color: var(--lime); }
.game-banner.warn { border-top-color: #ff8a7a; } .game-banner.warn .tk-tag { background: #ff8a7a; }
.game-banner.off { display: none !important; }
@keyframes tk-run { from { transform: translateX(0); } to { transform: translateX(-100%); } }
@media (prefers-reduced-motion: reduce) { .game-banner .tk-move { animation: none; padding-left: 12px; } }
.maint { position: fixed; inset: 0; z-index: 200; background: linear-gradient(rgba(18, 13, 36, .72), rgba(18, 13, 36, .72)), #120d24 url(assets/site_bg.webp) center / cover; display: grid; place-items: center; padding: 16px; }
.maint .panel { max-width: 460px; text-align: center; padding: 22px; } .maint h2 { margin: 0 0 8px; }
.maint-timer { font-size: 34px; font-weight: 800; letter-spacing: 2px; margin: 6px 0 10px; font-variant-numeric: tabular-nums; color: var(--gold, #ffcf4a); }
.maint[hidden], .game-banner[hidden], .town-night[hidden] { display: none !important; }
.adm-note { border-left: 4px solid var(--lime); padding: 2px 8px; margin: 4px 0; background: #fffbe8; } .adm-note p { margin: 2px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.adm-chips select { padding: 5px 8px; font: 700 13px var(--font); }

/* 🌙 T56 Game Night in Mind City */
.town-night { position: absolute; top: 58px; left: 50%; transform: translateX(-50%); z-index: 6; max-width: min(560px, calc(100% - 24px)); background: rgba(29,27,47,.92); color: #fff8e4; border: 2px solid #d4ff1f; border-radius: 10px; padding: 8px 12px; display: flex; flex-direction: column; gap: 6px; box-shadow: 0 0 18px rgba(212,255,31,.35); }
.town-night small { opacity: .85; margin-left: 6px; }
.town-night .tn-quiz { display: flex; flex-direction: column; gap: 4px; border-top: 1px solid rgba(255,255,255,.2); padding-top: 6px; }
.town-night .tn-quiz small { margin: 0; }
.town-night .tn-quiz span { display: flex; gap: 6px; }
.town-night .tn-quiz input { flex: 1; min-width: 0; }
#s-town.night .town-top b { color: #d4ff1f; text-shadow: 0 0 8px #ff4fd8; }
.adm-night { border-color: #7a5aff; }
.adm-on { color: #4ade80; font-style: normal; font-weight: 700; }
@media (max-width: 600px) { .town-night { top: 96px; font-size: 13px; } }
/* 🎮 T58 lobby mini-games */
.bubble.invite{background:#fff7c2;border:2px solid #f5b81c;font-weight:700;animation:invpulse 1s ease-in-out infinite}
@keyframes invpulse{50%{transform:translate(-50%,-100%) scale(1.06)}}
.mini{min-width:min(340px,80vw);text-align:center}
.mini-head{font-size:18px;margin-bottom:6px}
.mini-status{min-height:22px;margin:6px 0 10px;font-weight:600}
.mini-score{font-size:16px;margin-bottom:10px}
.mini-rps{display:flex;gap:10px;justify-content:center}
.mini-pick{font-size:34px;display:flex;flex-direction:column;align-items:center;padding:8px 14px}
.mini-pick small{font-size:11px;text-transform:capitalize}
.mini-xo{display:grid;grid-template-columns:repeat(3,72px);gap:6px;justify-content:center}
.mini-cell{width:72px;height:72px;font-size:36px;border-radius:10px;border:2px solid #3a3a5a;background:#fffdf3;cursor:pointer}
.mini-chess{display:grid;grid-template-columns:repeat(5,56px);justify-content:center;border:3px solid #3a2a1a;width:max-content;margin:0 auto}
.mini-sq{width:56px;height:56px;font-size:38px;line-height:1;border:0;background:#f0d9b5;color:#1d1b2f;font-family:'Segoe UI Symbol','DejaVu Sans',serif;font-variant-emoji:text;cursor:pointer;padding:0}
.mini-sq.d{background:#b58863}.mini-sq.blk{color:#1d1b2f}
.mini-sq.sel{box-shadow:inset 0 0 0 4px #c6ff3a}.mini-sq.tg{box-shadow:inset 0 0 0 4px #4fc3ff}
@media (max-width:420px){.mini-chess{grid-template-columns:repeat(5,48px)}.mini-sq{width:48px;height:48px;font-size:32px}}

/* 🎛️ T59 Game Night host window (staff only, inside Mind City) */
.town-host { position: absolute; top: 100px; right: 14px; z-index: 7; }
.town-host[hidden] { display: none !important; }
.modal:has(.host-panel) { width: min(860px, calc(100% - 24px)); max-width: none; max-height: calc(100% - 24px); }   /* T59: everything fits, no scrolling */
.host-panel { width: 100%; text-align: left; box-sizing: border-box; }
.host-panel .muted { margin: 0; }
.host-panel h3 { margin: 0 0 4px; }
.hp-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 14px; margin: 10px 0; }
@media (max-width: 640px) { .hp-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.hp-f input, .hp-f select, .hp-quiz input { box-sizing: border-box; min-width: 0; font: 700 15px var(--font); padding: 7px 9px; border: 0; background: #fff; box-shadow: 0 0 0 2px var(--ink); height: 38px; }
.hp-f { display: flex; flex-direction: column; gap: 2px; font-weight: 700; font-size: 13px; }
.hp-f input, .hp-f select { width: 100%; }
.hp-f small { opacity: .6; font-weight: 600; }
.hp-quiz { display: flex; flex-direction: column; gap: 6px; border-top: 2px dashed rgba(29,27,47,.2); padding-top: 8px; }
.hp-quiz span { display: flex; gap: 6px; } .hp-quiz span input:first-child { flex: 1; } .hp-quiz span input:last-child { width: 70px; }
/* 🪖 T59 (owner: "the army window doesn't have to be long, make it a rectangle"): a wide window with a grid of troop cards */
.modal:has(.army-list) { width: min(980px, calc(100% - 24px)); max-width: none; }
.army-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(178px, 1fr)); gap: 8px; }
.army-row { grid-template-columns: 40px 1fr 40px; grid-template-rows: auto auto; gap: 4px 6px; padding: 8px; text-align: left; align-items: start; box-shadow: 0 0 0 2px rgba(29,27,47,.18); }
.army-row > img { grid-row: 1; grid-column: 1; width: 40px; height: 44px; }
.army-row > div { grid-row: 1; grid-column: 2 / 4; font-size: 14px; line-height: 1.2; }
.army-row > div small { font-size: 11px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.army-row > .btn, .army-row > em { align-self: center; }
.army-row > .btn { justify-self: stretch; }
@media (max-width: 520px) { .army-list { grid-template-columns: repeat(2, 1fr); } }
/* 🛒 T59 (owner: "make the store window large, game-like"): a big window, categories on a left rail, cards in a wide grid */
@media (min-width: 900px) {
  #s-shop > .page { width: min(1340px, calc(100% - 24px)); height: min(900px, calc(100% - 24px)); max-height: none; display: grid; grid-template-columns: 190px 1fr; grid-template-rows: auto auto 1fr; gap: 12px 16px; overflow: hidden; }
  #s-shop .pagehead { grid-column: 1 / -1; grid-template-columns: 1fr auto auto; position: static; margin: -16px -18px 0; }
  #s-shop .pagehead #shop-tabs { display: none; }
  #s-shop .shop-rail { grid-column: 1; grid-row: 2 / 4; display: flex; flex-direction: column; gap: 6px; overflow-y: auto; overflow-x: hidden; padding: 2px 10px 2px 2px; }
  #s-shop .shop-rail button { display: flex; align-items: center; gap: 8px; text-align: left; padding: 10px 12px; font: 900 15px var(--font); background: var(--paper); color: var(--ink); border: 0; box-shadow: 0 0 0 2px var(--ink), 0 4px 0 0 rgba(29,27,47,.35); cursor: pointer; transition: transform .08s; }
  #s-shop .shop-rail button:hover { transform: translateX(3px); }
  #s-shop .shop-rail button.on { background: var(--lime); transform: translateX(6px); box-shadow: 0 0 0 2px var(--ink), 4px 4px 0 0 var(--ink); }
  #s-shop .shop-bar { grid-column: 2; grid-row: 2; }
  #s-shop .shop-grid { grid-column: 2; grid-row: 3; overflow: auto; align-content: start; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); grid-auto-rows: max-content; min-height: 0; padding: 4px 8px 12px 4px; }
}
@media (max-width: 899px) { #s-shop .shop-rail { display: none; } }

/* 🔎 T59 C9 item details: tap a shop card */
.shop-card[data-info] { cursor: pointer; }
.shop-card[data-info]:hover { transform: translateY(-2px); }
.shop-i { position: absolute; top: 34px; right: 8px; z-index: 2; width: 18px; height: 18px; display: grid; place-items: center; font: italic 900 12px/1 Georgia, serif; color: #fff; background: var(--ink); border-radius: 50%; box-shadow: 0 0 0 2px #fff; pointer-events: none; }
.shop-card:not([data-info]) .shop-i { display: none; }
.shop-card { position: relative; }
.bk-chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 6px 0; }
.bk-chip { font: 800 12px var(--font); font-style: normal; padding: 3px 8px; background: #ece7da; box-shadow: 0 0 0 2px var(--ink); }
.bk-chip.ok { background: #dff5c4; } .bk-chip.no { background: #f6dada; } .bk-chip.gem { background: #e6dbff; }

.game-banner.dup { display: none !important; }   /* T59: Mind City shows the Game Night strip instead */

/* 👹 T59 Square Boss chip in Mind City (when it comes, tap to walk there) */
.town-boss { position: absolute; top: 58px; right: 14px; z-index: 7; display: flex; flex-direction: column; align-items: flex-end; gap: 1px; padding: 6px 10px; border: 0; cursor: pointer; font: 800 13px var(--font); color: #fff; background: rgba(29,27,47,.88); box-shadow: 0 0 0 2px var(--ink); text-align: right; }
.town-boss span, .town-boss small { white-space: nowrap; }
.town-boss small { opacity: .8; font-size: 11px; }
.town-boss.now { background: #c0392b; animation: bossPulse 1s ease-in-out infinite; }
@keyframes bossPulse { 50% { transform: scale(1.05); } }
@media (max-width: 600px) { .town-boss { top: 96px; font-size: 12px; } .town-host { top: 140px; } }

/* 🎨 T59 C10 UI kit (AI pixel art in assets/ui): painted icons, button skins, wooden window frame */
.uii { width: 30px; height: 30px; image-rendering: pixelated; object-fit: contain; vertical-align: middle; pointer-events: none; }
.iconbtn .uii { width: 40px; height: 40px; }
#shop-tabs .uii { width: 22px; height: 22px; margin-right: 4px; vertical-align: -5px; }
#s-shop .shop-rail .uii { width: 32px; height: 32px; }
.pagehead h2 .uii { width: 34px; height: 34px; vertical-align: -6px; }
img.pxi[src$=".webp"] { image-rendering: pixelated; }
/* buttons + panels use the AI skins through the existing .skin layer (uiskin.js) so every screen picks them up */
.skin .btn { border: 6px solid transparent; border-image: url(assets/ui/btn_cream.webp) 5 fill / 10px stretch; background: none; image-rendering: pixelated; box-shadow: 0 4px 0 0 rgba(29,27,47,.28); }
.skin .btn.primary { border-image-source: url(assets/ui/btn_lime.webp); background: none; }
.skin .btn.gem { border-image-source: url(assets/ui/btn_purple.webp); background: none; color: #fff; }
.skin .btn.red { border-image-source: url(assets/ui/btn_red.webp); background: none; color: #fff; }
.skin .btn.blue { border-image-source: url(assets/ui/btn_blue.webp); background: none; color: #fff; }
.skin .btn.gold { border-image-source: url(assets/ui/btn_gold.webp); background: none; }
.skin .btn:active { border-image-source: url(assets/ui/btn_cream_on.webp); box-shadow: 0 1px 0 0 rgba(29,27,47,.28); }
.skin .btn.primary:active { border-image-source: url(assets/ui/btn_lime_on.webp); }
.skin .btn.gem:active { border-image-source: url(assets/ui/btn_purple_on.webp); }
.skin .btn.red:active { border-image-source: url(assets/ui/btn_red_on.webp); }
.skin .btn.blue:active { border-image-source: url(assets/ui/btn_blue_on.webp); }
.skin .btn.gold:active { border-image-source: url(assets/ui/btn_gold_on.webp); }
.skin .panel { border: 14px solid transparent; border-image: url(assets/ui/frame.webp) 12 fill / 24px stretch; background: none; image-rendering: pixelated; }
.skin .btn:disabled { color: var(--ink); }
/* T59 C10: AI close button (red round X) for every ✕ */
.skin .closex, .skin #fr-close, .skin .drawer-head .iconbtn.small { font-size: 0 !important; color: transparent !important; background: url(assets/ui/close.webp) center / 100% 100% no-repeat !important; border-image: none !important; border: 0 !important; box-shadow: none !important; image-rendering: pixelated; }

/* T59 owner QA: bigger buttons, more room, readable two-line upgrade buttons */
.btn.small { font-size: 17px; padding: 8px 14px; min-height: 42px; }
#shop-grid .shop-btns { gap: 10px; }
#shop-grid .shop-btns .btn { font-size: 17px; padding: 9px 10px; min-height: 46px; }
#shop-grid .troop-lv { display: block; font-size: 13px; line-height: 1.4; }
#shop-grid .troop-lv em { font-style: normal; color: #2e7d32; font-weight: 800; white-space: nowrap; }
#shop-grid .troop-up { display: flex; flex-direction: column; gap: 10px; width: 100%; margin-top: 8px; }
#shop-grid .troop-up .btn { width: 100%; white-space: nowrap; min-height: 46px; }
#shop-grid .troop-up .btn:not(.gem) { flex-direction: column; gap: 2px; white-space: normal; min-height: 54px; }
#shop-grid .troop-up .btn small { font-size: 13px; font-weight: 700; opacity: .85; }
.skin .btn.gem, .skin .btn.red, .skin .btn.blue { text-shadow: 0 2px 0 rgba(29,27,47,.55); }
@media (max-width: 560px) { #shop-grid .shop-btns .btn { font-size: 15px; min-height: 42px; } .btn.small { font-size: 15px; min-height: 38px; } }
/* T59 owner QA ("store looks basic, borders are plain lines"): painted AI frames for shop cards and the shop tabs */
.skin #shop-grid .shop-card { border: 12px solid transparent; border-image: url(assets/ui/card_frame.webp) 14 fill / 18px stretch; background: none; image-rendering: pixelated; box-shadow: 0 6px 0 -2px rgba(29,27,47,.25) !important; }
.skin #shop-grid .shop-card:hover { box-shadow: 0 9px 0 -2px rgba(29,27,47,.2), 0 0 18px color-mix(in srgb, var(--rc) 55%, transparent) !important; }
.skin #shop-grid .shop-card.owned { box-shadow: 0 0 0 3px var(--lime), 0 6px 0 -2px rgba(29,27,47,.25) !important; }
.skin #shop-grid .shop-card::before { margin: -2px -2px 0; }
.skin #shop-grid .shop-img { background-color: transparent; }
.skin #s-shop .shop-rail button { border: 7px solid transparent; border-image: url(assets/ui/tab.webp) 7 fill / 12px stretch; background: none; box-shadow: 0 4px 0 -1px rgba(29,27,47,.3); image-rendering: pixelated; padding: 6px 8px; min-height: 52px; }
.skin #s-shop .shop-rail button.on { border-image-source: url(assets/ui/tab_on.webp); background: none; box-shadow: 0 4px 0 -1px rgba(29,27,47,.3); }
.skin #shop-grid .shop-info { border: 10px solid transparent; border-image: url(assets/ui/card_frame.webp) 14 fill / 15px stretch; background: none; box-shadow: none; image-rendering: pixelated; padding: 6px 10px; }
/* T59 owner QA: small icons were hard to tell apart (32px art squeezed to 18px). Show them near their drawn size. */
.isl-pi { width: 30px; height: 30px; vertical-align: -8px; }
.iconbtn .isl-pi { width: 30px; height: 30px; }
.isl-res span { gap: 6px; padding: 2px 10px 2px 6px; }
.shop-bar .isl-pi { width: 28px; height: 28px; }
.wb-chip img.wb-i { width: 28px; height: 28px; }
@media (max-width: 520px) { .wb-chip img.wb-i { width: 22px; height: 22px; } }
img.pxi.tabi { width: 24px; height: 24px; vertical-align: -6px; }
img.pxi.epx { width: max(20px, 1.4em); height: max(20px, 1.4em); vertical-align: -0.35em; }
.book-btn img.pxi, .bk-book h3 img.pxi { width: 28px; height: 28px; vertical-align: -8px; }
.today-row > i.qpx img.pxi { width: 26px; height: 26px; }
.quest > i.qpx img.pxi { width: 30px; height: 30px; }
.quest > .pxi.qi { width: 36px; height: 36px; }
.q-slot .pxi.ri { width: 30px; height: 30px; }
.topbtns .pxi.topi { width: 30px; height: 30px; }
.q-daycell .pxi.ci { width: 32px; height: 32px; }
@media (max-width: 900px) { #s-hub .topbtns .pxi.topi { width: 28px; height: 28px; } .isl-pi { width: 24px; height: 24px; vertical-align: -6px; } .isl-res span { padding: 2px 6px 2px 4px; gap: 4px; } }
/* T59 owner QA: no more bare blue screen with only 'Raid'/'Wild island' while the island loads: a sky scene with the airship
   landing; the top and bottom bars only show once the island is really open (.ready) */
#s-raid, #s-adv { background: linear-gradient(#7fd0ff 0%, #bfe9ff 55%, #e9f7ff 100%); }
#s-raid.ready { background: #3b86d1; } #s-adv.ready { background: #3b86d1; }
#s-raid:not(.ready) > .raid-top, #s-raid:not(.ready) > .raid-bottom, #s-adv:not(.ready) > .raid-top, #s-adv:not(.ready) > .raid-bottom { visibility: hidden; }
#s-raid:not(.ready)::before, #s-adv:not(.ready)::before { content: ''; position: absolute; left: 50%; top: 42%; width: 160px; height: 160px; margin: -80px 0 0 -80px; background: url(assets/airship.webp) center / contain no-repeat; image-rendering: pixelated; animation: landbob 1.6s ease-in-out infinite; filter: drop-shadow(0 18px 0 rgba(29,27,47,.18)); }
#s-raid:not(.ready)::after, #s-adv:not(.ready)::after { content: 'Landing on the island…'; position: absolute; left: 0; right: 0; top: calc(42% + 96px); text-align: center; font: 400 22px var(--pix); color: var(--ink); text-shadow: 2px 2px 0 #fff; }
#s-raid:not(.ready) > canvas, #s-adv:not(.ready) > canvas { visibility: hidden; }
@keyframes landbob { 0%, 100% { transform: translateY(-8px); } 50% { transform: translateY(8px); } }
/* 🎫 T59 support tickets */
.tk-wrap { z-index: 70; }
.modal.tk { width: min(620px, calc(100% - 24px)); text-align: left; position: relative; gap: 10px; }
.tk h3 { font-size: 24px; text-align: center; padding: 0 30px; } .tk .tk-meta { text-align: center; font-size: 14px; }
.tk-x { position: absolute; top: 8px; right: 8px; width: 36px; height: 36px; border: 0; background: var(--paper-2); box-shadow: 0 0 0 2px var(--ink); font: 700 18px var(--ui, sans-serif); color: var(--ink); cursor: pointer; }
.tk-list { display: flex; flex-direction: column; gap: 8px; max-height: 50vh; overflow: auto; padding: 2px; }
.tk-item { display: flex; flex-direction: column; gap: 2px; text-align: left; padding: 10px 12px; background: #fffbe8; color: var(--ink); border: 0; box-shadow: 0 0 0 2px var(--ink), 0 3px 0 2px rgba(29,27,47,.2); cursor: pointer; font: inherit; }
.tk-item b { font-size: 16px; } .tk-item small { font-size: 13px; color: #6b5e4a; } .tk-item.closed { opacity: .7; } .tk-item:hover { background: #fff3c0; }
.tk-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--red, #e8434f); margin-right: 6px; vertical-align: 1px; }
.tk-lab { display: flex; flex-direction: column; gap: 4px; font-weight: 700; font-size: 15px; }
.tk-lab input, .tk-lab select, .tk-lab textarea, .tk-reply textarea { font: inherit; font-size: 16px; padding: 8px; border: 0; box-shadow: 0 0 0 2px var(--ink); background: #fff; color: var(--ink); resize: vertical; }
.tk-shot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; } .tk-shot img { max-height: 80px; max-width: 140px; box-shadow: 0 0 0 2px var(--ink); }
.tk-thread { display: flex; flex-direction: column; gap: 8px; max-height: 46vh; overflow: auto; padding: 6px; background: rgba(29,27,47,.06); box-shadow: inset 0 0 0 2px rgba(29,27,47,.15); }
.tk-msg { max-width: 82%; padding: 8px 10px; background: #fff; color: var(--ink); box-shadow: 0 0 0 2px var(--ink); align-self: flex-end; }
.tk-msg.staff { align-self: flex-start; background: #e6f6ff; } .tk-msg.view-staff.me { align-self: flex-start; background: #fff; } .tk-msg.view-staff.staff { align-self: flex-end; }
.tk-msg small { display: block; font-size: 12px; color: #6b5e4a; margin-bottom: 2px; } .tk-msg p { margin: 0; font-size: 15px; white-space: pre-wrap; overflow-wrap: anywhere; }
.tk-msg img { display: block; max-width: 100%; max-height: 240px; margin-top: 6px; box-shadow: 0 0 0 2px var(--ink); }
.tk-reply { display: flex; flex-direction: column; gap: 6px; } .tk-seg { justify-content: center; }
.tk [hidden] { display: none !important; } .tk-thread { min-height: 120px; }
/* T60: ticket screenshot opens inside the game; follow-panel empty line spans the row */
.tk-pic { display: block; padding: 0; border: 0; background: none; cursor: zoom-in; max-width: 100%; } .tk-shot img { cursor: zoom-in; }
.tk-view { position: fixed; inset: 0; z-index: 9999; background: rgba(8, 10, 20, .92); display: grid; place-items: center; padding: 16px; cursor: zoom-out; }
.tk-view img { max-width: 100%; max-height: 100%; object-fit: contain; box-shadow: 0 0 0 3px #fff; image-rendering: auto; }
.tk-view .tk-x { position: fixed; top: 12px; right: 12px; }
.mf-feed li.muted { display: block; }
.mf-feed li > span { min-width: 0; }   /* T60: an emoji swapped for a pixel <img> no longer becomes its own grid cell */
/* T60 live: the panel redraws every second, so the drop-in plays only on a line that is under a second old (it kept sliding over RIGHT NOW) */
.mf-feed li.new { animation: none; } .mf-feed li.new.fresh { animation: drop .3s; }
/* T60 live: the Host button sat on the boss chip's second line: it goes under the chip */
.town-host { top: 128px; }
@media (max-width: 600px) { .town-host { top: 150px; } }
/* T60 375 px: the "About the game" button sat on top of the logo on the title screen */
@media (max-width: 520px) { .boot { padding-top: 54px; } .bootsite { top: 10px; right: 10px; font-size: 13px; } }
/* T60 375 px: the island tour card showed on top of the Trial-mode notice (two boxes at once): it waits behind any open modal */
body:has(#modal.on) #isl-coach { visibility: hidden; }
/* T60 375 px: the red Trial bar covered the island's hint line */
@media (max-width: 520px) { .trial-bar { bottom: 172px; font-size: 13px; padding: 5px 10px; } }
/* T60 375 px: the shop's welcome chest was squeezed to 28 px and sat on the text */
.shop-hero > div:first-child { flex: none; }
/* T61 375 px duel: the rival's score plate ("BOT · normal" + picture) was wider than its column and covered "ROUND 1" */
@media (max-width: 420px) {
  .duel-top .plate { min-width: 0; max-width: 100%; overflow: hidden; }
  .duel-top .plate .info { min-width: 0; } .duel-top .plate .info b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .duel-top .roundlbl { font-size: 13px; }
}
/* T61 375 px duel: the picked card rose 18 px into the spell row and hid "Reverse" */
@media (max-width: 420px) { .card.on { transform: translateY(-8px); } }

/* T67h (owner): ONE bag tile everywhere: Inventory, trade, pot duel, gift and the confirm pop-ups. Same size, same look. */
.items-grid { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; align-content: start; }
.items-grid > .item { min-height: 128px; justify-content: center; position: relative; }
.items-grid > p { grid-column: 1 / -1; margin: 0; }
/* the bag picker: search + chips stay put, only the tiles scroll, so the buttons are always on screen */
.bag-pick { display: flex; flex-direction: column; gap: 8px; min-height: 0; flex: 1; }
.bag-pick > .items-grid { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 6px 6px 4px; }
/* 🤝 trade / ⚔️ pot duel: a wide window in the middle; offer on the left, your bag on the right, buttons always at the bottom */
#trade { left: 50%; top: 50%; right: auto; bottom: auto; width: min(1180px, calc(100vw - 24px)); height: min(88vh, 860px); max-height: none; overflow: hidden; padding: 14px 16px 16px; gap: 10px;
  transform: translate(-50%, -47%) scale(.97); opacity: 0; pointer-events: none; transition: transform .2s, opacity .2s; box-shadow: 0 0 0 4px var(--ink), 0 24px 70px rgba(0,0,0,.55); }
#trade.on { transform: translate(-50%, -50%); opacity: 1; pointer-events: auto; }
#trade > *, #trade .tr-side > *, #trade .tr-bag > .label { flex-shrink: 0; }
#trade .tr-body { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 14px; }
#trade .tr-side { min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 2px 6px 6px 2px; }
#trade .tr-bag { min-height: 0; display: flex; flex-direction: column; gap: 8px; padding: 10px; background: var(--paper-2); box-shadow: inset 0 0 0 2px rgba(29,27,47,.18); }
#trade #tr-add { flex: 1; min-height: 0; display: flex; flex-direction: column; }
#trade .label { margin: 0; }
.tr-foot { display: flex; gap: 10px; } .tr-foot .btn { flex: 1; } .tr-foot #tr-agree { flex: 2; }
.tr-give { gap: 4px; } .tr-give input { width: 100%; max-width: 90px; text-align: center; font: 700 15px var(--font); padding: 4px; border: 2px solid var(--ink); background: #fff; }
.tr-give small { color: var(--muted); font-size: 11px; }
.tr-x { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; padding: 0; border: 2px solid var(--ink); background: #ff6b6b; color: #fff; font: 900 12px var(--font); cursor: pointer; line-height: 1; }
@media (max-width: 760px) {
  #trade { height: calc(100dvh - 20px); width: calc(100vw - 16px); padding: 10px; }
  #trade .tr-body { display: block; overflow-y: auto; }
  #trade .tr-side { overflow: visible; margin-bottom: 12px; }
  #trade .tr-bag { height: 62vh; }
  .tr-foot { flex-wrap: wrap; } .tr-foot #tr-agree { flex-basis: 100%; order: -1; } .tr-foot .btn { font-size: 15px; padding-inline: 6px; white-space: nowrap; }
  .items-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 8px; }
}
/* 🎁 gift pop-up: wide and landscape, same tiles, Next/Cancel always visible */
.modal:has(.bag-pick) { width: min(1000px, 94vw); max-height: min(86vh, 820px); overflow: hidden; }
.gift-amt { display: flex; align-items: center; justify-content: center; gap: 10px; font-weight: 800; flex-shrink: 0; } .gift-amt input { flex: none; width: 130px; text-align: center; font: 700 16px var(--font); padding: 6px; border: 2px solid var(--ink); }
.modal:has(.bag-pick) #modal-body { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 10px; }
.modal:has(.bag-pick) .modal-btns { flex-shrink: 0; }
.modal:has(.tr-sum) { width: min(820px, 94vw); }
.tr-sum small { display: block; font-weight: 800; margin-bottom: 6px; }
/* T67h: the picked tile must show (a later skin rule hid it) */
.bag-pick .items-grid > .item.px[aria-pressed="true"] { background: #e9ffc2; box-shadow: 0 0 0 3px var(--ink), 0 0 0 6px var(--lime), 0 4px 0 6px rgba(29,27,47,.25); }
.bag-pick .items-grid > .item.px[aria-pressed="true"]::after { content: '✔'; position: absolute; top: 4px; right: 6px; font: 900 16px var(--font); color: #2f9e44; }
.md-away .md-away-off { color: #ffb3b3; font-weight: 800; opacity: 1; }   /* T67p */
.md-away-btns { display: flex; gap: 8px; flex-wrap: wrap; }   /* T68 */

/* T71f: a troop card = its troop in a card frame */
.tcard{display:inline-grid;place-items:center;width:1.5em;height:2em;max-width:100%;background:linear-gradient(#fff8e1,#f1d9a0);border:2px solid #7a4a1e;border-radius:4px;box-shadow:inset 0 0 0 2px #ffd84a;font-style:normal;vertical-align:middle}
.tcard img{width:90%;height:auto;image-rendering:pixelated}
.tr-hint{display:block;font-size:10px;line-height:1.2;opacity:.8;margin-top:2px}
.adv-ab b img.pxi{height:30px;width:auto;image-rendering:pixelated;vertical-align:middle}   /* T71o */
/* T71t wallet picker */
.wallet-pick{display:grid;gap:8px;margin-top:10px}
.wallet-pick .btn{display:flex;align-items:center;gap:10px;justify-content:flex-start;width:100%}
.wallet-pick img{width:28px;height:28px;border-radius:6px;flex:none}
/* T71y: Neuron rules (Store + before every Neuron buy) */
.neu-rules{text-align:left;margin:8px 0;padding-left:20px;font-size:14px;line-height:1.45}
.neu-rules li{margin:3px 0}
.neu-usd{width:100%;border-collapse:collapse;font-size:13px;margin:6px 0}
.neu-usd th,.neu-usd td{padding:4px 6px;border-bottom:1px solid rgba(255,255,255,.12);text-align:left}
.neu-usd th{opacity:.75;font-weight:700}

/* T71z: the AI live view has a close ✕ at the top and fits the phone's real screen height */
.mf-x { position: absolute; top: 8px; right: 8px; z-index: 5; width: 36px; height: 36px; border-radius: 50%; border: 3px solid var(--ink); background: #e53b3b; color: #fff; font: 900 16px/1 system-ui, sans-serif; cursor: pointer; }
.mf-live { right: 52px !important; }
.mf-card2 { max-height: calc(100dvh - 32px); -webkit-overflow-scrolling: touch; }
.q-cats .btn.dot { position: relative; }   /* T71z: the quest category with a ready quest gets the same red dot as the tabs */

/* T71z: what each Hello Minds permission is for */
.hm-perms { text-align: left; margin: 8px 0; padding-left: 20px; font-size: 14px; line-height: 1.45; }
.hm-perms li { margin: 4px 0; }

/* T71z (owner): "best played on a computer", shown on phones and tablets only, under TAP TO PLAY */
.pc-note { display: none; margin: 10px auto 0; max-width: 320px; font: 700 13px/1.35 var(--font, system-ui); color: #fff; text-shadow: 0 2px 0 #000; text-align: center; }
#boot-start.on ~ .pc-note { display: block; }
@media (hover: hover) and (pointer: fine) and (min-width: 900px) { #boot-start.on ~ .pc-note { display: none; } }

/* T72b: the "Made with Minds" badge on the start screen, under TAP TO PLAY (in the flow, so it never covers anything) */
.mwm-boot { justify-self: center; line-height: 0; }
.mwm-boot img { display: block; max-width: calc(100vw - 32px); }
@media (max-height: 760px) { .mwm-boot { margin: -10px 0 -8px; transform: scale(.8); } }
