/* ============================================================
   style.css — case-opening store page
   ============================================================ */

:root {
  --bg-0: #0a0b0f;
  --bg-1: #121319;
  --bg-2: #191b23;
  --panel: #15161d;
  --panel-border: #262838;
  --text-0: #eef0f6;
  --text-1: #9096ab;
  --text-2: #5c6178;
  --brand: #2ee6c8;
  --brand-dim: #1d9c88;
  --danger: #ef5163;

  --milspec: #4b69ff;
  --restricted: #8847ff;
  --classified: #d32ce6;
  --covert: #eb4b4b;
  --gold: #e4ae39;

  --radius-s: 6px;
  --radius-m: 10px;
  --radius-l: 16px;
  --font-display: 'Rajdhani', sans-serif;
  --font-body: 'Inter', sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  background:
    radial-gradient(1200px 600px at 15% -10%, #1a1e2c 0%, transparent 60%),
    radial-gradient(1000px 500px at 100% 0%, #17222a 0%, transparent 55%),
    var(--bg-0);
  color: var(--text-0);
  -webkit-font-smoothing: antialiased;
  min-height: 100%;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
img, svg { display: block; }

::selection { background: var(--brand); color: #04231e; }

.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 clamp(14px, 4vw, 24px);
}

/* ---------- Top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(10, 11, 15, 0.86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--panel-border);
  padding-top: env(safe-area-inset-top);
}
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 0;
  flex-wrap: wrap;
}
.brand {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: 0.02em;
}
.brand .dot { color: var(--brand); }
.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.balance-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.balance-chip .coin {
  width: 16px; height: 16px; border-radius: 50%;
  background: linear-gradient(145deg, var(--gold), #a67517);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.25);
}
.btn {
  border: 1px solid var(--panel-border);
  background: var(--panel);
  color: var(--text-0);
  padding: 9px 16px;
  border-radius: var(--radius-s);
  font-size: 14px;
  font-weight: 600;
  min-height: 40px;
  touch-action: manipulation;
  transition: border-color 0.15s ease, transform 0.1s ease;
}
.btn:hover { border-color: #3a3e52; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}
.btn-ghost { background: transparent; }
.btn-admin {
  border-color: var(--panel-border);
  color: var(--text-1);
  font-size: 13px;
}

/* ---------- Case selector ---------- */
.section-label {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.06em;
  color: var(--text-1);
  margin: 32px 0 14px;
}
.case-strip {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 6px;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
}
.case-pick {
  flex: 0 0 auto;
  width: 168px;
  scroll-snap-align: start;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-m);
  padding: 14px;
  text-align: left;
  color: var(--text-1);
  touch-action: manipulation;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.case-pick:hover { border-color: #3a3e52; }
.case-pick.active {
  border-color: var(--brand);
  background: linear-gradient(180deg, rgba(46,230,200,0.08), transparent);
  color: var(--text-0);
}
.case-pick .mini-crate { margin: 0 auto 10px; width: 54px; height: 40px; }
.case-pick .cp-name { font-weight: 600; font-size: 13.5px; line-height: 1.3; }
.case-pick .cp-price { font-size: 12px; margin-top: 4px; color: var(--gold); }

/* ---------- Hero case panel ---------- */
.hero {
  margin-top: 30px;
  background: linear-gradient(180deg, var(--bg-1), var(--bg-2));
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-l);
  padding: 46px 24px 34px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(420px 220px at 50% 0%, rgba(46,230,200,0.09), transparent 70%);
  pointer-events: none;
}
.hero-eyebrow { color: var(--text-2); font-size: 13px; }
.hero-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 30px;
  margin: 4px 0 26px;
}
.crate {
  width: 190px;
  height: 132px;
  margin: 0 auto 28px;
  position: relative;
}
.crate .box {
  position: absolute; inset: 0;
  border-radius: 10px;
  background: linear-gradient(155deg, #caa24a 0%, #8c6a20 45%, #6b4f16 100%);
  box-shadow: 0 18px 40px rgba(0,0,0,0.45), inset 0 0 0 1px rgba(255,255,255,0.15);
}
.crate .box::after {
  content: '';
  position: absolute; left: 10px; right: 10px; top: 10px; bottom: 10px;
  border: 1px solid rgba(0,0,0,0.25);
  border-radius: 6px;
}
.crate .plate {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 76px; height: 76px; border-radius: 50%;
  background: #14161d;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 4px rgba(0,0,0,0.2);
}
.crate .plate svg { width: 38px; height: 38px; }
.crate .lock {
  position: absolute; right: -6px; top: 38%;
  width: 26px; height: 26px;
}
@keyframes crate-shake {
  /* Intensity builds from a faint tremor to a hard rattle, so a longer
     unlock sound reads as mounting tension rather than the same quick
     shake played back in slow motion. */
  0%   { transform: translate(0, 0) rotate(0deg); }
  8%   { transform: translate(-1px, 0) rotate(-0.4deg); }
  16%  { transform: translate(1px, 0) rotate(0.4deg); }
  24%  { transform: translate(-1.5px, 1px) rotate(-0.7deg); }
  32%  { transform: translate(1.5px, -1px) rotate(0.7deg); }
  40%  { transform: translate(-2px, 1px) rotate(-1.1deg); }
  48%  { transform: translate(2px, -1px) rotate(1.1deg); }
  56%  { transform: translate(-3px, 1.5px) rotate(-1.8deg); }
  64%  { transform: translate(3px, -1.5px) rotate(1.8deg); }
  72%  { transform: translate(-4px, 2px) rotate(-2.6deg); }
  80%  { transform: translate(4px, -2px) rotate(2.6deg); }
  88%  { transform: translate(-5px, 2.5px) rotate(-3.4deg); }
  94%  { transform: translate(5px, -3px) rotate(3.4deg); }
  97%  { transform: translate(0, -1px) rotate(0deg) scale(1.05); }
  100% { transform: translate(0, 0) rotate(0deg) scale(1); }
}
@keyframes crate-glow {
  /* Glow rises gradually with the rattle, then flashes hard right at the
     end — the visual "click" of the lock releasing, timed to land with
     the tail of the unlock sound. */
  0%   { filter: drop-shadow(0 0 0 rgba(255, 205, 100, 0)); }
  60%  { filter: drop-shadow(0 0 10px rgba(255, 205, 100, 0.35)); }
  85%  { filter: drop-shadow(0 0 16px rgba(255, 205, 100, 0.55)); }
  95%  { filter: drop-shadow(0 0 36px rgba(255, 205, 100, 1)); }
  100% { filter: drop-shadow(0 0 6px rgba(255, 205, 100, 0.3)); }
}
.crate.shaking {
  animation: crate-shake var(--shake-duration, 0.65s) cubic-bezier(.3, 0, .7, 1),
             crate-glow var(--shake-duration, 0.65s) ease-in;
}
.crate-photo {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.mini-crate-photo {
  width: 54px; height: 40px; object-fit: cover; border-radius: 7px; display: block;
}
.hero-name { font-family: var(--font-display); font-size: 22px; font-weight: 600; }
.hero-price { color: var(--gold); font-weight: 600; margin-top: 6px; font-variant-numeric: tabular-nums; }
.hero-open {
  margin-top: 22px;
  background: linear-gradient(180deg, var(--brand), var(--brand-dim));
  color: #04231e;
  border: none;
  padding: 14px 38px;
  border-radius: var(--radius-s);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.02em;
  box-shadow: 0 10px 24px rgba(46,230,200,0.18);
}
.hero-open:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}
.hero-note { margin-top: 10px; font-size: 12.5px; color: var(--text-2); }

/* ---------- Contents grid ---------- */
.contents-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-top: 34px;
}
.odds-toggle { font-size: 12.5px; color: var(--text-1); display: flex; gap: 6px; align-items: center; }
.contents-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-top: 14px;
}
.item-card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-top: 3px solid var(--r-color, var(--milspec));
  border-radius: var(--radius-m);
  padding: 14px 12px 12px;
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.item-card:hover { transform: translateY(-3px); }
.item-icon {
  height: 78px; display: flex; align-items: center; justify-content: center;
  margin-bottom: 10px; border-radius: 6px; overflow: hidden;
  background: rgba(255,255,255,0.03);
}
.item-icon svg { width: 60%; height: 28px; color: var(--r-color, var(--milspec)); }
.item-icon img { width: 100%; height: 100%; object-fit: contain; display: block; }
.item-weapon { font-size: 12px; color: var(--text-1); }
.item-skin { font-size: 13.5px; font-weight: 600; margin-top: 1px; line-height: 1.25; }
.item-odds { font-size: 11.5px; color: var(--text-2); margin-top: 8px; font-variant-numeric: tabular-nums; }

/* ---------- Rarity legend ---------- */
.legend {
  display: flex; flex-wrap: wrap; gap: 16px;
  margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--panel-border);
}
.legend-item { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-1); }
.legend-dot { width: 9px; height: 9px; border-radius: 50%; }

/* ---------- History ---------- */
.history-strip { display: flex; gap: 10px; overflow-x: auto; margin-top: 14px; padding-bottom: 30px; }
.history-empty { color: var(--text-2); font-size: 13px; padding: 10px 0 30px; }
.hist-card {
  flex: 0 0 auto; width: 140px;
  background: var(--panel); border: 1px solid var(--panel-border);
  border-left: 3px solid var(--r-color, var(--milspec));
  border-radius: var(--radius-s); padding: 8px 10px;
  display: flex; align-items: center; gap: 9px;
}
.hist-thumb {
  flex: 0 0 auto; width: 32px; height: 32px; border-radius: 6px; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.03);
}
.hist-thumb svg { width: 60%; height: 16px; color: var(--r-color, var(--milspec)); }
.hist-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hist-text { min-width: 0; }
.hist-card .hw { font-size: 10.5px; color: var(--text-2); }
.hist-card .hs { font-size: 11.5px; font-weight: 600; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Spin modal ---------- */
.modal-scrim {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(6,7,10,0.86);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s ease;
}
.modal-scrim.open { opacity: 1; pointer-events: auto; }
.spin-modal {
  width: min(920px, 94vw);
  background: var(--bg-1);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-l);
  padding: 30px 0 30px;
  position: relative;
}
.spin-title { text-align: center; font-family: var(--font-display); font-size: 18px; color: var(--text-1); margin-bottom: 18px; }
.reel-viewport {
  position: relative;
  height: 168px;
  overflow: hidden;
  margin: 0 22px;
  border-radius: var(--radius-m);
  background: linear-gradient(180deg, #0e0f14, #14161d);
  box-shadow: inset 0 0 0 1px var(--panel-border);
}
.reel-viewport::before, .reel-viewport::after {
  content: ''; position: absolute; top: 0; bottom: 0; width: 90px; z-index: 3; pointer-events: none;
}
.reel-viewport::before { left: 0; background: linear-gradient(90deg, #0e0f14, transparent); }
.reel-viewport::after { right: 0; background: linear-gradient(-90deg, #0e0f14, transparent); }
.reel-pointer {
  position: absolute; left: 50%; top: 0; bottom: 0; width: 2px; margin-left: -1px;
  background: var(--brand); z-index: 4; box-shadow: 0 0 12px var(--brand);
}
.reel-pointer::before, .reel-pointer::after {
  content: ''; position: absolute; left: 50%; width: 0; height: 0; transform: translateX(-50%);
  border-left: 7px solid transparent; border-right: 7px solid transparent;
}
.reel-pointer::before { top: -1px; border-top: 8px solid var(--brand); }
.reel-pointer::after { bottom: -1px; border-bottom: 8px solid var(--brand); }
.reel-track {
  position: absolute; top: 0; left: 0; height: 100%;
  display: flex; align-items: center; gap: 10px; padding: 0 10px;
  will-change: transform;
}
.reel-item {
  flex: 0 0 auto; width: 132px; height: 148px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-top: 3px solid var(--r-color, var(--milspec));
  border-radius: var(--radius-m);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 10px;
  text-align: center;
}
.reel-item .item-icon { margin-bottom: 8px; height: 76px; width: 100%; }
.reel-item.win-highlight {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px var(--brand), 0 0 26px rgba(46,230,200,0.45);
}
.spin-actions { display: flex; justify-content: center; gap: 12px; margin-top: 22px; }

/* result reveal */
.reveal {
  text-align: center; padding: 8px 30px 0;
}
.reveal-media {
  width: 200px; height: 200px; margin: 0 auto 16px;
  overflow: hidden;
}
.reveal-media:empty { display: none; }
.reveal-media img { width: 100%; height: 100%; object-fit: contain; display: block; }
.reveal-tag {
  display: inline-block; font-size: 12px; letter-spacing: 0.04em;
  padding: 4px 12px; border-radius: 999px; margin-bottom: 10px;
  background: rgba(255,255,255,0.06); color: var(--r-color, var(--milspec));
  border: 1px solid var(--r-color, var(--milspec));
}
.reveal-name { font-family: var(--font-display); font-size: 24px; font-weight: 700; }
.reveal-sub { color: var(--text-1); font-size: 13.5px; margin-top: 4px; }

@media (max-width: 860px) {
  .contents-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 640px) {
  .section-label { margin: 26px 0 12px; }
  .hero { margin-top: 22px; padding: 34px 18px 28px; border-radius: var(--radius-m); }
  .hero-title { font-size: 22px; margin: 4px 0 20px; }
  .crate { width: clamp(140px, 42vw, 190px); height: clamp(98px, 29vw, 132px); }
  .hero-open { width: 100%; min-height: 48px; }
  .spin-modal { padding: 22px 0 22px; }
  .reel-viewport { margin: 0 14px; height: 148px; }
  .reel-item { width: 108px; height: 128px; padding: 8px; }
  .reel-item .item-icon { height: 59px; margin-bottom: 6px; }
  .reel-item .item-skin { font-size: 12px; }
  .reveal-media { width: 116px; height: 116px; }
  .reveal-name { font-size: 20px; }
}

@media (max-width: 560px) {
  .contents-grid { grid-template-columns: repeat(2, 1fr); }
  .hero-title { font-size: 24px; }
}

@media (max-width: 420px) {
  .brand { font-size: 18px; }
  .balance-chip { padding: 7px 11px; font-size: 13px; }
  .btn { padding: 8px 12px; font-size: 13px; }
  .btn-admin { padding: 8px 10px; }
  .case-pick { width: 148px; padding: 12px; }
  .hero { padding: 28px 14px 24px; }
  .item-card { padding: 12px 10px 10px; }
  .item-icon { height: 62px; }
}

@media (prefers-reduced-motion: reduce) {
  .item-card, .hero-open, .modal-scrim { transition: none !important; }
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

footer.site-foot {
  text-align: center; color: var(--text-2); font-size: 12px;
  padding: 10px 0 max(40px, env(safe-area-inset-bottom));
}
footer.site-foot a { color: var(--text-1); }
