/* =================================================================
   THEME: GLASS — minimal frosted panels, enamel badges, slanted HP, DM Sans
   Scene: #app[data-theme="glass"]   Selector: #app[data-ui="glass"]
   ================================================================= */
.themes { grid-template-columns: repeat(5, 1fr); gap: 6px; }
.theme-card span { font-size: 10.5px; }
.t-glass { background: linear-gradient(160deg, #dfe7f5 0%, #f4efe9 55%, #e6eef0 100%); color: #1c2230; font-family: 'DM Sans', system-ui, sans-serif; box-shadow: inset 0 1px 0 #fff; }
.t-glass b { font-weight: 500; }

#app[data-theme="glass"] .battle {
  --font: 'DM Sans', system-ui, sans-serif; --fg: #1c2230; --muted: #6b7282;
  --panel: #ffffff8c; --panel-b: #ffffffd0; --accent: #6390F0;
  --ink: #1c2230; --ink2: #6b7282; --ink3: #8a91a2;
  font-family: var(--font); color: var(--fg);
  background:
    radial-gradient(420px 420px at 108% 6%, #ffb48a55, transparent 65%),
    radial-gradient(440px 440px at -18% 46%, #8ab4ff44, transparent 65%),
    linear-gradient(160deg, #dfe7f5 0%, #f4efe9 55%, #e6eef0 100%);
}
#app[data-theme="glass"] .topbar { background: transparent; }
#app[data-theme="glass"] .topbar .pill, #app[data-theme="glass"] .skin-switch { background: #ffffffa6; color: var(--ink); border: 1px solid #ffffffd8; box-shadow: 0 4px 14px #1c22300d; font-family: var(--font); }
#app[data-theme="glass"] .skin-switch button { color: var(--ink2); font: 600 11px var(--font); }
#app[data-theme="glass"] .skin-switch button.on { background: var(--ink); color: #fff; }
.skin-switch [data-look] { width: auto !important; padding: 0 8px; }
.skin-switch [data-look="pixel"] + [data-skin] { margin-left: 4px; }

/* ---------- scene ---------- */
#app[data-theme="glass"] .scene { --aspect: 4/3.85; background: transparent; overflow: visible; }
#app[data-theme="glass"] .scene .bg i { display: block; border-radius: 50%; filter: blur(30px); opacity: .5; animation: gdrift 16s ease-in-out infinite alternate; }
#app[data-theme="glass"] .scene .bg .b1 { width: 60%; height: 40%; right: -12%; top: 4%; background: #ffc6a3; }
#app[data-theme="glass"] .scene .bg .b2 { width: 55%; height: 40%; left: -16%; bottom: 0; background: #b3ccff; animation-delay: -8s; }
#app[data-theme="glass"] .scene .bg .b3 { display: none; }
@keyframes gdrift { to { transform: translate(-8%, 6%) scale(1.08); } }
#app[data-theme="glass"] .platform { display: block; z-index: 1; background: radial-gradient(closest-side, #ffffffd0, #ffffff70 55%, #ffffff00); box-shadow: inset 0 -6px 14px #1c22300a; }
#app[data-theme="glass"] .platform.foe { width: 46%; height: 10%; right: 3%; bottom: 43%; }
#app[data-theme="glass"] .platform.me { width: 64%; height: 13%; left: -6%; bottom: 2%; }
#app[data-theme="glass"] .platform::after { content: ''; position: absolute; inset: 0; border-radius: 50%; border: 2px solid #fff; opacity: 0; }
#app[data-theme="glass"] .platform.pulse::after { animation: ripple .8s cubic-bezier(.2,.7,.3,1); }
@keyframes ripple { 0% { opacity: .9; transform: scale(.4); } 100% { opacity: 0; transform: scale(1.35); } }

#app[data-theme="glass"] .mon { z-index: 6; }
#app[data-theme="glass"] .mon.foe { right: 7%; bottom: 46%; }
#app[data-theme="glass"] .mon.me { left: 0; bottom: 13%; }
#app[data-theme="glass"] .mon .sprite { filter: drop-shadow(0 14px 12px #1c223030) drop-shadow(0 0 1px #fff); }
#app[data-theme="glass"] .mon.idle .sprite { animation: gfloat 3.4s ease-in-out infinite; }
#app[data-theme="glass"] .mon.idle.foe .sprite { animation-duration: 3.9s; animation-delay: -1.2s; }
@keyframes gfloat { 50% { transform: translateY(-4px); } }

/* materialise: white silhouette swells in, settles with a soft overshoot */
#app[data-theme="glass"] .mon.genter .sprite { animation: genter .62s cubic-bezier(.2,.9,.25,1.15) both; }
@keyframes genter {
  0% { opacity: 0; transform: translateY(18%) scale(.2); filter: brightness(0) invert(1) blur(6px); }
  40% { opacity: 1; transform: translateY(-3%) scale(1.07); filter: brightness(0) invert(1) blur(0); }
  70% { filter: brightness(1.5) drop-shadow(0 0 12px #fff); }
  100% { opacity: 1; transform: none; filter: drop-shadow(0 14px 12px #1c223030) drop-shadow(0 0 1px #fff); }
}
#app[data-theme="glass"] .mon.withdraw .sprite { animation: gwithdraw .38s cubic-bezier(.5,0,.8,.4) forwards; }
@keyframes gwithdraw { 30% { filter: brightness(0) invert(1); transform: scale(1.04); } 100% { filter: brightness(0) invert(1) blur(4px); transform: translateY(10%) scale(0); opacity: 0; } }
#app[data-theme="glass"] .mon.hit.foe .sprite { animation: ghitFoe .52s ease-out both; }
#app[data-theme="glass"] .mon.hit.me .sprite { animation: ghitMe .52s ease-out both; }
@keyframes ghitFoe { 0% { transform: none; } 12% { transform: translateX(7%); filter: brightness(0) invert(1); } 24% { filter: none; } 36% { filter: brightness(0) invert(1); } 48% { transform: translateX(-2%); filter: none; } 100% { transform: none; } }
@keyframes ghitMe { 0% { transform: none; } 12% { transform: translateX(-7%); filter: brightness(0) invert(1); } 24% { filter: none; } 36% { filter: brightness(0) invert(1); } 48% { transform: translateX(2%); filter: none; } 100% { transform: none; } }
#app[data-theme="glass"] .mon.faint .sprite { animation: gfaint .75s cubic-bezier(.55,0,.75,.3) forwards; }
@keyframes gfaint { 0% { filter: none; } 25% { transform: translateY(-3%); filter: grayscale(1) brightness(1.15); } 100% { transform: translateY(40%) scaleY(.55); opacity: 0; filter: grayscale(1) blur(3px); } }
#app[data-theme="glass"] .mon.charge .sprite { animation: gcharge .6s ease-in-out; }
@keyframes gcharge { 30%, 70% { filter: brightness(1.6) drop-shadow(0 0 14px #fff); transform: scale(1.05); } }

/* the scene dims behind the attacker while a move plays, tinted by the move's type */
#app[data-theme="glass"] .scene::before { content: ''; position: absolute; inset: 0 -16px -8px; -webkit-mask-image: linear-gradient(transparent, #000 14%, #000 86%, transparent); mask-image: linear-gradient(transparent, #000 14%, #000 86%, transparent); z-index: 5; pointer-events: none; opacity: 0; transition: opacity .3s;
  background: radial-gradient(90% 70% at 55% 48%, color-mix(in srgb, var(--cast, #6390F0) 30%, #10142a) 0%, #0b0f1fd9 100%); }
#app[data-theme="glass"] .scene.cast::before { opacity: .55; }
#app[data-theme="glass"] .hud { z-index: 4; }
#app[data-theme="glass"] .fx { z-index: 8; }

/* light orb instead of a thrown ball */
#app[data-theme="glass"] .ball { width: 14px; height: 14px; background: radial-gradient(circle at 40% 35%, #fff, #dbe7ff 60%, #9ec1ff); box-shadow: 0 0 14px 4px #fff, 0 0 34px 8px #9ec1ff88; }
#app[data-theme="glass"] .ball.orb-me { display: block; animation: throwMe .46s cubic-bezier(.3,.6,.4,1) forwards; }
#app[data-theme="glass"] .ball.orb-foe { display: block; animation: throwFoe .46s cubic-bezier(.3,.6,.4,1) forwards; }

/* ---------- HP cards ---------- */
.hud .g { display: none; }
#app[data-theme="glass"] .hud > :not(.g) { display: none !important; }
#app[data-theme="glass"] .hud .g { display: flex; flex-direction: column; gap: 7px; }
#app[data-theme="glass"] .hud { width: 52%; max-width: 236px; padding: 10px 12px; border-radius: 16px; color: var(--ink);
  background: #ffffff8c; border: 1px solid #ffffffd0; backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); box-shadow: 0 10px 28px #1c223012;
  transition: opacity .45s, transform .55s cubic-bezier(.2,.9,.3,1.1), filter .45s; }
#app[data-theme="glass"] .hud.foe { left: 3%; top: 2%; }
#app[data-theme="glass"] .hud.me { right: 3%; bottom: 2%; left: auto; padding-left: 20px; }
#app[data-theme="glass"] .hud.off { opacity: 0; filter: blur(6px); }
#app[data-theme="glass"] .hud.foe.off { transform: translateX(-24px); }
#app[data-theme="glass"] .hud.me.off { transform: translateX(24px); }
#app[data-theme="glass"] .hud.dent { animation: dent .35s ease-out; }
@keyframes dent { 30% { transform: scale(.985); } }
#app[data-theme="glass"] .hud.jolt { animation: jolt .45s linear; }
@keyframes jolt { 15%, 55% { transform: translateX(-4px) rotate(-.6deg); } 35%, 75% { transform: translateX(4px) rotate(.6deg); } }
.g-top { display: flex; align-items: center; gap: 6px; white-space: nowrap; min-width: 0; }
.g-nm { font: 600 13px var(--font, 'DM Sans'); overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.g-lv { font: 500 10.5px var(--font, 'DM Sans'); color: #8a91a2; flex: none; }
.g-top .g-types { margin-left: auto; }
.g-types { display: inline-flex; gap: 3px; flex: none; }
.g-hp { margin-left: auto; font: 600 12px var(--font, 'DM Sans'); font-variant-numeric: tabular-nums; flex: none; }
.g-hp i { font-style: normal; color: #8a91a2; }
.g-bar { position: relative; height: 9px; margin: 0 4px; transform: skewX(-28deg); border-radius: 2px; background: #1c223014; overflow: hidden; box-shadow: inset 0 1px 1px #0000000d; }
.g-bar i { position: absolute; left: 0; top: 0; bottom: 0; width: 100%; }
.g-bar .trail { background: repeating-linear-gradient(90deg, #f6a99b 0 3px, #f9c6bc 3px 6px); }
.g-bar .fill { background: linear-gradient(90deg, #43a047, #7bd389); box-shadow: inset 0 1px 0 #ffffff80; }
.g-bar[data-lv="mid"] .fill { background: linear-gradient(90deg, #e0a100, #f7d02c); }
.g-bar[data-lv="lo"] .fill { background: linear-gradient(90deg, #d84315, #ff8a65); animation: lowpulse 1.2s ease-in-out infinite; }
@keyframes lowpulse { 50% { filter: brightness(1.18) saturate(1.2); } }
.g-row { display: flex; align-items: center; gap: 6px; min-height: 18px; }
.g-row .g-st:empty, .g-row .g-bo:empty { display: none; }
.g-bo { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.g-pips { display: flex; align-items: center; gap: 7px; padding-top: 7px; border-top: 1px solid #1c22300d; }

/* ---------- shared atoms (scene + selector) ---------- */
.dm { display: inline-flex; align-items: center; gap: 3px; font: 800 9px 'DM Sans', sans-serif; letter-spacing: .7px; padding: 3px 6px; border-radius: 6px; color: #fff; text-shadow: 0 -1px 0 #0003; white-space: nowrap;
  background: linear-gradient(color-mix(in srgb, var(--c) 70%, #fff), var(--c)); border: 1px solid color-mix(in srgb, var(--c) 70%, #000);
  box-shadow: inset 0 1px 0 #ffffff90, inset 0 -2px 0 #00000022, 0 1px 2px #0003; }
.dm.lt, .disc.lt { color: color-mix(in srgb, var(--c) 30%, #1a1406); text-shadow: none; }
.disc { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; color: #fff;
  background: linear-gradient(color-mix(in srgb, var(--c) 70%, #fff), var(--c)); border: 1px solid color-mix(in srgb, var(--c) 70%, #000);
  box-shadow: inset 0 1px 0 #ffffff90, inset 0 -3px 0 #00000022, 0 2px 5px #0003; }
.pc { display: inline-flex; align-items: center; font: 800 9px 'DM Sans', sans-serif; letter-spacing: .7px; padding: 3px 7px; border-radius: 6px; color: #50535c; white-space: nowrap;
  background: linear-gradient(#fff, #ecedf0); border: 1px solid #ced0d5; box-shadow: inset 0 1px 0 #fff, inset 0 -2px 0 #9da0aa29; animation: chipIn .35s cubic-bezier(.2,1.4,.4,1) both; }
@keyframes chipIn { from { transform: scale(.6); opacity: 0; } }
.gst { font: 700 9.5px 'DM Sans', sans-serif; letter-spacing: 1.1px; color: color-mix(in srgb, var(--c) 62%, #000); animation: fadeUp .35s ease-out both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(4px); } }
.bp { display: inline-flex; align-items: center; gap: 4px; }
.bp i { width: 11px; height: 11px; border-radius: 50%; box-sizing: border-box; display: inline-block; transition: opacity .3s;
  background: radial-gradient(circle, #fff 0 1.6px, #2a2f3a 1.7px 2.6px, transparent 2.7px), linear-gradient(#f0705f 0 44%, #2a2f3a 44% 56%, #fbfbfd 56%);
  border: 1px solid #2a2f3a; box-shadow: inset 0 1px 0 #ffffff80, 0 1px 2px #0003; }
.bp i.fnt { background: radial-gradient(circle, #f3f4f6 0 1.6px, #9aa0ab 1.7px 2.6px, transparent 2.7px), linear-gradient(#c4c8d0 0 44%, #9aa0ab 44% 56%, #e9ebef 56%); border-color: #9aa0ab; opacity: .55; box-shadow: none; }
.bp i.unk { background: none; border: 1.3px dashed #9aa0ab; box-shadow: none; }
.g-pips.pop .bp i.fnt { animation: pipOut .6s ease-out; }
@keyframes pipOut { 0% { transform: scale(1.5) rotate(-30deg); opacity: 1; filter: brightness(1.3); } 100% { transform: none; } }
.bpt { font: 500 10px 'DM Sans', sans-serif; color: #6b7282; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sb { display: block; height: 7px; margin: 0 3px; transform: skewX(-28deg); border-radius: 2px; background: #1c223014; overflow: hidden; }
.sb.thin { height: 5px; }
.sb i { display: block; height: 100%; background: linear-gradient(90deg, #43a047, #7bd389); }
.sb[data-lv="mid"] i { background: linear-gradient(90deg, #e0a100, #f7d02c); }
.sb[data-lv="lo"] i { background: linear-gradient(90deg, #d84315, #ff8a65); }

/* floaters */
#app[data-theme="glass"] .floater { font: 700 13px 'DM Sans', sans-serif; color: #c0392b; text-shadow: none; padding: 4px 10px; border-radius: 99px; background: #ffffffe6; box-shadow: 0 6px 18px #1c22302a; animation: gfloatUp 1.1s cubic-bezier(.2,.8,.3,1) forwards; }
#app[data-theme="glass"] .floater[data-k="se"] { color: #d84315; font-size: 15px; }
#app[data-theme="glass"] .floater[data-k="nve"] { color: #8a6a4a; font-size: 12px; }
#app[data-theme="glass"] .floater[data-k="heal"] { color: #2f8a4b; }
#app[data-theme="glass"] .floater.crit { color: #8a6400; background: linear-gradient(#fffbe8, #fff1c2); letter-spacing: .3px; font-size: 12.5px; }
@keyframes gfloatUp { 0% { opacity: 0; transform: translate(-50%, 8px) scale(.7); } 14% { opacity: 1; transform: translate(-50%, -6px) scale(1.06); } 26% { transform: translate(-50%, -8px) scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -40px); } }

/* ---------- typed caption ---------- */
#app[data-theme="glass"] .console { padding: 6px 14px max(14px, env(safe-area-inset-bottom)); gap: 8px; }
#app[data-theme="glass"] .textbox { min-height: 0; padding: 10px 16px 11px; border-radius: 18px; font: 500 14.5px/1.4 var(--font); color: var(--ink);
  background: #ffffffa6; border: 1px solid #ffffffd8; backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); box-shadow: 0 8px 24px #1c22300f; }
#app[data-theme="glass"] .textbox .more { right: 14px; bottom: 50%; transform: translateY(50%); width: 6px; height: 6px; border-radius: 50%; background: var(--ink3); font-size: 0; }
#app[data-theme="glass"] .textbox.wait .more { animation: breathDot 1.2s ease-in-out infinite; }
@keyframes breathDot { 50% { opacity: .25; transform: translateY(50%) scale(.7); } }
.textbox .w { display: inline-block; white-space: nowrap; }
.textbox .ch { display: inline-block; animation: chIn .42s cubic-bezier(.2,.7,.2,1) both; animation-delay: var(--d); }
@keyframes chIn { from { opacity: 0; transform: translateY(.38em); filter: blur(3px); } 60% { filter: blur(0); } }
.textbox .nm { font-weight: 700; }
.textbox .mv { font-weight: 700; color: color-mix(in srgb, var(--c) 72%, #111); }
.textbox .se { color: #2f8a4b; font-weight: 600; }
.textbox .nve { color: #a0622a; font-weight: 600; }
.textbox .crit { color: #8a6400; font-weight: 700; }
.textbox .fnt { color: #b0473a; font-weight: 600; }
.textbox .mv .ch, .textbox .se .ch, .textbox .crit .ch { animation-name: chInPop; }
@keyframes chInPop { from { opacity: 0; transform: translateY(.4em) scale(1.25); filter: blur(3px); } 60% { transform: scale(1.04); filter: blur(0); } }

/* ---------- selector (also usable under retro screens) ---------- */
.glass-ui { flex: 1; display: flex; flex-direction: column; min-height: 0; transition: opacity .3s, filter .3s, transform .35s cubic-bezier(.2,.9,.3,1); }
.controls.busy .glass-ui { opacity: .42; filter: saturate(.5); transform: translateY(6px); pointer-events: none; }
.gpanel { display: flex; flex-direction: column; gap: 2px; min-height: 0; padding: 10px 12px 12px; border-radius: 24px; font-family: 'DM Sans', system-ui, sans-serif; color: #1c2230;
  background: #ffffff8c; border: 1px solid #ffffffd0; backdrop-filter: blur(22px); -webkit-backdrop-filter: blur(22px); box-shadow: 0 20px 50px #1c22301a; }
#app:not([data-theme="glass"]) .gpanel { background: #f6f7fbf0; }
.ghead { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 0 6px 6px; font: 500 12px 'DM Sans', sans-serif; color: #6b7282; }
.ghead .big { font: 600 16px 'DM Sans', sans-serif; color: #1c2230; }
.ghead.sub { margin-top: auto; padding-top: 10px; }
.pipwrap { display: inline-flex; align-items: center; gap: 7px; }
.glist { display: flex; flex-direction: column; gap: 3px; min-height: 0; overflow-y: auto; }
.gm { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 11px; align-items: center; padding: 7px 10px; border-radius: 16px; text-align: left; color: #1c2230;
  transition: background .2s, box-shadow .2s, transform .12s; animation: rowIn .45s cubic-bezier(.2,.8,.3,1) both; animation-delay: calc(var(--i) * 45ms); }
@keyframes rowIn { from { opacity: 0; transform: translateY(10px); } }
.gm:hover, .gm:focus-visible, .gm.hot { background: #fff; box-shadow: 0 6px 18px #1c22301a; outline: none; }
.gm:active { transform: scale(.98); }
.gm:active .disc { transform: scale(.92); }
.gm .disc { transition: transform .15s; }
.gm[disabled] { opacity: .4; }
.gmn { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.gmn b { font: 500 14px 'DM Sans', sans-serif; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gm.hot .gmn b { font-weight: 600; }
.gmn small { font: 500 10.5px 'DM Sans', sans-serif; color: #6b7282; }
.gmr { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; white-space: nowrap; }
.gmr .dmg { font: 600 12px 'DM Sans', sans-serif; font-variant-numeric: tabular-nums; }
.gmr .note { font: 500 11.5px 'DM Sans', sans-serif; color: #6b7282; }
.gmr .eff { font: 500 10.5px 'DM Sans', sans-serif; }
.eff.se { color: #3f9b5a; } .eff.nve { color: #a0622a; } .eff.none { color: #8a91a2; } .eff.ko { color: #c0392b; font-weight: 600; }
.gfoot { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
.gfoot.one { grid-template-columns: 1fr; }
.gbtn { min-height: 44px; border-radius: 14px; border: 1px solid #1c223018; font: 500 13px 'DM Sans', sans-serif; color: #1c2230; transition: background .2s, transform .12s; }
.gbtn:hover { background: #ffffff90; } .gbtn:active { transform: scale(.98); }
.gbtn.muted { color: #6b7282; }
.gp { display: grid; grid-template-columns: 42px minmax(0, 1fr); gap: 10px; align-items: center; padding: 6px 10px; border-radius: 16px; text-align: left; color: #1c2230;
  background: #fff; box-shadow: 0 6px 18px #1c223012; animation: rowIn .45s cubic-bezier(.2,.8,.3,1) both; animation-delay: calc(var(--i) * 50ms); transition: transform .12s; }
.gp:active { transform: scale(.985); }
.gp.cur { background: #1c22300a; box-shadow: none; opacity: .62; }
.gp.fnt { background: #1c223008; box-shadow: none; opacity: .5; filter: grayscale(1); }
.gpi { width: 42px; height: 36px; object-fit: contain; image-rendering: pixelated; }
.gpi.smooth { image-rendering: auto; }
.gpb { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.gpt { display: flex; align-items: center; gap: 5px; min-width: 0; }
.gpt b { font: 600 13.5px 'DM Sans', sans-serif; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gph { margin-left: auto; font: 500 11px 'DM Sans', sans-serif; color: #6b7282; font-variant-numeric: tabular-nums; }
.gpn { font: 500 10.5px 'DM Sans', sans-serif; color: #6b7282; }
.gpn.bad { color: #c0533a; } .gpn.good { color: #3f9b5a; }
.ftiles { display: flex; gap: 8px; flex-wrap: wrap; }
.ft { flex: 1 1 28%; min-width: 0; display: grid; grid-template-columns: 30px minmax(0, 1fr); grid-template-rows: auto auto auto; column-gap: 6px; row-gap: 3px; align-items: center; padding: 7px 8px; border-radius: 14px; background: #ffffffc0; box-shadow: 0 4px 12px #1c22300d; text-align: center; font-family: 'DM Sans', sans-serif; }
.ft img, .ft .q { grid-row: 1 / 4; width: 30px; height: 28px; object-fit: contain; image-rendering: pixelated; }
.ft > :not(img):not(.q) { grid-column: 2; justify-self: start; text-align: left; }
.ft b { font: 600 12px 'DM Sans', sans-serif; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ft .sb { width: calc(100% - 6px); margin: 1px 3px; }
.ft small { display: inline-flex; gap: 4px; align-items: center; font: 600 10.5px 'DM Sans', sans-serif; font-variant-numeric: tabular-nums; }
.ft.act { box-shadow: 0 0 0 1.5px #1c223022, 0 4px 12px #1c22300d; }
.ft.fnt { background: #1c223008; box-shadow: none; }
.ft.fnt img { filter: grayscale(1); opacity: .4; }
.ft.fnt b { color: #8a91a2; text-decoration: line-through; }
.ft.fnt small { color: #b0473a; font-weight: 500; }
.ft.unk { background: transparent; border: 1px dashed #1c223022; box-shadow: none; }
.ft.unk .q { width: 26px; height: 26px; font-size: 12px; display: grid; place-items: center; border-radius: 50%; border: 1.5px dashed #9aa0ab; color: #8a91a2; font-weight: 600; }
.ft.unk b { color: #8a91a2; } .ft.unk small { color: #a0a6b3; font-weight: 500; }

/* panes, team sides and explorer on the glass screen */
#app[data-theme="glass"] .ptabs button { font-family: var(--font); color: var(--ink2); }
#app[data-theme="glass"] .ptabs button[aria-selected="true"] { background: #ffffffa6; border-color: #ffffffd8; color: var(--ink); }
#app[data-theme="glass"] .tmon, #app[data-theme="glass"] .exm { font-family: var(--font); }
#app[data-theme="glass"] .exm button { background: #fff; }
#app[data-theme="glass"] .result { background: #e9edf3b0; }
#app[data-theme="glass"] .result-card { background: #ffffffe8; border: 1px solid #fff; color: var(--ink); box-shadow: 0 30px 80px #1c223030; font-family: 'DM Sans', sans-serif; }
#app[data-theme="glass"] .result-card p { color: #6b7282; }
#app[data-theme="glass"] .result-card h2 { background-image: linear-gradient(120deg, #6390F0, #A98FF3 50%, #F95587); }
#app[data-theme="glass"] .result-card.lose h2 { background-image: linear-gradient(120deg, #8a91a2, #5d6478); }
#app[data-theme="glass"] .result .cta.ghost { color: #1c2230; background: #fff; border-color: #1c223018; }
#app[data-theme="glass"] .result .cta:not(.ghost) { background: #1c2230; box-shadow: 0 10px 30px #1c223040; font-family: "DM Sans", sans-serif; font-weight: 600; }
#app[data-theme="glass"] .result-card { color: #1c2230; }

#app[data-theme="glass"] .ptabs { padding-top: 2px; }
#app[data-theme="glass"] .ptabs button { min-height: 32px; }
#app[data-theme="glass"] .mon.me .sprite { max-width: 46cqw; height: auto; }
#app[data-theme="glass"] .mon.foe .sprite { max-width: 40cqw; height: auto; }
#app[data-theme="glass"] .scene { container-type: inline-size; }

/* switch view: the panel takes the caption's room */
#app[data-ui="glass"] .console.party .textbox { display: none; }
/* screenshot mode (?demo&still): settle every animation at its end state */
#app.still *, #app.still *::before, #app.still *::after { animation-duration: 0s !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; transition: none !important; }

/* move stats in the row, and the hold-for-details card */
.gmn small i { font-style: normal; margin: 0 5px; color: #b4bac6; }
.ghead .hint { font: 500 10.5px 'DM Sans', sans-serif; color: #a0a6b3; }
.gm { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; touch-action: manipulation; }
.gm.holding { background: #fff; box-shadow: 0 0 0 1.5px color-mix(in srgb, #1c2230 12%, transparent), 0 6px 18px #1c22301a; transform: scale(.985); }
.gpanel { position: relative; }
.ginfo { position: absolute; left: 6px; right: 6px; bottom: calc(100% + 10px); z-index: 30; padding: 14px 16px 12px; border-radius: 22px; color: #1c2230; font-family: 'DM Sans', sans-serif;
  background: linear-gradient(160deg, #fff, color-mix(in srgb, var(--c) 7%, #fff)); border: 1px solid #fff; backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  box-shadow: 0 24px 60px #1c223033, 0 2px 0 #fff inset; animation: cardIn .26s cubic-bezier(.2,.9,.3,1.15) both; transform-origin: 50% 100%; pointer-events: none; }
@keyframes cardIn { from { opacity: 0; transform: translateY(10px) scale(.95); } }
.ginfo::after { content: ''; position: absolute; left: 50%; bottom: -7px; width: 14px; height: 14px; transform: translateX(-50%) rotate(45deg); background: color-mix(in srgb, var(--c) 7%, #fff); border-right: 1px solid #fff; border-bottom: 1px solid #fff; }
.mc-top { display: flex; align-items: center; gap: 12px; }
.mc-top .disc { width: 42px; height: 42px; }
.mc-name { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.mc-name > b { font: 600 17px 'DM Sans', sans-serif; }
.mc-tags { display: flex; gap: 6px; align-items: center; }
.mc-cat { display: inline-flex; align-items: center; gap: 4px; font: 600 10.5px 'DM Sans', sans-serif; color: #5a6274; padding: 2px 8px; border-radius: 99px; background: #1c22300d; }
.mc-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-top: 12px; }
.mc-s { display: flex; flex-direction: column; gap: 1px; padding: 8px 9px; border-radius: 12px; background: #ffffffb0; box-shadow: inset 0 0 0 1px #1c22300a; }
.mc-s small { font: 500 10px 'DM Sans', sans-serif; color: #8a91a2; }
.mc-s b { font: 600 15px 'DM Sans', sans-serif; font-variant-numeric: tabular-nums; }
.mc-s b i { font-style: normal; color: #a0a6b3; font-weight: 500; font-size: 12px; }
.mc-s em { font: 500 9.5px 'DM Sans', sans-serif; color: #8a91a2; font-style: normal; }
.mc-desc { margin: 10px 2px 0; font: 500 13px/1.4 'DM Sans', sans-serif; color: #3a4152; }
.mc-vs { display: flex; align-items: baseline; gap: 8px; margin-top: 10px; padding-top: 9px; border-top: 1px solid #1c22300f; font: 500 11.5px 'DM Sans', sans-serif; color: #6b7282; }
.mc-vs b { font: 600 13px 'DM Sans', sans-serif; color: #1c2230; font-variant-numeric: tabular-nums; }
.mc-vs .eff { margin-left: auto; font-size: 11.5px; }
#app[data-ui="glass"] .console { position: relative; z-index: 12; }

/* =================================================================
   GLASS: home, team preview, settings, Teams and Moves tabs
   ================================================================= */
#app[data-theme="glass"] { --bg: #e9edf3; --fg: #1c2230; --muted: #6b7282; --panel: #ffffff8c; --panel-b: #ffffffd0; --font: 'DM Sans', system-ui, sans-serif;
  background: linear-gradient(160deg, #dfe7f5 0%, #f4efe9 55%, #e6eef0 100%); font-family: 'DM Sans', system-ui, sans-serif; color: #1c2230; }
#app[data-theme="glass"] .home, #app[data-theme="glass"] .preview { font-family: 'DM Sans', system-ui, sans-serif; color: #1c2230; }
#app[data-theme="glass"] .home-bg::before { background: radial-gradient(circle, #ffc6a3, transparent 60%); opacity: .55; filter: blur(50px); left: auto; right: -70%; top: -55%; }
#app[data-theme="glass"] .home-bg::after { background: radial-gradient(circle, #b3ccff, transparent 60%); opacity: .55; filter: blur(50px); right: auto; left: -75%; bottom: -45%; }
#app[data-theme="glass"] .brand { margin-top: 18px; }
#app[data-theme="glass"] .brand-ball { width: 34px; height: 34px; box-shadow: 0 0 0 2px #2a2f3a, 0 6px 14px #1c22302a;
  background: radial-gradient(circle, #fff 0 4.5px, #2a2f3a 5px 7px, transparent 7.5px), linear-gradient(#f0705f 0 44%, #2a2f3a 44% 56%, #fbfbfd 56%); }
#app[data-theme="glass"] .brand-ball::after { display: none; }
#app[data-theme="glass"] .brand h1 { font: 600 38px 'DM Sans', sans-serif; letter-spacing: -1.2px; background: none; color: #1c2230; margin-top: 12px; }
#app[data-theme="glass"] .brand p { font: 500 12px 'DM Sans', sans-serif; letter-spacing: .2px; text-transform: none; color: #6b7282; }
#app[data-theme="glass"] .hero-mons { position: relative; height: 128px; margin: 8px 0 2px; }
#app[data-theme="glass"] .hero-mons::before { content: ''; position: absolute; left: 12%; right: 12%; bottom: -4px; height: 30px; border-radius: 50%; background: radial-gradient(closest-side, #ffffffd8, #ffffff60 60%, transparent); }
#app[data-theme="glass"] .hero-mons img { position: relative; filter: drop-shadow(0 12px 10px #1c223026); animation: gfloat 3.4s ease-in-out infinite; }
#app[data-theme="glass"] .label { font: 600 11px 'DM Sans', sans-serif; letter-spacing: 1.2px; color: #8a91a2; margin-top: 12px; }
#app[data-theme="glass"] .themes { gap: 6px; }
#app[data-theme="glass"] .theme-card { border-radius: 16px; border: 1.5px solid #ffffffd0; box-shadow: 0 6px 18px #1c223012; min-height: 76px; justify-content: center; }
#app[data-theme="glass"] .theme-card.on { border-color: #1c2230; box-shadow: 0 10px 24px #1c223026; transform: translateY(-2px); }
#app[data-theme="glass"] .t-glass { background: #ffffffb8; backdrop-filter: blur(14px); }
#app[data-theme="glass"] .t-glass b { font-size: 20px; }
#app[data-theme="glass"] .seg { background: #ffffff80; border: 1px solid #ffffffd0; box-shadow: 0 4px 14px #1c22300a; border-radius: 14px; }
#app[data-theme="glass"] .seg button { color: #6b7282; font: 500 14px 'DM Sans', sans-serif; }
#app[data-theme="glass"] .seg button.on { background: #1c2230; color: #fff; box-shadow: 0 4px 12px #1c223030; }
#app[data-theme="glass"] .cta { font: 600 16px 'DM Sans', sans-serif; letter-spacing: 0; background: #1c2230; color: #fff; box-shadow: 0 12px 30px #1c223033; border-radius: 16px; }
#app[data-theme="glass"] .cta.ghost { background: #ffffffa6; color: #1c2230; border: 1px solid #ffffffd8; box-shadow: 0 4px 14px #1c22300a; font-weight: 500; }
#app[data-theme="glass"] .cta[disabled] { color: #8a91a2; opacity: 1; }
#app[data-theme="glass"] .cta small { background: #1c22300f; color: #6b7282; font-weight: 600; }
#app[data-theme="glass"] .link { color: #6b7282; font: 500 14px 'DM Sans', sans-serif; }
#app[data-theme="glass"] .credits { color: #8a91a2; opacity: 1; font-family: 'DM Sans', sans-serif; }

/* team preview */
#app[data-theme="glass"] .preview { background: transparent; gap: 10px; }
#app[data-theme="glass"] .team-row { gap: 10px; padding: 4px 0; }
#app[data-theme="glass"] .team-row .tm.unk { width: 58px; height: 58px; display: grid; place-items: center; border-radius: 18px; background: #ffffff70; border: 1.5px dashed #1c223026; animation: rise .45s both; animation-delay: calc(var(--i) * 70ms); }
#app[data-theme="glass"] .team-row .q { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; border: 1.5px dashed #9aa0ab; color: #8a91a2; font: 600 13px 'DM Sans', sans-serif; }
#app[data-theme="glass"] .tm-note { flex-basis: 100%; margin: 2px 0 0; text-align: center; font: 500 11.5px 'DM Sans', sans-serif; color: #8a91a2; }
#app[data-theme="glass"] .vs { display: flex; align-items: center; gap: 12px; font: 600 11px 'DM Sans', sans-serif; letter-spacing: 2px; color: #a0a6b3; background: none; -webkit-text-fill-color: currentColor; margin: 4px 0; }
#app[data-theme="glass"] .vs::before, #app[data-theme="glass"] .vs::after { content: ''; flex: 1; height: 1px; background: #1c223014; }
#app[data-theme="glass"] .tcard.g { grid-template-columns: 72px minmax(0, 1fr); gap: 10px; padding: 10px 14px 10px 6px; border-radius: 18px; background: #ffffffb8; border: 1px solid #ffffffd8; box-shadow: 0 8px 22px #1c223010; animation: rise .45s both; animation-delay: calc(var(--i) * 70ms); }
#app[data-theme="glass"] .tcard.g img { width: 72px; height: 72px; object-fit: contain; image-rendering: pixelated; filter: drop-shadow(0 6px 6px #1c22301f); }
.tc-b { min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.tc-h { display: flex; align-items: center; gap: 6px; min-width: 0; }
.tc-h b { font: 600 15px 'DM Sans', sans-serif; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tc-h small { font: 500 11px 'DM Sans', sans-serif; color: #8a91a2; }
.tc-h .g-types { margin-left: auto; }
.tc-m { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 10px; }
.mvp { display: flex; align-items: center; gap: 7px; font: 500 12.5px 'DM Sans', sans-serif; color: #3a4152; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mvp .disc { width: 20px; height: 20px; box-shadow: inset 0 1px 0 #ffffff90, inset 0 -2px 0 #00000022, 0 1px 2px #0003; }
.mvp .disc svg { width: 11px; height: 11px; }

/* settings sheet */
#app[data-theme="glass"] .sheet { background: #dfe5efa8; }
#app[data-theme="glass"] .sheet-card { background: #f8f9fbf5; color: #1c2230; font-family: 'DM Sans', sans-serif; border: 1px solid #fff; box-shadow: 0 -20px 60px #1c223022; backdrop-filter: blur(20px); }
#app[data-theme="glass"] .sheet-head h2 { font: 600 20px 'DM Sans', sans-serif; }
#app[data-theme="glass"] .sheet .pill { background: #1c22300d; color: #1c2230; }
#app[data-theme="glass"] .sheet .label { color: #8a91a2; }
#app[data-theme="glass"] .sheet .seg { --panel: #ffffff; --panel-b: #1c223010; --muted: #6b7282; background: #1c223008; border-color: #1c22300d; box-shadow: none; }
#app[data-theme="glass"] .sheet .seg button { font-size: 13px; }
#app[data-theme="glass"] .sheet .seg button.on { background: #fff; color: #1c2230; box-shadow: 0 2px 8px #1c22301f; }
#app[data-theme="glass"] .sheet .check { color: #3a4152; }
#app[data-theme="glass"] .sheet .check input { accent-color: #1c2230; }
#app[data-theme="glass"] .mini-preview img { background: #ffffff; box-shadow: inset 0 0 0 1px #1c22300d; }

/* Teams tab */
#app[data-theme="glass"] .side h3 { display: flex; align-items: center; justify-content: space-between; font: 600 12px 'DM Sans', sans-serif; letter-spacing: .4px; text-transform: none; color: #1c2230; margin: 6px 4px 8px; }
#app[data-theme="glass"] .tmon.g { grid-template-columns: 44px minmax(0, 1fr); gap: 8px; padding: 8px 10px 8px 6px; border-radius: 16px; border: 1px solid #ffffffd8; background: #ffffffb8; box-shadow: 0 6px 16px #1c22300d; font-family: 'DM Sans', sans-serif; color: #1c2230; }
#app[data-theme="glass"] .tmon.g.active { outline: none; box-shadow: 0 0 0 1.5px #1c223026, 0 6px 16px #1c22300d; }
#app[data-theme="glass"] .tmon.g.fainted { opacity: .5; filter: grayscale(1); }
#app[data-theme="glass"] .tmon.g .top { align-items: center; font: 600 13px 'DM Sans', sans-serif; margin-bottom: 6px; }
#app[data-theme="glass"] .tmon.g .sb { margin: 0 3px 6px; }
#app[data-theme="glass"] .tmon.g .sub { gap: 6px; font: 500 11px 'DM Sans', sans-serif; color: #8a91a2; }
#app[data-theme="glass"] .tmon.g .sub b { margin-left: auto; color: #1c2230; font-weight: 600; font-variant-numeric: tabular-nums; }
#app[data-theme="glass"] .tmon.g .tag { font: 600 9px 'DM Sans', sans-serif; letter-spacing: .6px; text-transform: uppercase; color: #5a6274; padding: 2px 6px; border-radius: 6px; background: #1c22300d; }
#app[data-theme="glass"] .tmon.g.unk { background: transparent; border: 1px dashed #1c223022; box-shadow: none; align-items: center; }
#app[data-theme="glass"] .tmon.g.unk .q { justify-self: center; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; border: 1.5px dashed #9aa0ab; color: #8a91a2; font-weight: 600; }
#app[data-theme="glass"] .tmon.g.unk .top { color: #8a91a2; margin-bottom: 2px; }

/* Moves tab */
#app[data-theme="glass"] .ex-head h3 { font: 600 12px 'DM Sans', sans-serif; letter-spacing: .4px; text-transform: none; color: #1c2230; }
#app[data-theme="glass"] .seg.mini button { font-size: 12px; }
#app[data-theme="glass"] .ex-mon { font: 500 13px 'DM Sans', sans-serif; color: #6b7282; }
#app[data-theme="glass"] .ex-mon b { color: #1c2230; font-weight: 600; } #app[data-theme="glass"] .ex-mon i { font-style: normal; color: #a0a6b3; margin: 0 2px; }
#app[data-theme="glass"] .exm.g { grid-template-columns: minmax(0, 1fr) auto; gap: 10px 10px; padding: 12px 14px; border-radius: 18px; border: 1px solid #ffffffd8; border-left-width: 1px; background: #ffffffb8; box-shadow: 0 6px 16px #1c22300d; font-family: 'DM Sans', sans-serif; color: #1c2230; }
#app[data-theme="glass"] .exm.g .nm { gap: 10px; }
.exn { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.exn b { font: 600 14.5px 'DM Sans', sans-serif; }
.exn > span { display: flex; align-items: center; gap: 6px; }
.exn em { font: 500 10.5px 'DM Sans', sans-serif; font-style: normal; color: #8a91a2; }
#app[data-theme="glass"] .exm.g button { align-self: center; font: 500 12px 'DM Sans', sans-serif; padding: 7px 12px; border-radius: 99px; border: 1px solid #1c223018; background: #fff; color: #1c2230; }
#app[data-theme="glass"] .exm.g .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; font: 500 10.5px 'DM Sans', sans-serif; color: #8a91a2; }
#app[data-theme="glass"] .exm.g .stats > span { padding: 7px 8px; border-radius: 10px; background: #1c223006; }
#app[data-theme="glass"] .exm.g .stats b { font: 600 13.5px 'DM Sans', sans-serif; color: #1c2230; margin-bottom: 1px; }
#app[data-theme="glass"] .exm.g .stats b i { font-style: normal; color: #a0a6b3; font-weight: 500; font-size: 11px; }
#app[data-theme="glass"] .exm.g .note { display: flex; gap: 10px; justify-content: space-between; align-items: baseline; font: 500 12px/1.4 'DM Sans', sans-serif; color: #3a4152; }
#app[data-theme="glass"] .exm.g .note .eff { flex: none; font-size: 11px; }
#app[data-theme="glass"] .exm.g.unk { display: flex; align-items: center; gap: 10px; background: transparent; border: 1px dashed #1c223022; box-shadow: none; color: #8a91a2; font-size: 12.5px; }
#app[data-theme="glass"] .exm.g.unk .q { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; border: 1.5px dashed #9aa0ab; font-weight: 600; }

/* back sprites are cropped at their base like in the games: stand them on the frame's bottom edge,
   level with the bottom of the player's HP card */
#app[data-theme="glass"] .mon.me { bottom: 2%; left: 0; }
#app[data-theme="glass"] .scene { overflow: hidden; }
#app[data-theme="glass"] .platform.me { bottom: -5%; }

/* Command / Teams / Moves as a bottom tab bar on phones */
@media (max-width: 1099px) {
  #app[data-theme="glass"] .battle { grid-template-rows: auto auto minmax(0, 1fr) auto; grid-template-areas: "top top" "screen screen" "ctl ctl" "tabs tabs"; }
  #app[data-theme="glass"] .battle[data-pane="teams"] { grid-template-areas: "top top" "screen screen" "me foe" "tabs tabs"; }
  #app[data-theme="glass"] .battle[data-pane="moves"] { grid-template-areas: "top top" "screen screen" "ex ex" "tabs tabs"; }
  #app[data-theme="glass"] .ptabs { padding: 6px 14px max(10px, env(safe-area-inset-bottom)); gap: 6px; background: linear-gradient(#ffffff00, #ffffff80 40%); border-top: 1px solid #ffffff90; }
  #app[data-theme="glass"] .ptabs button { min-height: 38px; border-radius: 12px; font: 500 13px 'DM Sans', sans-serif; }
  #app[data-theme="glass"] .ptabs button[aria-selected="true"] { background: #1c2230; color: #fff; border-color: #1c2230; box-shadow: 0 4px 12px #1c223030; }
  #app[data-theme="glass"] .console { padding-bottom: 8px; }
}

/* Pokémon types as small domed enamel dots */
.tdot { display: inline-block; flex: none; width: 10px; height: 10px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--c) 45%, #fff) 0 18%, transparent 45%), linear-gradient(color-mix(in srgb, var(--c) 72%, #fff), var(--c));
  border: 1px solid color-mix(in srgb, var(--c) 70%, #000); box-shadow: inset 0 -1.5px 0 #00000026, 0 1px 2px #0002; }
.g-types { gap: 4px; align-items: center; }

/* effectiveness in monochrome */
.eff.se, .eff.ko { color: #1c2230; font-weight: 600; }
.eff.nve { color: #8a91a2; }
.eff.none { color: #a0a6b3; }
.textbox .se { color: #1c2230; font-weight: 700; }
.textbox .nve { color: #6b7282; font-weight: 600; }
#app[data-theme="glass"] .floater[data-k="se"] { color: #1c2230; }
#app[data-theme="glass"] .floater[data-k="nve"] { color: #6b7282; }
.gpn.bad { color: #1c2230; font-weight: 600; } .gpn.good { color: #6b7282; }
/* dots sit right after the name */
.g-top .g-types, .tc-h .g-types { margin-left: 2px; }
.tc-h small { margin-left: auto; }
#app[data-theme="glass"] .tmon.g .top { justify-content: flex-start; gap: 6px; }

/* =================================================================
   Friend battles + team builder (base styles work on every theme; glass refines)
   ================================================================= */
.links { display: flex; justify-content: center; gap: 4px; }
.field { width: 100%; box-sizing: border-box; padding: 12px 14px; border-radius: 12px; border: 1px solid #8884; background: #fff1; color: inherit; font: 500 15px 'DM Sans', system-ui, sans-serif; outline: none; }
.field:focus { border-color: currentColor; }
.field.code { text-align: center; font: 600 28px 'DM Sans', sans-serif; letter-spacing: 10px; text-transform: uppercase; padding: 14px; }
#friend .hint, #friend .status { margin: 4px 2px; font: 500 12.5px/1.4 'DM Sans', sans-serif; opacity: .75; }
#friend .status { text-align: center; min-height: 1.4em; }
.fpane { display: flex; flex-direction: column; gap: 8px; }
.room { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 16px 12px 8px; border-radius: 18px; background: #8881; margin-top: 4px; animation: rise .4s both; }
.room .lbl { font: 600 11px 'DM Sans', sans-serif; letter-spacing: 1.2px; text-transform: uppercase; opacity: .6; }
.room b { font: 700 40px 'DM Sans', sans-serif; letter-spacing: 10px; padding-left: 10px; font-variant-numeric: tabular-nums; }
.row.even { grid-template-columns: 1fr 1fr; width: 100%; }
.row.even .cta { font-size: 14px; padding: 12px; }

.builder { gap: 10px; font-family: 'DM Sans', system-ui, sans-serif; }
.b-head { display: flex; align-items: center; gap: 8px; }
.b-head h2 { margin: 0; flex: 1; text-align: center; font: 600 20px 'DM Sans', sans-serif; }
.b-head .link { padding: 8px 4px; }
.b-head span { min-width: 54px; text-align: right; font: 600 13px 'DM Sans', sans-serif; opacity: .6; font-variant-numeric: tabular-nums; }
.b-sub { margin: -4px 2px 2px; font: 500 12.5px 'DM Sans', sans-serif; opacity: .65; text-align: center; }
.b-list { display: flex; flex-direction: column; gap: 8px; }
.bslot { padding: 10px 12px 12px; border-radius: 18px; background: #fff1; border: 1px solid #8883; animation: rise .35s both; animation-delay: calc(var(--i) * 40ms); }
.bs-h { display: flex; align-items: center; gap: 10px; }
.bi { width: 44px; height: 38px; object-fit: contain; image-rendering: pixelated; flex: none; }
.bs-n { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0; }
.bs-n b { font: 600 15px 'DM Sans', sans-serif; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bs-n small { font: 500 11px 'DM Sans', sans-serif; opacity: .55; }
.bs-n .lead { font: 700 9px 'DM Sans', sans-serif; letter-spacing: .8px; text-transform: uppercase; padding: 2px 6px; border-radius: 6px; background: #8882; }
.bs-a { display: flex; gap: 6px; }
.bs-a .pill { height: 28px; min-width: 28px; padding: 0 8px; }
.bs-m { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.bs-c { flex-basis: 100%; font: 500 11px 'DM Sans', sans-serif; opacity: .55; }
.bm { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 4px; border-radius: 99px; border: 1px solid #8883; font: 500 12.5px 'DM Sans', sans-serif; opacity: .6; transition: opacity .15s, background .15s, transform .12s; }
.bm .disc { width: 20px; height: 20px; } .bm .disc svg { width: 11px; height: 11px; }
.bm.on { opacity: 1; border-color: currentColor; font-weight: 600; }
.bm:active { transform: scale(.96); }
.bm.nope { animation: jolt .35s linear; }
.bempty { padding: 24px 12px; text-align: center; font: 500 13px 'DM Sans', sans-serif; opacity: .6; border-radius: 16px; border: 1px dashed #8885; }
.b-err { margin: 0; min-height: 1.3em; text-align: center; font: 600 12.5px 'DM Sans', sans-serif; color: #c0533a; }
.builder .cta[disabled] { opacity: .45; }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; max-height: 58vh; overflow-y: auto; padding: 2px; }
.pk { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; border-radius: 14px; background: #8881; font: 500 12px 'DM Sans', sans-serif; transition: background .15s, transform .12s; }
.pk:active { transform: scale(.96); }
.pk b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

/* glass refinements */
#app[data-theme="glass"] .builder { color: #1c2230; }
#app[data-theme="glass"] .bslot { background: #ffffffb8; border-color: #ffffffd8; box-shadow: 0 6px 16px #1c22300d; }
#app[data-theme="glass"] .bs-a .pill { background: #1c22300d; color: #1c2230; }
#app[data-theme="glass"] .bm { border-color: #1c22301a; background: #fff; color: #1c2230; opacity: .62; }
#app[data-theme="glass"] .bm.on { opacity: 1; background: #1c2230; color: #fff; border-color: #1c2230; }
#app[data-theme="glass"] .bs-n .lead { background: #1c22300d; color: #5a6274; }
#app[data-theme="glass"] .pk { background: #fff; box-shadow: 0 2px 8px #1c22300a; color: #1c2230; }
#app[data-theme="glass"] .field { background: #fff; border-color: #1c22301a; color: #1c2230; }
#app[data-theme="glass"] .field:focus { border-color: #1c2230; }
#app[data-theme="glass"] .room { background: #fff; box-shadow: inset 0 0 0 1px #1c22300d; }
#app[data-theme="glass"] .bempty { border-color: #1c223022; color: #6b7282; }
#app[data-theme="glass"] .sheet .cta.ghost { background: #fff; border-color: #1c223014; }

/* =================================================================
   HOME (redesign): brand bar, hero, two play tiles, setup card, look picker.
   The launcher is always light glass, whichever battle look is chosen.
   ================================================================= */
#app .home { gap: 14px; padding: max(14px, env(safe-area-inset-top)) 18px max(18px, env(safe-area-inset-bottom)); color: #1c2230; font-family: 'DM Sans', system-ui, sans-serif;
  background: radial-gradient(420px 360px at 110% 0%, #ffc6a366, transparent 70%), radial-gradient(420px 380px at -20% 40%, #b3ccff66, transparent 70%), linear-gradient(160deg, #dfe7f5 0%, #f4efe9 55%, #e6eef0 100%); }
#app .home .home-bg { display: none; }
.h-top { display: flex; align-items: center; justify-content: space-between; }
.h-brand { display: inline-flex; align-items: center; gap: 9px; font: 600 17px 'DM Sans', sans-serif; letter-spacing: -.2px; }
.h-ball { width: 20px; height: 20px; border-radius: 50%; display: inline-block; box-shadow: 0 0 0 1.5px #2a2f3a, 0 3px 8px #1c22302a;
  background: radial-gradient(circle, #fff 0 2.6px, #2a2f3a 3px 4.2px, transparent 4.6px), linear-gradient(#f0705f 0 44%, #2a2f3a 44% 56%, #fbfbfd 56%); }
#app .home .pill { background: #ffffffa6; color: #1c2230; border: 1px solid #ffffffd8; box-shadow: 0 4px 14px #1c22300d; }

.h-hero { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); padding: 22px 20px 0; border-radius: 26px; overflow: hidden; min-height: 248px;
  background: linear-gradient(160deg, #ffffffb0, #ffffff60); border: 1px solid #ffffffd8; box-shadow: 0 20px 50px #1c223014; backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); }
.h-hero::before { content: ''; position: absolute; width: 260px; height: 260px; right: -60px; top: -80px; border-radius: 50%; background: radial-gradient(circle, #ffb48a55, transparent 65%); }
.h-copy { position: relative; z-index: 1; }
.h-copy h1 { margin: 0; font: 600 30px/1.08 'DM Sans', sans-serif; letter-spacing: -1px; }
.h-copy p { margin: 8px 0 0; max-width: 30ch; font: 500 13.5px/1.45 'DM Sans', sans-serif; color: #5a6274; }
#app .home .hero-mons { position: relative; height: 128px; margin: 6px -8px 0; display: flex; justify-content: center; align-items: flex-end; gap: 0; }
#app .home .hero-mons::before { content: ''; position: absolute; left: 6%; right: 6%; bottom: 2px; height: 34px; border-radius: 50%; background: radial-gradient(closest-side, #ffffffe0, #ffffff70 60%, transparent); }
#app .home .hero-mons img { position: relative; height: 104px; max-width: 34%; object-fit: contain; image-rendering: pixelated; filter: drop-shadow(0 12px 10px #1c22302a); animation: gfloat 3.6s ease-in-out infinite; margin-bottom: 6px; }
#app .home .hero-mons img:nth-child(2) { height: 124px; animation-delay: -1.2s; z-index: 1; }
#app .home .hero-mons img:nth-child(3) { animation-delay: -2.4s; }

.h-play { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.h-tile { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-height: 96px; padding: 16px 16px 14px; border-radius: 22px; text-align: left; color: #1c2230;
  background: #ffffffb8; border: 1px solid #ffffffd8; box-shadow: 0 10px 28px #1c223012; transition: transform .15s, box-shadow .2s; }
.h-tile b { font: 600 16.5px 'DM Sans', sans-serif; letter-spacing: -.2px; }
.h-tile span { font: 500 12px 'DM Sans', sans-serif; color: #6b7282; }
.h-tile i { position: absolute; right: 14px; bottom: 12px; font-style: normal; font-size: 18px; opacity: .55; transition: transform .2s; }
.h-tile:active { transform: scale(.98); }
.h-tile:hover i { transform: translateX(3px); }
.h-tile.dark { background: #1c2230; color: #fff; border-color: #1c2230; box-shadow: 0 14px 34px #1c223040; }
.h-tile.dark span { color: #ffffffa8; }

.h-card { display: flex; flex-direction: column; padding: 4px 14px; border-radius: 22px; background: #ffffffa6; border: 1px solid #ffffffd8; box-shadow: 0 8px 24px #1c22300d; }
.h-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; border-bottom: 1px solid #1c22300d; text-align: left; width: 100%; color: #1c2230; }
.h-row:last-child { border-bottom: 0; }
.h-l { font: 500 14px 'DM Sans', sans-serif; flex: none; }
.h-v { flex: 1; min-width: 0; text-align: right; font: 500 13px 'DM Sans', sans-serif; color: #6b7282; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.h-link i { font-style: normal; font-size: 20px; color: #a0a6b3; margin-left: -4px; }
#app .home .seg.sm { display: flex; padding: 3px; gap: 2px; border-radius: 11px; background: #1c22300a; border: 0; box-shadow: none; }
#app .home .seg.sm button { padding: 7px 11px; border-radius: 9px; font: 500 13px 'DM Sans', sans-serif; color: #6b7282; }
#app .home .seg.sm button.on { background: #fff; color: #1c2230; box-shadow: 0 1px 4px #1c22301f; }

#app .home .label { margin: 4px 4px -4px; font: 600 11px 'DM Sans', sans-serif; letter-spacing: 1.2px; color: #8a91a2; }
#app .home .themes { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
#app .home .theme-card { min-height: 0; padding: 8px 4px 9px; gap: 3px; border-radius: 16px; border: 1.5px solid transparent; transform: none;
  background: #ffffffa6; box-shadow: 0 4px 14px #1c22300a; color: #1c2230; font-family: 'DM Sans', sans-serif; }
#app .home .theme-card .sw { display: block; width: 100%; height: 26px; border-radius: 10px; margin-bottom: 3px; box-shadow: inset 0 0 0 1px #1c22300f; }
#app .home .theme-card b { font: 600 11.5px 'DM Sans', sans-serif; line-height: 1.1; }
#app .home .theme-card i { font: 500 9.5px 'DM Sans', sans-serif; font-style: normal; color: #8a91a2; opacity: 1; }
#app .home .theme-card.on { border-color: #1c2230; background: #fff; box-shadow: 0 8px 20px #1c22301f; }
#app .home .t-glass .sw { background: linear-gradient(135deg, #dfe7f5, #f4efe9 55%, #ffd9c2); }
#app .home .t-gen1 .sw { background: linear-gradient(#f4f2ec 0 60%, #9bbc0f 60%); }
#app .home .t-gen2 .sw { background: linear-gradient(#f8f8f8 0 55%, #c8f0ff 55%); }
#app .home .t-gen3 .sw { background: linear-gradient(#a8e0a0, #58a858); }
#app .home .t-modern .sw { background: linear-gradient(135deg, #7c5cff, #22d3ee); }
#app .home .credits { margin-top: auto; color: #8a91a2; opacity: 1; font: 500 10.5px/1.4 'DM Sans', sans-serif; }
.h-row.h-link { padding: 0; }

/* =================================================================
   FIT TO VIEWPORT (phones): the battle frame takes whatever height the controls leave,
   so the whole screen fits with no scrolling, including Safari with its toolbars showing.
   ================================================================= */
@media (max-width: 1099px) {
  #app[data-theme="glass"] .battle { height: 100%; overflow: hidden; grid-template-rows: auto minmax(0, 1fr) auto auto; }
  #app[data-theme="glass"] .battle[data-pane="teams"], #app[data-theme="glass"] .battle[data-pane="moves"] { grid-template-rows: auto minmax(150px, 34%) minmax(0, 1fr) auto; }
  #app[data-theme="glass"] .battle > .scene { aspect-ratio: auto !important; height: 100%; min-height: 0; max-height: 560px; align-self: stretch; container-type: size; }
  #app[data-theme="glass"] .battle > .console { flex: none; min-height: 0; }
  #app[data-theme="glass"] .controls { flex: none; }
  #app[data-theme="glass"] .glass-ui { flex: none; }
  #app[data-theme="glass"] .side, #app[data-theme="glass"] .explorer { overflow-y: auto; min-height: 0; }
  /* sprite height is capped in sizeSprite() (app.js), which knows each image's proportions */
}

/* short frame: slimmer HP cards (pips share the bottom row) */
@container (max-height: 360px) {
  #app[data-theme="glass"] .hud { padding: 7px 10px; border-radius: 14px; }
  #app[data-theme="glass"] .hud.me { padding-left: 16px; }
  #app[data-theme="glass"] .hud .g { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "top top" "bar bar" "row pips"; gap: 5px 8px; }
  #app[data-theme="glass"] .hud .g-top { grid-area: top; } #app[data-theme="glass"] .hud .g-bar { grid-area: bar; height: 7px; }
  #app[data-theme="glass"] .hud .g-row { grid-area: row; min-height: 0; } #app[data-theme="glass"] .hud .g-pips { grid-area: pips; padding: 0; border: 0; }
  #app[data-theme="glass"] .hud .g-pips .bpt { display: none; }
  #app[data-theme="glass"] .hud .bp i { width: 9px; height: 9px; }
  #app[data-theme="glass"] .hud .g-nm { font-size: 12.5px; }
  #app[data-theme="glass"] .hud.foe { top: 2%; } #app[data-theme="glass"] .hud.me { bottom: 3%; }
}

/* short viewport: moves as a 2×2 grid, tighter caption and tab bar */
@media (max-width: 1099px) and (max-height: 780px) {
  #app[data-theme="glass"] .topbar { padding-top: max(6px, env(safe-area-inset-top)); padding-bottom: 4px; }
  #app[data-theme="glass"] .pill { height: 28px; }
  #app[data-theme="glass"] .console { padding-top: 4px; gap: 6px; }
  #app[data-theme="glass"] .textbox { padding: 8px 14px; font-size: 14px; border-radius: 16px; }
  #app[data-ui="glass"] .gpanel:not(.party) { padding: 8px; border-radius: 22px; }
  #app[data-ui="glass"] .gpanel:not(.party) .ghead { display: none; }
  #app[data-ui="glass"] .gpanel:not(.party) .glist { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; }
  #app[data-ui="glass"] .gpanel:not(.party) .gm { grid-template-columns: 30px minmax(0, 1fr); grid-template-areas: "d n" "d r"; gap: 2px 9px; padding: 8px 9px; align-items: center; }
  #app[data-ui="glass"] .gm .disc { grid-area: d; width: 30px; height: 30px; }
  #app[data-ui="glass"] .gm .disc svg { width: 15px; height: 15px; }
  #app[data-ui="glass"] .gm .gmn { grid-area: n; gap: 1px; }
  #app[data-ui="glass"] .gm .gmn b { font-size: 13.5px; }
  #app[data-ui="glass"] .gm .gmn small { font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #app[data-ui="glass"] .gm .gmn small i { margin: 0 3px; }
  #app[data-ui="glass"] .gm .gmr { grid-area: r; align-items: flex-start; min-height: 13px; }
  #app[data-ui="glass"] .gm .gmr .eff, #app[data-ui="glass"] .gm .gmr .note { font-size: 10px; }
  #app[data-ui="glass"] .gfoot { margin-top: 6px; gap: 6px; }
  #app[data-ui="glass"] .gbtn { min-height: 38px; border-radius: 12px; }
  #app[data-ui="glass"] .gpanel.party { padding: 10px; }
  #app[data-ui="glass"] .gp { padding: 5px 9px; }
  #app[data-ui="glass"] .gp .gpi { width: 36px; height: 30px; }
  #app[data-theme="glass"] .ptabs { padding: 4px 14px max(6px, env(safe-area-inset-bottom)); }
  #app[data-theme="glass"] .ptabs button { min-height: 32px; font-size: 12.5px; }
}
.gmn .short { display: none; }
.gmn small em { font-style: normal; opacity: .7; margin-left: 1px; }
@media (max-width: 1099px) and (max-height: 780px) {
  #app[data-ui="glass"] .gpanel:not(.party) .gmn .full { display: none; }
  #app[data-ui="glass"] .gpanel:not(.party) .gmn .short { display: block; }
}
#app[data-ui="glass"]:not([data-theme="glass"]) .ptabs button[aria-selected="true"] { background: #1c2230; color: #fff; border-color: #1c2230; }
