* { box-sizing: border-box; }

:root {
  --bg-deep: #06070a;
  --bg: #0c0e13;
  --panel: #14161f;
  --panel-2: #1b1e2a;
  --line: rgba(255, 255, 255, 0.07);
  --text: #eef1f6;
  --hint: #8b93a3;
  --accent: #ff8a1e;
  --accent-2: #ffb020;
  --accent-soft: rgba(255, 138, 30, 0.18);
  --danger: #ff5b5b;
  --radius: 14px;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  /* Blocks pinch-zoom app-wide (fast tapping with two fingers close
     together was triggering it) while leaving normal vertical scroll
     alone — there's nothing that needs horizontal touch panning here, the
     prize reel is animated programmatically, not swiped. */
  touch-action: pan-y;
}

#bg-fx {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(60% 38% at 50% -8%, rgba(255, 138, 30, 0.20), transparent 60%),
    radial-gradient(46% 30% at 105% 105%, rgba(139, 71, 255, 0.14), transparent 60%),
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.025) 0 2px, transparent 2px 28px),
    var(--bg-deep);
}

#confetti-layer {
  position: fixed;
  inset: 0;
  z-index: 999;
  pointer-events: none;
  overflow: hidden;
}

.confetti-piece {
  position: absolute;
  top: -12px;
  width: 8px;
  height: 14px;
  opacity: 0.95;
  animation: confetti-fall linear forwards;
  border-radius: 2px;
}

@keyframes confetti-fall {
  to {
    transform: translateY(115vh) rotate(540deg);
    opacity: 0.2;
  }
}

#app {
  max-width: 480px;
  margin: 0 auto;
  padding: 20px 16px 40px;
  position: relative;
}

header { text-align: center; margin-bottom: 16px; }

#main-tabs {
  display: flex;
  gap: 4px;
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  padding: 8px 0;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.tab-btn {
  flex: 1;
  width: auto;
  min-width: 0;
  background: none;
  box-shadow: none;
  color: var(--hint);
  font-size: 11.5px;
  font-weight: 700;
  padding: 8px 2px 12px;
  border-radius: 0;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tab-btn.tab-active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

.icon {
  width: 1em;
  height: 1em;
  display: inline-block;
  vertical-align: -0.15em;
  fill: currentColor;
  flex-shrink: 0;
}

.tab-btn .icon {
  width: 1.15em;
  height: 1.15em;
  display: block;
  margin: 0 auto 3px;
}

.kicker {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2.5px;
  color: var(--accent-2);
  text-transform: uppercase;
  margin-bottom: 6px;
}

header h1 {
  margin: 0 0 6px;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 0.3px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.header-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid var(--accent);
  flex-shrink: 0;
}

.subtitle { margin: 0; color: var(--hint); font-size: 13.5px; }

.screen.hidden, .hidden { display: none !important; }

.hint { color: var(--hint); font-size: 13px; line-height: 1.45; }
.error { color: var(--danger); font-size: 13px; }

input[type="text"], input[type="number"], textarea {
  width: 100%;
  padding: 13px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font-size: 14px;
  margin: 6px 0 14px;
  font-family: inherit;
  resize: vertical;
}

input[type="text"]:focus, input[type="number"]:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
}

#bonus-spins-badge {
  text-align: center;
  color: var(--accent-2);
  font-weight: 700;
  margin: 0 0 10px;
}

#invite-panel {
  margin-top: 14px;
  padding: 14px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--line);
}

label {
  display: block;
  font-size: 13px;
  color: var(--hint);
  margin-top: 8px;
}

fieldset {
  border: 1px solid var(--line);
  border-radius: 10px;
  margin: 10px 0 14px;
  padding: 10px 12px;
}

fieldset legend {
  color: var(--hint);
  font-size: 13px;
  padding: 0 4px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  font-size: 14px;
}

.checkbox-row input { width: auto; margin: 0; }

button {
  width: 100%;
  padding: 15px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #17110a;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.3px;
  cursor: pointer;
  box-shadow: 0 8px 24px -8px var(--accent-soft);
  transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.12s ease;
}

button:active { transform: scale(0.97); }

button:disabled {
  opacity: 0.45;
  cursor: default;
  box-shadow: none;
  background: var(--panel-2);
  color: var(--hint);
}

.link-button {
  background: none;
  color: var(--hint);
  font-weight: 500;
  font-size: 13px;
  margin-top: 16px;
  text-decoration: none;
  box-shadow: none;
  width: auto;
  padding: 6px;
}

.link-button b {
  color: var(--accent-2);
}

#reel-viewport {
  position: relative;
  height: 116px;
  overflow: hidden;
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--line);
  margin-bottom: 16px;
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.4);
}

#reel-viewport::before, #reel-viewport::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 36px;
  z-index: 2;
  pointer-events: none;
}

#reel-viewport::before { left: 0; background: linear-gradient(90deg, var(--panel), transparent); }
#reel-viewport::after { right: 0; background: linear-gradient(270deg, var(--panel-2), transparent); }

#reel {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  display: flex;
  align-items: center;
  will-change: transform;
}

.reel-item {
  width: 92px;
  height: 92px;
  margin: 0 4px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(120% 120% at 50% 20%, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.01));
  border: 2px solid var(--tier-color, #2a2d38);
  box-shadow: 0 0 16px -4px var(--tier-color, transparent);
  flex: 0 0 auto;
}

.reel-item img { max-width: 74%; max-height: 74%; filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.5)); }
.reel-item .placeholder { font-size: 26px; opacity: 0.35; }

.reel-pointer {
  position: absolute;
  top: 0;
  left: 50%;
  width: 3px;
  height: 100%;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  transform: translateX(-1.5px);
  pointer-events: none;
  z-index: 3;
  box-shadow: 0 0 10px var(--accent);
}

#result-card {
  text-align: center;
  margin-top: 18px;
  padding: 20px 16px;
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--tier-color, var(--line));
  box-shadow: 0 0 30px -10px var(--tier-color, transparent);
  animation: result-pop 0.35s ease;
}

@keyframes result-pop {
  from { transform: scale(0.92); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

#result-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.5px;
  padding: 5px 12px;
  border-radius: 999px;
  margin-bottom: 10px;
  background: linear-gradient(135deg, #ffd700, #ff8a1e);
  color: #241a00;
  box-shadow: 0 0 18px -2px rgba(255, 200, 60, 0.7);
}

#result-image { max-width: 104px; max-height: 104px; margin-bottom: 10px; filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.5)); }
#result-name { font-weight: 700; margin-bottom: 6px; font-size: 15px; }

#cooldown-text { text-align: center; margin-top: 10px; }

#season-name {
  text-align: center;
  margin: 0 0 14px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--accent-2);
}

#not-subscribed-screen { text-align: center; }
#not-subscribed-screen a { text-decoration: none; display: block; margin-bottom: 10px; }
#not-subscribed-screen button { margin-bottom: 10px; }

.footer-links {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.footer-links .link-button { width: auto; margin: 16px 0 0; white-space: nowrap; }

#points-progress { margin-top: 16px; }

.progress-bar {
  height: 9px;
  border-radius: 5px;
  background: var(--panel);
  border: 1px solid var(--line);
  overflow: hidden;
}

#points-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  width: 0%;
  transition: width 0.4s ease;
  box-shadow: 0 0 10px var(--accent-soft);
}

#points-text { text-align: center; margin-top: 6px; }

#admin-screen h2 { font-size: 16px; margin: 20px 0 4px; color: var(--text); }
#admin-screen h3 { font-size: 14px; color: var(--hint); margin: 18px 0 4px; }

.season-card {
  padding: 14px;
  border-radius: 12px;
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--line);
  margin-bottom: 10px;
}

.season-card .season-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
}

.user-link {
  color: var(--accent-2);
  cursor: pointer;
}

.season-card .badge {
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #17110a;
  font-weight: 800;
}

.season-card .season-card-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.season-card .season-card-actions button {
  padding: 10px;
  font-size: 13px;
}

.season-edit-panel {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.speedup-card {
  padding: 0;
  border-radius: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  margin-bottom: 16px;
  overflow: hidden;
}

.speedup-card summary {
  padding: 14px 16px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.speedup-card summary::-webkit-details-marker { display: none; }

.speedup-card summary::after {
  content: "▾";
  color: var(--hint);
  font-size: 14px;
  transition: transform 0.2s ease;
}

.speedup-card[open] summary::after { transform: rotate(180deg); }

.speedup-card-body {
  padding: 0 16px 16px;
}

.speedup-card a { display: block; }
.speedup-card button { width: 100%; }

#toast {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  z-index: 100;
  background: var(--accent, #3a3b44);
  color: #fff;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  max-width: 90vw;
  text-align: center;
}

#toast.toast-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.leaderboard-viewer-row {
  border: 1.5px solid var(--accent) !important;
  background: linear-gradient(180deg, var(--panel-2), var(--panel)) !important;
}

.inventory-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

#inventory-value {
  font-size: 30px;
  font-weight: 800;
}

#inventory-screen h2 { font-size: 16px; margin: 20px 0 4px; color: var(--text); }
#inventory-screen h2:first-of-type { margin-top: 6px; }

/* ---- Case Clicker ---- */

#clicker-topbar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 8px;
  border-radius: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  margin-bottom: 10px;
}

.clicker-stat { display: flex; align-items: center; gap: 5px; font-weight: 700; font-size: 15px; }
.clicker-stat.hint { font-weight: 500; font-size: 12px; }

#clicker-scrap-value { display: inline-block; }

/* Fires whenever a background poll actually credits accrued passive income
   — without this the scrap number only ever changes right after a tap, so
   idle building/rental income was invisible even though it was accruing. */
#clicker-scrap-value.clicker-scrap-pulse { animation: clicker-scrap-pulse 0.6s ease-out; }

@keyframes clicker-scrap-pulse {
  0% { color: #69db7c; transform: scale(1.22); }
  100% { color: inherit; transform: scale(1); }
}

.clicker-income-float {
  position: absolute;
  left: 50%;
  bottom: 100%;
  transform: translateX(-50%);
  margin-bottom: 2px;
  font-weight: 800;
  font-size: 12px;
  color: #69db7c;
  pointer-events: none;
  animation: clicker-income-float-up 0.9s ease-out forwards;
}

@keyframes clicker-income-float-up {
  0% { opacity: 0; transform: translate(-50%, 4px); }
  20% { opacity: 1; transform: translate(-50%, 0); }
  100% { opacity: 0; transform: translate(-50%, -16px); }
}

#clicker-subtabs {
  display: flex;
  gap: 4px;
  margin-bottom: 14px;
  padding: 3px;
  border-radius: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
}

.clicker-subtab-btn {
  flex: 1;
  width: auto;
  min-width: 0;
  background: none;
  box-shadow: none;
  color: var(--hint);
  font-size: 12px;
  font-weight: 700;
  padding: 8px 2px;
  border-radius: 7px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.clicker-subtab-btn.clicker-subtab-active {
  color: var(--text);
  background: var(--panel-2);
}

#clicker-tap-area {
  position: relative;
  z-index: 0;
  text-align: center;
  padding: 40px 18px;
  border-radius: 14px;
  border: 1px solid var(--line);
  margin-bottom: 14px;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  /* Taps are handled on touchstart; without this the browser still reserves
     its double-tap-to-zoom delay and can swallow rapid multi-finger taps. */
  touch-action: none;
  cursor: pointer;
  background-color: var(--panel);
  background-size: 300% 300%;
  animation: clicker-bg-shift 12s ease infinite;
  transition: box-shadow 0.25s ease, border-color 0.25s ease;
}

/* One vivid theme per case (picked deterministically from case_id in JS —
   see applyClickerBgTheme), so different cases actually feel different
   instead of every one sitting on the same purple gradient. Kept jewel-tone
   dark so the white case name/hint text (which relies on a text-shadow, not
   a background scrim) stays legible against all of them. Using
   background-image rather than the `background` shorthand here so these
   don't reset background-size/position back to their initial values. */
.clicker-bg-0 { background-image: linear-gradient(120deg, #2a1a3d, #3d1f2e, #1a2a3d, #2e1f3d); } /* violet nebula */
.clicker-bg-1 { background-image: linear-gradient(120deg, #4a1a10, #6b2d12, #3d1408, #5c220e); } /* fire */
.clicker-bg-2 { background-image: linear-gradient(120deg, #0d3b3f, #0a5c63, #123a4d, #0f4a52); } /* electric teal */
.clicker-bg-3 { background-image: linear-gradient(120deg, #1f3d1a, #2d5c1f, #143d2a, #245c1f); } /* toxic green */
.clicker-bg-4 { background-image: linear-gradient(120deg, #4a0d3a, #6b125c, #3d0a4d, #5c0f52); } /* neon magenta */
.clicker-bg-5 { background-image: linear-gradient(120deg, #0d1a4a, #12256b, #0a0f3d, #0f145c); } /* deep cosmic blue */

/* Sustained fast tapping lights the whole arena up — the ambient half of
   "multitap should feel like something", next to the per-tap effects. */
#clicker-tap-area.clicker-hot {
  border-color: rgba(255, 215, 0, 0.55);
  box-shadow: 0 0 26px -4px rgba(255, 170, 0, 0.55), inset 0 0 40px -12px rgba(255, 200, 0, 0.5);
}

@keyframes clicker-bg-shift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* White flash across the arena at the moment a case cracks. */
#clicker-tap-flash {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(circle at 50% 42%, rgba(255, 255, 255, 0.85), rgba(255, 255, 255, 0) 62%);
}

#clicker-combo-badge {
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 3;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 800;
  color: #fff;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 215, 0, 0.6);
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
  pointer-events: none;
}

#clicker-case-image {
  position: relative;
  z-index: 1;
  width: 140px;
  height: 140px;
  object-fit: contain;
  margin-bottom: 10px;
  filter: drop-shadow(0 6px 18px rgba(0, 0, 0, 0.5));
  pointer-events: none;
  will-change: transform;
  transform: scale(1) rotate(0deg);
  /* No CSS transition here on purpose — the engage/release rAF loop in
     app.js (clickerCaseTick) sets style.transform on every animation frame
     itself, smoothing continuously toward whatever the current tap target
     is. A CSS transition running on top of that would just fight it,
     trying to interpolate between two already-close per-frame values. */
}

.clicker-tap-ripple {
  position: absolute;
  z-index: 3;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0));
  pointer-events: none;
  animation: clicker-ripple 0.28s ease-out forwards;
}

@keyframes clicker-ripple {
  0% { transform: scale(0.4); opacity: 0.9; }
  100% { transform: scale(6); opacity: 0; }
}

.clicker-spark {
  position: absolute;
  z-index: 3;
  width: 6px;
  height: 6px;
  margin: -3px 0 0 -3px;
  border-radius: 50%;
  pointer-events: none;
}

#clicker-case-name {
  position: relative;
  z-index: 1;
  margin-bottom: 4px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
  pointer-events: none;
}

#clicker-case-hint {
  position: relative;
  z-index: 1;
  color: rgba(255, 255, 255, 0.75);
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
  pointer-events: none;
  min-height: 16px;
}

#clicker-number-layer {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  overflow: hidden;
}

.clicker-float-number {
  position: absolute;
  font-weight: 800;
  font-size: 20px;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
  pointer-events: none;
  /* Short and snappy: at 0.9s a spam-tapper ended up with a wall of stale
     numbers still on screen, which read as lag rather than as feedback. */
  animation: clicker-float-up 0.55s cubic-bezier(0.15, 0.7, 0.3, 1) forwards;
}

.clicker-float-number.clicker-crit {
  font-size: 30px;
  color: #ffd700;
  animation-duration: 0.8s;
}

@keyframes clicker-float-up {
  0% { opacity: 0; transform: translateY(6px) scale(0.7); }
  22% { opacity: 1; transform: translateY(-8px) scale(1.15); }
  100% { opacity: 0; transform: translateY(-62px) scale(0.95); }
}

#clicker-drop-backdrop {
  position: fixed;
  inset: 0;
  z-index: 49;
  background: rgba(0, 0, 0, 0.55);
}

#clicker-drop-reveal {
  position: fixed;
  left: 16px;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 50;
  text-align: center;
  padding: 22px 18px;
  border-radius: 14px;
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 2px solid var(--tier-color, #2a2d38);
  box-shadow: 0 12px 40px -8px rgba(0, 0, 0, 0.6), 0 0 30px -8px var(--tier-color, transparent);
}

/* Plays while "Продолжить" is still disabled (see CLICKER_DROP_GUARD_MS) —
   gives a fast tapper's finger something to actually watch instead of
   landing on the button before the drop is even visible. */
#clicker-drop-reveal.clicker-drop-reveal-in { animation: clicker-drop-reveal-in 0.32s cubic-bezier(0.16, 1, 0.3, 1); }

@keyframes clicker-drop-reveal-in {
  0% { opacity: 0; transform: translateY(-50%) scale(0.82); }
  100% { opacity: 1; transform: translateY(-50%) scale(1); }
}

#clicker-drop-image { width: 120px; height: 120px; object-fit: contain; margin-bottom: 8px; }

#clicker-drop-tier {
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--tier-color, var(--hint));
  margin: 0 0 4px;
  /* Browsers still reserve letter-spacing after the LAST character, so the
     centered box is wider than the visible glyphs and the text reads as
     shifted left — canceling the trailing gap with a negative margin
     re-centers what's actually visible. This was the reported bug. */
  margin-right: -0.04em;
}

#clicker-drop-name { font-weight: 700; margin-bottom: 4px; }
#clicker-drop-continue { margin-top: 14px; }

#clicker-drop-scrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin-top: 8px;
  font-weight: 800;
  font-size: 17px;
  color: var(--accent-2, #ffd700);
}

#clicker-drop-scrap .icon { width: 18px; height: 18px; }

#clicker-voucher-status:empty { display: none; }
#clicker-voucher-status { margin-top: 8px; }

#clicker-voucher-progress-bar { margin-top: 10px; }

/* The fill had no rule of its own — only its width was being set, so the
   bar looked permanently empty no matter how many taps were banked. */
#clicker-voucher-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 10px var(--accent-soft);
  transition: width 0.3s ease;
}

#clicker-voucher-counter {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 7px;
  font-size: 13px;
  font-weight: 700;
}

#clicker-voucher-counter .icon {
  width: 15px;
  height: 15px;
  color: var(--accent-2, #ffd700);
  flex-shrink: 0;
}

#clicker-voucher-reset {
  margin-left: auto;
  font-size: 11px;
  font-weight: 500;
  color: var(--hint);
}

#clicker-voucher-explainer { margin-top: 10px; }

.clicker-shop-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-radius: 12px;
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--line);
  margin-bottom: 8px;
}

.clicker-shop-icon {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  color: var(--accent-2, #ffd700);
}

.clicker-shop-info { flex: 1; min-width: 0; }
.clicker-shop-name { font-weight: 700; font-size: 13px; }
.clicker-shop-meta { font-size: 11px; color: var(--hint); margin-top: 2px; }

.clicker-shop-buy {
  width: auto;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.clicker-shop-buy:disabled { opacity: 0.4; }

.clicker-leaderboard-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--line);
  margin-bottom: 6px;
  font-size: 13px;
}

.clicker-leaderboard-rank {
  flex-shrink: 0;
  width: 28px;
  font-weight: 700;
  color: var(--hint);
}

.clicker-leaderboard-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.clicker-leaderboard-value {
  flex-shrink: 0;
  font-weight: 700;
  color: var(--accent-2, #ffd700);
}

.clicker-leaderboard-row.clicker-leaderboard-viewer {
  border: 1.5px solid var(--accent);
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
}

#clicker-leaderboard-viewer { margin-top: 4px; }

/* Player cards: a separate, visually distinct premium upgrade category —
   a labeled divider, then compact rows (round photo thumbnail + name +
   level) that expand into a full glowing "trading card" overlay on tap. */

/* Energy: the tap budget. Sits directly above the case so the reason
   tapping stops is impossible to miss. */
#clicker-energy { margin-bottom: 10px; }

#clicker-energy-bar {
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--panel-2);
  border: 1px solid var(--line);
}

#clicker-energy-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #4ecdc4, #63e6be);
  box-shadow: 0 0 10px rgba(78, 205, 196, 0.5);
  transition: width 0.25s ease;
}

#clicker-energy-text {
  margin-top: 5px;
  font-size: 12px;
  font-weight: 700;
  color: var(--hint);
  text-align: center;
}

/* Drained: makes "why did tapping stop working" self-evident instead of
   looking like the game froze. */
#clicker-tap-area.clicker-drained { opacity: 0.45; filter: grayscale(0.6); }

#clicker-exchange-progress-bar { margin-top: 10px; }

#clicker-exchange-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 10px var(--accent-soft);
  transition: width 0.3s ease;
}

.clicker-shop-divider {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 18px 2px 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--hint);
}

.clicker-shop-divider .icon { width: 16px; height: 16px; color: var(--accent-2, #ffd700); }

.clicker-card-row { cursor: pointer; }

/* Each card sets --card-color inline (see app.js) so every player reads as
   visually distinct instead of every card sharing the same gold accent. */
.clicker-card-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  object-position: top;
  flex-shrink: 0;
  border: 1.5px solid var(--card-color, var(--accent-2, #ffd700));
  box-shadow: 0 0 8px -2px var(--card-color, var(--accent-2, #ffd700));
}

.clicker-card-chevron {
  color: var(--hint);
  font-size: 20px;
  flex-shrink: 0;
  margin-left: 2px;
}

#clicker-card-backdrop {
  position: fixed;
  inset: 0;
  z-index: 49;
  background: rgba(0, 0, 0, 0.6);
}

#clicker-card-modal {
  position: fixed;
  left: 16px;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 50;
  max-width: 300px;
  margin: 0 auto;
  border-radius: 16px;
  overflow: hidden;
  background: var(--panel);
  border: 2px solid var(--card-color, var(--accent-2, #ffd700));
  box-shadow: 0 12px 40px -8px rgba(0, 0, 0, 0.6), 0 0 36px -6px var(--card-color, var(--accent-2, #ffd700));
  max-height: 82vh;
  display: flex;
  flex-direction: column;
}

.clicker-card-close {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  border: none;
  font-size: 14px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.clicker-card-photo-wrap {
  position: relative;
  width: 100%;
  /* Capped small on purpose — the source photos are only 320-800px wide,
     so stretching this to the full modal width upscaled them past their
     native resolution and looked soft/blurry. Modal is also capped to
     max-width: 300px for the same reason (stays at or under every photo's
     native width instead of scaling up). */
  height: 190px;
  background: linear-gradient(180deg, #23262e, #14151a);
  overflow: hidden;
  flex-shrink: 0;
}

.clicker-card-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
  display: block;
}

/* The source photos are cropped abruptly right at the torso — this line
   turns that hard cutoff into a deliberate-looking frame edge instead of
   looking like a rendering bug. */
.clicker-card-divider {
  height: 3px;
  flex-shrink: 0;
  background: linear-gradient(90deg, transparent, var(--card-color, var(--accent-2, #ffd700)), transparent);
  box-shadow: 0 0 10px var(--card-color, var(--accent-2, #ffd700));
}

.clicker-card-info {
  padding: 14px 16px;
  text-align: center;
  overflow-y: auto;
}

.clicker-card-nickname {
  font-size: 20px;
  font-weight: 800;
  color: var(--card-color, var(--accent-2, #ffd700));
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.clicker-card-info .hint { margin-top: 6px; }
#clicker-card-level { font-weight: 700; color: var(--text); }
#clicker-card-buy-btn { margin-top: 14px; width: 100%; }

/* Collection: one collapsible section per case, holding a compact grid.
   The old flat list of every item in every case was ~90 full-width rows of
   endless scrolling. */

.clicker-case-group {
  border-radius: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  margin-bottom: 8px;
  overflow: hidden;
}

.clicker-case-header {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  background: none;
  box-shadow: none;
  border-radius: 0;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.clicker-case-header img {
  width: 34px;
  height: 34px;
  object-fit: contain;
  flex-shrink: 0;
}

.clicker-case-header-info { flex: 1; min-width: 0; }

.clicker-case-header-name {
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.clicker-case-header-count { font-size: 11px; font-weight: 500; color: var(--hint); margin-top: 2px; }

.clicker-case-chevron {
  flex-shrink: 0;
  font-size: 11px;
  color: var(--hint);
  transition: transform 0.2s ease;
}

.clicker-case-group.clicker-case-open .clicker-case-chevron { transform: rotate(180deg); }

/* Shown instead of the chevron once every item in the case is owned —
   click claims the flat completion bonus (see claimCollectionCase). */
.clicker-case-claim {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  padding: 0;
  border-radius: 50%;
  background: #2b8a3e;
  box-shadow: 0 0 0 2px rgba(43, 138, 62, 0.35);
  color: #fff;
}

.clicker-case-claim .icon { width: 16px; height: 16px; }

.clicker-case-claim:not(:disabled):active { transform: scale(0.92); }

/* Once claimed the checkmark just sits there as a status badge, not a
   button anymore — same green so it still reads as "done", but with the
   button's own press/hover affordances removed via :disabled. */
.clicker-case-claim.clicker-case-claimed { opacity: 0.85; box-shadow: none; }

/* The whole case is "archived": collected once, income now comes from the
   flat completion bonus instead, and it can never drop again for this
   user. Still fully viewable — only the header dims, the item grid and
   tiles underneath are untouched. */
.clicker-case-group.clicker-case-activated .clicker-case-header-name {
  opacity: 0.55;
  text-decoration: line-through;
}

.clicker-case-group.clicker-case-activated .clicker-case-header-count { color: #2b8a3e; }
.clicker-case-group.clicker-case-activated .clicker-case-header img { opacity: 0.6; }

.clicker-case-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
  gap: 6px;
  padding: 0 8px 10px;
}

.clicker-case-group:not(.clicker-case-open) .clicker-case-grid { display: none; }

.clicker-collection-tile {
  position: relative;
  padding: 6px 4px 5px;
  border-radius: 9px;
  background: var(--panel-2);
  border: 1.5px solid var(--tier-color, var(--line));
  text-align: center;
  overflow: hidden;
}

/* Tier colour as a soft glow from the bottom, the way case UIs in-game do it. */
.clicker-collection-tile::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: var(--tier-color, var(--line));
}

.clicker-collection-tile.clicker-unowned {
  opacity: 0.4;
  border-color: var(--line);
}

.clicker-collection-tile.clicker-unowned::after { background: var(--line); }

.clicker-collection-tile img {
  width: 100%;
  height: 44px;
  object-fit: contain;
  filter: grayscale(1) brightness(0.45);
}

.clicker-collection-tile.clicker-owned img { filter: none; }

.clicker-tile-name {
  font-size: 10px;
  line-height: 1.25;
  margin-top: 3px;
  height: 25px;
  color: var(--hint);
  /* Real skin names run long ("★ Butterfly Knife | Gamma Doppler") — clamp
     to two lines with an ellipsis rather than cutting mid-word. */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.clicker-collection-tile.clicker-owned .clicker-tile-name { color: var(--text); }

.clicker-tile-scrap {
  font-size: 10px;
  font-weight: 700;
  color: var(--tier-color, var(--hint));
  margin-top: 1px;
}

.currency-toggle {
  width: auto;
  padding: 8px 16px;
  font-size: 15px;
  flex-shrink: 0;
}

.inv-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  margin-bottom: 8px;
}

.inv-item img { width: 40px; height: 40px; object-fit: contain; flex-shrink: 0; }
.inv-item .inv-item-name { flex: 1; font-size: 13px; }
.inv-item .inv-item-price { font-weight: 700; color: var(--accent-2); white-space: nowrap; font-size: 13px; }


/* Shown in place of the spin button while the roulette is paused. Styled as
   a notice rather than an error: nothing is broken for the player, and the
   point is that they should NOT keep spinning into a failing delivery. */
#spin-maintenance {
  margin: 12px 0;
  padding: 14px 16px;
  border: 1px solid rgba(255, 176, 32, 0.45);
  border-radius: 12px;
  background: rgba(255, 176, 32, 0.10);
  color: #ffcf7a;
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-line;
  text-align: left;
}
