/* Season 1 pages (garage, market, races): on top of style.css and home.css, in the same look: near-black, charcoal
   panels, hairlines, Michroma titles. Rarity and class share one accent each: Common / Muscle gold, Rare / GT silver,
   Epic / Super red, Legendary / Hyper blue (the colours of the part art and the car paint). No glow. */

[data-rarity="common"], [data-class="muscle"] { --accent-line: var(--class-muscle); }
[data-rarity="rare"], [data-class="gt"] { --accent-line: var(--class-gt); }
[data-rarity="epic"], [data-class="super"] { --accent-line: var(--class-super); }
[data-rarity="legendary"], [data-class="hyper"] { --accent-line: var(--class-hyper); }

body.game.sheet-open { overflow: hidden; }
.game .top-actions button { min-height: 36px; padding: 8px 14px; font-size: 0.7rem; }
.game .top-actions button.warn { border-color: var(--bad); color: var(--bad); }
.game .wallet-box { margin-top: 14px; }

/* the band at the top: the page's photograph, dimmed, with its title */
.game-hero { position: relative; overflow: hidden; border-bottom: 1px solid var(--line); background: #0b0b0c var(--hero) center / cover no-repeat; }
.game-hero::before { content: ""; position: absolute; inset: 0; background: rgba(10, 10, 11, 0.55); }
.game-hero-row { position: relative; display: grid; align-items: center; gap: 12px 40px; min-height: clamp(220px, 30vw, 360px); padding-top: clamp(36px, 5vw, 64px); padding-bottom: clamp(28px, 4vw, 48px); }
@media (min-width: 820px) { .game-hero-row { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); } }
.game-hero h1 { font: 400 clamp(1.8rem, 1.2rem + 2.6vw, 3.2rem)/1.1 var(--head); letter-spacing: 0.04em; }
.game-hero .lead { max-width: 52ch; margin: 16px 0 0; color: var(--silver); }
.game-hero .hero-actions { margin-top: 22px; }
.eyebrow { margin: 0 0 14px; color: var(--muted); font-size: 0.7rem; font-weight: 600; letter-spacing: 0.24em; text-transform: uppercase; }
.game-hero-art { justify-self: center; width: min(100%, 300px); height: auto; }
.game-hero-art.wide { width: min(100%, 360px); }
@media (max-width: 819px) { .game-hero-art { display: none; } }

.game-body { padding: clamp(28px, 4vw, 56px) 0 clamp(64px, 8vw, 120px); }
.game-panel { margin: 0 0 clamp(14px, 2vw, 22px); padding: clamp(18px, 2.4vw, 30px); }
.game-panel > h2, .section-line h2 { margin: 0 0 16px; color: var(--muted); font: 600 0.72rem/1.3 var(--body); letter-spacing: 0.2em; text-transform: uppercase; }
body.home .game-panel > h2, body.home .section-line h2 { font: 600 0.72rem/1.3 var(--body); color: var(--muted); letter-spacing: 0.2em; }
.game-grid { display: grid; gap: 0 clamp(14px, 2vw, 22px); }
@media (min-width: 1000px) { .game-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; } }
.section-line { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 16px; margin: clamp(26px, 3vw, 40px) 0 14px; }
.section-line h2 { margin: 0; }
.game-state { margin: 0 0 6px; font: 400 clamp(1rem, 0.9rem + 0.4vw, 1.2rem)/1.45 var(--head); letter-spacing: 0.04em; }
.game-state[data-state="open"], .game-state[data-state="early"] { color: var(--ink); }
.game-state[data-state="ended"] { color: var(--muted); }
.game .note code { font-size: 0.78rem; overflow-wrap: anywhere; color: var(--silver); }

/* the wallet whose garage the page shows */
.player-bar { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px 12px; align-items: center; margin: 0 0 clamp(20px, 3vw, 32px); padding: 16px 18px; background: var(--panel); border: 1px solid var(--line); border-radius: 2px; }
@media (min-width: 760px) { .player-bar { grid-template-columns: auto minmax(0, 1fr) auto; } .player-bar .note { grid-column: 1 / -1; } }
.player-bar label { color: var(--muted); font-size: 0.7rem; font-weight: 600; letter-spacing: 0.2em; text-transform: uppercase; }
.player-bar input, .sheet input, .sheet select, .filters select { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 2px; background: var(--bg); color: var(--ink); font: 0.92rem var(--mono); }
.sheet select, .filters select { font-family: var(--body); }
.player-bar .note { margin: 0; }
.note.bad { color: var(--bad); }

/* boxes */
.box-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px 24px; align-items: center; }
@media (min-width: 560px) { .box-row { grid-template-columns: 150px minmax(0, 1fr); } }
.box-art { width: 150px; height: auto; justify-self: center; }
.box-info .note { margin: 6px 0 0; }
.qty { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 16px; }
.qty > button:not(.primary) { width: 44px; padding: 0; font-size: 1.1rem; letter-spacing: 0; }
.qty output { min-width: 2ch; font: 400 1.2rem var(--head); text-align: center; font-variant-numeric: tabular-nums; }
.qty .primary { flex: 1 1 200px; }
.reveal { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
body.home .reveal h3 { margin: 0 0 12px; color: var(--muted); font: 600 0.7rem var(--body); letter-spacing: 0.2em; text-transform: uppercase; }
.reveal-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.reveal-card { display: grid; gap: 6px; justify-items: center; margin: 0; padding: 10px 6px 12px; background: var(--bg); border: 1px solid var(--line); border-bottom: 2px solid var(--accent-line, var(--line)); border-radius: 2px; }
.reveal-card img { width: 100%; max-width: 92px; height: auto; aspect-ratio: 1; object-fit: contain; }
.reveal-card figcaption { color: var(--silver); font-size: 0.64rem; font-weight: 600; letter-spacing: 0.1em; text-align: center; text-transform: uppercase; }
.reveal-card.closed img { opacity: 0.55; }
.reveal-card.closed figcaption { color: var(--muted); }
@media (prefers-reduced-motion: no-preference) {
  .reveal-card.fresh { animation: reveal 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
  .reveal-card.fresh:nth-child(2) { animation-delay: 0.15s; }
  .reveal-card.fresh:nth-child(3) { animation-delay: 0.3s; }
  .reveal-card.fresh:nth-child(4) { animation-delay: 0.45s; }
  .reveal-card.closed img { animation: shake 1.4s ease-in-out infinite; }
}
@keyframes reveal { from { opacity: 0; transform: translateY(14px) scale(0.92) rotateY(80deg); } to { opacity: 1; transform: none; } }
@keyframes shake { 0%, 100% { transform: none; } 45% { transform: rotate(-2deg); } 55% { transform: rotate(2deg); } }

.quick { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
body.home .quick h3 { margin: 0 0 10px; color: var(--muted); font: 600 0.7rem var(--body); letter-spacing: 0.2em; text-transform: uppercase; }
.quick .post-text { font-size: 0.88rem; }
.quick .actions { margin-top: 10px; }

/* parts: kinds down, rarities across */
.parts-grid { display: grid; gap: 10px; }
.parts-row { display: grid; grid-template-columns: 74px repeat(4, minmax(0, 1fr)); gap: 8px; align-items: stretch; }
.parts-kind { align-self: center; color: var(--muted); font-size: 0.66rem; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; }
.part-cell { position: relative; display: grid; justify-items: center; gap: 2px; min-height: 0; padding: 8px 4px 9px; border: 1px solid var(--line); border-bottom: 2px solid var(--accent-line); background: var(--bg); text-transform: none; letter-spacing: 0; }
.part-cell img { width: 100%; max-width: 76px; height: auto; aspect-ratio: 1; object-fit: contain; }
.part-cell .part-count { color: var(--ink); font: 400 0.9rem var(--head); font-variant-numeric: tabular-nums; }
.part-cell .part-rarity { color: var(--muted); font-size: 0.58rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; }
.part-cell:disabled { opacity: 0.3; }
@media (max-width: 520px) { .parts-row { grid-template-columns: repeat(4, minmax(0, 1fr)); } .parts-kind { grid-column: 1 / -1; } .part-cell .part-rarity { display: none; } }

/* slot levels: one bar per slot, grouped by kind, filled to its level out of 5 */
.levels { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px 14px; margin: 14px 0 0; }
.level-group { display: grid; gap: 6px; min-width: 0; }
.level-kind { color: var(--muted); font-size: 0.6rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; }
.level-bars { display: flex; gap: 4px; }
.level-bars i, .mini-levels i { position: relative; flex: 1; height: 26px; background: var(--meter-track); }
.level-bars i::after, .mini-levels i::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: calc(var(--level) * 20%); background: var(--meter); }

/* build */
.build-row { display: grid; gap: 16px 32px; align-items: center; }
@media (min-width: 760px) { .build-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); } }
.build-art { padding-bottom: 6px; border-bottom: 2px solid var(--accent-line); }
.build-art img { display: block; width: 100%; height: auto; }
.build-class { margin: 6px 0 0; font: 400 1.3rem var(--head); letter-spacing: 0.08em; text-transform: uppercase; }
.build-info .primary { margin-top: 18px; }

/* cars */
.car-list { display: grid; gap: clamp(12px, 1.6vw, 18px); margin: 0 0 clamp(14px, 2vw, 22px); padding: 0; list-style: none; }
@media (min-width: 900px) { .car-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.car-item { display: grid; grid-template-columns: minmax(0, 1fr); background: var(--panel); border: 1px solid var(--line); border-radius: 2px; }
@media (min-width: 560px) { .car-item { grid-template-columns: 42% minmax(0, 1fr); } }
.car-item-art { display: flex; align-items: center; justify-content: center; padding: 10px; border-bottom: 2px solid var(--accent-line); }
@media (min-width: 560px) { .car-item-art { border-bottom: 0; border-right: 2px solid var(--accent-line); } }
.car-item-art img { display: block; width: 100%; height: auto; }
.car-item-body { padding: 16px 18px 18px; min-width: 0; }
.car-item-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
body.home .car-item-head h3 { margin: 0; font: 400 1.05rem var(--head); letter-spacing: 0.06em; }
.car-class { color: var(--accent-line); font-size: 0.68rem; font-weight: 600; letter-spacing: 0.18em; text-transform: uppercase; }
.car-item .note { margin: 6px 0 0; }
.car-item .actions { margin-top: 14px; }
.car-item .actions button { flex: 1 1 auto; padding: 10px 12px; }

/* earnings */
.earn-rows { display: grid; gap: 0; }
.earn-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.earn-row:last-child { border-bottom: 0; }
.earn-row span { color: var(--silver); }

/* the action sheet */
.sheet { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; padding: 0; background: rgba(5, 5, 6, 0.72); }
@media (min-width: 700px) { .sheet { align-items: center; padding: 24px; } }
.sheet-card { width: 100%; max-width: 680px; max-height: 92vh; overflow-y: auto; padding: clamp(20px, 3vw, 30px); background: var(--panel); border: 1px solid var(--line-strong); border-radius: 2px; }
.sheet-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
body.home .sheet-head h3 { margin: 0; font: 400 1.05rem var(--head); letter-spacing: 0.08em; text-transform: uppercase; }
.sheet h4 { margin: 20px 0 10px; color: var(--muted); font-size: 0.7rem; font-weight: 600; letter-spacing: 0.2em; text-transform: uppercase; }
.sheet-fields { display: grid; gap: 12px; margin: 4px 0 10px; }
.field { display: grid; gap: 6px; }
.field span { color: var(--muted); font-size: 0.75rem; }
.sheet-summary { margin: 0; color: var(--silver); }
.sheet-cost { margin: 8px 0 0; font-weight: 600; }
.cmd { max-height: 210px; overflow: auto; font: 0.76rem/1.55 var(--mono) !important; }
.sheet .actions { margin-top: 10px; }
.sheet-here { margin-top: 6px; padding-top: 4px; border-top: 1px solid var(--line); }
.sheet .agent-fund { margin: 0 0 14px; }
.sheet .copy-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.sheet .copy-row code { flex: 1 1 200px; overflow-wrap: anywhere; font-size: 0.78rem; color: var(--silver); }
.sheet .copy-row button { min-height: 36px; padding: 8px 12px; }

/* market */
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 12px; }
.filters button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.filters .filter-gap { flex: 1 1 20px; }
.filters select { width: auto; min-width: 150px; }
.floor-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.floor-cell { display: grid; grid-template-columns: 42px minmax(0, 1fr); grid-template-rows: auto auto; column-gap: 10px; row-gap: 2px; align-items: center; padding: 8px 10px; background: var(--bg); border: 1px solid var(--line); border-left: 2px solid var(--accent-line); }
.floor-cell img { grid-row: 1 / 3; width: 42px; height: 42px; object-fit: contain; }
.floor-name { align-self: end; color: var(--muted); font-size: 0.6rem; font-weight: 600; line-height: 1.25; letter-spacing: 0.08em; text-transform: uppercase; }
.floor-cell b { align-self: start; font-size: 0.8rem; font-weight: 500; white-space: nowrap; font-variant-numeric: tabular-nums; }
.listing-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); gap: clamp(10px, 1.4vw, 16px); margin: 0; padding: 0; list-style: none; }
.listing { display: flex; flex-direction: column; padding: 14px 16px 16px; background: var(--panel); border: 1px solid var(--line); border-top: 2px solid var(--accent-line, var(--line)); border-radius: 2px; }
.listing-art { display: block; width: 100%; height: auto; margin: 0 auto 8px; }
.listing-art.part { max-width: 150px; aspect-ratio: 1; object-fit: contain; }
body.home .listing h3 { margin: 0; font: 400 0.86rem/1.4 var(--head); letter-spacing: 0.06em; text-transform: uppercase; }
.listing .note { margin: 4px 0 0; }
.listing-price { margin: 12px 0 0; font: 400 1.15rem var(--head); letter-spacing: 0.02em; }
.listing .actions { margin-top: auto; padding-top: 12px; }
.listing .actions button { flex: 1; }
.mini-levels { display: flex; gap: 3px; margin-top: 10px; }
.mini-levels i { height: 18px; }
.mini-levels i[data-kind="1"] { margin-left: 0; }

/* races */
.stage-panel canvas { border: 1px solid var(--line); }
body.home .stage-panel h2 { margin: 0 0 10px; color: var(--muted); font: 600 0.72rem/1.3 var(--body); letter-spacing: 0.2em; text-transform: uppercase; }
.stage-panel .hud strong { font: 400 0.92rem var(--head); letter-spacing: 0.08em; text-transform: uppercase; }
.result-list { display: grid; gap: 10px; margin: 0 0 clamp(14px, 2vw, 22px); padding: 0; list-style: none; }
.result { padding: 14px 18px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 2px; }
body.home .result h3 { margin: 0; font: 400 0.86rem/1.4 var(--head); letter-spacing: 0.06em; text-transform: uppercase; }
.result .note { margin: 4px 0 0; }
.result .actions { margin-top: 10px; }
.result .actions button { padding: 9px 12px; font-size: 0.7rem; }
.top-board { padding: 6px 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 2px; }
