: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; }

.hint {
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
  letter-spacing: 0.5px;
  padding: 8px 0;
}

/* ---------- HOME ---------- */
#home { align-items: center; justify-content: center; }
.bg-canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; }
.home-inner {
  position: relative; z-index: 1;
  width: 100%; height: 100%;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 36px;
}
.home-head { text-align: center; }
.home-title {
  font-size: 50px; font-weight: 800; letter-spacing: 6px;
  background: linear-gradient(90deg, var(--accent), var(--accent-secondary));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.home-sub { color: var(--text-secondary); font-size: 18px; margin-top: 8px; letter-spacing: 1px; }
.menu { display: flex; flex-direction: column; gap: 16px; width: 380px; }
.menu-item {
  height: 88px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  color: var(--text-primary);
}
.menu-label { font-size: 22px; font-weight: 600; }
.menu-arrow { font-size: 30px; color: var(--accent); }

/* ---------- SUB SCREENS ---------- */
.sub-head {
  height: 70px; flex: 0 0 70px;
  display: flex; align-items: center;
  padding: 0 24px;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--bg-tertiary);
}
.sub-title { font-size: 26px; font-weight: 700; }
.sub-foot { flex: 0 0 auto; padding: 14px 24px 20px; display: flex; }
.back-btn {
  flex: 1; height: 64px;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border-radius: var(--radius-md);
  font-size: 20px; font-weight: 600;
}

/* ---------- VIEWER ---------- */
.view-stage { flex: 1; position: relative; }
#viewCanvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.hud {
  position: absolute; top: 14px; left: 16px;
  padding: 6px 14px;
  background: rgba(20, 20, 31, 0.7);
  border-radius: 10px;
  font-size: 22px; font-weight: 700;
  letter-spacing: 2px;
  color: var(--text-primary);
}
.hint-view { padding: 4px 0 6px; }
.controls {
  flex: 0 0 auto;
  display: flex; gap: 6px;
  padding: 8px 8px 14px;
  background: var(--bg-primary);
}
.pill {
  flex: 1; min-width: 0; height: 88px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 4px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  padding: 4px;
}
.pill-label { font-size: 12px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; }
.pill-value { font-size: 30px; font-weight: 800; color: var(--accent); line-height: 1; }
.pill-value-sm { font-size: 17px; font-weight: 700; text-align: center; }

/* ---------- PRESETS ---------- */
.preset-grid {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 16px;
  align-content: start;
  overflow: hidden;
}
.preset-card {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  height: 104px;
  color: var(--text-primary);
}
.preset-prev { width: 76px; height: 76px; flex: 0 0 76px; border-radius: 8px; background: #050507; }
.preset-meta { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0; }
.preset-name { font-size: 19px; font-weight: 700; }
.preset-ratio { font-size: 14px; color: var(--text-secondary); letter-spacing: 1px; }

/* ---------- ABOUT ---------- */
.about-body { flex: 1; padding: 22px 26px; display: flex; flex-direction: column; gap: 18px; overflow: hidden; }
.about-body p { font-size: 19px; line-height: 1.5; color: var(--text-secondary); }
.about-body strong { color: var(--text-primary); }
.hl { color: var(--accent); font-weight: 700; }
.formula {
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 18px 22px;
  font-size: 24px; line-height: 1.7;
  font-family: 'Courier New', monospace;
  color: var(--text-primary);
  text-align: center;
}
.about-tip { font-size: 16px !important; color: var(--text-muted) !important; }
