/* ============================================================
   SKINRUSH — PREMIUM POLISH LAYER
   Loaded LAST (after styles.css + ssr.css). Purely additive:
   refines depth, light, motion and touch. No layout is moved,
   nothing here changes element box sizes on desktop — every
   rule adds shadow / sheen / easing / focus, so it can be
   removed with zero regressions. Reuses existing :root tokens.
   ============================================================ */
:root {
  /* layered elevation — soft ambient + tight contact shadow */
  --sh-1: 0 1px 2px rgba(0,0,0,.4);
  --sh-2: 0 4px 10px rgba(0,0,0,.35), 0 1px 2px rgba(0,0,0,.45);
  --sh-3: 0 12px 28px rgba(0,0,0,.45), 0 3px 8px rgba(0,0,0,.4);
  --sh-4: 0 24px 60px rgba(0,0,0,.55), 0 6px 16px rgba(0,0,0,.45);
  /* a hairline of light along the top edge — the single biggest
     "expensive glass" tell on dark UIs */
  --edge: inset 0 1px 0 rgba(255,255,255,.06);
  --edge-strong: inset 0 1px 0 rgba(255,255,255,.10);
  /* one shared easing so every motion on the site feels related */
  --ease: cubic-bezier(.22,.61,.36,1);
  --ease-out: cubic-bezier(.16,1,.3,1);
}

/* ---------- global finishing ---------- */
html { -webkit-text-size-adjust: 100%; }
body { text-rendering: optimizeLegibility; }

::selection { background: rgba(245,176,39,.35); color: #fff; }

/* headings sit tighter and brighter — reads as intentional type */
.section-title, .panel__title, .bonus-card__title, .case-hero__title {
  letter-spacing: -.01em;
}
.section-title, .panel__title {
  background: linear-gradient(180deg, #ffffff, #c8ccda);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* thin, themed scrollbars (desktop) */
* { scrollbar-width: thin; scrollbar-color: #2a3042 transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #2c3345, #1c2130);
  border-radius: 20px; border: 2px solid transparent; background-clip: padding-box;
}
*::-webkit-scrollbar-thumb:hover { background: #363d52; background-clip: padding-box; }

/* keyboard focus is visible and on-brand everywhere */
a:focus-visible, button:focus-visible, input:focus-visible,
summary:focus-visible, .btn:focus-visible {
  outline: 2px solid var(--violet-2);
  outline-offset: 2px;
  border-radius: 8px;
}

/* ---------- header: deeper glass, luminous underline ---------- */
.header {
  background: rgba(8,9,15,.72);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  backdrop-filter: blur(18px) saturate(140%);
  border-bottom: 1px solid transparent;
  box-shadow: var(--sh-2);
}
.header::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(245,176,39,.45), rgba(45,212,191,.35), transparent);
  opacity: .7; pointer-events: none;
}
.header { position: sticky; }

.logo-img { transition: transform .3s var(--ease-out), filter .3s var(--ease); }
.logo:hover .logo-img { transform: translateY(-1px) scale(1.02); filter: drop-shadow(0 4px 14px rgba(245,176,39,.4)); }

/* ---------- buttons: sheen + real depth + lift ---------- */
.btn {
  position: relative; overflow: hidden;
  box-shadow: var(--sh-2), var(--edge);
  transition: transform .16s var(--ease), box-shadow .25s var(--ease), filter .2s var(--ease);
}
/* top-edge sheen so the fill looks lit, not painted */
.btn::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,.22), rgba(255,255,255,0) 42%);
  pointer-events: none;
}
/* moving shine on hover */
.btn::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: -60%; width: 45%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.35), transparent);
  transform: skewX(-18deg); opacity: 0; pointer-events: none;
}
.btn:hover { transform: translateY(-2px); }
.btn:hover::after { animation: btn-shine .7s var(--ease-out); }
.btn:active { transform: translateY(0) scale(.985); box-shadow: var(--sh-1), var(--edge); }
@keyframes btn-shine { 0% { left: -60%; opacity: 0; } 15% { opacity: 1; } 100% { left: 130%; opacity: 0; } }

.btn--login { box-shadow: 0 8px 22px rgba(34,197,94,.4), var(--edge-strong); }
.btn--login:hover { box-shadow: 0 12px 30px rgba(34,197,94,.5), var(--edge-strong); }
.btn--teal { box-shadow: 0 8px 22px rgba(45,212,191,.38), var(--edge-strong); }
.btn--teal:hover { box-shadow: 0 12px 30px rgba(45,212,191,.48), var(--edge-strong); }
.btn--gold { box-shadow: 0 8px 22px rgba(245,176,39,.38), var(--edge-strong); }
.btn--gold:hover { box-shadow: 0 12px 30px rgba(245,176,39,.48), var(--edge-strong); }
.btn--outline { box-shadow: none; }
.btn--outline::before { opacity: .4; }
.btn--outline:hover { box-shadow: 0 8px 20px rgba(245,176,39,.18); }

/* ---------- panels: elevation + lit top edge + inner glow ---------- */
.panel, .bonus-card {
  box-shadow: var(--sh-3), var(--edge);
  border-color: rgba(255,255,255,.06);
  transition: box-shadow .35s var(--ease), transform .35s var(--ease-out), border-color .35s var(--ease);
}
.panel:hover, .bonus-card:hover {
  box-shadow: var(--sh-4), var(--edge-strong);
  border-color: rgba(255,255,255,.10);
}
.panel__icon--svg {
  box-shadow: inset 0 0 0 1px rgba(245,176,39,.3), 0 6px 16px rgba(245,176,39,.22);
}

/* daily day tiles: soft depth, brighter claimable state */
.day { transition: transform .2s var(--ease), box-shadow .25s var(--ease), border-color .2s var(--ease); box-shadow: var(--edge); }
.day--special {
  border-color: rgba(245,176,39,.4);
  box-shadow: var(--edge-strong), 0 0 24px rgba(245,176,39,.12) inset;
}
.day:not(.day--locked):hover { transform: translateY(-2px); box-shadow: var(--sh-2), var(--edge-strong); }

/* task rows lift on hover */
.task { transition: background .2s var(--ease), transform .18s var(--ease); }
.task:hover { transform: translateX(2px); }

/* ---------- stat tiles ---------- */
.stat { transition: transform .25s var(--ease-out); }
.stat--icon:hover { transform: translateY(-2px); }
.stat__badge { transition: transform .25s var(--ease-out), box-shadow .25s var(--ease); }
.stat--icon:hover .stat__badge { transform: scale(1.06); }

/* numbers get a subtle glow that matches their gradient */
.grad-gold, .grad-violet, .grad-blue, .grad-green, .grad-teal, .grad-orange, .grad-pink {
  filter: drop-shadow(0 0 14px rgba(255,255,255,.06));
}

/* ---------- nav underline grows from center ---------- */
.nav__item::after {
  content: ""; position: absolute; left: 50%; right: 50%; bottom: 0; height: 2px;
  background: linear-gradient(90deg, var(--violet), var(--pink));
  border-radius: 2px; transition: left .25s var(--ease-out), right .25s var(--ease-out);
}
.nav__item:hover::after { left: 20%; right: 20%; }
.nav__item.is-active::after { left: 0; right: 0; box-shadow: 0 0 12px rgba(245,176,39,.6); }

/* ---------- case tiles: cinematic hover ---------- */
.case {
  transition: transform .28s var(--ease-out), box-shadow .3s var(--ease), border-color .25s var(--ease);
  /* thin frosted-glass hairline: translucent white edge + top light catch */
  border: 1px solid rgba(255,255,255,.12);
  box-shadow: var(--sh-2), var(--edge);
}
.case:hover {
  /* no coloured ring — just lift a little and grow slightly */
  transform: translateY(-4px) scale(1.03);
  border-color: rgba(255,255,255,.22);
  box-shadow: 0 22px 46px rgba(0,0,0,.55), var(--edge);
}
.case:hover .case__img { transform: scale(1.06); transition: transform .5s var(--ease-out); }
/* sheen sweeps across the art on hover */
.case__art::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(115deg, transparent 40%, rgba(255,255,255,.10) 50%, transparent 60%);
  transform: translateX(-100%); transition: transform .6s var(--ease-out); pointer-events: none;
}
.case:hover .case__art::after { transform: translateX(100%); }

.pill { transition: border-color .2s var(--ease), background .2s var(--ease); box-shadow: var(--edge); }

/* generic skin card (ss-card) gets the same lift language */
.ss-card { box-shadow: var(--sh-2), var(--edge); transition: transform .25s var(--ease-out), box-shadow .3s var(--ease); }
.ss-slot--pick:hover .ss-card { box-shadow: var(--sh-3), 0 0 22px color-mix(in srgb, var(--c, var(--violet)) 30%, transparent); }

/* ---------- live strip drop tiles ---------- */
.drop { transition: transform .2s var(--ease-out), box-shadow .25s var(--ease); }
.drop:hover { transform: translateY(-3px); box-shadow: 0 10px 22px rgba(0,0,0,.5), 0 0 0 1px var(--rc, var(--line)); }

/* ---------- user chip + coins pill ---------- */
.user-chip { transition: border-color .2s var(--ease), background .2s var(--ease), box-shadow .25s var(--ease); box-shadow: var(--edge); }
.user-chip:hover { box-shadow: var(--sh-2), var(--edge-strong); border-color: rgba(255,255,255,.12); }
.ss-coins-pill { box-shadow: var(--edge); }

/* ---------- dropdown menus float ---------- */
.ss-lang__menu, .ss-drawer__menu { box-shadow: var(--sh-4), var(--edge-strong); animation: menu-in .16s var(--ease-out); }
@keyframes menu-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* ---------- MOBILE bottom bar: premium glass + active pill ---------- */
@media (max-width: 820px) {
  .mbar {
    background: rgba(10,12,20,.78);
    -webkit-backdrop-filter: blur(22px) saturate(160%);
    backdrop-filter: blur(22px) saturate(160%);
    border-top: 1px solid transparent;
    box-shadow: 0 -10px 34px rgba(0,0,0,.5);
  }
  .mbar::before {
    content: ""; position: absolute; left: 0; right: 0; top: 0; height: 1px;
    background: linear-gradient(90deg, transparent, rgba(245,176,39,.5), rgba(45,212,191,.4), transparent);
  }
  .mbar__item, .mbar__center { position: relative; transition: color .2s var(--ease); }
  .mbar__ic svg { transition: transform .2s var(--ease-out); }
  .mbar__item.is-active .mbar__ic svg { transform: translateY(-1px) scale(1.08); }
  .mbar__center-btn { box-shadow: 0 6px 18px rgba(245,176,39,.45), var(--edge-strong); }

  /* bigger, comfier tap targets & spacing on phones */
  .btn { padding: 12px 20px; }
  .case__name { font-size: 13.5px; }
  .cases-grid { gap: 12px; }
  .section-title, .panel__title { font-size: 19px; }
  /* live-strip drop names never clip awkwardly */
  .drop__name { font-size: 10px; }
}

/* smaller phones: 1-col promo already handled; tighten stat text */
@media (max-width: 420px) {
  .stats--user .stat__num { font-size: 22px; }
  .stat__num { font-size: 24px; }
}

/* ---------- case detail hero ---------- */
.case-hero {
  box-shadow: var(--sh-3), var(--edge);
  border-color: rgba(255,255,255,.07);
}
.case-hero__art::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, transparent 55%, rgba(6,7,12,.5));
}
.case-hero__open {
  position: relative; overflow: hidden;
  box-shadow: 0 10px 26px rgba(0,145,255,.4), var(--edge-strong);
  transition: transform .16s var(--ease), box-shadow .25s var(--ease), filter .2s var(--ease);
}
.case-hero__open::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,.28), transparent 45%); pointer-events: none;
}
.case-hero__open:not(:disabled):hover { transform: translateY(-2px); box-shadow: 0 14px 34px rgba(0,145,255,.55), var(--edge-strong); }

/* ---------- inventory cards: lift + rarity glow ---------- */
.inv-card {
  box-shadow: var(--sh-2), var(--edge);
  transition: transform .24s var(--ease-out), box-shadow .3s var(--ease), border-color .25s var(--ease);
}
.inv-card:hover {
  transform: translateY(-4px);
  border-color: color-mix(in srgb, var(--rc) 60%, var(--line));
  box-shadow: var(--sh-3), 0 0 26px color-mix(in srgb, var(--rc) 32%, transparent);
}
.inv-card__art img { transition: transform .3s var(--ease-out); }
.inv-card:hover .inv-card__art img { transform: scale(1.06) translateY(-2px); }
.inv-card__sell { box-shadow: var(--sh-1), var(--edge); transition: transform .15s var(--ease), filter .2s var(--ease); }
.inv-card__sell:not(:disabled):hover { transform: translateY(-1px); }

/* ---------- reveal / modal ---------- */
.reveal-box { box-shadow: var(--sh-4), var(--edge-strong); }
.modal__actions .btn { min-width: 130px; }

/* ---------- battle "play again" and shared action buttons ---------- */
.battle-again { position: relative; overflow: hidden; box-shadow: var(--sh-2), var(--edge); transition: transform .16s var(--ease), box-shadow .25s var(--ease), filter .2s var(--ease); }
.battle-again:hover { transform: translateY(-2px); }

/* ---------- form inputs across the site get a soft focus ring ---------- */
.cases-search input:focus, .auth-field input:focus {
  box-shadow: 0 0 0 3px rgba(245,176,39,.16), var(--edge);
}

/* ---------- MOBILE: case page → fixed bottom "Open" action bar ----------
   On phones the Open + fast-open (skip) controls leave the hero and dock to
   the bottom as a fixed CTA bar, taking the bottom-nav's place. Open ~80%,
   skip ~20%, both full pills, glass background. Only fires where an
   .ss-openrow exists (the case detail page). */
@media (max-width: 820px) {
  /* the open bar replaces the bottom nav on this page */
  body:has(.ss-openrow) .mbar { display: none; }
  body:has(.ss-openrow) { padding-bottom: calc(92px + env(safe-area-inset-bottom)); }

  /* two free-floating buttons — no backing bar.
     NOTE: .ss-openrow is a <form>, so it also holds the hidden CSRF <input>.
     We give the row an explicit 56px height and ZERO vertical padding (the
     safe-area gap is applied via `bottom:` instead) so the flex line is
     exactly 56px and both 56px buttons centre on the same line. */
  .case-view .ss-openrow {
    position: fixed; left: 0; right: 0; z-index: 95;
    bottom: calc(12px + env(safe-area-inset-bottom));
    display: flex; align-items: center; gap: 2px;
    height: 56px; margin: 0; padding: 0 12px;
    background: none; box-shadow: none;
  }

  /* Open = ~85%, full pill, exactly the same height as the round skip.
     styles.css already turns .case-hero__open into a fixed bottom button on
     phones (position:fixed; left/right/bottom set). We now dock it INSIDE the
     .ss-openrow bar instead, so we must neutralise those leftover insets —
     otherwise the leaked `bottom:12px` on a relatively-positioned button
     shifts it 12px up and it stops aligning with the skip circle. */
  .case-view .ss-openrow .case-hero__open {
    position: relative; top: auto; right: auto; bottom: auto; left: auto;
    flex: 1 1 auto; min-width: 0; margin: 0; align-self: center;
    height: 56px; padding: 0 20px; border-radius: 999px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 18px; line-height: 1;
  }
  /* skip / fast-open = a perfect circle, on the same line as Open (~15%) */
  .case-view .ss-openrow .ss-fastopt {
    flex: 0 0 56px; align-self: center;
    height: 56px; display: inline-flex; align-items: center; justify-content: center;
  }
  .case-view .ss-openrow .ss-fastopt__dot {
    width: 56px; height: 56px; border-radius: 50%;
  }
  .case-view .ss-openrow .ss-fastopt__dot svg { width: 24px; height: 24px; }

  /* the hero no longer needs to reserve space for the buttons */
  .case-view .case-hero__panel { gap: 12px; }
}

/* ---------- honor reduced-motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important; animation-iteration-count: 1 !important;
    transition-duration: .001ms !important; scroll-behavior: auto !important;
  }
}
