: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 chrome ---------- */
.topbar {
  padding: 22px 26px 18px;
  background: var(--bg-primary);
  border-bottom: 1px solid #20202c;
}
.app-title {
  font-size: 40px; font-weight: 800; letter-spacing: -0.5px;
  background: linear-gradient(90deg, var(--accent), var(--accent-secondary));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.app-sub { display: block; color: var(--text-secondary); font-size: 16px; margin-top: 4px; }

.topbar-search { display: flex; align-items: center; gap: 14px; }
.screen-title { font-size: 26px; font-weight: 700; }

.back-btn, .mini-btn {
  flex: 0 0 auto;
  min-height: 52px; min-width: 52px;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border-radius: var(--radius-md);
  font-size: 26px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.mini-btn { font-size: 18px; padding: 0 16px; min-width: 64px; }

.hint {
  margin-top: auto;
  padding: 14px 26px;
  color: var(--text-muted);
  font-size: 15px;
  background: var(--bg-primary);
  border-top: 1px solid #20202c;
  text-align: center;
}

/* ---------- home ---------- */
.home-body { flex: 1; padding: 22px 26px; display: flex; flex-direction: column; gap: 22px; overflow: hidden; }
.menu { display: flex; flex-direction: column; gap: 16px; }
.menu-item {
  display: flex; align-items: center; gap: 18px;
  min-height: 88px; padding: 0 22px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  text-align: left;
}
.mi-icon {
  flex: 0 0 auto;
  width: 56px; height: 56px;
  display: flex; align-items: center; justify-content: center;
  font-size: 30px;
  color: #000;
  background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
  border-radius: 14px;
}
.mi-text { display: flex; flex-direction: column; gap: 3px; }
.mi-text b { font-size: 22px; font-weight: 700; color: var(--text-primary); }
.mi-text i { font-size: 16px; font-style: normal; color: var(--text-secondary); }

.section-label { font-size: 15px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 10px; }
.recent-row { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  min-height: 48px; padding: 0 18px;
  display: inline-flex; align-items: center;
  background: var(--bg-tertiary);
  border-radius: 24px;
  font-size: 18px; color: var(--text-primary);
}

/* ---------- search keyboard ---------- */
.query-box {
  flex: 1;
  min-height: 56px;
  display: flex; align-items: center;
  padding: 0 18px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  font-size: 30px; font-weight: 700; letter-spacing: 2px;
  white-space: nowrap; overflow: hidden;
}
.query-placeholder { color: var(--text-muted); font-weight: 500; letter-spacing: 0; font-size: 24px; }
.caret { color: var(--accent); animation: blink 1s step-end infinite; font-weight: 400; }
@keyframes blink { 50% { opacity: 0; } }

.kb { flex: 1; padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; justify-content: center; }
.kb-row { display: flex; gap: 8px; justify-content: center; }
.key {
  flex: 1 1 0;
  height: 62px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-secondary);
  border-radius: 10px;
  font-size: 24px; font-weight: 600; color: var(--text-primary);
}
.key.key-wide { flex: 1.6 1 0; font-size: 22px; color: var(--text-secondary); }
.kb-actions { display: flex; gap: 10px; margin-top: 4px; }
.key-action {
  flex: 1 1 0;
  height: 78px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-md);
  font-size: 22px; font-weight: 700;
}
.key-search { background: linear-gradient(135deg, var(--accent), var(--accent-secondary)); color: #000; }
.key-clear { background: var(--bg-tertiary); color: var(--text-secondary); }

/* ---------- browse ---------- */
.browse-body { flex: 1; overflow-y: auto; padding: 16px 22px; display: flex; flex-direction: column; gap: 10px; }
.browse-item {
  min-height: 64px; padding: 0 20px;
  display: flex; align-items: center; justify-content: space-between;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  font-size: 22px; font-weight: 600; color: var(--text-primary);
}
.browse-item .arrow { color: var(--text-muted); font-size: 20px; }

/* ---------- results ---------- */
.result-head { flex: 1; display: flex; flex-direction: column; gap: 2px; overflow: hidden; }
.result-word { font-size: 30px; font-weight: 800; text-transform: capitalize; }
.result-phon { font-size: 17px; color: var(--accent); }

.result-body { flex: 1; overflow-y: auto; padding: 18px 22px; display: flex; flex-direction: column; gap: 14px; }
.meaning {
  padding: 16px 18px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
}
.pos-badge {
  display: inline-block;
  padding: 4px 12px; margin-bottom: 12px;
  background: var(--bg-tertiary);
  color: var(--accent-secondary);
  border-radius: 8px;
  font-size: 15px; font-weight: 700; font-style: italic;
}
.def { margin-bottom: 12px; }
.def:last-child { margin-bottom: 0; }
.def-text { font-size: 20px; line-height: 1.4; color: var(--text-primary); }
.def-num { color: var(--accent); font-weight: 700; margin-right: 8px; }
.def-ex { display: block; margin-top: 6px; font-size: 17px; color: var(--text-secondary); font-style: italic; }
.def-syn { display: block; margin-top: 6px; font-size: 16px; color: var(--text-muted); }
.def-syn b { color: var(--text-secondary); font-weight: 700; font-style: normal; }

.status {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 16px; padding: 30px; text-align: center;
}
.status .big { font-size: 24px; font-weight: 700; }
.status .small { font-size: 18px; color: var(--text-secondary); line-height: 1.5; }
.spinner {
  width: 48px; height: 48px;
  border: 4px solid var(--bg-tertiary);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.badge-offline {
  display: inline-block; margin-left: 8px; padding: 2px 8px;
  font-size: 13px; font-weight: 700;
  background: var(--bg-tertiary); color: var(--text-muted);
  border-radius: 6px; vertical-align: middle;
}

/* thin scrollbars */
.result-body::-webkit-scrollbar, .browse-body::-webkit-scrollbar { width: 6px; }
.result-body::-webkit-scrollbar-thumb, .browse-body::-webkit-scrollbar-thumb { background: var(--bg-tertiary); border-radius: 3px; }
