/* ggum — Bioluminescent Liquid Glass Theme */

:root {
  --bg-dark: #060813;
  --bg-surface: rgba(14, 19, 36, 0.65);
  --oil-cyan: #00f2fe;
  --oil-magenta: #f355cd;
  --oil-yellow: #ffea00;
  --oil-amber: #ff7b00;
  --oil-crimson: #ff3366;
  --text: #f8fafc;
  --muted: #94a3b8;
  --accent: var(--oil-cyan);
  --glass-border: rgba(255, 255, 255, 0.22);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
}

html, body {
  height: 100%;
  color: var(--text);
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-dark);
  overflow: hidden;
}

/* ── Layout Shell ────────────────────────────────────────── */

.shell {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 28px;
  height: 100%;
  padding: 30px 36px;
}

/* ── Bioluminescent Navigation Rail ─────────────────────── */

.rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 18px 10px;
  width: 74px;
  border-radius: 38px 24px 34px 28px / 28px 34px 24px 38px;
  background: rgba(14, 19, 36, 0.55);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1.5px solid var(--glass-border);
  box-shadow:
    inset 0 0 16px rgba(255, 255, 255, 0.12),
    0 15px 35px rgba(0, 0, 0, 0.4);
  position: relative;
}

.rail-btn {
  all: unset;
  cursor: pointer;
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  border-radius: 55% 45% 42% 58% / 48% 52% 48% 52%;
  color: var(--muted);
  position: relative;
  transition: all 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.rail-btn:hover {
  color: #fff;
  transform: scale(1.08);
  border-radius: 45% 55% 60% 40% / 55% 45% 45% 55%;
  background: radial-gradient(circle, rgba(0, 242, 254, 0.25), rgba(243, 85, 205, 0.15), transparent 70%);
  box-shadow: 0 0 20px rgba(0, 242, 254, 0.3);
}

.rail-btn.active {
  color: #fff;
  border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
  background: radial-gradient(circle at 30% 30%, rgba(255, 234, 0, 0.45), transparent 50%),
              radial-gradient(circle at 70% 70%, rgba(0, 242, 254, 0.5), transparent 55%),
              linear-gradient(135deg, rgba(243, 85, 205, 0.45), rgba(36, 0, 70, 0.7));
  border: 1.5px solid rgba(255, 255, 255, 0.5);
  box-shadow:
    inset 0 0 12px rgba(255, 255, 255, 0.6),
    0 8px 24px rgba(243, 85, 205, 0.4);
}


.icon-img {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.5));
}

.rail-spacer { flex: 1; }

/* Morphing Liquid Rail Indicator */

/* ── Main Views ─────────────────────────────────────────── */

.views {
  flex: 1;
  min-width: 0;
  position: relative;
}

.view {
  content-visibility: auto;
  contain-intrinsic-size: auto 640px;
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
  opacity: 0;
  transform: translateY(12px) scale(0.98);
  pointer-events: none;
  transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
  padding: 10px 14px;
  border-radius: 32px;
}

.view.active {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

.view[hidden] { display: flex; }

.game-title {
  margin: 10px 8px 2px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #ffffff 20%, var(--oil-cyan) 50%, var(--oil-magenta) 80%, var(--oil-yellow) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 12px rgba(0, 242, 254, 0.2));
  color: #fff;
}

/* ── Downloads view: card fills the full view area ───────── */

#view-downloads .downloads-card {
  flex: 1;
  max-width: none;
  width: auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

#view-downloads .history {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

/* ── Morphing Bioluminescent Liquid Cards ───────────────── */

.card {
  border-radius: 36px 28px 38px 26px / 28px 36px 26px 38px;
  padding: 30px 34px;
  max-width: 760px;
  background:
    radial-gradient(circle at 10% 15%, rgba(0, 242, 254, 0.12) 0%, transparent 40%),
    radial-gradient(circle at 90% 85%, rgba(243, 85, 205, 0.12) 0%, transparent 45%),
    radial-gradient(circle at 50% 50%, rgba(255, 234, 0, 0.05) 0%, transparent 60%),
    var(--bg-surface);
  backdrop-filter: blur(28px) saturate(150%);
  -webkit-backdrop-filter: blur(28px) saturate(150%);
  border: 1.5px solid var(--glass-border);
  box-shadow:
    inset 0 0 20px rgba(255, 255, 255, 0.1),
    inset 0 -8px 20px rgba(0, 0, 0, 0.5),
    0 18px 45px rgba(0, 0, 0, 0.55),
    0 0 30px rgba(0, 242, 254, 0.1);
  position: relative;
  overflow: hidden;
}

@keyframes morphCard {
  0% { border-radius: 36px 28px 38px 26px / 28px 36px 26px 38px; }
  50% { border-radius: 28px 38px 26px 36px / 38px 26px 36px 28px; }
  100% { border-radius: 36px 28px 38px 26px / 28px 36px 26px 38px; }
}

.status-line {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 0 12px rgba(255, 255, 255, 0.4);
}

.sub-line {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

/* ── Per-Game Path Input Row ────────────────────────────── */

.path-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 10px;
  flex-wrap: wrap;
}

.path-input {
  flex: 1 1 280px;
  min-width: 200px;
  padding: 13px 20px;
  border-radius: 20px 14px 22px 16px / 16px 22px 14px 20px;
  border: 1.5px solid rgba(255, 255, 255, 0.18);
  background: rgba(8, 12, 24, 0.6);
  backdrop-filter: blur(16px);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.6), 0 0 10px rgba(0, 242, 254, 0.05);
  transition: all 0.35s ease;
  outline: none;
}

.path-input:focus {
  border-color: var(--oil-cyan);
  box-shadow:
    inset 0 2px 6px rgba(0, 0, 0, 0.4),
    0 0 25px rgba(0, 242, 254, 0.4),
    0 0 10px rgba(243, 85, 205, 0.3);
  background: rgba(12, 17, 34, 0.85);
}

.path-msg {
  color: var(--oil-crimson);
  font-size: 13px;
  font-weight: 600;
  text-shadow: 0 0 8px rgba(255, 51, 102, 0.4);
}

/* ── Amoeba Buttons ────────────────────────────────────────
   One ghost skin for every action button; the tint slot comes from the
   active game's extracted palette (.btn-c1/c2/c3). The membrane lives on
   ::before: hover disperses pigment to the outer rim, click squishes. */
.ghost-btn {
  all: unset;
  --squish-angle: 3deg;
  box-sizing: border-box;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 26px;
  font-weight: 700;
  font-size: 14px;
  line-height: 1.2;
  position: relative;
  user-select: none;
  animation: morphBtn 9s ease-in-out infinite;
  color: #fff;
  background: transparent;
  border-radius: 45% 55% 50% 50% / 55% 45% 55% 45%;
  filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.5));
  transition: filter 0.3s ease, transform 0.1s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.ghost-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: inherit;
  border: 2px solid color-mix(in srgb, var(--btn-fill, var(--accent)) 90%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  background:
    radial-gradient(circle at 70% 70%, color-mix(in srgb, var(--btn-fill, var(--accent)) 45%, transparent), transparent 60%),
    rgba(255, 255, 255, 0.22);
  box-shadow:
    inset 0 0 20px color-mix(in srgb, var(--btn-fill, var(--accent)) 45%, transparent),
    0 0 25px color-mix(in srgb, var(--btn-fill, var(--accent)) 40%, transparent);
  transition:
    border-color 0.3s ease,
    border-width 0.15s ease,
    box-shadow 0.3s ease,
    background 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.ghost-label {
  position: relative;
  z-index: 2;
  pointer-events: none;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.9), 0 0 15px color-mix(in srgb, var(--btn-fill, var(--accent)) 60%, transparent);
  transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1), letter-spacing 0.3s ease;
}

/* Hover: pigment condenses into a luminous outer ring */
.ghost-btn:hover {
  filter: drop-shadow(0 15px 30px rgba(0, 0, 0, 0.75));
}
.ghost-btn:hover::before {
  border-width: 3px;
  border-color: #ffffff;
  background:
    radial-gradient(circle at 50% 50%,
      transparent 0%,
      transparent 52%,
      color-mix(in srgb, var(--btn-fill, var(--accent)) 45%, transparent) 70%,
      var(--btn-fill, var(--accent)) 86%,
      color-mix(in srgb, var(--btn-fill, var(--accent)) 70%, #ffffff) 96%,
      #ffffff 100%),
    rgba(0, 0, 0, 0.05);
  box-shadow:
    inset 0 0 35px var(--btn-fill, var(--accent)),
    inset 0 0 65px color-mix(in srgb, var(--btn-fill, var(--accent)) 60%, transparent),
    0 0 45px color-mix(in srgb, var(--btn-fill, var(--accent)) 70%, transparent);
}
.ghost-btn:hover .ghost-label {
  letter-spacing: 3px;
}

/* Click: viscoelastic squish with counter-stretched label */
.ghost-btn:active {
  transform: scale(1.42, 0.48) rotate(var(--squish-angle));
  transition: transform 0.07s cubic-bezier(0.1, 0.9, 0.2, 1);
}
.ghost-btn:active::before {
  border-width: 4.5px;
  border-color: #ffffff;
  box-shadow:
    inset 0 0 45px var(--btn-fill, var(--accent)),
    inset 0 0 80px color-mix(in srgb, var(--btn-fill, var(--accent)) 60%, transparent),
    0 0 55px color-mix(in srgb, var(--btn-fill, var(--accent)) 70%, transparent);
  transition: border-width 0.05s ease, box-shadow 0.05s ease;
}
.ghost-btn:active .ghost-label {
  transform: scale(0.82, 1.45);
}

/* Palette tint slots */
.btn-c1 { --btn-fill: var(--hud-accent, var(--accent)); } /* primary */
.btn-c2 { --btn-fill: var(--hud-2nd, var(--oil-amber)); } /* secondary (pause) */
.btn-c3 { --btn-fill: var(--hud-3rd, var(--oil-crimson)); } /* heavy/destructive */

@keyframes morphBtn {
  0% { border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%; }
  50% { border-radius: 28% 72% 72% 28% / 44% 68% 32% 56%; }
  100% { border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%; }
}

/* Button Spacing & Rows */
.btn-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.card > .ghost-btn { margin-top: 16px; }

/* Busy / Spinner State */
.busy {
  cursor: progress !important;
  opacity: 0.85;
  pointer-events: none;
}

.spinner {
  width: 15px;
  height: 15px;
  flex: none;
  border: 2.5px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Integrity Scan & Bad Files ──────────────────────────── */

.scan-line {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 12px 0 8px;
  font-size: 13.5px;
  color: var(--muted);
  flex-wrap: wrap;
}

.scan-bar {
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.45);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.12);
  margin-bottom: 12px;
}

.scan-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--oil-cyan), var(--oil-magenta), var(--oil-yellow), var(--oil-cyan));
  box-shadow: 0 0 12px var(--oil-cyan);
  transition: width 0.35s ease;
}

.sub-line.warn {
  color: var(--oil-yellow);
  font-weight: 600;
  text-shadow: 0 0 10px rgba(255, 234, 0, 0.3);
}

.bad-list {
  font-size: 13px;
  color: var(--muted);
  margin: 8px 0 12px;
  background: rgba(0, 0, 0, 0.25);
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.bad-list summary {
  cursor: pointer;
  color: #e2e8f0;
  font-weight: 600;
  outline: none;
}

.bad-list div {
  padding-left: 14px;
  margin-top: 4px;
  word-break: break-all;
}

/* ── Downloads Manager & Progress Bar ────────────────────── */

/* active job wears the rail's liquid-glass skin, same footprint */
/* active download block: HUD bar + info live directly in the card */
.downloads-card > .hud-fluid-bar-container,
.downloads-card > .job-foot {
  position: relative;
}
.downloads-card > .hud-fluid-bar-container {
  margin-bottom: 18px;
}
.job-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 14px;
}
.job-foot .job-stats {
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.job-foot .job-actions { display: inline-flex; gap: 10px; margin-left: auto; }

.job-stats {
  color: var(--muted);
  font-size: 18px;
  font-weight: 500;
}

/* ── Fluid HUD progress bar (dynamic responsive) ─────────── */

.hud-fluid-bar-container {
  width: 100%;
  max-width: none;
  display: flex;
  flex-direction: column;
  filter: drop-shadow(0 14px 32px rgba(0, 0, 0, 0.65));
  user-select: none;
}


.job-foot .jt-pct {
  font-weight: 900;
  color: var(--hud-accent, var(--accent));
  text-shadow: 0 0 12px color-mix(in srgb, var(--hud-accent, var(--accent)) 60%, transparent);
}

.downloads-card .hud-svg {
  width: 100%;
  height: 120px; /* fixed height keeps tube diameter & bulb scale intact */
  overflow: visible;
  display: block;
}


@keyframes hudWaveFront {
  0% { transform: translateX(0); }
  100% { transform: translateX(-400px); }
}
@keyframes hudWaveBack {
  0% { transform: translateX(-400px); }
  100% { transform: translateX(0); }
}
@keyframes hudIconFloat {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-3px) scale(1.04); }
}
.hud-wave-front { animation: hudWaveFront 3.2s linear infinite; }
.hud-wave-back { animation: hudWaveBack 4.8s linear infinite; }
.hud-floating-icon {
  transform-origin: 58px 60px;
  animation: hudIconFloat 3.2s ease-in-out infinite;
}




/* ── History List ────────────────────────────────────────── */

.empty-hint {
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  margin: 10px 0 12px;
}

.history {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.history-entry {
  padding: 12px 18px;
  border-radius: 18px 12px 20px 14px / 14px 20px 12px 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.09);
  backdrop-filter: blur(12px);
  font-size: 13.5px;
  color: var(--muted);
  box-shadow: inset 0 0 10px rgba(0, 242, 254, 0.05);
}

.history-entry b {
  color: #fff;
  font-weight: 700;
}

.action-error {
  color: var(--oil-crimson);
  font-weight: 600;
  text-shadow: 0 0 8px rgba(255, 51, 102, 0.4);
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0s !important;
    transition-duration: 0s !important;
  }
}