/* ---------------------------------------------------------------------
   VMForge launcher — техноминимализм (2026-09-28 redesign)
   Two themes only on this screen (dark/light) — a third "gray" theme
   exists for other modules' own interiors; if data-theme="gray" is ever
   set when this screen loads, it silently renders as dark here (no
   [data-theme="gray"] block below at all, so it falls through to the
   default :root rules) rather than needing its own look.
   --------------------------------------------------------------------- */

:root {
  color-scheme: dark;
  --bg: #0a0b0c;
  --accent: #45bcc8;
  --accent-dim: rgba(69, 188, 200, 0.35);
  --glass-bg: rgba(20, 22, 24, 0.55);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-highlight: rgba(255, 255, 255, 0.06);
  --fg: #eef1f2;
  --fg-dim: rgba(238, 241, 242, 0.45);
  --fg-dimmer: rgba(238, 241, 242, 0.28);
  --logo-color: #ffffff;
  --shadow: rgba(0, 0, 0, 0.5);
  --mono: "Cascadia Mono", "Consolas", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --sans: -apple-system, "Segoe UI", Inter, "Helvetica Neue", Arial, sans-serif;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #eef0f1;
  --glass-bg: rgba(255, 255, 255, 0.55);
  --glass-border: rgba(20, 22, 24, 0.08);
  --glass-highlight: rgba(255, 255, 255, 0.5);
  --fg: #14181a;
  --fg-dim: rgba(20, 24, 26, 0.45);
  --fg-dimmer: rgba(20, 24, 26, 0.3);
  --logo-color: #14181a;
  --shadow: rgba(20, 24, 26, 0.18);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

body {
  position: relative;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
  transition: background 0.4s ease;
}

button {
  font-family: inherit;
}

/* ---------------- animated background ---------------- */

.bg-layer {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}

/* Rendered small (see width/height below) and scaled up via --bg-scale —
   the whole point is that filter: blur() only ever has to process a
   handful of thousand pixels, not a full 1080p+ viewport, every time the
   gif's frame changes. home.js's layoutBackground() computes both
   --bg-scale (to cover the viewport) and --bg-blur (divided by that same
   scale, so the visually-perceived blur radius stays constant regardless
   of screen size) on load and on resize. */
.bg-content {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 480px;
  height: 270px;
  transform: translate(-50%, -50%) scale(var(--bg-scale, 4.5));
  transform-origin: center center;
  filter: blur(var(--bg-blur, 9px)) saturate(1.1);
}

/* Placeholder abstract "texture" — slow-drifting turquoise/neutral blobs,
   standing in for the real background media until it's dropped in (see
   bg-gif below). Kept underneath the gif layer always, so a 404/missing
   file degrades to this instead of a blank screen. */
.bg-fallback {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 20% 30%, var(--accent-dim), transparent 45%), radial-gradient(circle at 80% 70%, var(--accent-dim), transparent 50%),
    radial-gradient(circle at 60% 20%, rgba(255, 255, 255, 0.05), transparent 40%), var(--bg);
  background-size: 180% 180%, 200% 200%, 160% 160%, 100% 100%;
  animation: bg-drift 28s ease-in-out infinite alternate;
}

:root[data-theme="light"] .bg-fallback {
  background: radial-gradient(circle at 20% 30%, var(--accent-dim), transparent 45%), radial-gradient(circle at 80% 70%, var(--accent-dim), transparent 50%),
    radial-gradient(circle at 60% 20%, rgba(20, 24, 26, 0.05), transparent 40%), var(--bg);
  background-size: 180% 180%, 200% 200%, 160% 160%, 100% 100%;
}

@keyframes bg-drift {
  0% {
    background-position: 0% 0%, 100% 100%, 50% 0%, 0 0;
  }
  100% {
    background-position: 30% 20%, 70% 80%, 20% 30%, 0 0;
  }
}

/* Real background media (gif/img), once one exists at this path — see
   home.js's tryLoadBackgroundMedia(). Grayscale always; inverted only in
   light mode, so ONE colour file works for both themes without ever
   touching the file itself (a real colour gif still plays/animates
   normally underneath these filters, applied live per frame). */
.bg-gif {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(1);
  opacity: 0;
  transition: opacity 1.2s ease;
}

.bg-gif.loaded {
  opacity: 1;
}

:root[data-theme="light"] .bg-gif {
  filter: grayscale(1) invert(1);
}

.bg-glass {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0) 40%), var(--bg);
  opacity: 0.38;
}

:root[data-theme="light"] .bg-glass {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0) 40%), var(--bg);
  opacity: 0.5;
}

/* Extra darkening behind the dock when it's being interacted with — see
   home.js toggling .dock-active on this element. */
.bg-vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 88% 50%, rgba(0, 0, 0, 0.55), transparent 45%);
  opacity: 0;
  transition: opacity 0.5s ease;
  pointer-events: none;
}

.bg-vignette.active {
  opacity: 1;
}

/* ---------------- glass panel primitive ---------------- */

.glass {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(24px) saturate(1.2);
  -webkit-backdrop-filter: blur(24px) saturate(1.2);
  box-shadow: 0 20px 60px var(--shadow), inset 0 1px 0 var(--glass-highlight);
}

/* ---------------- login screen ---------------- */

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  position: relative;
  width: 340px;
  max-width: calc(100vw - 40px);
  border-radius: 28px;
  padding: 40px 36px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  animation: login-in 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes login-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.login-theme-toggle {
  position: absolute;
  top: 16px;
  right: 18px;
}

.theme-text-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--fg-dimmer);
  font-size: 15px;
  line-height: 1;
  padding: 4px;
  transition: color 0.2s ease, transform 0.2s ease;
}

.theme-text-btn:hover {
  color: var(--fg);
  transform: rotate(12deg);
}

/* The source SVG (assets/vmerche-logo.svg) is hardcoded turquoise —
   masked instead of <img>'d so it can be recoloured per theme (white on
   dark, black on light) via --logo-color without touching the file. */
.login-logo,
.stage-logo {
  background-color: var(--logo-color);
  -webkit-mask-image: url("assets/vmerche-logo.svg");
  mask-image: url("assets/vmerche-logo.svg");
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
  aspect-ratio: 790.43 / 302.32;
}

.login-logo {
  width: 168px;
  opacity: 0.95;
}

.login-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.login-form input {
  width: 100%;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.04);
  border-radius: 12px;
  padding: 12px 14px;
  color: var(--fg);
  font-size: 13px;
  font-family: var(--sans);
  outline: none;
  transition: border-color 0.2s ease, background 0.2s ease;
}

:root[data-theme="light"] .login-form input {
  background: rgba(20, 24, 26, 0.03);
}

.login-form input:focus {
  border-color: var(--accent);
  background: rgba(69, 188, 200, 0.08);
}

.login-form input::placeholder {
  color: var(--fg-dimmer);
}

.login-submit {
  margin-top: 4px;
  border: none;
  border-radius: 12px;
  padding: 12px;
  background: var(--accent);
  color: #04181a;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: filter 0.2s ease, transform 0.1s ease;
}

.login-submit:hover {
  filter: brightness(1.08);
}

.login-submit:active {
  transform: scale(0.98);
}

.login-error {
  margin: 0;
  color: #ff6b6b;
  font-size: 11.5px;
  text-align: center;
}

/* ---------------- app screen ---------------- */

.app-screen {
  position: fixed;
  inset: 0;
  z-index: 5;
}

.corner-header {
  position: fixed;
  top: 22px;
  right: 28px;
  z-index: 20;
  text-align: right;
}

.corner-header-text {
  font-size: 11.5px;
  color: var(--fg-dimmer);
  letter-spacing: 0.01em;
  cursor: default;
  transition: color 0.25s ease;
}

.corner-header-text:hover {
  color: var(--fg-dim);
}

.corner-header-text .sep {
  margin: 0 8px;
  color: var(--fg-dimmer);
  opacity: 0.5;
}

.corner-header-text .link {
  cursor: pointer;
}

.corner-header-text .link:hover {
  color: var(--fg);
}

.stage {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.stage-logo {
  width: min(46vw, 560px);
  filter: drop-shadow(0 8px 30px var(--shadow));
  opacity: 0.92;
  transition: filter 0.4s ease, opacity 0.4s ease;
}

.stage.dimmed .stage-logo {
  filter: drop-shadow(0 8px 30px var(--shadow)) blur(2px);
  opacity: 0.55;
}

/* ---------------- circular dock ---------------- */

.dock {
  position: fixed;
  inset: 0;
  z-index: 15;
  pointer-events: none;
}

/* Faint curved track line — a visual hint that the ring of module icons
   continues past the edge of the screen (per the genre-picker reference).
   Its path is recomputed in JS alongside the icons themselves. */
.dock-track {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

#dockTrackPath {
  fill: none;
  stroke: var(--glass-border);
  stroke-width: 1.5;
  opacity: 0.8;
  transition: opacity 0.35s ease;
}

/* The ring morphs into this vertical capsule once expanded (2026-09-29,
   per reference screenshot) — every module icon lines up straight down
   its centre (see layoutDockPillIcons/layoutDockPill in home.js), so
   nothing needs "листать" through nearer icons to reach a further one.
   left/top/width/height animate via the same transition the icons already
   use, so the morph reads as one continuous motion, not a cut. */
.dock-pill {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  border-radius: 999px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 10px 40px var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: left 0.55s cubic-bezier(0.22, 0.9, 0.2, 1), top 0.55s cubic-bezier(0.22, 0.9, 0.2, 1),
    width 0.55s cubic-bezier(0.22, 0.9, 0.2, 1), height 0.55s cubic-bezier(0.22, 0.9, 0.2, 1), opacity 0.35s ease;
}

.dock-pill.visible {
  opacity: 1;
}

/* Outer element is a FIXED-size hit-zone, deliberately decoupled from the
   visible circle's own size (see .dock-icon-visual) — found 2026-09-28 via
   feedback that hovering near the edge made the icon "jitter": when the
   hover target itself grows on :hover, growing can shift its own edge out
   from under a cursor sitting near that edge, firing mouseleave, which
   shrinks it back, which re-enters it, forever. A hover target that never
   changes size can't do that. */
.dock-icon {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--hit-size, 84px);
  height: var(--hit-size, 84px);
  margin: calc(var(--hit-size, 84px) / -2) 0 0 calc(var(--hit-size, 84px) / -2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  pointer-events: auto;
  transition: left 0.55s cubic-bezier(0.22, 0.9, 0.2, 1), top 0.55s cubic-bezier(0.22, 0.9, 0.2, 1), opacity 0.4s ease;
}

/* The actual visible circle — THIS is what animates size between
   collapsed/expanded, centred inside the fixed hit-zone above. */
.dock-icon-visual {
  position: relative;
  width: var(--icon-size, 60px);
  height: var(--icon-size, 60px);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: var(--fg-dim);
  transition: width 0.3s ease, height 0.3s ease, background 0.25s ease, color 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.dock-icon .dock-icon-glyph {
  display: flex;
  transition: transform 0.25s ease;
}

.dock-icon-glyph svg {
  width: 22px;
  height: 22px;
  display: block;
}

.dock-icon:hover .dock-icon-glyph,
.dock-icon.is-active .dock-icon-glyph {
  transform: scale(1.08);
}

.dock-icon.is-active .dock-icon-visual {
  color: var(--fg);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 0 0 1px var(--accent-dim), 0 10px 30px var(--shadow);
}

/* Turquoise fills the icon's own container on hover — not just an outer
   ring — per direct feedback that only the outside was lighting up before. */
.dock-icon.is-active:hover .dock-icon-visual,
.dock-icon.is-active.is-hovered .dock-icon-visual {
  color: #04181a;
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 0 1.5px var(--accent), 0 0 28px var(--accent-dim), 0 10px 30px var(--shadow);
}

.dock-icon.is-warn .dock-icon-visual::after {
  content: "";
  position: absolute;
  top: 2px;
  right: 2px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ff8a5b;
  box-shadow: 0 0 0 2px var(--bg);
}

/* Module title/description that unfurls to the LEFT of the centred icon.
   --panel-right is set in JS from the active icon's actual bounding rect
   (showModulePanel) — a hardcoded offset kept drifting out of sync with
   DOCK_RADIUS/icon size and ended up overlapping the icon instead of
   sitting clear of it. */
.module-panel {
  position: fixed;
  top: 50%;
  right: var(--panel-right, 520px);
  transform: translateY(-50%) translateX(12px);
  z-index: 16;
  max-width: 340px;
  text-align: right;
  padding: 16px 20px;
  border-radius: 18px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.module-panel.visible {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

.module-panel-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 4px;
}

.module-panel-desc {
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--fg-dim);
}

.module-panel-warn {
  margin-top: 8px;
  font-size: 10.5px;
  color: #ff8a5b;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* ---------------- update / download status ---------------- */

.update-status-bar {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  z-index: 999;
  min-width: 280px;
  max-width: min(480px, calc(100vw - 40px));
  border-radius: 14px;
  padding: 12px 18px;
  overflow: hidden;
}

.update-status-fill {
  position: absolute;
  inset: 0;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-dim), var(--accent));
  transition: width 0.4s ease;
}

.update-status-text {
  position: relative;
  z-index: 1;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--fg);
  text-align: center;
  display: block;
}

/* ---------------- changelog modal (kept, restyled) ---------------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal {
  width: 480px;
  max-width: calc(100vw - 40px);
  max-height: calc(100vh - 80px);
  overflow-y: auto;
  border-radius: 20px;
  display: flex;
  flex-direction: column;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--glass-border);
  position: sticky;
  top: 0;
  background: var(--glass-bg);
  backdrop-filter: blur(24px);
}

.modal-head h2 {
  font-size: 14px;
  margin: 0;
  color: var(--fg);
  font-weight: 600;
}

.icon-btn {
  background: transparent;
  color: var(--fg-dim);
  border: none;
  font-size: 17px;
  line-height: 1;
  padding: 2px 6px;
  cursor: pointer;
  transition: color 0.2s ease;
}

.icon-btn:hover {
  color: var(--fg);
}

.modal-body {
  padding: 18px 20px;
  font-size: 12px;
  line-height: 1.6;
}

.changelog-entry {
  border-bottom: 1px solid var(--glass-border);
  padding-bottom: 12px;
  margin-bottom: 12px;
}

.changelog-entry:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.changelog-entry h3 {
  font-size: 13px;
  color: var(--accent);
  margin: 0 0 6px;
  font-weight: 600;
}

.changelog-body p {
  margin: 0 0 10px;
}

.changelog-body ul {
  margin: 0 0 10px;
  padding-left: 20px;
}

.changelog-body li {
  margin-bottom: 4px;
}

.changelog-body img {
  max-width: 100%;
  display: block;
  margin: 8px 0;
  border-radius: 10px;
}

.changelog-body a {
  color: var(--accent);
}
