:root {
  --bg: #06030b;
  --text: #f7eeff;
  --muted: #c6b3e6;
  --pink: #ff48c4;
  --violet: #9b5bff;
  --cyan: #5dfdff;
  --panel: rgba(255, 255, 255, 0.04);
  --border: rgba(255, 255, 255, 0.12);
  --font-display: 'Epilogue', sans-serif;
  --font-body: 'Space Grotesk', sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { background: var(--bg); color: var(--text); font-family: var(--font-body); min-height: 100vh; }
body { overflow-x: hidden; }

/* ---------- nav ---------- */
.t-nav {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.85rem 1.25rem;
  background: rgba(6, 3, 11, 0.82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(255, 72, 196, 0.2);
}
.t-brand { font-family: var(--font-display); font-weight: 900; text-decoration: none; color: var(--text); font-size: 1rem; }
.t-sep { color: rgba(255, 255, 255, 0.25); }
.t-title {
  font-family: var(--font-display); font-weight: 700;
  background: linear-gradient(90deg, var(--pink), var(--cyan));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.t-link { margin-left: auto; color: var(--muted); text-decoration: none; font-size: 0.85rem; }
.t-link:hover { color: var(--text); }

/* ---------- stage ---------- */
.t-main { max-width: 980px; margin: 0 auto; padding: 1.5rem 1rem 4rem; }
.t-stage {
  position: relative; width: 100%; max-width: 640px; margin: 0 auto;
  aspect-ratio: 1 / 1; border-radius: 14px; overflow: hidden;
  border: 1px solid rgba(255, 72, 196, 0.3);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.5), 0 0 60px rgba(155, 91, 255, 0.12);
  background: #0c0716;
}
.t-canvas {
  width: 100%; height: 100%; display: block;
  transition: filter 0.1s linear;
}

.t-loading {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 7px;
  background: rgba(12, 7, 22, 0.85);
}
.t-loading.hide { display: none; }
.t-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--pink); animation: bounce 1.1s ease-in-out infinite; }
.t-dot:nth-child(2) { animation-delay: 0.15s; background: var(--violet); }
.t-dot:nth-child(3) { animation-delay: 0.3s; background: var(--cyan); }
@keyframes bounce { 0%, 80%, 100% { transform: translateY(0); opacity: 0.5; } 40% { transform: translateY(-9px); opacity: 1; } }

/* ---------- control panel ---------- */
.t-panel {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
  gap: 0.75rem; margin: 1.5rem auto 0; max-width: 720px;
}
.t-btn {
  font-family: var(--font-body); font-weight: 700; font-size: 0.9rem;
  color: var(--text); cursor: pointer;
  padding: 0.7rem 1.2rem; border-radius: 999px;
  background: var(--panel); border: 1px solid var(--border);
  transition: transform 0.15s, background 0.2s, border-color 0.2s;
}
.t-btn:hover { transform: translateY(-2px); border-color: rgba(255, 72, 196, 0.5); }
.t-primary {
  background: linear-gradient(135deg, rgba(255, 72, 196, 0.9), rgba(155, 91, 255, 0.9));
  border-color: transparent; box-shadow: 0 10px 28px rgba(255, 72, 196, 0.25);
}

.t-ctrl {
  display: flex; flex-direction: column; gap: 0.35rem;
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted);
  min-width: 130px;
}
.t-ctrl em { color: var(--cyan); font-style: normal; text-transform: none; margin-left: 0.3rem; }
.t-ctrl select, .t-ctrl input[type="range"] {
  font-family: var(--font-body); accent-color: var(--pink);
}
.t-ctrl select {
  background: var(--panel); color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; padding: 0.4rem 0.5rem; font-size: 0.85rem;
}
.t-ctrl input[type="range"] { width: 100%; }

.t-toggle {
  display: flex; align-items: center; gap: 0.45rem; cursor: pointer;
  font-size: 0.8rem; color: var(--muted);
}
.t-toggle input { accent-color: var(--pink); width: 16px; height: 16px; }

.t-hint { text-align: center; color: var(--muted); font-size: 0.8rem; margin-top: 1.25rem; opacity: 0.8; }

@media (max-width: 520px) {
  .t-ctrl { min-width: 46%; }
}

/* ---------- screensaver ---------- */
.ss-exit {
  position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.55); color: rgba(255, 255, 255, 0.65);
  font-size: 0.78rem; padding: 0.4rem 1.1rem; border-radius: 999px;
  z-index: 200; opacity: 0; transition: opacity 0.6s; pointer-events: none;
  letter-spacing: 0.04em;
}
.ss-exit.visible { opacity: 1; }

body.screensaver { overflow: hidden; }
body.screensaver .t-nav,
body.screensaver .t-panel,
body.screensaver .t-hint,
body.screensaver .t-loading { opacity: 0; pointer-events: none; }
body.screensaver .t-main {
  max-width: none; padding: 0; margin: 0;
  height: 100vh; display: flex; align-items: center; justify-content: center;
}
body.screensaver .t-stage {
  position: fixed; inset: 0; max-width: none;
  width: 100vw; height: 100vh;
  border-radius: 0; border: none; box-shadow: none; margin: 0;
  z-index: 100;
}
body.screensaver .t-canvas { width: 100%; height: 100%; }
