/* ===== Homelab Portal Cube — cyberpunk glassmorphism HUD ===== */
:root {
  --cyan: #22d3ee;
  --cyan-dim: rgba(34, 211, 238, 0.35);
  --emerald: #34d399;
  --amber: #fbbf24;
  --bg: #05070f;
  --glass: rgba(13, 20, 38, 0.55);
  --glass-border: rgba(34, 211, 238, 0.28);
  --text: #dbe7ff;
  --text-dim: #7f8db3;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: 'Rajdhani', 'Segoe UI', system-ui, sans-serif;
}

#app { position: fixed; inset: 0; height: 100vh; height: 100dvh; }

/* ---- 3D layers ---- */
#webgl-container, #css3d-container {
  position: absolute; inset: 0;
  overflow: hidden;
}
#webgl-container canvas { display: block; }
#css3d-container { pointer-events: none; z-index: 2; }

/* iframes inside CSS3D elements */
.face-el {
  position: absolute;
  top: 0; left: 0;
  width: 1600px; height: 1600px;   /* 4x the old 400px — sharper when scaled up */
  /* CSS3DRenderer applies translate(-50%,-50%) — do NOT add margins */
  border-radius: 56px;
  overflow: hidden;
  pointer-events: none;           /* drag never trapped inside an iframe */
  background: #070b16;
  box-shadow:
    0 0 0 4px rgba(34, 211, 238, 0.35),
    0 0 168px rgba(34, 211, 238, 0.22),
    inset 0 0 240px rgba(3, 6, 14, 0.85);
  transition: box-shadow 0.45s ease;
}
.face-el iframe {
  width: 100%; height: 100%;
  border: 0; display: block;
  background: #070b16;
}
.face-el.active {
  pointer-events: auto;           /* interactive only when face is front & focused */
  box-shadow:
    0 0 0 4px rgba(52, 211, 153, 0.55),
    0 0 280px rgba(34, 211, 238, 0.35),
    inset 0 0 240px rgba(3, 6, 14, 0.85);
}

/* ---- FX overlays ---- */
.fx-vignette {
  position: absolute; inset: 0; z-index: 3; pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 52%, rgba(2, 4, 10, 0.75) 100%);
}
.fx-scanlines {
  position: absolute; inset: 0; z-index: 3; pointer-events: none; opacity: 0.05;
  background: repeating-linear-gradient(to bottom, transparent 0 2px, #9be8ff 2px 3px);
}

/* ---- HUD ---- */
#hud {
  position: absolute; top: 0; left: 0; right: 0; z-index: 10;
  display: flex; align-items: center; gap: 18px;
  padding: 14px 20px;
  background: linear-gradient(to bottom, rgba(4, 8, 18, 0.82), rgba(4, 8, 18, 0.35) 70%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(34, 211, 238, 0.12);
}

.hud-brand { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.hud-logo {
  font-size: 30px; color: var(--cyan);
  text-shadow: 0 0 14px var(--cyan), 0 0 34px rgba(34, 211, 238, 0.5);
  animation: logoPulse 3.2s ease-in-out infinite;
}
@keyframes logoPulse {
  0%, 100% { text-shadow: 0 0 14px var(--cyan), 0 0 34px rgba(34, 211, 238, 0.5); }
  50%      { text-shadow: 0 0 20px var(--emerald), 0 0 48px rgba(52, 211, 153, 0.55); color: var(--emerald); }
}
.hud-title { display: flex; flex-direction: column; line-height: 1.05; }
.hud-title-main {
  font-family: 'Orbitron', monospace; font-weight: 900; font-size: 17px; letter-spacing: 0.22em;
  background: linear-gradient(90deg, #67e8f9, #34d399);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hud-title-sub { font-size: 10px; letter-spacing: 0.5em; color: var(--text-dim); font-weight: 600; }

.hud-services {
  display: flex; align-items: center; gap: 8px;
  overflow-x: auto; flex: 1; padding: 6px 2px;
  scrollbar-width: none;
}
.hud-services::-webkit-scrollbar { display: none; }

.svc-btn {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: 'Rajdhani', sans-serif; font-weight: 600; font-size: 14px; letter-spacing: 0.06em;
  color: var(--text); text-decoration: none; white-space: nowrap;
  padding: 8px 14px; border-radius: 999px; cursor: pointer;
  background: var(--glass); border: 1px solid rgba(120, 150, 220, 0.18);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  transition: all 0.22s ease;
}
.svc-btn:hover {
  border-color: var(--glass-border); color: #fff;
  box-shadow: 0 0 18px rgba(34, 211, 238, 0.25), inset 0 0 12px rgba(34, 211, 238, 0.08);
  transform: translateY(-1px);
}
.svc-btn.active {
  border-color: var(--emerald); color: #04110b;
  background: linear-gradient(135deg, rgba(52, 211, 153, 0.9), rgba(34, 211, 238, 0.85));
  box-shadow: 0 0 22px rgba(52, 211, 153, 0.45);
  font-weight: 700;
}
.svc-btn.active .dot { background: #04110b !important; box-shadow: none !important; }
.svc-external { border-style: dashed; border-color: rgba(251, 191, 36, 0.4); }
.svc-external:hover { border-color: var(--amber); box-shadow: 0 0 18px rgba(251, 191, 36, 0.3); }
.ext-icon { font-size: 12px; opacity: 0.8; }

.dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dot-cyan    { background: var(--cyan);    box-shadow: 0 0 8px var(--cyan); }
.dot-emerald { background: var(--emerald); box-shadow: 0 0 8px var(--emerald); }
.dot-amber   { background: var(--amber);   box-shadow: 0 0 8px var(--amber); }

.hud-actions { flex-shrink: 0; display: flex; gap: 8px; align-items: center; }
.sound-btn.off { opacity: 0.55; }
.overview-btn {
  font-family: 'Orbitron', monospace; font-size: 11px; font-weight: 700; letter-spacing: 0.14em;
  color: var(--cyan); background: rgba(34, 211, 238, 0.08);
  border: 1px solid var(--glass-border); border-radius: 10px;
  padding: 11px 16px; cursor: pointer; white-space: nowrap;
  transition: all 0.22s ease;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.overview-btn:hover { background: rgba(34, 211, 238, 0.18); box-shadow: 0 0 20px rgba(34, 211, 238, 0.35); color: #fff; }

/* ---- status bar ---- */
#statusbar {
  position: absolute; bottom: 0; left: 0; right: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 22px;
  background: linear-gradient(to top, rgba(4, 8, 18, 0.85), transparent);
  font-size: 13px; letter-spacing: 0.12em; font-weight: 600;
}
.status-item { display: flex; align-items: center; gap: 9px; color: var(--cyan); text-transform: uppercase; }
.status-item.focused { color: var(--emerald); }
.pulse { width: 9px; height: 9px; border-radius: 50%; background: currentColor; box-shadow: 0 0 10px currentColor; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1; transform: scale(1);} 50% { opacity: 0.35; transform: scale(0.7);} }
.status-hint { color: var(--text-dim); font-size: 12px; letter-spacing: 0.08em; text-align: right; }

@media (max-width: 900px) {
  #hud { flex-wrap: wrap; gap: 8px; padding: 10px 12px calc(10px + env(safe-area-inset-top)); padding-top: max(10px, env(safe-area-inset-top)); }
  .hud-brand { gap: 8px; }
  .hud-logo { font-size: 22px; }
  .hud-title-main { font-size: 13px; letter-spacing: 0.16em; }
  .hud-title-sub { font-size: 8px; letter-spacing: 0.4em; }
  .hud-services { order: 3; width: 100%; gap: 6px; padding: 2px; -webkit-overflow-scrolling: touch; scroll-snap-type: x proximity; }
  .svc-btn { font-size: 14px; min-height: 44px; padding: 10px 15px; gap: 6px; scroll-snap-align: start; }
  .overview-btn { min-height: 44px; font-size: 10px; padding: 10px 13px; letter-spacing: 0.1em; }
  #statusbar { padding: 10px 14px calc(12px + env(safe-area-inset-bottom)); font-size: 11px; letter-spacing: 0.08em; }
  .status-hint { display: none; }
  .pulse { width: 7px; height: 7px; }
}

/* Touch devices: larger targets + no hover-only affordances */
@media (pointer: coarse) {
  .svc-btn { min-height: 46px; }
  .overview-btn { min-height: 46px; }
}
