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

/* ---------- shared layout ---------- */
.app-header {
  display: flex; align-items: center; gap: 14px;
  padding: 22px 28px;
  border-bottom: 1px solid #23233a;
  background: linear-gradient(180deg, #14141f 0%, #0e0e16 100%);
  flex-shrink: 0;
}
.app-header.sub { padding: 26px 28px; }
.brand-logo { display: inline-flex; filter: drop-shadow(0 0 6px rgba(0, 212, 255, 0.5)); }
.brand-title { font-size: 30px; font-weight: 700; letter-spacing: 0.3px; }

.screen-body { flex: 1; position: relative; min-height: 0; padding: 22px 28px; display: flex; flex-direction: column; }

.legend {
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; gap: 22px;
  padding: 14px 20px; min-height: 58px;
  border-top: 1px solid #23233a;
  background: #0e0e16;
}
.hint { font-size: 15px; color: var(--text-secondary); white-space: nowrap; }
.hint b {
  display: inline-block; min-width: 30px; text-align: center;
  color: var(--accent); font-weight: 700; margin-right: 4px;
}

/* ---------- home menu ---------- */
.home-body { justify-content: center; gap: 16px; }
.menu { display: flex; flex-direction: column; gap: 16px; }
.menu-item {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: 92px; padding: 0 24px; text-align: left;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  color: var(--text-primary);
}
.menu-item:focus { background: var(--bg-tertiary); transform: translateY(-1px); }
.mi-text { display: flex; flex-direction: column; gap: 5px; }
.mi-title { font-size: 23px; font-weight: 650; }
.mi-desc { font-size: 15px; color: var(--text-secondary); }
.mi-arrow { font-size: 32px; color: var(--accent); font-weight: 300; }

/* ---------- zoom bar (shared) ---------- */
.zoombar {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  width: 10px; height: 62%;
  background: var(--bg-tertiary); border-radius: 6px; overflow: hidden;
}
.zoombar-fill {
  position: absolute; bottom: 0; left: 0; width: 100%; height: 12%;
  background: linear-gradient(0deg, var(--accent-secondary), var(--accent));
  transition: height 0.15s ease;
}

/* ---------- tool header ---------- */
.tool-head {
  display: flex; align-items: center; gap: 12px;
  padding: 18px 26px; flex-shrink: 0;
  border-bottom: 1px solid #23233a;
  background: linear-gradient(180deg, #14141f 0%, #0e0e16 100%);
}
.th-name { font-size: 20px; font-weight: 650; flex: 1; }
.th-pos, .th-mode { font-size: 14px; color: var(--text-secondary); }
.readout {
  font-size: 18px; font-weight: 700; color: var(--accent);
  background: rgba(0, 212, 255, 0.12);
  border: 1px solid rgba(0, 212, 255, 0.35);
  padding: 6px 12px; border-radius: 999px;
  min-width: 70px; text-align: center; font-variant-numeric: tabular-nums;
}

/* ---------- text magnifier ---------- */
#text .screen-body { padding-right: 38px; }
.text-viewport {
  flex: 1; min-height: 0; position: relative;
  background: var(--bg-secondary);
  border: 1px solid #23233a;
  border-radius: var(--radius-md);
  overflow-y: auto; overflow-x: hidden;
  padding: 22px 26px;
}
.text-viewport::-webkit-scrollbar { display: none; }
.text-viewport { scrollbar-width: none; }
.text-content {
  font-size: 48px; line-height: 1.32; font-weight: 500;
  white-space: pre-wrap; word-break: break-word; color: var(--text-primary);
}
.scroll-track {
  position: absolute; left: 0; right: 0; bottom: 0; height: 4px;
  background: rgba(255, 255, 255, 0.06);
}
.scroll-fill {
  height: 100%; width: 0%;
  background: var(--accent); transition: width 0.12s ease;
}

/* ---------- camera viewfinder ---------- */
#camera .screen-body { padding-right: 38px; }
.viewfinder {
  flex: 1; min-height: 0; position: relative; overflow: hidden;
  background: radial-gradient(circle at 50% 45%, #15151f 0%, #0a0a0f 100%);
  border: 1px solid #23233a;
  border-radius: var(--radius-md);
}
.doc-clip {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.doc-stage {
  transform: scale(var(--zoom, 1));
  transform-origin: center center;
  transition: transform 0.13s ease;
  filter: var(--doc-filter, none);
}
.doc {
  width: 430px; padding: 22px 24px;
  background: #f4f3ec; color: #16161c;
  border-radius: 6px;
  font-family: 'Times New Roman', Georgia, serif;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.55);
}

/* viewfinder overlays */
.vf-corner { position: absolute; width: 26px; height: 26px; border: 3px solid var(--accent); opacity: 0.85; }
.vf-corner.tl { top: 14px; left: 14px; border-right: none; border-bottom: none; border-radius: 4px 0 0 0; }
.vf-corner.tr { top: 14px; right: 14px; border-left: none; border-bottom: none; border-radius: 0 4px 0 0; }
.vf-corner.bl { bottom: 14px; left: 14px; border-right: none; border-top: none; border-radius: 0 0 0 4px; }
.vf-corner.br { bottom: 14px; right: 14px; border-left: none; border-top: none; border-radius: 0 0 4px 0; }
.crosshair { position: absolute; background: rgba(0, 212, 255, 0.45); pointer-events: none; }
.ch-h { left: 50%; top: 50%; width: 26px; height: 2px; transform: translate(-50%, -50%); }
.ch-v { left: 50%; top: 50%; width: 2px; height: 26px; transform: translate(-50%, -50%); }
.vf-tag {
  position: absolute; top: 16px; left: 50%; transform: translateX(-50%);
  font-size: 11px; letter-spacing: 2px; font-weight: 700;
  color: var(--accent); background: rgba(0, 0, 0, 0.45);
  padding: 3px 8px; border-radius: 4px;
}

/* color modes (applied to .doc-stage via --doc-filter) */

/* ---------- demo scene styles ---------- */
.eyechart { text-align: center; font-family: Arial, Helvetica, sans-serif; }
.ec-row { font-weight: 800; letter-spacing: 4px; line-height: 1.18; color: #16161c; }
.ec-meta { margin-top: 8px; font-size: 8px; letter-spacing: 1px; color: #555; font-family: Arial, sans-serif; }

.lbl-h { font-size: 22px; font-weight: 800; font-family: Arial, sans-serif; }
.lbl-sub { font-size: 12px; font-weight: 700; color: #444; font-family: Arial, sans-serif; border-bottom: 2px solid #16161c; padding-bottom: 6px; margin-bottom: 8px; }
.lbl-fine { font-size: 8px; line-height: 1.5; text-align: justify; }
.lbl-warn { margin-top: 8px; font-size: 7px; line-height: 1.5; text-align: justify; }
.lbl-warn b { font-size: 9px; }

.news-h { font-size: 26px; font-weight: 900; text-align: center; letter-spacing: 1px; border-bottom: 3px double #16161c; padding-bottom: 5px; margin-bottom: 8px; font-family: 'Times New Roman', serif; }
.news-sub { font-size: 9px; text-align: center; color: #555; margin-bottom: 10px; letter-spacing: 3px; font-family: Arial, sans-serif; }
.news-cols { column-count: 2; column-gap: 14px; font-size: 7.5px; line-height: 1.55; text-align: justify; }
.news-cols b { font-size: 10px; display: block; margin-bottom: 2px; }

/* ---------- about ---------- */
.about-body { justify-content: center; }
.card {
  background: var(--bg-secondary);
  border: 1px solid #23233a;
  border-radius: var(--radius-md);
  padding: 26px 24px;
}
.about-lead { font-size: 18px; line-height: 1.5; color: var(--text-primary); margin-bottom: 18px; }
.ctrl-list { list-style: none; display: flex; flex-direction: column; gap: 12px; }
.ctrl-list li { display: flex; align-items: center; gap: 14px; font-size: 16px; color: var(--text-secondary); }
.key {
  display: inline-block; min-width: 64px; text-align: center;
  font-size: 15px; font-weight: 700; color: var(--accent);
  background: var(--bg-tertiary); border: 1px solid #2c2c44;
  border-radius: 8px; padding: 7px 10px;
}
.about-note { margin-top: 20px; font-size: 13px; color: var(--text-muted); }

.back-btn {
  width: 100%; min-height: 44px; padding: 12px;
  background: var(--bg-tertiary); color: var(--text-primary);
  border-radius: 10px; font-size: 17px; font-weight: 600;
}
.back-btn:focus { background: #26263c; }
