/* The Wastelands RPG — shared web theme (homepage + standalone play client)
   Industrial wasteland HUD: muted gunmetal surfaces, controlled gold/amber +
   faction accents, sharp paneled materials over floaty glass. Mirrors the
   Twitch extension panel's palette so the web experience feels like the same
   product. */

@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@600;700;900&family=Inter:wght@400;500;600;700;800&family=Oswald:wght@500;600;700&display=swap');

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

:root {
  /* ── Core palette (token names kept stable; values retuned warmer/grittier) ── */
  --bg:         #0a0907;
  --bg2:        #14120e;
  --bg3:        #211d17;
  --border:     #393327;
  --accent:     #c8a84b;
  --accent2:    #e0c068;
  --red:        #e74c3c;
  --green:      #27ae60;
  --blue:       #74b9ff;
  --teal:       #1abc9c;
  --purple:     #9b59b6;
  --amber:      #e67e22;
  --text:       #e8ddc4;
  --text-dim:   #9b9079;
  --text-faint: #6f6552;

  /* ── Industrial surfaces & edges ── */
  --panel-1:    #16140f;   /* base panel fill (top of gradient) */
  --panel-2:    #100e0a;   /* base panel fill (bottom of gradient) */
  --raised:     #211d16;   /* raised inner tiles / rows */
  --inset:      #0c0a07;   /* sunken tracks / wells */
  --edge-hi:    rgba(255,238,196,0.07);  /* metallic top highlight */
  --edge-lo:    rgba(0,0,0,0.55);        /* bottom shade */
  --border-2:   #4a4234;   /* brighter border (hover / emphasis) */
  --hair:       rgba(255,255,255,0.05);  /* hairline dividers */

  /* ── Semantic state ── */
  --danger:     #e74c3c;
  --success:    #27ae60;
  --warning:    #e6a423;
  --info:       #74b9ff;
  --reward:     #f1c40f;
  --loot:       #b07be0;

  /* ── Tier colors (exact match to extension) ── */
  --tier-common:    #b6ad99;
  --tier-rare:      #4aa3e0;
  --tier-epic:      #b06fd6;
  --tier-legendary: #f39c12;
  --tier-prestige:  #f9ca24;
  --tier-mythic:    #ff5ec7;

  /* ── Radius / spacing scale ── */
  --r-1: 4px;
  --r-2: 6px;
  --r-3: 9px;
  --r-pill: 999px;

  /* ── Motion tokens ── */
  --ease-out:    cubic-bezier(.16,1,.3,1);
  --ease-spring: cubic-bezier(.34,1.56,.64,1);
  --dur-1: 130ms;
  --dur-2: 240ms;
  --dur-3: 420ms;
  --dur-4: 700ms;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* ── Ambient background — a low, smoky wasteland haze + faint scanline grain
   behind a vignette. Muted, not a SaaS gradient. ── */
.bg-glow {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(120% 70% at 50% -10%, rgba(200,168,75,0.07), transparent 55%),
    radial-gradient(80% 50% at 85% 100%, rgba(231,76,60,0.05), transparent 60%),
    linear-gradient(180deg, #0c0b08, var(--bg) 60%);
  /* Static: a full-viewport layer animating forever forced constant GPU
     compositing that lagged video in other windows. The drift was barely
     visible anyway. */
}
/* Subtle dust/grain layer over the haze (very low contrast). */
.bg-glow::after {
  content: '';
  position: absolute; inset: 0;
  background-image: repeating-linear-gradient(0deg, rgba(0,0,0,0.18) 0 1px, transparent 1px 3px);
  opacity: 0.25;
  mix-blend-mode: overlay;
}

/* ── Keyframes (shared motion library) ────────────────── */
@keyframes drift {
  0%   { background-position: 0% 0%, 0% 0%, 0 0; }
  100% { background-position: 4% 3%, -4% -4%, 0 0; }
}
@keyframes fade-in-up {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
@keyframes skeleton-wave {
  0%   { background-position: 100% 50%; }
  100% { background-position:   0% 50%; }
}
@keyframes pulse-logo {
  0%, 100% { filter: drop-shadow(0 0 4px rgba(200,168,75,0.45)); }
  50%       { filter: drop-shadow(0 0 11px rgba(224,192,104,0.8)); }
}
@keyframes popIn {
  from { opacity: 0; transform: scale(0.85); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 6px rgba(231,76,60,0.35), 0 0 0 rgba(231,76,60,0); opacity: 1; }
  50%       { box-shadow: 0 0 22px rgba(231,76,60,0.7), 0 0 40px rgba(231,76,60,0.16); opacity: 0.9; }
}
@keyframes floatY {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-5px); }
}
@keyframes countPop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.16); }
  100% { transform: scale(1); }
}

h1, h2, h3, .display {
  font-family: 'Cinzel', serif;
  letter-spacing: 0.5px;
}

/* ── Global links ─────────────────────────────────────── */
a {
  color: var(--accent2);
  transition: color var(--dur-2) var(--ease-out),
              text-shadow var(--dur-2) var(--ease-out);
}
a:hover {
  color: #f0d488;
  text-shadow: 0 0 8px rgba(224,192,104,0.4);
}

/* ── Focus-visible ring (links + buttons + controls) ──── */
a:focus-visible,
.btn:focus-visible,
button:focus-visible,
select:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--accent2);
  outline-offset: 2px;
  border-radius: var(--r-1);
}

/* ── Header ───────────────────────────────────────────── */
.site-header {
  background:
    linear-gradient(180deg, rgba(255,238,196,0.05), transparent 40%),
    linear-gradient(135deg, #171206, #221805);
  border-bottom: 1px solid var(--accent);
  box-shadow: 0 1px 0 rgba(0,0,0,0.6), 0 6px 22px rgba(0,0,0,0.5);
  padding: 12px 22px;
  display: flex; justify-content: space-between; align-items: center;
  position: sticky; top: 0; z-index: 20;
}
.site-header .brand { display: flex; align-items: center; gap: 10px; }
.site-header .brand img {
  width: 32px; height: 32px;
  filter: drop-shadow(0 0 6px rgba(200,168,75,0.55));
}
.site-header h1 {
  color: var(--accent2);
  font-size: 1.2em;
  text-shadow: 0 0 14px rgba(224,192,104,0.35);
}
.site-header nav { display: flex; gap: 16px; align-items: center; font-size: 0.9em; }
.site-header nav a {
  text-decoration: none;
  opacity: 0.82;
  transition: opacity var(--dur-2) var(--ease-out),
              text-shadow var(--dur-2) var(--ease-out);
}
.site-header nav a:hover { opacity: 1; text-shadow: 0 0 8px rgba(224,192,104,0.55); }
/* ── Who's-online header ticker ──────────────────────────
   Sits between the brand and the nav; scrolls only when the roster is wider
   than the slot (JS toggles .scrolling and duplicates the track content). */
.online-ticker {
  flex: 1 1 auto; min-width: 0;
  overflow: hidden; white-space: nowrap;
  margin: 0 18px 0 30px; font-size: 0.82em; color: var(--text-dim);
}
/* Edge fade only while scrolling — a static short roster ("2 online") would
   otherwise sit dimmed under the left fade. */
.online-ticker.scrolling {
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
          mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.online-ticker .ot-track { display: inline-block; white-space: nowrap; }
.online-ticker.scrolling .ot-track {
  animation: ot-scroll var(--ot-dur, 30s) linear infinite;
}
.online-ticker .ot-track:hover { animation-play-state: paused; }
.online-ticker .ot-dot { color: #7bd88f; margin: 0 4px; }
.online-ticker .ot-name { color: var(--text); }
@keyframes ot-scroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }   /* track holds two copies — -50% = seamless loop */
}

/* Keep the brand on one line on small screens. */
@media (max-width: 480px) {
  .site-header { padding: 10px 14px; }
  .site-header h1 { font-size: 1em !important; white-space: nowrap; }
  .site-header nav { gap: 12px; }
  .online-ticker { display: none; }   /* no room on phones */
}

/* ── Panels (kept the .glass class name; new industrial material) ────────────
   Solid layered gunmetal surface, sharp utilitarian corners, a thin metallic
   top edge and a hairline left rail. No backdrop-blur, no float — hover just
   brightens the edges. ── */
.glass {
  background:
    linear-gradient(180deg, var(--panel-1), var(--panel-2));
  border: 1px solid var(--border);
  border-top-color: var(--border-2);
  border-radius: var(--r-3);
  box-shadow:
    0 1px 0 var(--edge-hi) inset,
    0 -1px 0 var(--edge-lo) inset,
    0 10px 26px rgba(0,0,0,0.42);
  padding: 18px;
  position: relative;
  animation: fade-in-up var(--dur-3) var(--ease-out) both;
  transition:
    border-color var(--dur-2) var(--ease-out),
    box-shadow var(--dur-2) var(--ease-out);
}
/* faint vertical accent rail on the left edge for structure */
.glass::before {
  content: '';
  position: absolute; left: 0; top: 10px; bottom: 10px; width: 2px;
  background: linear-gradient(180deg, transparent, rgba(200,168,75,0.35), transparent);
  border-radius: 2px;
  opacity: 0.55;
  pointer-events: none;
}
.glass:hover {
  border-color: var(--border-2);
  box-shadow:
    0 1px 0 var(--edge-hi) inset,
    0 -1px 0 var(--edge-lo) inset,
    0 12px 30px rgba(0,0,0,0.5),
    0 0 0 1px rgba(200,168,75,0.10);
}
.glass h2 {
  color: var(--accent2);
  font-size: 0.96em;
  font-family: 'Oswald', 'Cinzel', sans-serif;
  font-weight: 600;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  margin-bottom: 13px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--hair);
  display: flex; align-items: center; gap: 8px;
}

/* ── Inline SVG icon system ───────────────────────────────
   Consistent stroke icon set. <svg class="ic"><use href="#ic-..."/></svg>
   inherits currentColor, so icons recolor with their context. */
.ic {
  width: 1.05em; height: 1.05em;
  flex-shrink: 0;
  display: inline-block;
  vertical-align: -0.16em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.3;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ic-lg { width: 1.4em; height: 1.4em; }
.ic-fill { fill: currentColor; stroke: none; }

/* ── Buttons ──────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  background: linear-gradient(180deg, #2a251c, #1b1812);
  color: var(--text);
  border: 1px solid var(--border-2);
  font-weight: 600;
  font-size: 0.95em;
  padding: 11px 18px;
  border-radius: var(--r-2);
  text-decoration: none;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  box-shadow: 0 1px 0 var(--edge-hi) inset, 0 1px 2px rgba(0,0,0,0.4);
  transition:
    transform    var(--dur-1) var(--ease-out),
    border-color var(--dur-2) var(--ease-out),
    box-shadow   var(--dur-2) var(--ease-out),
    color        var(--dur-2) var(--ease-out),
    background   var(--dur-2) var(--ease-out),
    filter       var(--dur-2) var(--ease-out);
}
.btn:hover:not(:disabled)  { transform: translateY(-1px); border-color: var(--accent); }
.btn:active:not(:disabled) { transform: translateY(0) scale(0.98); }
.btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  filter: saturate(0.5);
  box-shadow: none;
}

/* ── btn-primary: forged gold ── */
.btn-primary {
  background: linear-gradient(180deg, var(--accent2), var(--accent));
  color: #20180a;
  border: 1px solid #8a6f2a;
  text-shadow: 0 1px 0 rgba(255,255,255,0.18);
  box-shadow: 0 2px 10px rgba(200,168,75,0.28),
              inset 0 1px 0 rgba(255,255,255,0.28);
}
.btn-primary::before {
  content: '';
  position: absolute;
  top: 0; left: -75%;
  width: 45%; height: 100%;
  background: linear-gradient(120deg, transparent 20%, rgba(255,255,255,0.32) 50%, transparent 80%);
  transform: skewX(-15deg);
  transition: left var(--dur-3) var(--ease-out);
}
.btn-primary:hover:not(:disabled)::before { left: 130%; }
.btn-primary:hover:not(:disabled) {
  border-color: #b89236;
  box-shadow: 0 4px 18px rgba(224,192,104,0.5),
              inset 0 1px 0 rgba(255,255,255,0.32);
}

/* ── Action button accent variants (colored edge + hover wash) ── */
.btn-attack  { border-color: #6a2420; }
.btn-attack:hover:not(:disabled)  { border-color: var(--red);    color: #ff7a6b; box-shadow: 0 0 14px rgba(231,76,60,0.3), 0 1px 0 var(--edge-hi) inset; }
.btn-rest    { border-color: #234a23; }
.btn-rest:hover:not(:disabled)    { border-color: var(--green);  color: #62e892; box-shadow: 0 0 14px rgba(39,174,96,0.3), 0 1px 0 var(--edge-hi) inset; }
.btn-explore { border-color: #234155; }
.btn-explore:hover:not(:disabled) { border-color: var(--blue);   color: var(--blue); box-shadow: 0 0 14px rgba(116,185,255,0.3), 0 1px 0 var(--edge-hi) inset; }
.btn-heal    { border-color: #1f4a3a; }
.btn-heal:hover:not(:disabled)    { border-color: var(--teal);   color: #a8e6cf; box-shadow: 0 0 14px rgba(26,188,156,0.3), 0 1px 0 var(--edge-hi) inset; }
.btn-potions { border-color: #3c2750; }
.btn-potions:hover:not(:disabled) { border-color: var(--purple); color: #c9a7dd; box-shadow: 0 0 14px rgba(155,89,182,0.3), 0 1px 0 var(--edge-hi) inset; }
.btn-shop    { border-color: #4a3718; }
.btn-shop:hover:not(:disabled)    { border-color: var(--accent); color: var(--accent2); box-shadow: 0 0 14px rgba(200,168,75,0.3), 0 1px 0 var(--edge-hi) inset; }
.btn-secondary { border-color: var(--border-2); }
.btn-secondary:hover:not(:disabled) { border-color: var(--accent); color: var(--accent2); }

/* ── Chips (cost / status / meta tags) ── */
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 0.72em; font-weight: 700; line-height: 1;
  padding: 3px 7px; border-radius: var(--r-1);
  background: var(--inset); color: var(--text-dim);
  border: 1px solid var(--border);
  white-space: nowrap;
}
.chip-gold { color: var(--accent2); border-color: #5a4515; background: #1c1407; }
.chip-danger { color: #ff8076; border-color: #5a221d; background: #1f0d0b; }
.chip-good { color: #62e892; border-color: #1f4a2a; background: #0c1d11; }

/* ── HP / progress bars ──────────────────────────────── */
.bar-wrap {
  height: 15px; background: var(--inset); border-radius: var(--r-1); overflow: hidden;
  margin: 7px 0; border: 1px solid rgba(0,0,0,0.5);
  box-shadow: inset 0 1px 4px rgba(0,0,0,0.6);
}
.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #1a6b1a, var(--green));
  transition: width 0.5s var(--ease-out), background 0.6s var(--ease-out);
  position: relative;
  overflow: hidden;
}
.bar-fill.mid { background: linear-gradient(90deg, #8a6a00, var(--amber)); }
.bar-fill.low { background: linear-gradient(90deg, #7b0000, var(--red)); }
.bar-fill::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(110deg, transparent 38%, rgba(255,255,255,0.10) 50%, transparent 62%);
  background-size: 100% 100%;
}

/* ── Tier colors (exact match to extension) ─────────── */
.tier-common    { color: var(--tier-common); }
.tier-rare      { color: var(--tier-rare); }
.tier-epic      { color: var(--tier-epic); }
.tier-legendary { color: var(--tier-legendary); }
@keyframes prestigeGlow {
  0%, 100% { text-shadow: 0 0 6px rgba(249,202,36,0.45); }
  50%      { text-shadow: 0 0 15px rgba(249,202,36,0.9), 0 0 26px rgba(249,202,36,0.28); }
}
.tier-prestige  {
  color: var(--tier-prestige);
  animation: prestigeGlow 3s ease-in-out infinite;
}
@keyframes mythicGlow {
  0%, 100% { text-shadow: 0 0 6px rgba(255,94,199,0.45); }
  50%      { text-shadow: 0 0 15px rgba(255,94,199,0.9), 0 0 26px rgba(255,94,199,0.28); }
}
.tier-mythic {
  color: var(--tier-mythic);
  animation: mythicGlow 3s ease-in-out infinite;
}
.glow-prestige { animation: glowPulse 2.8s ease-in-out infinite; }

/* ── Misc ─────────────────────────────────────────────── */
.stat-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 5px 0;
  font-size: 0.92em;
  color: var(--text-dim);
  border-bottom: 1px solid rgba(255,255,255,0.03);
  transition: color var(--dur-1) var(--ease-out);
}
.stat-row:last-child { border-bottom: none; }
.stat-row b { color: var(--text); font-weight: 600; }

.skeleton {
  background: linear-gradient(90deg, var(--bg3) 25%, #2c2820 37%, var(--bg3) 63%);
  background-size: 400% 100%;
  animation: skeleton-wave 1.4s ease infinite;
  border-radius: var(--r-2);
  color: transparent;
}

.pop-in { animation: popIn var(--dur-2) var(--ease-spring) both; }
.count-pop { animation: countPop var(--dur-2) var(--ease-spring); }
.float-idle { animation: floatY 3.6s ease-in-out infinite; }

/* ── Scrollbars ───────────────────────────────────────── */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: var(--inset); }
::-webkit-scrollbar-thumb {
  background: #3a3429;
  border-radius: var(--r-1);
  border: 2px solid var(--inset);
  transition: background var(--dur-2) var(--ease-out);
}
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ── Reduced-motion overrides ─────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .bg-glow              { animation: none; }
  .skeleton             { animation: none; background: var(--bg3); }
  .bar-fill::after      { animation: none; }
  .site-header .brand img { animation: none; }
  .tier-prestige,
  .tier-mythic,
  .glow-prestige        { animation: none; }
  .pop-in               { animation: none; opacity: 1; transform: none; }
  .float-idle           { animation: none; }
  .count-pop            { animation: none; }

  .glass {
    animation: none;
    opacity: 1;
    transition: box-shadow var(--dur-2) linear, border-color var(--dur-2) linear;
  }

  .btn-primary::before  { display: none; }
  .btn,
  .btn-primary          { transition: box-shadow var(--dur-1) linear, border-color var(--dur-1) linear; }
  .btn:hover:not(:disabled),
  .btn:active:not(:disabled) { transform: none; }

  a, .site-header nav a { transition: none; }
}
