/* Palette and sizes from Ui.kt; px here are Android dp. */
:root {
  --bg: #F3F4F6;
  --surface: #FFFFFF;
  --fill: #E6E8EC;
  --raised: #FFFFFF;
  --text: #15171A;
  --muted: #5B616B;
  --up: #C62828;
  --down: #1F4FB5;
  --accent: #D8300C;
  /* Accent as text: 5.0:1 on --fill, 5.6:1 on --surface. --accent itself (3.9:1 on --fill) stays for filled chips. */
  --accent-text: #BA2909;
  --ring: #D8300C;
  --good: #1E7B3A;
  --bad: #C62828;
  --tone: 16%;
  --press: rgba(0, 0, 0, .12);
  --hover: rgba(0, 0, 0, .05);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111215; --surface: #1C1E23; --fill: #2A2D34; --raised: #3B3F48; --text: #F1F2F4; --muted: #9BA1AB;
    --up: #FF8A80; --down: #82B1FF; --accent-text: #FF8A65; --ring: #FF8A65; --good: #7BD88F; --bad: #FF8A80; --tone: 22%;
    --press: rgba(255, 255, 255, .2); --hover: rgba(255, 255, 255, .07); color-scheme: dark;
  }
  :root:not([data-theme="light"]) .ink { color: var(--ink-n); }
}
:root[data-theme="dark"] {
  --bg: #111215; --surface: #1C1E23; --fill: #2A2D34; --raised: #3B3F48; --text: #F1F2F4; --muted: #9BA1AB;
  --up: #FF8A80; --down: #82B1FF; --accent-text: #FF8A65; --ring: #FF8A65; --good: #7BD88F; --bad: #FF8A80; --tone: 22%;
  --press: rgba(255, 255, 255, .2); --hover: rgba(255, 255, 255, .07); color-scheme: dark;
}
:root[data-theme="dark"] .ink { color: var(--ink-n); }
.ink { color: var(--ink-d); }

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.35 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; overflow: hidden;
}
button { font: inherit; color: inherit; border: 0; background: none; padding: 0; cursor: pointer; text-align: inherit; }
button:focus-visible, [tabindex]:focus-visible, input:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
/* The search box and sheet fields hide the input's own ring and show it on their rounded frame instead. */
.search:has(input:focus-visible), .sheet .field:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
p, h1, h2, h3 { margin: 0; }
img { -webkit-touch-callout: none; -webkit-user-drag: none; user-select: none; }
.tap, .row, .card, .tile, .chip, .slot { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.tap:active, .row:active, .card:active, .tile:active, .chip:active, .opt:active, .set:active { filter: brightness(.94); }

/* Pages stack; only the top one paints. */
.page {
  position: fixed; inset: 0; overflow-y: auto; overscroll-behavior: contain; background: var(--bg);
  padding-bottom: calc(16px + env(safe-area-inset-bottom));
}
.page.under { visibility: hidden; }
.page.in { animation: in .2s ease-out; }
@keyframes in { from { transform: translateX(32px); } }
@media (prefers-reduced-motion: reduce) { .page.in { animation: none; } .tip summary svg { transition: none; } }
.col { max-width: 600px; margin: 0 auto; }
.fixed { padding-bottom: env(safe-area-inset-bottom); }
.fixed > .col { min-height: 100%; display: flex; flex-direction: column; }

.head { display: flex; align-items: center; gap: 4px; padding: calc(8px + env(safe-area-inset-top)) 16px 8px 4px; }
.head .title { flex: 1; padding: 0; min-width: 0; overflow-wrap: anywhere; }
.head.home { padding-left: 16px; }
.title { font-size: 30px; font-weight: 700; line-height: 1.2; padding: 12px 16px 8px; }
.back { flex: none; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 999px; color: var(--text); }
.back svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.sub { color: var(--muted); font-size: 14px; padding: 0 16px 12px; }
.wide { margin-left: 16px; margin-right: 16px; }
.mb4 { margin-bottom: 4px; } .mb8 { margin-bottom: 8px; } .mb10 { margin-bottom: 10px; } .mb12 { margin-bottom: 12px; }
.mt8 { margin-top: 8px; } .mt10 { margin-top: 10px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; }
.muted { color: var(--muted); font-size: 14px; }
.note { color: var(--muted); font-size: 13px; }
.body { font-size: 15px; white-space: pre-line; }
.bold { font-weight: 700; }
.caption { color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.pad { padding: 0 16px; }
.empty { color: var(--muted); font-size: 15px; text-align: center; padding: 48px 32px; }
.empty:empty { display: none; }
.tnum { font-variant-numeric: tabular-nums; }

.panel { background: var(--surface); border-radius: 18px; padding: 14px 16px 16px; }
.panel > h2 { font-size: 17px; font-weight: 700; padding-bottom: 10px; }
.panel.flush { padding: 14px 0 8px; }
.panel.flush > h2 { padding: 0 16px 4px; }

/* 44px to tap: transparent borders above and below, the background drawn inside them. */
.chip {
  flex: none; font-size: 14px; font-weight: 700; padding: 8px 14px; border-radius: 999px; white-space: nowrap;
  border-block: 5px solid transparent; background: var(--fill) padding-box; color: var(--text);
}
.chip.on { background: var(--accent) padding-box; color: #fff; }
.chip.danger { color: var(--accent-text); }
/* One line, never scrolling sideways: fit() in app.js sets --pad and --fs when the labels do not fit. */
.chips { display: flex; gap: 8px; padding: 0 16px 3px; --pad: 14px; --fs: 14px; }
.chips > .chip { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; padding-inline: var(--pad); font-size: var(--fs); }
.chips.measure > .chip { flex: none; }
.wrap { display: flex; flex-wrap: wrap; gap: 0 8px; }

/* Each segment reaches the control's edge to be tapped and draws its highlight 4px inside (radius 15 - 4 = 11). */
.seg { display: flex; background: var(--fill); border-radius: 14px; }
.seg button {
  flex: 1; font-size: 14px; font-weight: 700; padding: 9px 4px; color: var(--muted); text-align: center; min-width: 0;
  border: 4px solid transparent; border-radius: 15px; background-clip: padding-box;
}
.seg button.on { background: var(--raised) padding-box; color: var(--text); }

.search { display: flex; align-items: center; gap: 8px; background: var(--surface); border-radius: 14px; padding: 0 6px 0 14px; }
.search.filled { background: var(--fill); }
.search svg { flex: none; width: 22px; height: 22px; fill: none; stroke: var(--muted); stroke-width: 2.2; stroke-linecap: round; }
.search input {
  flex: 1; min-width: 0; font: inherit; font-size: 16px; color: var(--text); background: none; border: 0; outline: 0;
  padding: 12px 0; -webkit-appearance: none; appearance: none;
}
.search input::placeholder { color: var(--muted); }
.search input::-webkit-search-cancel-button { display: none; }
.search .x { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 999px; }
.search .x[hidden] { display: none; }

.pill {
  display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 999px; text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.glass { background: rgba(0, 0, 0, .18); color: #fff; padding: 3px 10px; }
.glass.big { font-size: 13px; padding: 5px 14px; }
.pills { display: flex; flex-direction: column; gap: 6px; }
.pills > div { display: flex; gap: 6px; }
.pills .pill { flex: 1 1 0; min-width: 0; padding: 5px 0; }
.pills .pill.blank { visibility: hidden; }

/* List row and Pokédex card, as Ui.row and Ui.card. */
.row { display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 6px 16px; width: 100%; cursor: pointer; }
.row .art { flex: none; width: 56px; height: 56px; border-radius: 50%; padding: 4px; background: color-mix(in srgb, var(--c) 22%, transparent); }
.row .art img { width: 100%; height: 100%; object-fit: contain; display: block; }
.row .art.item { padding: 10px; }
.row .art.item img { image-rendering: pixelated; }
.row .box {
  flex: none; width: 58px; height: 36px; display: grid; place-items: center; background: var(--fill); border-radius: 10px;
  font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 4px;
}
/* A list where some rows carry a badge box keeps every title on one edge: the rows without one get an empty box. */
.rows:has(> .row > .box) > .row:not(:has(> .art, > .box))::before { content: ''; flex: none; width: 58px; }
.row .texts { flex: 1; min-width: 0; }
.row .t { font-size: 16px; font-weight: 700; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.row .s { color: var(--muted); font-size: 13px; }
.row .pl { flex: none; display: flex; flex-direction: column; gap: 4px; }
.row .pl .pill { width: 72px; }
.hdr { padding: 18px 16px 6px; }
.row.on { background: var(--fill); border-radius: 14px; }

.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 4px 16px 16px; }
.card { position: relative; height: 118px; border-radius: 18px; color: #fff; padding: 10px 0 10px 12px; overflow: hidden; cursor: pointer; }
/* The number floats ahead of the name, so a long name stops 8px short of it at any number width.
   Both are positioned to paint over the picture, which is absolute and later in the card. */
.card .name { font-size: 16px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin: 0 0 4px; position: relative; z-index: 1; }
.card .num { float: right; margin: 1px 12px 0 8px; font-size: 13px; font-weight: 700; position: relative; z-index: 1; }
.card img { position: absolute; right: 6px; bottom: 6px; width: 84px; height: 84px; object-fit: contain; }
.card .glass { margin: 2px 0; }
.card .types { display: flex; flex-direction: column; align-items: flex-start; }
.card .s { font-size: 11px; font-weight: 700; margin-top: 4px; position: relative; }
.ball {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' fill='none' stroke='%23fff' stroke-opacity='.15' stroke-width='8'%3E%3Ccircle cx='50' cy='50' r='46'/%3E%3Cpath d='M0 50h33M67 50h33'/%3E%3Ccircle cx='50' cy='50' r='13'/%3E%3C/svg%3E"), var(--g);
  background-repeat: no-repeat; background-size: 104px 104px, auto; background-position: right -23px bottom -23px, 0 0;
}

.hero {
  color: #fff; border-radius: 0 0 28px 28px; padding: calc(4px + env(safe-area-inset-top)) 20px 24px;
  background-size: 240px 240px, auto; background-position: right -54px bottom -54px, 0 0;
}
.hero .back { color: #fff; margin-left: -12px; }
.hero h1 { font-size: 30px; font-weight: 700; line-height: 1.2; }
.hero .line { display: flex; align-items: center; height: 40px; margin-top: 2px; }
.hero .line h1 { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hero .nav { width: 40px; height: 40px; display: grid; place-items: center; color: #fff; }
.hero .nav[hidden] { visibility: hidden; display: grid; }
.hero .nav svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.hero .no { font-size: 17px; font-weight: 700; }
.hero .glass { margin-right: 6px; }
.hero .main { display: block; width: 200px; height: 200px; margin: 4px auto 0; object-fit: contain; }
.hero .typerow { display: flex; align-items: center; }
.hero .shiny { margin-left: auto; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 999px; background: rgba(0, 0, 0, .18); color: #fff; }
.hero .shiny[aria-pressed="true"] { background: #fff; color: var(--ink); }
img.pixel { image-rendering: pixelated; }
.seg .pv { display: block; width: 64px; height: 64px; margin: 0 auto 4px; object-fit: contain; }
.hero .where { font-size: 13px; font-weight: 700; text-align: center; margin-top: 6px; }
.hero .add { display: block; width: 100%; text-align: center; font-size: 14px; font-weight: 700; padding: 10px 0; margin-top: 14px; border-radius: 999px; background: rgba(0, 0, 0, .18); }
.hero .cols { display: flex; gap: 20px; margin-top: 4px; }
.hero .cols b { display: block; font-size: 22px; }
.hero .cols span { font-size: 12px; }

.set { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 8px; width: 100%; border-radius: 10px; background: var(--surface); }
/* Inside a panel or sheet the label lines up with the heading; the hover and press fill reach 8 px past it. */
.set:not(.wide) { margin-inline: -8px; width: calc(100% + 16px); }
.set > span:first-child { flex: 1; font-size: 15px; }
.set .v { flex: 2; font-size: 15px; font-weight: 700; color: var(--accent-text); text-align: end; }
input.num {
  width: 60px; font: inherit; font-size: 16px; text-align: center; color: var(--text); background: var(--fill); border: 0;
  border-radius: 10px; padding: 6px; -moz-appearance: textfield; appearance: textfield;
}

.bar { flex: 1; height: 8px; border-radius: 999px; background: var(--fill); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 999px; }
.stat { display: flex; align-items: center; padding: 3px 0; }
.stat .k { width: 48px; color: var(--muted); font-size: 14px; }
.stat .n { width: 44px; font-size: 14px; font-weight: 700; }
.fact { display: flex; padding: 4px 0; font-size: 14px; }
.fact .k { width: 130px; flex: none; color: var(--muted); }
.fact.wide-v .k { flex: 1; width: auto; }
.fact.wide-v .v { font-size: 15px; font-weight: 700; }
.facts { display: flex; gap: 12px; padding-top: 14px; }
.facts > div { flex: 1; }
.facts b { display: block; font-size: 16px; }
.facts span { color: var(--muted); font-size: 12px; }

dialog.sheet {
  width: min(100% - 32px, 440px); max-height: calc(100% - 32px); padding: 0; border: 0; border-radius: 28px;
  background: var(--surface); color: var(--text); display: flex; flex-direction: column; overflow: hidden;
}
dialog.sheet:not([open]) { display: none; }
dialog.sheet::backdrop { background: rgba(0, 0, 0, .45); }
.sheet > h2 { font-size: 20px; font-weight: 700; padding: 20px 20px 12px; }
/* The heading takes focus only to keep the keyboard closed; it is not a control, so no ring. */
.sheet > h2:focus-visible { outline: 0; }
.sheet > .in { padding: 0 16px; overflow-y: auto; min-height: 0; flex: 0 1 auto; }
.sheet > .btns { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding: 12px 20px 20px 16px; }
.opt { display: block; width: 100%; font-size: 16px; padding: 13px 16px; margin-bottom: 6px; background: var(--fill); border-radius: 14px; }
.opt.on { font-weight: 700; box-shadow: inset 0 0 0 2px var(--ring); }
.pick .pills .pill { box-shadow: 0 0 0 3px var(--surface); padding: 8px 0; }
.pick .pills .pill.on { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--text); }
.sheet .field { width: 100%; font: inherit; font-size: 16px; color: var(--text); background: var(--fill); border: 0; border-radius: 14px; padding: 12px 14px; outline: 0; }
.sheet .list { height: min(520px, 60vh); overflow-y: auto; margin: 0 -16px; }
.gens { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.gens button { padding: 10px 4px; border-radius: 16px; background: var(--fill); text-align: center; }
.gens button.on { box-shadow: inset 0 0 0 2px var(--ring); }
.gens img { width: 28px; height: 28px; }

/* Home: fills the screen; the game card and tiles share the spare height. */
.homebox { flex: 1; display: flex; flex-direction: column; gap: 12px; padding: 0 16px 4px; }
/* They stop growing at about a tall phone's size; a tablet or a tall window leaves the rest of the height empty. */
.grow { flex: 1 1 0; min-height: 80px; max-height: 140px; }
.gamecard.grow { max-height: 320px; }
/* Never shorter than its text and chips: Safari's toolbars and the install card leave less height than the home screen icon. */
.gamecard { flex: 1 0 auto; position: relative; display: flex; align-items: flex-start; border-radius: 18px; color: #fff; overflow: hidden; cursor: pointer; }
.gamecard .texts { padding: 14px 16px; min-width: 0; margin-right: calc(12px + 56px * var(--n)); }
.gamecard h2 { font-size: 19px; font-weight: 700; text-wrap: balance; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.gamecard p { font-size: 13px; padding-top: 4px; white-space: pre-line; }
.gamecard .tag { margin-top: 10px; padding: 7px 14px; }
/* A button's 7px of tap area above and below come out of the space around it, so the card keeps its look. */
.gamecard button.tag { margin-top: 3px; border-block: 7px solid transparent; background-clip: padding-box; }
.gamecard .texts:has(button.tag) { padding-bottom: 7px; }
.gamecard .art { position: absolute; right: 8px; bottom: 6px; display: flex; }
.gamecard .art img { width: 64px; height: 64px; object-fit: contain; }
.tonal { background: color-mix(in srgb, var(--c) var(--tone), var(--surface)); border-radius: 18px; }
.pill.tonal { color: var(--text); border-radius: 999px; }
.teamcard { padding: 12px 10px 12px 16px; cursor: pointer; }
.teamcard .top { display: flex; align-items: center; gap: 8px; }
.teamcard .top > div:first-child { flex: 1; min-width: 0; }
.teamcard .art { display: flex; }
.teamcard .art img { width: 44px; height: 44px; object-fit: contain; }
.teamcard .art img + img { margin-left: -14px; }
/* Side by side on a wide screen; on a phone the game card, team card and tiles stack as children of .homebox. */
.halves, .halves > .side { display: contents; }
.homedex { display: none; }
.tiles { display: flex; gap: 12px; }
.tile { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; justify-content: space-between; padding: 10px 12px; text-align: start; }
.tile b { font-size: 15px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tile > span { font-size: 14px; }
.big { font-size: 1.6em; font-weight: 700; }
.update { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 12px 14px 12px 16px; font-size: 15px; font-weight: 700; }

.slots { display: flex; gap: 4px; padding-top: 10px; }
.slot { flex: 1; height: 46px; border-radius: 50%; background: var(--fill); display: grid; place-items: center; overflow: hidden; }
.slot img { height: 46px; width: 46px; object-fit: contain; }
.button { display: block; width: calc(100% - 32px); margin: 6px 16px 0; padding: 14px 16px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 15px; font-weight: 700; text-align: center; }
.tip + .tip { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--fill); }
.tip summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; font-size: 15px; cursor: pointer; list-style: none; }
.tip summary::-webkit-details-marker { display: none; }
.tip summary svg { flex: none; color: var(--muted); transition: transform 0.15s; }
.tip[open] summary svg { transform: rotate(90deg); }
.tip[open] { padding-bottom: 6px; }
.fix { margin-top: 10px; padding: 10px 12px; border-radius: 12px; background: color-mix(in srgb, var(--good) var(--tone), var(--surface)); }
.fix .bold { font-size: 14px; color: var(--good); }
.tip .chip { margin-top: 8px; }
.defs { display: flex; gap: 12px; }
.defs > div { flex: 1; min-width: 0; }
.defrow { display: flex; align-items: center; padding: 2px 0; }
.defrow > :first-child { width: 76px; flex: none; }
.defrow b { flex: 1; text-align: center; font-size: 14px; }
.defrow.top b { font-size: 11px; color: var(--muted); }

.pair { display: flex; gap: 12px; }
.pair > * { flex: 1 1 0; min-width: 0; }
.headcard { display: flex; flex-direction: column; align-items: center; background: var(--surface); border-radius: 18px; padding: 12px 10px; text-align: center; cursor: pointer; }
.headcard img { width: 96px; height: 96px; object-fit: contain; }
.headcard .nm { font-size: 16px; font-weight: 700; }
/* An empty side is a slot to fill: dashed outline, a plus for the sprite. */
.headcard.empty { outline: 2px dashed var(--muted); outline-offset: -2px; }
.headcard.empty .nm { color: var(--muted); }
.headcard .plus { width: 96px; height: 96px; border-radius: 50%; background: var(--fill); color: var(--muted); font-size: 40px; display: grid; place-items: center; }
.headcard .pills { width: 100%; margin-top: 6px; }
/* Above the second list: the side already picked and the one being picked, in their places. .vs keeps these off the
   round team slots in the teams list. */
.vs.slots { align-items: center; gap: 8px; padding-top: 0; font-size: 13px; }
.vs .slot { flex: 1 1 0; min-width: 0; height: auto; display: flex; align-items: center; gap: 8px; border-radius: 14px; padding: 6px 10px 6px 6px; }
.vs .slot img, .vs .slot .plus { width: 40px; height: 40px; flex: none; object-fit: contain; }
.vs .slot .plus { border-radius: 50%; background: var(--fill); color: var(--muted); font-size: 22px; display: grid; place-items: center; }
.vs .slot .nm { font-size: 14px; font-weight: 700; overflow-wrap: anywhere; }
.vs .slot.empty { background: var(--surface); outline: 2px dashed var(--muted); outline-offset: -2px; }
.vs .slot.empty .nm { color: var(--muted); }
/* One side of a teach or swap confirm, above the values compared. */
.half { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; }
.half img { width: 72px; height: 72px; object-fit: contain; }
.half .nm { font-size: 16px; font-weight: 700; overflow-wrap: anywhere; }
.half .pills { width: 100%; margin-top: 2px; }
.choices .row { background: var(--fill); border-radius: 14px; margin-bottom: 6px; }
.choices .row.on { box-shadow: inset 0 0 0 2px var(--ring); }
.verdict { display: flex; align-items: center; gap: 10px; padding-bottom: 8px; }
.verdict img { width: 56px; height: 56px; object-fit: contain; flex: none; }
.verdict .h { font-size: 17px; font-weight: 700; text-wrap: balance; }
.verdict .muted { font-size: 13px; }
.lvl { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.sides { display: flex; align-items: center; padding: 5px 0; }
.sides.bars { padding: 4px 0; }
.sides .v { width: 40px; font-size: 15px; }
.sides .v:last-child { text-align: end; }
.sides .v.best { font-weight: 700; color: var(--good); }
.sides .mid { width: 80px; color: var(--muted); font-size: 14px; text-align: center; flex: none; }
.sides .mid .pill { width: 72px; }
.sides .side { flex: 1; height: 8px; margin: 0 8px; display: flex; }
.sides .side.l { justify-content: flex-end; }
.sides .side i { display: block; height: 100%; border-radius: 999px; }
.hp { height: 10px; margin: 8px 0; border-radius: 999px; background: var(--fill); overflow: hidden; }
.hp > i { display: block; height: 100%; border-radius: 999px; background: color-mix(in srgb, var(--accent) 40%, transparent); overflow: hidden; }
.hp > i > i { display: block; height: 100%; border-radius: 999px; background: var(--accent); }

.grid { overflow-x: auto; }
.grid table { border-collapse: separate; border-spacing: 1px; }
.grid td, .grid th { padding: 0; text-align: center; font-size: 12px; font-weight: 700; border-radius: 4px; }
.grid tr.on td { box-shadow: inset 0 0 0 2px var(--text); }
.natures { display: grid; grid-template-columns: 34px repeat(5, 1fr); gap: 3px; }
.natures > * { display: grid; place-items: center; font-size: 12px; font-weight: 700; text-align: center; border-radius: 10px; }
.natures .h { height: 28px; }
.natures .c { min-height: 48px; padding: 1px; font-size: 11px; -webkit-hyphens: auto; hyphens: auto; overflow-wrap: anywhere; }
.forms { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.forms button { display: flex; flex-direction: column; align-items: center; padding: 6px 2px; border-radius: 14px; font-size: 12px; color: var(--muted); text-align: center; }
.forms button.on { background: var(--fill); font-weight: 700; color: var(--text); }
.forms img { width: 56px; height: 56px; object-fit: contain; }
.ab { display: block; width: 100%; padding: 6px 0; }
.ab .tag { display: inline-block; background: var(--fill); padding: 2px 8px; border-radius: 999px; margin-left: 8px; vertical-align: middle; }
.member { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.member > div { flex: 1; min-width: 0; }
.member img { width: 128px; height: 128px; object-fit: contain; flex: none; cursor: pointer; }
.member h1 { font-size: 26px; }
.statrow { display: flex; align-items: center; gap: 8px; padding: 3px 0; }
.statrow > :first-child { flex: 1; font-size: 15px; font-weight: 700; }
.statrow .b { width: 40px; color: var(--muted); font-size: 15px; text-align: end; }
.statrow .num { width: 60px; }
.statrow .o { width: 52px; font-size: 15px; font-weight: 700; text-align: end; }
.statrow.top > * { font-size: 12px; }
.up { color: var(--up); }
.down { color: var(--down); }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); max-width: calc(100% - 32px);
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 14px; font-size: 14px; z-index: 2;
}
.boot { display: grid; place-items: center; height: 100%; padding: 32px; text-align: center; color: var(--muted); }

/* Type labels in the Settings style, as Ui.typeLabel: glyph and name, glyph alone, or the pixel badge. */
.pill.ic { display: inline-flex; align-items: center; justify-content: center; gap: 4px; }
.pill .glyph {
  flex: none; width: .8em; height: 1.1em; background: currentColor;
  -webkit-mask-size: contain; mask-size: contain; -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-position: center; mask-position: center;
}
.pill.only .glyph { width: .95em; height: 1.3em; }
.pill.px { padding: 0; border-radius: 0; line-height: 0; }
.pill.px img { display: block; height: 20px; width: auto; margin: 0 auto; }
.opts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.opts > button { padding: 12px 8px; border-radius: 14px; background: var(--fill); font-size: 13px; font-weight: 700; text-align: center; }
.opts > button.on { box-shadow: inset 0 0 0 2px var(--ring); }
.opts > button > div { display: flex; justify-content: center; align-items: center; gap: 6px; height: 24px; margin-bottom: 8px; }
.opts .pill:not(.ic):not(.px) { width: 56px; }
.opts .pill.ic { padding: 3px 8px; }
.setrow { display: flex; align-items: center; gap: 12px; }
.setrow > .bold { flex: 1; font-size: 15px; }
.chip:disabled { opacity: .4; }

/* Workspace pill and caught progress on the home game card. */
.gamecard .tags { display: flex; flex-wrap: wrap; gap: 0 8px; margin-top: 3px; }
.gamecard .tags .tag { margin-top: 0; }
.gamecard .more { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; }
.gamecard .more span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.progress { font-size: 12px; }
.progress .track { height: 6px; margin: 8px 0 4px; border-radius: 999px; background: rgba(255, 255, 255, .25); overflow: hidden; }
.progress .track i { display: block; height: 100%; border-radius: 999px; background: #fff; }

/* Caught and Add to team side by side on the Pokémon page. */
.hero .acts { display: flex; gap: 8px; margin-top: 14px; }
.hero .acts .add { flex: 1; min-width: 0; margin-top: 0; }
.hero .acts div.add { background: none; }
.hero .stage { display: flex; align-items: center; justify-content: center; gap: 6px; padding-inline: 12px; }
.hero .stage span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hero .mark[aria-pressed="true"] { background: #fff; color: var(--ink); }

/* Smogon set cards, as MemberActivity.buildCard. */
.builds .build { margin-top: 12px; }
.build.fill { background: var(--fill); }
.btop { display: flex; align-items: center; gap: 6px; }
.btop > div { flex: 1; min-width: 0; }
.btop .bold { font-size: 17px; }
.bfacts { margin: 10px 0 4px; }
.bfacts > * { display: flex; width: 100%; padding: 3px 0; font-size: 14px; text-align: start; border-radius: 8px; }
.bfacts .k { flex: none; width: 72px; color: var(--muted); }
.bfacts .up, .bfacts .down { margin-left: 10px; }
.bmoves { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.bmoves button { display: flex; flex-direction: column; min-width: 0; padding: 8px 12px; border-radius: 12px; font-size: 12px; text-align: start; }
.bmoves b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.build > .chip, .build > .two { margin-top: 14px; }
.two { display: flex; gap: 8px; }
.two .chip { flex: 1; min-width: 0; white-space: normal; }

/* Install steps for Safari. */
.steps { padding-left: 22px; font-size: 16px; line-height: 1.4; }
.steps li + li { margin-top: 10px; }

/* Mouse and trackpad. */
@media (hover: hover) {
  button:not(.on):not(:disabled):hover, [role=button]:hover { box-shadow: inset 0 0 0 100vmax var(--hover); }
}

/* Computer, or a tablet held sideways: lists and the Pokédex use the width, the Pokémon page keeps its picture
   beside the tabs. */
@media (min-width: 900px) {
  .col.broad, .col.split { max-width: 1040px; }
  .broad .cards { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
  .broad .rows { display: grid; grid-template-columns: 1fr 1fr; }
  .broad .hdr { grid-column: 1 / -1; }
  .split { display: grid; grid-template-columns: 400px minmax(0, 1fr); grid-template-rows: auto 1fr; align-items: start; }
  .split > .hero { grid-row: span 2; position: sticky; top: 0; }
  /* The home sizes to its content: the game card, its box art under the text, beside the team card and tiles. */
  .homebox { flex: none; }
  .homedex { display: block; }
  .halves { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
  .halves > .side { display: flex; flex-direction: column; gap: 12px; }
  .halves .tiles { min-height: 96px; max-height: none; }
  .halves .gamecard {
    flex-direction: column; align-items: stretch; justify-content: space-between; max-height: none;
    background-size: 240px 240px, auto; background-position: right -54px bottom -54px, 0 0;
  }
  .halves .gamecard .texts { margin-right: 0; padding: 20px 24px 0; }
  .halves .gamecard h2 { font-size: 26px; }
  .halves .gamecard p { font-size: 14px; }
  .halves .gamecard .art { position: static; align-self: flex-end; padding: 0 16px 12px; }
  .halves .gamecard .art img { width: 112px; height: 112px; }
}
