:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #14141f;
  --bg-tertiary: #1e1e2e;
  --text-primary: #ffffff;
  --text-secondary: #a0a0b0;
  --text-muted: #606070;
  --accent: #00d4ff;
  --accent-secondary: #00ff88;
  --danger: #ff4466;
  --focus-ring: #00d4ff;
  --focus-glow: rgba(0, 212, 255, 0.4);
  --radius-md: 12px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
  width: 600px; height: 600px; overflow: hidden;
  background: #000;
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
#app { width: 100%; height: 100%; position: relative; }
.screen { width: 100%; height: 100%; position: absolute; top: 0; left: 0; display: flex; flex-direction: column; }
.screen.hidden { display: none; }
.focusable { transition: all 0.15s ease; border: 2px solid transparent; cursor: pointer; outline: none; }
.focusable:focus { border-color: var(--focus-ring); box-shadow: 0 0 20px var(--focus-glow); }
.hidden { display: none !important; }

/* ---------- HOME ---------- */
.home-inner {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 40px 44px; gap: 30px;
}
.brand { text-align: center; }
.brand-mark { display: flex; justify-content: center; gap: 14px; margin-bottom: 18px; }
.dot { width: 16px; height: 16px; border-radius: 50%; box-shadow: 0 0 16px currentColor; }
.dot.d1 { background: var(--accent); color: var(--accent); }
.dot.d2 { background: var(--accent-secondary); color: var(--accent-secondary); }
.dot.d3 { background: #b48cff; color: #b48cff; }
.title {
  font-size: 56px; font-weight: 800; letter-spacing: 8px;
  background: linear-gradient(90deg, var(--accent), var(--accent-secondary));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.subtitle { color: var(--text-secondary); font-size: 19px; margin-top: 6px; letter-spacing: 1px; }

.menu { width: 100%; display: flex; flex-direction: column; gap: 16px; }
.menu-btn {
  min-height: 88px; width: 100%;
  display: flex; align-items: center; gap: 18px;
  padding: 0 22px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  text-align: left;
}
.mb-ico {
  font-size: 26px; width: 52px; height: 52px; flex: 0 0 52px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 12px; background: var(--bg-tertiary); color: var(--accent);
}
.mb-txt { display: flex; flex-direction: column; }
.mb-txt strong { font-size: 22px; font-weight: 700; }
.mb-txt em { font-size: 14px; color: var(--text-secondary); font-style: normal; margin-top: 2px; }
.foot { color: var(--text-muted); font-size: 14px; letter-spacing: 0.5px; }

/* ---------- EXPLORER ---------- */
.viewport {
  position: relative; width: 100%; height: 100%;
  background: #000; overflow: hidden;
}
.viewport.focusable:focus {
  border-color: transparent;
  box-shadow: inset 0 0 0 2px var(--accent), inset 0 0 34px var(--focus-glow);
}
#fractal { position: absolute; inset: 0; width: 100%; height: 100%; display: block; image-rendering: auto; }

.hud {
  position: absolute; left: 0; right: 0;
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px; pointer-events: none;
  font-variant-numeric: tabular-nums;
}
.hud-top { top: 0; justify-content: space-between; }
.hud-bottom { bottom: 0; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(10, 10, 15, 0.72); border: 1px solid #2a2a3a;
  border-radius: 999px; padding: 7px 14px; font-size: 16px; font-weight: 600;
  backdrop-filter: blur(2px);
}
.chip-k { color: var(--text-muted); font-size: 12px; letter-spacing: 1px; }
.mode-pill {
  background: var(--accent); color: #001016;
  font-weight: 800; font-size: 15px; letter-spacing: 1.5px;
  padding: 7px 14px; border-radius: 8px;
}
.mode-pill.zoom { background: var(--accent-secondary); }
.mode-pill.tour { background: #b48cff; }
.hint {
  background: rgba(10, 10, 15, 0.72); border: 1px solid #2a2a3a;
  border-radius: 8px; padding: 7px 12px; font-size: 14px; color: var(--text-secondary);
}
.coords {
  width: 100%; font-size: 13px; color: var(--text-muted);
  background: rgba(10, 10, 15, 0.6); border-radius: 6px; padding: 4px 10px;
}
.crosshair {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%); width: 40px; height: 40px;
  pointer-events: none; opacity: 0.85;
}
.crosshair i, .crosshair b {
  position: absolute; background: var(--accent); box-shadow: 0 0 8px var(--accent);
}
.crosshair i { top: 50%; left: 0; width: 100%; height: 2px; transform: translateY(-50%); }
.crosshair b { left: 50%; top: 0; height: 100%; width: 2px; transform: translateX(-50%); }

/* ---------- BAR (gallery / guide) ---------- */
.bar {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 18px; background: var(--bg-primary);
  border-bottom: 1px solid #20202e;
}
.bar h2 { font-size: 24px; font-weight: 700; }
.bar-back {
  width: 52px; height: 52px; flex: 0 0 52px;
  display: flex; align-items: center; justify-content: center;
  font-size: 34px; line-height: 1;
  background: var(--bg-secondary); border-radius: 12px; color: var(--accent);
}

/* ---------- GALLERY LIST ---------- */
.list { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.preset {
  min-height: 84px; width: 100%;
  display: flex; align-items: center; gap: 16px;
  padding: 14px 18px; background: var(--bg-secondary);
  border-radius: var(--radius-md); color: var(--text-primary); text-align: left;
}
.preset.tour-card { background: linear-gradient(120deg, #1b1430, #14141f); }
.p-glyph {
  font-size: 24px; width: 56px; height: 56px; flex: 0 0 56px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 12px; background: var(--bg-tertiary); color: var(--accent-secondary);
}
.tour-card .p-glyph { color: #b48cff; }
.p-txt { display: flex; flex-direction: column; }
.p-txt strong { font-size: 20px; font-weight: 700; }
.p-txt em { font-size: 13px; color: var(--text-secondary); font-style: normal; margin-top: 3px; }

/* ---------- GUIDE ---------- */
.guide-body { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.g-card { background: var(--bg-secondary); border-radius: var(--radius-md); padding: 16px 18px; }
.g-card h3 { font-size: 18px; color: var(--accent); margin-bottom: 10px; }
.g-card p { font-size: 15px; color: var(--text-secondary); margin: 6px 0; display: flex; align-items: center; gap: 10px; }
.k {
  display: inline-block; min-width: 38px; text-align: center;
  background: var(--bg-tertiary); color: var(--text-primary);
  border: 1px solid #2e2e40; border-radius: 6px; padding: 3px 8px;
  font-size: 13px; font-weight: 700;
}
.wide-btn {
  min-height: 60px; width: 100%; margin-top: 4px;
  background: var(--accent); color: #001016; font-size: 18px; font-weight: 700;
  border-radius: var(--radius-md);
}
.wide-btn:focus { background: var(--accent-secondary); }
