:root {
  --bg: #060810;
  --panel: rgba(10, 14, 24, 0.82);
  --edge: rgba(79, 227, 255, 0.28);
  --ink: #e7f0ff;
  --ink-dim: #8aa4c8;
  --accent: #4fe3ff;
  --radius: 14px;
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  overflow: hidden;
  user-select: none;
}

canvas#webgl {
  position: fixed;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  z-index: 0;
  cursor: crosshair;
}

#vignette {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(130% 120% at 50% 42%, transparent 52%, rgba(2, 3, 10, 0.55) 100%);
}

#loading {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(120% 120% at 50% 30%, #0c1428 0%, #060810 70%);
  transition: opacity 0.8s ease;
  gap: 8px;
}
#loading.gone { opacity: 0; pointer-events: none; }

.ld-ring {
  width: 120px;
  height: 120px;
  margin-bottom: 24px;
  border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: var(--accent);
  border-right-color: rgba(91, 140, 255, 0.4);
  animation: spin 1.4s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.ld-title {
  margin: 0;
  font-size: clamp(28px, 5vw, 42px);
  letter-spacing: 0.18em;
  font-weight: 700;
}
.ld-sub { margin: 0; color: var(--ink-dim); font-size: 15px; }
.ld-err { margin: 8px 0 0; color: #ff6b7a; font-size: 14px; max-width: 90vw; text-align: center; }

#ui {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

#topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
}
.brand {
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.04em;
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: 999px;
  padding: 8px 16px;
  backdrop-filter: blur(8px);
}
#lock-badge {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  background: rgba(79, 227, 255, 0.12);
  border: 1px solid rgba(79, 227, 255, 0.45);
  border-radius: 999px;
  padding: 8px 14px;
  animation: pulse-badge 2s ease-in-out infinite;
}
#lock-badge.hidden { display: none; }
@keyframes pulse-badge {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.65; }
}

#panel {
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  width: min(320px, calc(100vw - 40px));
  padding: 20px 22px;
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  backdrop-filter: blur(10px);
  pointer-events: auto;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}
#panel.hidden { display: none; }
.panel-tag {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-dim);
  margin-bottom: 6px;
}
#panel-title { margin: 0 0 4px; font-size: 24px; }
.panel-sub {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.panel-desc { margin: 0 0 14px; color: var(--ink-dim); font-size: 14px; line-height: 1.5; }
#panel-link {
  color: var(--ink);
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  border-bottom: 1px solid rgba(231, 240, 255, 0.35);
}
#panel-link:hover { color: var(--accent); border-color: var(--accent); }

#bottombar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  padding: 18px;
}
#hint {
  margin: 0;
  font-size: 13px;
  color: var(--ink-dim);
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: 999px;
  padding: 10px 18px;
  backdrop-filter: blur(8px);
}
