:root {
  color-scheme: dark;
  --bg: #100f16;
  --panel: #191820;
  --line: #34303d;
  --ink: #f2eae2;
  --muted: #b7aebd;
  --gold: #e8bc86;
  --serif: Georgia, 'Times New Roman', serif;
  --mono: 'Cascadia Mono', Consolas, monospace;
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
}

* { box-sizing: border-box; }
body { min-height: 100vh; margin: 0; display: flex; flex-direction: column; isolation: isolate; background: radial-gradient(ellipse 65% 460px at 48% 0, #242035 0, transparent 100%); }
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: .24;
  background: url('/riftbound/art/branding/mythgrail-background.png') center 42% / cover no-repeat;
}
button, input, select { font: inherit; }
button, a, input, select, summary { -webkit-tap-highlight-color: transparent; }
button { color: inherit; cursor: pointer; }
button:disabled { opacity: .55; cursor: not-allowed; }
button[aria-disabled='true'] { cursor: default; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid #f2c99b; outline-offset: 3px; }
h1, h2, p { margin: 0; }
h1, h2 { font-family: var(--serif); font-weight: 500; }
main { flex: 1; width: min(1260px, 100%); margin: auto; padding: 0 44px 54px; }
footer { margin-top: auto; display: flex; justify-content: space-between; gap: 12px; padding: 20px max(22px, calc((100vw - 1172px)/2)); border-top: 1px solid var(--line); }
footer, .edition, .section-line > span, .kicker, .faction-tag, .hero-index, .profile-art > span, .quest > span, .card-top, .card-type, .awake, .opponent-hand, .room-code {
  font: 600 11px/1.3 var(--mono); letter-spacing: .12em; text-transform: uppercase;
}
footer, footer b, .edition, .section-line > span { color: #aaa0b3; }
.topbar { min-height: 71px; display: flex; justify-content: space-between; align-items: stretch; gap: 20px; padding: 0 max(24px, calc((100vw - 1172px)/2)); border-bottom: 1px solid #373140; background: #100f16cf; }
.brand { flex: 0 0 auto; align-self: center; display: flex; padding-block: 3px; }
.brand img {
  display: block;
  width: 230px;
  height: 114px;
  object-fit: cover;
  object-position: center 49%;
}
.topbar nav { display: flex; align-items: stretch; gap: 24px; }
.topbar nav a { display: grid; place-items: center; position: relative; color: var(--muted); font-size: 13px; font-weight: 600; }
.topbar nav a:hover, .topbar nav a[aria-current] { color: var(--ink); }
.topbar nav a[aria-current]::after { content: ''; position: absolute; height: 2px; background: var(--gold); inset: auto 0 -1px; }
.edition { align-self: center; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.edition i { width: 7px; height: 7px; border-radius: 50%; background: #9ad7a8; box-shadow: 0 0 12px #9ad7a880; }
.intro { padding: 47px 0 35px; }
.kicker { display: flex; align-items: center; gap: 9px; color: var(--gold); }
.kicker > span { width: 18px; height: 1px; background: var(--gold); }
h1 { margin: 8px 0 12px; font-size: clamp(42px, 6vw, 79px); line-height: 1.02; letter-spacing: -.055em; }
h1 em { color: var(--gold); font-weight: 400; }
.intro > p:last-child, .center-panel > p:not(.kicker) { color: var(--muted); max-width: 520px; line-height: 1.55; font-size: 15px; }
.lobby-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(310px, .49fr); gap: 22px; align-items: start; }
.section-line { display: flex; justify-content: space-between; align-items: baseline; gap: 9px; margin-bottom: 13px; }
.section-line h2 { font-size: 24px; }
.hero-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.hero-tile, .hero-profile, .profile-art, .unit { --tone: color-mix(in srgb, var(--tint) 24%, #1c1722); }
.hero-tile { isolation: isolate; position: relative; overflow: hidden; min-height: 156px; display: flex; flex-direction: column; align-items: center; justify-content: end; gap: 5px; padding: 15px 5px; border: 1px solid var(--tone); border-radius: 9px; background: #181720; transition: border-color .16s, transform .16s; }
.hero-tile .portrait { position: absolute; z-index: -2; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 24%; transition: transform .32s, filter .32s; filter: saturate(.82); }
.hero-tile::before { content: ''; position: absolute; z-index: -1; inset: 0; background: linear-gradient(0deg, #14111a 2%, #17121c72 40%, transparent 75%); }
.hero-tile:hover .portrait, .hero-tile.selected .portrait { transform: scale(1.065); filter: saturate(1.13); }
.hero-tile:hover { border-color: var(--tint); transform: translateY(-2px); }
.hero-tile.selected { border-color: var(--tint); box-shadow: inset 0 0 0 1px var(--tint), 0 4px 20px #0004; }
.hero-index { color: var(--tint); position: absolute; top: 9px; left: 10px; padding: 3px 5px; border-radius: 4px; background: #14111acf; font-size: 10px; }
.hero-tile strong { font: 600 21px/1 var(--serif); }
.emblem { width: 75px; height: 75px; flex: 0 0 auto; color: var(--tint, var(--gold)); stroke: currentColor; }
.emblem .orbit { opacity: .33; stroke-width: .7; }
.emblem .dotted { stroke-dasharray: 1 4; }
.emblem .glyph { stroke-width: 1.55; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 0 5px currentColor); }
.faction-tag { color: var(--tint, var(--gold)); font-size: 9px; letter-spacing: .16em; }
.hero-profile { overflow: hidden; border: 1px solid var(--tone); border-radius: 11px; background: #19171f; }
.profile-art { height: 154px; position: relative; overflow: hidden; border-bottom: 1px solid var(--tone); background: var(--tone); }
.profile-art > .portrait { width: 100%; height: 100%; object-fit: cover; object-position: center 24%; }
.profile-art::after { content: ''; position: absolute; inset: 0; background: linear-gradient(0deg, #120e19a0, transparent 64%); pointer-events: none; }
.profile-art > span { position: absolute; z-index: 1; bottom: 12px; left: 14px; color: var(--tint); font-size: 10px; text-shadow: 0 1px 7px #000; }
.profile-art .emblem { position: absolute; z-index: 1; bottom: 9px; right: 12px; width: 37px; height: 37px; }
.profile-body { padding: 16px 17px 18px; }
.profile-body h2 { font-size: 35px; line-height: 1; }
.hero-title { margin: 4px 0 10px; color: var(--tint); font: italic 17px/1.2 var(--serif); }
.hero-style, .quest p { font-size: 13px; line-height: 1.45; color: var(--muted); }
.quest { border-left: 2px solid var(--tint); margin-top: 14px; padding: 10px 11px; background: color-mix(in srgb, var(--tint) 7%, #17151d); }
.quest > span { display: block; color: var(--tint); margin-bottom: 5px; }
.quest .quest-power { margin-top: 6px; color: #e4d8e5; }
.btn { display: inline-flex; justify-content: center; align-items: center; gap: 8px; padding: 10px 13px; border: 1px solid #534759; border-radius: 6px; background: #211e29; font-size: 13px; font-weight: 650; line-height: 1.2; text-align: center; }
.btn:hover, .btn.active { background: #302838; border-color: #9c819f; }
.btn.primary { background: #e8bc86; border-color: #e8bc86; color: #1e1513; }
.btn.primary:hover { background: #ffd5a2; }
.profile-body > .primary { width: 100%; justify-content: space-between; padding: 11px 13px; margin-top: 13px; }
.button-row { display: flex; align-items: stretch; gap: 7px; }
.profile-body > .button-row { margin-top: 7px; }
.profile-body > .button-row > * { flex: 1; }
.deck-link { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 12px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 6px; font-size: 13px; }
.deck-link span { color: var(--tint); font-weight: 650; }
.deck-link:hover { border-color: var(--tint); }
.deck-hint { color: var(--muted); font-size: 12px; line-height: 1.45; margin-top: 6px; }
.join-form { margin-top: 13px; }
label { color: var(--muted); font-size: 12px; font-weight: 600; }
input, select { padding: 8px 10px; color: var(--ink); border: 1px solid #544959; border-radius: 5px; background: #15141c; min-width: 0; }
.join-form input { width: 100%; text-transform: uppercase; }
.join-form .button-row { margin-top: 5px; }
.center-panel { max-width: 680px; margin: 55px auto; padding: 35px 20px; text-align: center; border: 1px solid var(--line); border-radius: 12px; background: #191720; }
.center-panel .kicker { justify-content: center; }
.center-panel .portrait { width: 86px; height: 86px; object-fit: cover; object-position: center 28%; border: 1px solid var(--tint); border-radius: 50%; margin-bottom: 8px; }
.center-panel h1 { font-size: clamp(36px, 5vw, 60px); }
.center-panel > p { margin-inline: auto; }
.room-code { font-size: clamp(24px, 5vw, 38px); letter-spacing: .22em; margin: 24px auto; color: var(--gold); }
.library-toolbar, .library-hero { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.library-toolbar { justify-content: space-between; margin-bottom: 18px; }
.library-hero { padding: 15px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 22px; background: #191720; }
.library-hero p { flex: 0 0 100%; font-size: 14px; color: var(--muted); }
.library-hero p strong { color: var(--ink); margin-right: 4px; }
.library-hero .portrait, .banner .portrait { width: 43px; height: 43px; flex: 0 0 auto; border: 1px solid var(--tint); border-radius: 50%; object-fit: cover; object-position: center 36%; background: #211a27; }
.search { display: flex; flex-direction: column; gap: 6px; max-width: 370px; margin-bottom: 20px; }
.library-result-toolbar { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 20px; }
.library-result-toolbar .search { flex: 1 1 240px; margin-bottom: 0; }
.catalog-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 10px; }
.catalog-list { display: grid; gap: 8px; }
.catalog-card, .hand-card { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; text-align: left; border: 1px solid color-mix(in srgb, var(--tint) 32%, #282333); border-radius: 7px; background: linear-gradient(160deg, color-mix(in srgb, var(--tint) 11%, #1a1921), #191720 80%); padding: 10px; }
.catalog-card { min-height: 132px; }
.catalog-card[data-rarity] { border-color: color-mix(in srgb, var(--rarity-accent) 40%, var(--line)); border-inline-start: 3px solid var(--rarity-accent); }
.card-attributes { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.card-rarity { display: inline-flex; align-items: center; gap: .35em; padding: .2rem .35rem; border: 1px solid color-mix(in srgb, currentColor 48%, transparent); border-radius: 4px; color: var(--rarity-accent); font-size: .75rem; font-weight: 650; line-height: 1.15; }
.card-set { color: var(--muted); font-size: .75rem; }
.card-rarity-editor { width: 100%; display: grid; gap: 5px; margin-top: auto; padding-top: 8px; border-top: 1px solid var(--line); }
.catalog-list-card .card-rarity-editor { max-width: 310px; margin-top: 4px; }
.card-rarity-controls { display: flex; flex-wrap: wrap; gap: 6px; }
.card-rarity-controls select { flex: 1 1 105px; min-width: 0; max-width: 100%; padding-inline: 6px; font-size: 13px; }
.card-rarity-controls select, .card-rarity-controls .btn { min-height: 40px; }
.card-rarity-controls .btn[aria-disabled="true"] { opacity: .55; }
.card-rarity-editor p, .rarity-load-status { color: var(--muted); font-size: 13px; }
.card-rarity-editor .card-rarity-error, .rarity-load-status [role="alert"] { color: #ffad9f; }
.rarity-load-status { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin: 0 0 16px; }
.catalog-list-card { display: grid; grid-template-columns: clamp(64px, 14vw, 96px) minmax(0, 1fr); align-items: start; gap: 12px; min-height: 0; }
.catalog-list-card .art-window .pending-art { padding: 4px; font-size: 10px; }
.catalog-list-details { min-width: 0; display: grid; gap: 4px; }
.catalog-list-title, .catalog-list-meta { display: flex; align-items: center; gap: 6px 10px; flex-wrap: wrap; }
.catalog-list-title { justify-content: space-between; }
.catalog-list-title strong { overflow-wrap: anywhere; }
.builder-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(252px, .39fr); gap: 20px; align-items: start; }
.deck-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px; }
.deck-filters input { flex: 1; min-width: 120px; }
.deck-filters select { max-width: 100%; }
.deck-panel { position: sticky; top: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: #191720; }
.deck-heading { display: flex; align-items: center; gap: 10px; margin-bottom: 13px; }
.deck-heading img { width: 46px; height: 46px; object-fit: cover; object-position: center 30%; border-radius: 50%; border: 1px solid var(--tint); }
.deck-heading h2 { font-size: 24px; }
.deck-panel > select { width: 100%; margin: 4px 0 10px; }
.deck-count { color: var(--ink); font-size: 16px; font-weight: 650; }
.deck-count span { color: var(--tint); font-size: 13px; }
.deck-panel .button-row { flex-wrap: wrap; margin-top: 11px; }
.deck-panel .button-row > * { flex: 1; }
.deck-list { list-style: none; margin: 12px 0 0; padding: 0; max-height: 50vh; overflow: auto; }
.deck-list li { padding: 5px 3px; border-top: 1px solid var(--line); font-size: 12px; }
.deck-list .deck-card { display: grid; grid-template-columns: 24px 52px minmax(0, 1fr) auto 28px; align-items: center; gap: 7px; }
.deck-list .card-illustration { width: 52px; height: 52px; border-radius: 4px; object-fit: cover; }
.deck-list li small { color: var(--muted); }
.deck-list .btn { padding: 3px 6px; }
.deck-add { margin-top: auto; width: 100%; justify-content: space-between; }
.deck-add span { color: var(--gold); }
.deck-pagination { display: flex; align-items: center; justify-content: center; gap: 10px; padding-top: 14px; color: var(--muted); font-size: 12px; }
.art-window { position: relative; display: block; overflow: hidden; width: 100%; aspect-ratio: 1; border: 1px solid color-mix(in srgb, var(--tint) 26%, #282333); border-radius: 4px; background: #16131d; }
.card-illustration { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center 40%; transition: transform .28s ease; }
.archived-art { display: grid; place-items: center; color: var(--muted); background: #25202b; font: 11px var(--mono); }

.card-top { display: flex; align-items: center; justify-content: space-between; gap: 4px; width: 100%; color: var(--tint); }
.card-reference { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 4px; min-width: 0; }
.card-id { display: inline-flex; align-items: center; gap: 5px; min-height: 32px; padding: 4px 6px; border: 1px solid #65505e; border-radius: 5px; background: #25202b; color: var(--ink); cursor: pointer; }
.card-id span { color: var(--muted); font: 10px var(--mono); }
.card-id code { font: 12px var(--mono); }
.card-id:hover, .card-id:focus-visible { border-color: var(--gold); }
.card-top > span { background: #131019e8; }
.card-top > span:not(.mana-cost) { border-radius: 3px; padding: 3px 5px; font-size: 9px; }
.mana-cost { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; border: 1px solid currentColor; color: #b3c8ff; font-size: 12px; letter-spacing: 0; }
.card-type { color: var(--tint); font-size: 9px; }
.effect { font-size: 12px; line-height: 1.42; color: #cfc5d1; }
.match { padding-top: 26px; }
.match-header { display: flex; justify-content: space-between; align-items: end; gap: 12px; margin-bottom: 16px; }
.match-header h1 { font-size: clamp(32px, 5vw, 54px); margin-bottom: 0; }
.quiet { color: var(--muted); background: transparent; }
.match-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(185px, 225px); align-items: start; gap: 16px; }
.arena { overflow: hidden; border: 1px solid var(--line); border-radius: 9px; background: linear-gradient(#100a19a8, #100a19b8), url('/riftbound/art/branding/mythgrail-arena.png') center / cover no-repeat; }
.playfield { position: relative; }
.banner { min-height: 66px; position: relative; display: flex; align-items: center; flex-wrap: wrap; gap: 10px; padding: 8px 13px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--tint) 8%, #1d1925); }
.banner.awakened .portrait { border-color: var(--gold); box-shadow: 0 0 12px #e8bc8680; }
.banner-name { display: grid; gap: 3px; min-width: 73px; }
.banner-name strong { font: 600 22px/1 var(--serif); }
.meters { display: flex; flex-wrap: wrap; gap: 4px; }
.meters span { border: 1px solid #ffffff22; padding: 4px 6px; border-radius: 4px; background: #15141b; color: #e2d8e4; font: 600 12px/1 var(--mono); }
.meters span:nth-child(1) { color: #ff9d9e; }
.meters span:nth-child(3) { color: #b3c8ff; }
.awake { display: flex; flex-direction: column; gap: 3px; color: var(--tint); margin-left: auto; }
.awake progress { accent-color: var(--tint); width: 90px; height: 6px; }
.hit-hero { color: var(--gold); }
.opponent-hand { display: flex; align-items: center; gap: 3px; justify-content: center; padding-top: 8px; color: var(--muted); font-size: 9px; }
.opponent-hand i { width: 11px; height: 16px; border-radius: 2px; border: 1px solid #685573; background: linear-gradient(125deg, #494057, #242030); }
.opponent-hand > span { margin-left: 6px; }
.board-row { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(86px, 120px); justify-content: safe center; gap: 6px; padding: 8px 11px; min-height: 128px; overflow: auto; }
.board-divider { display: flex; align-items: center; gap: 10px; padding: 0 12px; color: #887391; font-size: 12px; }
.board-divider::before, .board-divider::after { content: ''; background: #413549; height: 1px; flex: 1; }
.empty-board { display: grid; place-items: center; color: #aca1b3; font-size: 12px; padding: 8px; text-align: center; }
.unit { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 4px 5px; border: 1px solid var(--tone); border-radius: 6px; background: linear-gradient(160deg, color-mix(in srgb, var(--tint) 10%, #211d2c), #1b1721); }
.unit-art { display: block; overflow: hidden; height: 70px; width: 100%; border-radius: 3px; }
.unit strong { font-size: 11px; line-height: 1.08; }
.keywords { color: var(--tint); font-size: 9px; text-align: center; }
.stats { display: flex; width: 100%; justify-content: space-around; margin-top: auto; font: 600 11px/1.2 var(--mono); }
.stats b:first-child { color: #edc08c; }
.stats b:last-child { color: #ffa6a6; }
.available { box-shadow: inset 0 0 0 1px #d3b48365; }
.available:hover, .hand-card:hover { border-color: var(--tint); }
.unit.selected, .hand-card.selected, .targetable { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); }
.decision { display: flex; align-items: center; gap: 7px; min-height: 62px; padding: 8px 12px; border-bottom: 1px solid var(--line); background: #201b27; }
.decision > div:first-child { flex: 1; }
.decision > div:first-child > span { display: block; margin-top: 4px; font-size: 12px; color: var(--muted); }
.decision > strong { flex: 1; }
.decision.pending { flex-wrap: wrap; box-shadow: inset 3px 0 var(--gold); }
.decision.pending .button-row { flex-wrap: wrap; }
.decision .scry-preview { display: flex; align-items: center; gap: 8px; }
.scry-preview .card-illustration { flex: 0 0 50px; width: 50px; height: 50px; border-radius: 4px; }
.hand-line { margin: 8px 12px 5px; }
.hand-line h2 { font-size: 18px; }
.hand-row { display: flex; overflow: auto; gap: 6px; padding: 3px 12px 10px; }
.hand-card { width: 125px; flex: 0 0 125px; min-height: 130px; padding: 6px 7px; }
.hand-card strong { font-size: 12px; }
.hand-card .effect { font-size: 11px; }
.replace-flag { font-size: 10px; color: var(--gold); margin-top: auto; }
.fx-layer { position: absolute; z-index: 3; inset: 0; pointer-events: none; }
.fx-cue { position: absolute; top: 50%; left: 50%; opacity: 0; animation-fill-mode: both; pointer-events: none; }
.fx-play { --fx-color: var(--gold); display: grid; width: 96px; padding: 4px; border: 1px solid var(--fx-color); border-radius: 6px; background: #15111d; color: var(--ink); text-align: center; box-shadow: 0 0 22px var(--fx-color); animation: card-cast 810ms ease-out both; }
.fx-play img { height: 68px; border-radius: 3px; }
.fx-play strong { padding: 4px 2px 2px; font-size: 10px; }
.fx-attack { width: 78px; height: 11px; border-radius: 100%; background: #ffe2aa; box-shadow: 0 0 22px #ff8150; animation: blade-flash 480ms ease-out both; }
.fx-awaken { display: flex; align-items: center; gap: 8px; padding: 7px 14px 7px 7px; border: 1px solid var(--gold); border-radius: 40px; background: #251a22; color: #ffdfac; box-shadow: 0 0 30px #e8bc8680; white-space: nowrap; animation: hero-awaken 1.18s ease-out both; }
.fx-awaken img { width: 34px; height: 34px; object-fit: cover; border-radius: 50%; }
@keyframes card-cast {
  0% { opacity: 0; transform: translate(-50%, calc(-50% + var(--fx-from))) scale(.72) rotate(-8deg); }
  25%, 65% { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(0); }
  100% { opacity: 0; transform: translate(-50%, calc(-50% - 15px)) scale(.91); }
}
@keyframes blade-flash {
  0% { opacity: 0; transform: translate(-50%, -50%) rotate(-39deg) scaleX(.1); }
  40% { opacity: 1; transform: translate(-50%, -50%) rotate(-39deg) scaleX(1.3); }
  100% { opacity: 0; transform: translate(-50%, -50%) rotate(-39deg) scaleX(1.75); }
}
@keyframes hero-awaken {
  0% { opacity: 0; transform: translate(-50%, -30%) scale(.82); }
  24%, 76% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -75%) scale(1.06); }
}
.duel-sidebar section, .duel-sidebar details { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 13px; margin-bottom: 8px; }
.duel-sidebar h2 { font-size: 22px; margin-top: 4px; }
.log { padding: 0; margin: 8px 0 0; list-style: none; }
.log li { border-top: 1px solid #322b39; padding: 6px 0; font-size: 12px; color: var(--muted); }
.duel-sidebar summary { cursor: pointer; font-weight: 600; font-size: 13px; }
.duel-sidebar details p { font-size: 12px; line-height: 1.5; margin-top: 6px; color: var(--muted); }
.notice { position: fixed; z-index: 4; right: 16px; bottom: 16px; max-width: min(340px, calc(100% - 32px)); padding: 12px 16px; border: 1px solid var(--gold); border-radius: 7px; background: #211c2a; box-shadow: 0 8px 30px #0007; color: var(--ink); }

@media (max-width: 930px) {
  .brand img { width: 168px; height: 84px; }
  main { padding-inline: 22px; }
  .hero-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero-tile { min-height: 121px; }
  .match-grid { grid-template-columns: minmax(0, 1fr); }
  .duel-sidebar { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 7px; align-items: start; }
}

@media (max-width: 620px) {
  main { padding-inline: 12px; padding-bottom: 30px; }
  footer, .topbar { padding-inline: 12px; }
  .topbar { gap: 8px; min-height: 59px; }
  .topbar nav { gap: 10px; }
  .topbar nav a { font-size: 12px; }
  .edition { display: none; }
  .intro { padding-top: 32px; padding-bottom: 23px; }
  .lobby-grid { grid-template-columns: minmax(0, 1fr); }
  .hero-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; }
  .hero-tile { min-height: 98px; padding: 10px 2px; }
  .hero-tile strong { font-size: 16px; }
  .hero-tile .faction-tag { font-size: 8px; letter-spacing: .06em; }
  .hero-index { font-size: 8px; top: 5px; left: 5px; }
  .profile-art { height: 136px; }
  .banner { gap: 5px; padding: 7px; }
  .banner .portrait { width: 33px; height: 33px; }
  .banner-name { min-width: 54px; }
  .banner-name strong { font-size: 17px; }
  .banner-name .faction-tag, .awake { font-size: 8px; }
  .meters span { font-size: 10px; padding: 4px; }
  .awake progress { width: 56px; }
  .duel-sidebar { grid-template-columns: 1fr 1fr; }
  .duel-sidebar section { grid-column: 1 / -1; }
  .catalog-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .builder-grid { grid-template-columns: minmax(0, 1fr); }
  .deck-panel { position: static; grid-row: 1; }
  .deck-list { max-height: 160px; }
  .library-toolbar .button-row { flex-wrap: wrap; }
}

@media (max-width: 380px) {
  .topbar nav { gap: 7px; }
  .topbar nav a { font-size: 11px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
  .fx-layer { display: none; }
}

.account-page { max-width: 470px; }
.account-form { display: grid; gap: 10px; max-width: 360px; }
.account-form .btn { justify-self: start; }
.deck-account { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.deck-account small { color: var(--muted); }
.deck-pagination[hidden] { display: none; }
.topbar [data-nav="account"] { flex: 0 0 auto; max-width: 12ch; overflow: hidden; overflow-wrap: anywhere; }
@media (max-width: 480px) {
  .topbar { flex-wrap: wrap; gap: 0; }
  .topbar nav { width: 100%; min-height: 38px; justify-content: space-between; }
  .topbar [data-nav="account"] { white-space: nowrap; }
}

.catalog-card .stats, .hand-card .stats, .deck-list .stats { justify-content: flex-start; gap: 4px; }
.catalog-card .stats b, .hand-card .stats b { padding: 3px 4px; border-radius: 4px; background: #100f16; white-space: nowrap; }
.catalog-card .stats { font-size: 12px; }
.deck-list .stats { margin-top: 3px; }

.topbar nav .return-room { min-height: 44px; padding: 4px 8px; border: 1px solid var(--gold); border-radius: 8px; color: var(--ink); text-align: center; }
.topbar nav .return-room:hover, .topbar nav .return-room:focus-visible { background: #ffffff12; }

.progress-panel { margin: 1.5rem 0; padding: 1.3rem; border: 1px solid #65513d; border-radius: 14px; background: #1c1824; }
.progress-panel progress { width: 100%; accent-color: #e9bd87; }
.progress-panel > p { margin: .5rem 0; line-height: 1.5; }
.progress-panel > h3 { margin: 1.2rem 0 .5rem; }
.progress-panel > details { margin-top: 1rem; }
.pack-inventory { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 154px), 1fr)); gap: 10px; padding: 0; list-style: none; }
.pack-option { display: grid; grid-template-rows: auto auto 1fr auto; gap: .35rem; padding: .8rem; border: 1px solid var(--line); border-top: 2px solid var(--rarity-accent); border-radius: 8px; background: #17151d; }
.pack-option h4 { margin: 0; color: var(--rarity-accent); font-size: 1rem; }
.pack-option p { color: var(--muted); font-size: .85rem; }
.pack-option p strong { color: var(--ink); }
.pack-option .btn { justify-self: start; margin-top: .35rem; }
.pack-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); gap: 12px; margin-top: 18px; }
[data-rarity="normal"] { --rarity-accent: #ded7e1; }
[data-rarity="rare"] { --rarity-accent: #94c8f3; }
[data-rarity="super_rare"] { --rarity-accent: #c9adfb; }
[data-rarity="ultra_rare"] { --rarity-accent: #f4a8cf; }
[data-rarity="legendary"] { --rarity-accent: var(--gold); }
.pack-option[data-rarity="expansion_1"] { --rarity-accent: #8ad8c3; }
.pending-art{display:flex;align-items:center;justify-content:center;min-height:140px;color:#b8a68d;background:#211e28;font-size:.8rem}.hero-tile:disabled{opacity:.38;filter:grayscale(1);cursor:not-allowed}
