: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; padding: 24px; }
.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; }

button { font: inherit; color: inherit; background: none; border: none; }

/* ---------- HOME ---------- */
.home-head { margin-bottom: 22px; }
.home-head h1 { font-size: 32px; font-weight: 700; letter-spacing: -0.5px; }
.subtitle { color: var(--text-secondary); font-size: 15px; margin-top: 8px; }

.menu { display: flex; flex-direction: column; gap: 12px; }
.menu-btn {
  display: flex; flex-direction: column; gap: 4px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 16px 20px; min-height: 76px;
  border-left: 4px solid var(--accent);
  border-top: 2px solid transparent;
  border-right: 2px solid transparent;
  border-bottom: 2px solid transparent;
  text-align: left;
}
.menu-btn.secondary { border-left-color: var(--accent-secondary); min-height: 64px; }
.menu-btn:focus { border-color: var(--focus-ring); }
.menu-btn .mb-title { font-size: 20px; font-weight: 600; }
.menu-btn .mb-sub { font-size: 13px; color: var(--text-secondary); }

.hint { margin-top: auto; color: var(--text-muted); font-size: 13px; text-align: center; padding-top: 16px; }

/* ---------- BARS / HEADERS ---------- */
.bar { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.bar h2 { font-size: 24px; font-weight: 700; }
.icon-btn {
  width: 48px; height: 48px; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-tertiary); border-radius: var(--radius-md);
  font-size: 22px; line-height: 1;
}
.caption { color: var(--text-secondary); font-size: 13px; margin-bottom: 14px; }

/* ---------- TABS ---------- */
.tabs { display: flex; gap: 8px; margin-bottom: 20px; }
.tab {
  flex: 1; min-height: 48px; border-radius: var(--radius-md);
  background: var(--bg-tertiary); color: var(--text-secondary);
  font-size: 15px; font-weight: 600;
}
.tab.active { background: var(--accent); color: #001018; }

/* ---------- KEYBOARD ---------- */
.kb-wrap { text-align: center; }
.keyboard { display: inline-block; }
.kbd-row { display: flex; gap: 6px; margin-bottom: 6px; }
.kbd-row.s1 { padding-left: 20px; }
.kbd-row.s2 { padding-left: 40px; }
.key {
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-tertiary); color: var(--text-primary);
  border-radius: 8px; font-size: 17px; font-weight: 600;
  border-bottom: 2px solid rgba(0, 0, 0, 0.45);
}
.show-homerow .key.home { box-shadow: inset 0 0 0 2px var(--accent); }
.show-fingers .key.f-LP { background: #ff6b6b; color: #0a0a0f; }
.show-fingers .key.f-LR { background: #ffa94d; color: #0a0a0f; }
.show-fingers .key.f-LM { background: #ffd43b; color: #0a0a0f; }
.show-fingers .key.f-LI { background: #51cf66; color: #0a0a0f; }
.show-fingers .key.f-RI { background: #38d9a9; color: #0a0a0f; }
.show-fingers .key.f-RM { background: #4dabf7; color: #0a0a0f; }
.show-fingers .key.f-RR { background: #9775fa; color: #0a0a0f; }
.show-fingers .key.f-RP { background: #f783ac; color: #0a0a0f; }

/* ---------- LEGEND ---------- */
.legend {
  display: flex; flex-wrap: wrap; gap: 8px 16px;
  background: var(--bg-secondary); border-radius: var(--radius-md);
  padding: 12px 16px; margin-top: 16px;
}
.leg-item { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text-secondary); width: calc(25% - 12px); }
.dot { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.dot.f-LP { background: #ff6b6b; }
.dot.f-LR { background: #ffa94d; }
.dot.f-LM { background: #ffd43b; }
.dot.f-LI { background: #51cf66; }
.dot.f-RI { background: #38d9a9; }
.dot.f-RM { background: #4dabf7; }
.dot.f-RR { background: #9775fa; }
.dot.f-RP { background: #f783ac; }

/* ---------- CONTROLS ---------- */
.controls { display: flex; gap: 8px; margin-top: auto; }
.chip {
  flex: 1; min-height: 48px; border-radius: var(--radius-md);
  background: var(--bg-tertiary); color: var(--text-secondary);
  font-size: 14px; font-weight: 600;
}
.chip.active { background: rgba(0, 212, 255, 0.16); color: var(--accent); border-color: var(--accent); }

/* ---------- COMPARE ---------- */
.compare-list { display: flex; flex-direction: column; gap: 14px; overflow: hidden; }
.cmp-card { background: var(--bg-secondary); border-radius: var(--radius-md); padding: 14px 16px; }
.cmp-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.cmp-name { font-size: 18px; font-weight: 700; }
.cmp-stat { font-size: 12px; color: var(--text-secondary); }
.cmp-row { display: flex; gap: 4px; justify-content: center; margin-bottom: 12px; }
.key.small { width: 34px; height: 34px; font-size: 14px; border-radius: 6px; }
.key.same { background: var(--bg-tertiary); color: var(--text-muted); }
.key.diff { background: rgba(0, 255, 136, 0.18); color: var(--accent-secondary); box-shadow: inset 0 0 0 1px var(--accent-secondary); }
.view-btn {
  width: 100%; min-height: 44px; border-radius: var(--radius-md);
  background: var(--bg-tertiary); color: var(--text-primary);
  font-size: 14px; font-weight: 600;
}

/* ---------- INFO ---------- */
.info-body { background: var(--bg-secondary); border-radius: var(--radius-md); padding: 20px; }
#info-text { font-size: 16px; line-height: 1.5; color: var(--text-primary); margin-bottom: 18px; }
.info-meta { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.info-meta li { display: flex; justify-content: space-between; font-size: 15px; padding: 8px 0; border-top: 1px solid var(--bg-tertiary); }
.info-meta li span { color: var(--text-secondary); }
.info-meta li b { color: var(--accent); font-weight: 700; }
