:root {
  --bg: #05060a;
  --bg2: #0d111a;
  --text: #ecf5ff;
  --muted: rgba(236,245,255,.66);
  --line: rgba(174,198,255,.18);
  --line-hot: rgba(255,140,58,.64);
  --panel: rgba(9, 13, 22, .64);
  --panel2: rgba(12, 18, 30, .78);
  --card: rgba(10, 15, 27, .54);
  --shadow: 0 24px 80px rgba(0,0,0,.5);
  --hot: #ff8a39;
  --gold: #ffd27a;
  --green: #38ff72;
  --cyan: #62e9ff;
  --blue: #607dff;
  --radius: 22px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}
.theme-light {
  --bg: #f5f7fb;
  --bg2: #dde7f8;
  --text: #111827;
  --muted: rgba(17,24,39,.66);
  --line: rgba(48,70,120,.2);
  --panel: rgba(255,255,255,.7);
  --panel2: rgba(248,251,255,.82);
  --card: rgba(255,255,255,.66);
  --shadow: 0 24px 80px rgba(50,74,118,.22);
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { min-height: 100%; margin: 0; }
body {
  min-height: 100svh;
  overflow: hidden;
  background: radial-gradient(circle at 65% 20%, rgba(22, 35, 72, .8), transparent 42%), radial-gradient(circle at 22% 88%, rgba(8, 74, 48, .58), transparent 38%), var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
  user-select: none;
  touch-action: manipulation;
}
button, input, textarea { font: inherit; }
button { color: inherit; }
.ambient-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100svh;
  display: block;
  z-index: 0;
  opacity: .75;
}
.glass-bar, .glass-panel, .glass-card {
  border: 1px solid var(--line);
  background: linear-gradient(145deg, var(--panel2), var(--panel));
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  box-shadow: var(--shadow), inset 0 0 0 1px rgba(255,255,255,.03);
}
.topbar {
  position: fixed;
  z-index: 20;
  top: max(10px, env(safe-area-inset-top));
  left: 10px;
  right: 10px;
  height: 62px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 10px 9px 12px;
}
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; min-width: 0; }
.brand-logo { width: 42px; height: 42px; filter: drop-shadow(0 0 16px rgba(255,120,42,.42)); }
.brand-text { display: grid; line-height: 1.05; min-width: 0; }
.brand-text strong { font-size: 18px; letter-spacing: .02em; }
.brand-text small { color: var(--muted); font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.top-actions { display: flex; gap: 8px; align-items: center; }
.chip, .round-btn, .pill-btn, .tile-btn, .tab-btn {
  border: 1px solid var(--line);
  background: rgba(255,255,255,.055);
  color: var(--text);
  border-radius: 999px;
  cursor: pointer;
  transition: transform .16s ease, border-color .16s ease, background .16s ease, box-shadow .16s ease;
}
.chip:active, .round-btn:active, .pill-btn:active, .tile-btn:active, .tab-btn:active { transform: scale(.96); }
.icon-chip { width: 40px; height: 40px; display: grid; place-items: center; font-weight: 850; }
.app-shell {
  position: relative;
  z-index: 1;
  height: 100svh;
  width: 100vw;
  overflow: hidden;
}
.hero-stage { position: fixed; inset: 0; overflow: hidden; }
.main-visual, .experience-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  border: 0;
  background: #000;
  touch-action: none;
}
.experience-frame { z-index: 3; }
.stage-vignette {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  background: radial-gradient(circle at 50% 48%, transparent 0%, transparent 48%, rgba(0,0,0,.32) 82%, rgba(0,0,0,.72) 100%);
}
.theme-light .stage-vignette { background: radial-gradient(circle at 50% 48%, transparent 0%, transparent 54%, rgba(255,255,255,.18) 86%, rgba(255,255,255,.42) 100%); }
.stage-touch-zone { position: absolute; inset: 0; z-index: 5; pointer-events: none; }
.visual-orbit-toolbar {
  position: fixed;
  z-index: 11;
  left: 50%;
  bottom: calc(86px + var(--safe-bottom));
  transform: translateX(-50%);
  display: flex;
  gap: 9px;
  align-items: center;
  padding: 9px;
  border-radius: 24px;
}
.round-btn {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  font-size: 21px;
  font-weight: 900;
  background: rgba(3, 8, 16, .48);
}
.round-btn.primary {
  border-color: rgba(255, 145, 58, .78);
  background: radial-gradient(circle at 40% 25%, rgba(255,214,122,.42), rgba(255,100,50,.16) 52%, rgba(0,0,0,.18));
  box-shadow: 0 0 30px rgba(255,118,42,.24);
}
.visual-meta {
  position: fixed;
  z-index: 10;
  left: 12px;
  top: 88px;
  max-width: min(330px, calc(100vw - 24px));
  border-radius: 22px;
  padding: 16px;
  pointer-events: none;
}
.eyebrow { color: var(--hot); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; font-weight: 900; }
.visual-meta h1 { margin: 7px 0 8px; font-size: clamp(24px, 7vw, 48px); line-height: .92; letter-spacing: -.05em; }
.visual-meta p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.35; }
.no-labels .labels-only { display: none !important; }
.gallery-strip {
  position: fixed;
  z-index: 12;
  left: 10px;
  right: 10px;
  bottom: calc(10px + var(--safe-bottom));
  border-radius: 22px;
  padding: 10px;
  display: grid;
  gap: 8px;
}
.strip-head { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; padding: 0 4px; }
.visual-gallery { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(118px, 38vw); gap: 10px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; scroll-snap-type: x mandatory; }
.visual-gallery::-webkit-scrollbar { display: none; }
.visual-card {
  position: relative;
  height: 100px;
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  background: #000;
  scroll-snap-align: center;
  cursor: pointer;
  isolation: isolate;
}
.visual-card.active { border-color: var(--line-hot); box-shadow: 0 0 22px rgba(255,120,38,.28); }
.visual-card canvas { width: 100%; height: 100%; display: block; }
.visual-card .card-label {
  position: absolute;
  left: 8px;
  bottom: 8px;
  right: 8px;
  display: none;
  z-index: 2;
  padding: 7px 9px;
  border-radius: 12px;
  background: rgba(0,0,0,.5);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
body:not(.no-labels) .visual-card .card-label { display: block; }
.ghost-dock { position: fixed; inset: 0; z-index: 30; pointer-events: none; }
.ghost-card {
  --x: 12px;
  --y: 100px;
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: min(392px, calc(100vw - 24px));
  max-height: min(72svh, 640px);
  border-radius: 22px;
  overflow: hidden;
  pointer-events: auto;
  opacity: 0;
  transform: translateY(20px) scale(.94);
  visibility: hidden;
  transition: opacity .18s ease, transform .18s ease, visibility .18s ease;
}
.ghost-card.is-open { opacity: 1; transform: translateY(0) scale(1); visibility: visible; }
.ghost-card.is-collapsed .ghost-card-body { display: none; }
.ghost-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 48px;
  padding: 10px 12px 10px 15px;
  cursor: grab;
  border-bottom: 1px solid rgba(180,205,255,.12);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .07em;
  font-weight: 900;
}
.ghost-card.dragging .ghost-card-head { cursor: grabbing; }
.card-buttons { display: flex; gap: 6px; }
.card-buttons button {
  border: 1px solid var(--line);
  background: rgba(255,255,255,.06);
  color: inherit;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  cursor: pointer;
}
.ghost-card-body { padding: 12px; overflow: auto; max-height: calc(min(72svh, 640px) - 48px); }
.tab-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 10px; }
.tab-btn { padding: 10px 8px; font-weight: 850; border-radius: 14px; font-size: 12px; }
.tab-btn.active { border-color: rgba(255,140,58,.86); background: rgba(255,116,40,.14); box-shadow: inset 0 0 20px rgba(255,116,40,.09); }
.comment-feed, .chat-feed { display: grid; gap: 9px; min-height: 170px; max-height: 280px; overflow: auto; padding-right: 2px; }
.comment-item, .chat-item {
  border: 1px solid rgba(180,205,255,.13);
  background: rgba(0,0,0,.18);
  border-radius: 16px;
  padding: 10px 11px;
}
.comment-item strong, .chat-item strong { display: block; font-size: 11px; color: var(--gold); margin-bottom: 5px; }
.comment-item p, .chat-item p { margin: 0; color: var(--text); font-size: 13px; line-height: 1.35; user-select: text; }
.comment-item small, .chat-item small { display: block; margin-top: 7px; color: var(--muted); font-size: 10px; }
.comment-form { display: grid; gap: 8px; margin-top: 10px; }
textarea, input {
  width: 100%;
  border: 1px solid rgba(180,205,255,.16);
  background: rgba(0,0,0,.24);
  color: var(--text);
  border-radius: 15px;
  padding: 11px 12px;
  outline: none;
  user-select: text;
}
textarea:focus, input:focus { border-color: rgba(98,233,255,.58); box-shadow: 0 0 0 3px rgba(98,233,255,.08); }
.pill-btn { padding: 11px 14px; font-weight: 850; border-radius: 15px; background: rgba(255,255,255,.07); }
.pill-btn:hover, .round-btn:hover, .chip:hover, .tile-btn:hover { border-color: rgba(255,255,255,.38); }
.studio-body { display: grid; gap: 12px; }
.mini-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mini-grid label { display: grid; gap: 5px; color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
input[type="range"] { accent-color: var(--hot); padding: 0; }
.color-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.color-row input { height: 44px; padding: 4px; }
.button-grid, .admin-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.profile-panel { color: var(--muted); font-size: 13px; line-height: 1.45; margin-bottom: 12px; }
.auth-box { display: grid; gap: 8px; }
.tile-btn { border-radius: 16px; padding: 14px 10px; font-weight: 850; }
.console-output { min-height: 130px; overflow: auto; padding: 11px; border: 1px solid rgba(180,205,255,.12); background: rgba(0,0,0,.25); border-radius: 14px; color: var(--muted); font-size: 11px; white-space: pre-wrap; user-select: text; }
.mobile-nav {
  position: fixed;
  z-index: 22;
  left: 50%;
  bottom: calc(128px + var(--safe-bottom));
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  padding: 7px;
  border-radius: 18px;
}
.mobile-nav button {
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 9px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.mobile-nav button:active { background: rgba(255,255,255,.08); }
.toast {
  position: fixed;
  z-index: 60;
  left: 50%;
  top: 88px;
  transform: translateX(-50%) translateY(-12px);
  max-width: min(560px, calc(100vw - 24px));
  padding: 11px 14px;
  border: 1px solid rgba(98,233,255,.25);
  background: rgba(3,7,14,.75);
  color: #ecf5ff;
  border-radius: 16px;
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
  font-size: 13px;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
@media (min-width: 760px) {
  .topbar { left: 18px; right: 18px; height: 70px; padding: 11px 13px 11px 16px; }
  .brand-logo { width: 48px; height: 48px; }
  .brand-text strong { font-size: 22px; }
  .brand-text small { font-size: 11px; max-width: none; }
  .visual-orbit-toolbar { bottom: 28px; }
  .gallery-strip { left: auto; right: 18px; bottom: 18px; width: min(526px, 48vw); }
  .visual-gallery { grid-auto-columns: 156px; }
  .visual-card { height: 112px; }
  .mobile-nav { display: none; }
  .ghost-card[data-card="comments"] { --x: 18px; --y: 98px; }
  .ghost-card[data-card="studio"] { --x: calc(100vw - 420px); --y: 98px; }
}
@media (max-width: 430px) {
  .brand-text small { display: none; }
  .top-actions { gap: 5px; }
  .icon-chip { width: 36px; height: 36px; }
  .visual-orbit-toolbar { gap: 7px; padding: 7px; bottom: calc(80px + var(--safe-bottom)); }
  .round-btn { width: 44px; height: 44px; }
  .ghost-card { width: calc(100vw - 20px); }
  .ghost-card.is-open { --x: 10px !important; }
  .mini-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .001ms !important; animation-duration: .001ms !important; }
}
