/* ============================================================
   CARDZY — COMPONENT LIBRARY  ("Studs & Sorbet")
   Depends on tokens.css
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: var(--lh-base);
  color: var(--ink);
  background: var(--vanilla);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1,h2,h3,h4,h5 { font-family: var(--font-display); font-weight: var(--fw-semibold); margin: 0; letter-spacing: -.01em; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
::selection { background: var(--lemon); color: var(--ink); }

/* utility text-wrap */
.tw-pretty { text-wrap: pretty; }
.tw-balance { text-wrap: balance; }

/* ---------- LABEL (uppercase eyebrow) ---------- */
.lbl {
  font-family: var(--font-body);
  font-size: var(--fs-label);
  font-weight: var(--fw-bold);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

/* =========================================================
   BUTTONS
   ========================================================= */
.btn {
  --bg: var(--coral); --fg: #fff; --sh: var(--coral-deep);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font-body);
  font-weight: var(--fw-bold);
  font-size: var(--fs-base);
  line-height: 1;
  padding: 13px 20px;
  color: var(--fg);
  background: var(--bg);
  border: var(--bw) solid var(--ink);
  border-radius: var(--r-md);
  box-shadow: 3px 3px 0 var(--ink);
  transition: transform var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
  white-space: nowrap;
  user-select: none;
}
.btn:hover { transform: translate(-1px,-1px); box-shadow: 4px 4px 0 var(--ink); }
.btn:active { transform: translate(2px,2px); box-shadow: 1px 1px 0 var(--ink); }
.btn:focus-visible { outline: 3px solid var(--lemon); outline-offset: 2px; }

.btn--secondary { --bg: var(--grass); --fg:#fff; }
.btn--lemon     { --bg: var(--lemon); --fg: var(--ink); }
.btn--grape     { --bg: var(--grape); --fg:#fff; }
.btn--blue      { --bg: var(--blueberry); --fg:#fff; }
.btn--danger    { --bg: var(--danger); --fg:#fff; }
.btn--ghost     { --bg: var(--paper); --fg: var(--ink); }
.btn--ink       { --bg: var(--ink); --fg:#fff; }

.btn--lg { padding: 16px 26px; font-size: var(--fs-lg); border-radius: var(--r-lg); }
.btn--sm { padding: 9px 14px; font-size: var(--fs-sm); box-shadow: 2px 2px 0 var(--ink); }
.btn--block { display: flex; width: 100%; }

.btn[disabled], .btn.is-disabled {
  --bg: #EAE0D4; --fg: var(--ink-faint);
  box-shadow: 3px 3px 0 #CFC4B6; border-color: #CFC4B6;
  cursor: not-allowed; pointer-events: none;
}

/* icon-only round button */
.iconbtn {
  display: inline-grid; place-items: center;
  width: 40px; height: 40px;
  background: var(--paper); color: var(--ink);
  border: var(--bw) solid var(--ink);
  border-radius: var(--r-pill);
  box-shadow: 2px 2px 0 var(--ink);
  transition: transform var(--t-fast), box-shadow var(--t-fast);
}
.iconbtn:hover { transform: translate(-1px,-1px); box-shadow: 3px 3px 0 var(--ink); }
.iconbtn:active { transform: translate(1px,1px); box-shadow: 1px 1px 0 var(--ink); }

/* =========================================================
   INPUTS
   ========================================================= */
.field { display: flex; flex-direction: column; gap: 7px; }
.field > .lbl { margin-bottom: 1px; }

.input, .select, .textarea {
  font-family: var(--font-body);
  font-size: var(--fs-base);
  color: var(--ink);
  background: var(--paper);
  border: var(--bw) solid var(--ink);
  border-radius: var(--r-md);
  padding: 12px 14px;
  width: 100%;
  box-shadow: var(--sh-block-xs);
  transition: box-shadow var(--t-fast), border-color var(--t-fast);
}
.input::placeholder, .textarea::placeholder { color: var(--ink-faint); }
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--coral);
  box-shadow: 2px 2px 0 var(--coral);
}
.textarea { resize: vertical; min-height: 110px; line-height: 1.5; }
.input--err { border-color: var(--danger); box-shadow: 2px 2px 0 var(--danger); }
.field-hint { font-size: var(--fs-xs); color: var(--ink-faint); }
.field-err  { font-size: var(--fs-xs); color: var(--danger); font-weight: var(--fw-semibold); }

/* search input with leading icon */
.search {
  display: flex; align-items: center; gap: 10px;
  background: var(--paper);
  border: var(--bw) solid var(--ink);
  border-radius: var(--r-pill);
  padding: 11px 18px;
  box-shadow: var(--sh-block-xs);
}
.search input { border: none; outline: none; background: none; flex: 1; font-family: var(--font-body); font-size: var(--fs-base); color: var(--ink); }
.search input::placeholder { color: var(--ink-faint); }

/* stepper (qty) */
.stepper { display: inline-flex; align-items: center; border: var(--bw) solid var(--ink); border-radius: var(--r-md); overflow: hidden; box-shadow: var(--sh-block-xs); background: var(--paper); }
.stepper button { width: 40px; height: 42px; border: none; background: var(--paper); font-size: 20px; color: var(--ink); display: grid; place-items: center; }
.stepper button:hover { background: var(--cream); }
.stepper input { width: 48px; height: 42px; text-align: center; border: none; border-inline: var(--bw) solid var(--ink); font-family: var(--font-display); font-weight: 600; font-size: 16px; color: var(--ink); background: var(--paper); }

/* toggle */
.toggle { position: relative; width: 50px; height: 28px; border: var(--bw) solid var(--ink); border-radius: var(--r-pill); background: var(--paper); cursor: pointer; transition: background var(--t-fast); flex: none; }
.toggle::after { content:""; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: var(--ink); transition: transform var(--t-spring); }
.toggle.is-on { background: var(--grass); }
.toggle.is-on::after { transform: translateX(22px); background:#fff; }

/* =========================================================
   CHIPS / PILLS / TABS
   ========================================================= */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: var(--fs-sm); font-weight: var(--fw-semibold);
  padding: 7px 13px; border-radius: var(--r-pill);
  background: var(--paper); color: var(--ink);
  border: var(--bw) solid var(--ink);
  box-shadow: var(--sh-block-xs);
  transition: transform var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
  user-select: none;
}
.chip:hover { transform: translate(-1px,-1px); box-shadow: var(--sh-block); }
.chip.is-active { background: var(--ink); color: #fff; }
.chip.is-active.chip--coral { background: var(--coral); color:#fff; }
.chip.is-active.chip--grass { background: var(--grass); color:#fff; }
.chip--soft { border-color: var(--line-soft); box-shadow: none; background: var(--paper); }
.chip--soft:hover { transform: none; box-shadow: var(--sh-block-xs); }

/* pill-tab row */
.tabs { display: inline-flex; gap: 8px; flex-wrap: wrap; }
.tab {
  font-family: var(--font-body); font-weight: var(--fw-semibold); font-size: var(--fs-sm);
  padding: 9px 16px; border-radius: var(--r-pill);
  background: transparent; color: var(--ink-soft);
  border: var(--bw) solid transparent;
  display: inline-flex; align-items: center; gap: 7px;
}
.tab:hover { background: var(--cream); color: var(--ink); }
.tab.is-active { background: var(--paper); color: var(--ink); border-color: var(--ink); box-shadow: var(--sh-block-xs); }
.tab .count { font-size: 11px; background: var(--ink); color:#fff; border-radius: var(--r-pill); padding: 1px 7px; font-weight: 700; }
.tab.is-active .count { background: var(--coral); }

/* underline tabs (content sections) */
.utabs { display: flex; gap: 26px; border-bottom: var(--bw) solid var(--line-soft); }
.utab { padding: 12px 2px; font-weight: var(--fw-semibold); color: var(--ink-faint); border-bottom: 3px solid transparent; margin-bottom: -2px; transition: color var(--t-fast); }
.utab:hover { color: var(--ink); }
.utab.is-active { color: var(--ink); border-color: var(--coral); }

/* =========================================================
   BADGES (rarity / game / status)
   ========================================================= */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: var(--fs-xs); font-weight: var(--fw-bold);
  letter-spacing: .01em;
  padding: 4px 10px; border-radius: var(--r-pill);
  border: var(--bw) solid var(--ink);
  white-space: nowrap;
}
.badge--sm { font-size: 10.5px; padding: 3px 8px; }

/* rarity */
.rar-common    { background: var(--r-common-bg);    color:#374151; border:1.5px solid #D1D5DB; }
.rar-uncommon  { background: var(--r-uncommon-bg);  color:#1D4ED8; }
.rar-rare      { background: var(--r-rare-bg);      color:#6D28D9; }
.rar-epic      { background: var(--r-epic-bg);      color:#5B21B6; }
.rar-legendary { background: var(--r-legendary-bg); color:#92660A; }
.rar-mythic    { background: var(--r-mythic-bg);    color:#BE185D; }
.rar-divine    { background: linear-gradient(90deg,#FCE0E5,#FFF0CC,#E1E5FD); color: var(--ink); }

/* game-specific rarities */
.rar-ultra_rare { background:#ECE3FE; color:#5B21B6; border:1.5px solid #8B5CF6; }
.rar-godly      { background:#FEE2E2; color:#991B1B; border:1.5px solid #DC2626; }
.rar-ancient    { background:#FEF3C7; color:#78350F; border:1.5px solid #92400E; }
.rar-vintage    { background:#FEF3C7; color:#92400E; border:1.5px solid #B45309; }
.rar-chroma     { background:#CFFAFE; color:#0E7490; border:1.5px solid #06B6D4; }
.rar-golden     { background:#FFF7CC; color:#B45309; border:1.5px solid #F59E0B; }
.rar-rainbow    { background:#FCE7F3; color:#BE185D; border:1.5px solid #EC4899; }
.rar-shiny      { background:#EDE9FE; color:#7C3AED; border:1.5px solid #A78BFA; }
.rar-huge       { background:#FEE2E2; color:#B91C1C; border:1.5px solid #EF4444; }
.rar-titanic    { background:#DBEAFE; color:#1E40AF; border:1.5px solid #3B82F6; }

/* game tags */
.game-adoptme { background: var(--g-adoptme-bg); color: var(--g-adoptme); }
.game-grow    { background: var(--g-grow-bg);    color: var(--g-grow); }
.game-mm2     { background: var(--g-mm2-bg);     color: var(--g-mm2); }
.game-blade   { background: var(--g-blade-bg);   color: var(--g-blade); }
.game-blox    { background: var(--g-blox-bg);    color: var(--g-blox); }
.game-petsim  { background: var(--g-petsim-bg);  color: var(--g-petsim); }

/* status-pill (with dot) */
.status { display: inline-flex; align-items: center; gap: 7px; font-size: var(--fs-xs); font-weight: var(--fw-bold); padding: 5px 11px 5px 9px; border-radius: var(--r-pill); border: var(--bw) solid var(--ink); }
.status .dot { width: 8px; height: 8px; border-radius: 50%; box-shadow: 0 0 0 2px rgba(255,255,255,.6); }
.status--ok    { background: var(--success-bg); color:#1F6B4A; } .status--ok .dot{ background: var(--success); }
.status--wait  { background: var(--warning-bg); color:#92660A; } .status--wait .dot{ background: var(--warning); }
.status--live  { background: var(--status-live-bg); color: var(--coral-deep); } .status--live .dot{ background: var(--coral); animation: pulse-dot 1.4s infinite; }
.status--err   { background: var(--danger-bg); color: var(--danger-deep); } .status--err .dot{ background: var(--danger); }
.status--info  { background: var(--info-bg); color: var(--info); } .status--info .dot{ background: var(--info); }
.status--muted { background: #EFE7DD; color: var(--ink-soft); } .status--muted .dot{ background: var(--ink-faint); }

@keyframes pulse-dot { 0%,100%{ box-shadow: 0 0 0 2px rgba(255,255,255,.6), 0 0 0 0 rgba(255,122,89,.5);} 50%{ box-shadow: 0 0 0 2px rgba(255,255,255,.6), 0 0 0 6px rgba(255,122,89,0);} }

/* =========================================================
   CARDS / SURFACES
   ========================================================= */
.card {
  background: var(--paper);
  border: var(--bw) solid var(--ink);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-block);
}
.card--soft { box-shadow: var(--sh-soft); border: var(--border-soft); }
.card--flat { box-shadow: none; }
.card-pad { padding: var(--sp-6); }

/* item card (marketplace) */
/* ═══════════════════════════════════════════════════════
   ITEM CARD — redesign wg mockupu
   ═══════════════════════════════════════════════════════ */
.item-card {
  background: var(--paper);
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  border: 1.5px solid var(--line-soft);
  box-shadow: 0 1px 4px rgba(36,27,22,.05);
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
  /* Stała wysokość — żadne tagi/nazwy nie mogą jej zmienić */
}
.item-card:hover {
  transform: translateY(-3px);
  border-color: var(--ink);
  box-shadow: 0 10px 26px rgba(36,27,22,.12);
}

/* ── Sekcja zdjęcia ── */
.item-thumb {
  position: relative;
  aspect-ratio: 1/1;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #F8F3EC;
  border-bottom: 1.5px solid var(--line-soft);
}
/* Delikatny radialny gradient (jaśniejszy środek) */
.item-thumb::after {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 50% 40%, rgba(255,255,255,.55) 0%, transparent 70%);
  pointer-events: none; z-index: 1;
}
/* Obrazki w karcie — styl nadpisywany przez Thumb inline, to jest fallback */
.item-thumb img {
  width: 88%; height: 88%;
  object-fit: contain;
  /* Bez drop-shadow — filtr CSS rozmywa obraz przy scalingu */
  position: relative; z-index: 2;
  image-rendering: auto;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  transform: translateZ(0);
}

/* Badge gry — lewy-góra */
.item-thumb .game-tag { position: absolute; top: 9px; left: 9px; z-index: 4; }
/* Serce — prawy-góra */
.item-thumb .fav       { position: absolute; top: 9px; right: 9px; z-index: 4; }

/* Mini-mody (M N F R) — lewy-dół zdjęcia, zawsze widoczne */
.item-mods-mini {
  position: absolute; bottom: 8px; left: 8px; z-index: 4;
  display: flex; flex-direction: row; gap: 3px;
  align-items: center;
}
.mod-mini {
  width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 11px; font-weight: 800; line-height: 1;
  border: 1.5px solid; box-shadow: 0 1px 4px rgba(0,0,0,.18);
}

/* Liczba ofert — prawy-dół zdjęcia */
.item-offers-chip {
  position: absolute; bottom: 8px; right: 9px; z-index: 4;
  background: rgba(255,255,255,.92); backdrop-filter: blur(4px);
  color: var(--ink); border: 1.5px solid var(--line-soft); border-radius: 999px;
  font-size: 10px; font-weight: 800; padding: 2.5px 8px;
}

/* ── Dolna sekcja ── kompaktowa, stała wysokość */
.item-body {
  padding: 10px 13px 12px;
  display: flex; flex-direction: column;
  gap: 3px;
  flex-shrink: 0;
}

/* Meta: rzadkość (kolorowa kropka) + wiek — 1 linia, stała wysokość */
.item-meta {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  height: 16px; overflow: hidden;
}
.item-rar {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10px; font-weight: 800; letter-spacing: .06em;
  text-transform: uppercase; color: var(--ink-soft);
  white-space: nowrap; min-width: 0;
}
.item-rar i {
  width: 8px; height: 8px; border-radius: 50%; flex: none;
  border: 1px solid rgba(36,27,22,.25);
}
.item-age-txt {
  font-size: 10.5px; font-weight: 600; color: var(--ink-faint);
  text-transform: lowercase; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
/* Wiek peta — własna linia nad rzadkością, delikatna czcionka */
.item-age-top {
  font-size: 10.5px; font-weight: 600; color: var(--ink-faint);
  text-transform: lowercase; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
  line-height: 1.1; margin-bottom: 3px;
}

/* Nazwa — 2 linie, stała wysokość, bold */
.item-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  line-height: 1.25;
  height: 2.5em;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--ink);
  margin: 0;
}

/* Tagi usunięte z body */
.item-tags { display: none; }

/* Stopka — cena lewa, koszyk prawy, oddzielona hairline */
.item-foot {
  display: flex; align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-top: 8px;
  padding-top: 9px;
  border-top: 1px solid var(--line-soft);
  flex-shrink: 0;
}
.item-price-wrap { display: flex; align-items: baseline; gap: 4px; min-width: 0; }
.item-from { font-size: 11px; font-weight: 600; color: var(--ink-faint); flex: none; }

/* Przycisk koszyka — ZAWSZE koralowy, zawsze widoczny, ikona koszyka */
.item-buy {
  flex-shrink: 0;
  width: 36px; height: 36px;
  border-radius: 12px;
  border: none;
  background: var(--coral);
  color: #fff;
  display: grid; place-items: center;
  box-shadow: 0 3px 0 var(--coral-deep), 0 2px 8px rgba(232,114,74,.3);
  transition: transform 120ms ease, box-shadow 120ms ease;
  cursor: pointer;
}
.item-buy:hover { transform: translateY(-1px); box-shadow: 0 5px 0 var(--coral-deep), 0 4px 12px rgba(232,114,74,.35); }
.item-buy:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--coral-deep); }

/* Mobile */
@media (hover: none) { .item-buy { opacity: 1; } }
.price { font-family: var(--font-display); font-weight: 600; font-size: var(--fs-price); color: var(--ink); }
.price .cur { font-size: 12px; color: var(--ink-soft); font-weight: 600; }

/* heart fav */
.fav { width: 30px; height: 30px; border-radius: 50%; background: rgba(255,255,255,.92); border: var(--bw) solid var(--ink); display: grid; place-items: center; font-size: 13px; color: var(--ink); transition: transform var(--t-fast), background var(--t-fast); }
.fav:hover { transform: scale(1.08); }
.fav.is-on { background: var(--bubble); color:#fff; }

/* feature/icon tile */
.itile { width: 44px; height: 44px; border-radius: var(--r-md); display: grid; place-items: center; border: var(--bw) solid var(--ink); flex: none; }
.itile--coral { background: var(--coral-tint); } .itile--grass { background: var(--grass-tint); }
.itile--blue  { background: var(--blueberry-tint); } .itile--lemon { background: var(--lemon-tint); }
.itile--grape { background: var(--grape-tint); } .itile--bubble { background: var(--bubble-tint); }

/* studs strip (signature roblox motif) */
.studs { display: flex; gap: 8px; align-items: center; }
.studs .stud { width: 10px; height: 10px; border-radius: 50%; background: var(--ink); opacity: .18; }
.studs--lemon .stud { background: var(--lemon-deep); opacity: 1; }

/* =========================================================
   AVATAR / RATING / TOOLTIP
   ========================================================= */
.avatar { display: inline-grid; place-items: center; border-radius: 50%; border: var(--bw) solid var(--ink); font-family: var(--font-display); font-weight: 600; color:#fff; overflow: hidden; flex: none; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar--sm { width: 32px; height: 32px; font-size: 14px; }
.avatar--md { width: 42px; height: 42px; font-size: 17px; }
.avatar--lg { width: 56px; height: 56px; font-size: 22px; }
.avatar .on-dot { position: absolute; }

.stars { display: inline-flex; align-items: center; gap: 2px; color: var(--lemon-deep); font-size: 13px; }
.stars .num { color: var(--ink-soft); font-size: var(--fs-xs); font-weight: 700; margin-left: 4px; }

.tip { position: relative; display: inline-flex; }
.tip__bub { position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%); background: var(--ink); color:#fff; font-size: var(--fs-xs); font-weight: 600; padding: 6px 10px; border-radius: var(--r-sm); white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity var(--t-fast); box-shadow: var(--sh-soft); }
.tip__bub::after { content:""; position: absolute; top: 100%; left: 50%; transform: translateX(-50%); border: 5px solid transparent; border-top-color: var(--ink); }
.tip:hover .tip__bub { opacity: 1; }

/* =========================================================
   TIMELINE (escrow steps)
   ========================================================= */
.timeline { display: flex; flex-direction: column; gap: 0; }
.tl-step { display: flex; gap: 14px; position: relative; padding-bottom: 22px; }
.tl-step:last-child { padding-bottom: 0; }
.tl-step::before { content:""; position: absolute; left: 17px; top: 36px; bottom: 0; width: 2.5px; background: var(--line-soft); }
.tl-step:last-child::before { display: none; }
.tl-step.is-done::before { background: var(--grass); }
.tl-node { width: 36px; height: 36px; flex: none; border-radius: 50%; border: var(--bw) solid var(--ink); display: grid; place-items: center; font-family: var(--font-display); font-weight: 700; font-size: 15px; background: var(--paper); color: var(--ink-faint); z-index: 1; }
.tl-step.is-done .tl-node { background: var(--grass); color:#fff; }
.tl-step.is-active .tl-node { background: var(--coral); color:#fff; box-shadow: 0 0 0 4px var(--coral-tint); animation: pulse-node 1.6s infinite; }
.tl-body { padding-top: 5px; }
.tl-title { font-family: var(--font-display); font-weight: 600; font-size: var(--fs-h4); }
.tl-sub { font-size: var(--fs-sm); color: var(--ink-soft); margin-top: 2px; }
@keyframes pulse-node { 0%,100%{ box-shadow: 0 0 0 4px var(--coral-tint);} 50%{ box-shadow: 0 0 0 8px rgba(255,122,89,.12);} }

/* horizontal step bar */
.hsteps { display: flex; gap: 10px; }
.hstep { flex: 1; text-align: center; }
.hstep .hnode { width: 46px; height: 46px; margin: 0 auto 8px; border-radius: var(--r-md); border: var(--bw) solid var(--ink); display: grid; place-items: center; font-size: 22px; background: var(--paper); box-shadow: var(--sh-block-xs); }
.hstep.is-done .hnode { background: var(--grass-tint); }
.hstep .hlbl { font-size: 10px; font-weight: 800; letter-spacing: .08em; color: var(--ink-faint); text-transform: uppercase; }
.hstep .htitle { font-size: var(--fs-sm); font-weight: 700; margin-top: 2px; }

/* =========================================================
   MODAL / TOAST / DRAWER
   ========================================================= */
.overlay { position: fixed; inset: 0; background: rgba(36,27,22,.42); backdrop-filter: blur(2px); display: grid; place-items: center; padding: 24px; z-index: 200; animation: fade .16s ease; }
@keyframes fade { from{opacity:0} to{opacity:1} }
.modal { background: var(--paper); border: var(--bw-thick) solid var(--ink); border-radius: var(--r-2xl); box-shadow: var(--sh-block-lg); width: 100%; max-width: 480px; overflow: hidden; animation: pop .26s cubic-bezier(.34,1.56,.64,1); }
@keyframes pop { from{ transform: translateY(10px) scale(.97); opacity:0 } to{ transform: none; opacity:1 } }
.modal-head { padding: 20px 24px; border-bottom: var(--bw) solid var(--line-soft); display: flex; align-items: center; justify-content: space-between; }
.modal-body { padding: 24px; }
.modal-foot { padding: 16px 24px; border-top: var(--bw) solid var(--line-soft); display: flex; gap: 10px; justify-content: flex-end; }

.toast { display: flex; align-items: center; gap: 12px; background: var(--paper); border: var(--bw) solid var(--ink); border-radius: var(--r-md); box-shadow: var(--sh-block); padding: 13px 16px; max-width: 360px; animation: toast-in .3s cubic-bezier(.34,1.56,.64,1); }
.toast .ticon { width: 34px; height: 34px; border-radius: var(--r-sm); display: grid; place-items: center; flex: none; border: var(--bw) solid var(--ink); }
@keyframes toast-in { from{ transform: translateX(20px); opacity:0 } to{ transform:none; opacity:1 } }

/* =========================================================
   BANNERS / NOTICES
   ========================================================= */
.notice { display: flex; gap: 12px; padding: 14px 16px; border-radius: var(--r-md); border: var(--bw) solid var(--ink); font-size: var(--fs-sm); align-items: flex-start; }
.notice--info { background: var(--info-bg); }
.notice--ok { background: var(--success-bg); }
.notice--warn { background: var(--warning-bg); }
.notice--err { background: var(--danger-bg); }

/* progress bar */
.bar { height: 12px; background: var(--cream); border: var(--bw) solid var(--ink); border-radius: var(--r-pill); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--lemon); border-right: var(--bw) solid var(--ink); }

/* =========================================================
   SKELETON (loading)
   ========================================================= */
.sk { background: linear-gradient(100deg, #EFE6DA 30%, #F8F1E8 50%, #EFE6DA 70%); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: var(--r-sm); }
@keyframes sk { from{ background-position: 200% 0 } to{ background-position: -200% 0 } }

/* =========================================================
   HELPERS
   ========================================================= */
.row { display: flex; align-items: center; }
.col { display: flex; flex-direction: column; }
.gap-1{gap:4px}.gap-2{gap:8px}.gap-3{gap:12px}.gap-4{gap:16px}.gap-5{gap:20px}.gap-6{gap:24px}
.between { justify-content: space-between; }
.center { align-items: center; justify-content: center; }
.wrap { flex-wrap: wrap; }
.muted { color: var(--ink-soft); }
.faint { color: var(--ink-faint); }
.mono { font-family: var(--font-mono); }
.grow { flex: 1; }

/* =========================================================
   DARK THEME — component fixes
   (--ink flips to cream, so high-contrast spots need dark text)
   ========================================================= */
[data-theme="dark"] .chip.is-active:not(.chip--coral):not(.chip--grass) { color: var(--vanilla); }
[data-theme="dark"] .tab .count { color: var(--vanilla); }
[data-theme="dark"] .tab.is-active .count { color: #fff; }
[data-theme="dark"] .btn--ink { --fg: var(--vanilla); }
[data-theme="dark"] .badge.rar-divine { color: var(--vanilla); }

/* notices → dark translucent so cream body text reads */
[data-theme="dark"] .notice--info { background: rgba(108,124,240,.16); }
[data-theme="dark"] .notice--ok   { background: rgba(93,187,142,.16); }
[data-theme="dark"] .notice--warn { background: rgba(255,201,77,.15); }
[data-theme="dark"] .notice--err  { background: rgba(229,72,77,.18); }

/* skeleton shimmer for dark */
[data-theme="dark"] .sk { background: linear-gradient(100deg,#2E2519 30%,#3A2F22 50%,#2E2519 70%); background-size:200% 100%; }

/* keep light pastel chips/badges readable — they already carry dark text */
[data-theme="dark"] .status--ok   { color:#1F6B4A; }
[data-theme="dark"] .status--wait { color:#92660A; }
[data-theme="dark"] .status--err  { color: var(--danger-deep); }

/* theme toggle */
.theme-toggle { display:inline-grid; place-items:center; width:40px; height:40px; border-radius:var(--r-pill); border:var(--bw) solid var(--ink); background:var(--paper); color:var(--ink); box-shadow:2px 2px 0 var(--ink); cursor:pointer; font-size:17px; transition: transform var(--t-fast); }
.theme-toggle:hover { transform: translate(-1px,-1px); box-shadow:3px 3px 0 var(--ink); }
.theme-toggle:active { transform: translate(1px,1px); box-shadow:1px 1px 0 var(--ink); }
