: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;
  --gold: #ffce4d;
  --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; }
.hidden { display: none !important; }
.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);
}

/* ---------- Header ---------- */
.app-header {
  flex: 0 0 auto;
  padding: 22px 24px 16px;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--bg-tertiary);
}
.title-row { display: flex; align-items: center; gap: 12px; }
.app-header h1 { font-size: 34px; font-weight: 700; letter-spacing: -0.5px; }
.app-header h2 { font-size: 26px; font-weight: 700; }
.jp-tag {
  font-size: 20px; color: var(--accent);
  background: var(--bg-tertiary);
  padding: 4px 12px; border-radius: 20px;
}
.cat-icon { font-size: 28px; }
.subtitle { font-size: 16px; color: var(--text-secondary); margin-top: 6px; }

/* ---------- Scroll body ---------- */
.screen-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px;
  scrollbar-width: none;
}
.screen-body::-webkit-scrollbar { width: 0; height: 0; }

/* ---------- Category cards ---------- */
.cat-card {
  display: flex; align-items: center; gap: 16px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 18px 18px;
  margin-bottom: 12px;
  min-height: 88px;
}
.cat-card .c-icon {
  font-size: 32px; width: 52px; height: 52px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-tertiary); border-radius: 12px;
  flex: 0 0 auto;
}
.cat-card .c-text { flex: 1 1 auto; min-width: 0; }
.cat-card .c-name { font-size: 20px; font-weight: 600; }
.cat-card .c-count { font-size: 15px; color: var(--text-secondary); margin-top: 3px; }
.cat-card .c-chevron { font-size: 26px; color: var(--text-muted); }
.cat-card.fav .c-icon { color: var(--gold); }

/* ---------- Phrase rows ---------- */
.phrase-row {
  display: flex; align-items: center; gap: 14px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 10px;
  min-height: 80px;
}
.phrase-row .p-text { flex: 1 1 auto; min-width: 0; }
.phrase-row .p-en { font-size: 19px; font-weight: 600; line-height: 1.2; }
.phrase-row .p-ro { font-size: 15px; color: var(--accent); margin-top: 4px; }
.phrase-row .p-star { font-size: 20px; color: var(--gold); flex: 0 0 auto; }
.phrase-row .p-chevron { font-size: 24px; color: var(--text-muted); flex: 0 0 auto; }
.empty-msg { text-align: center; color: var(--text-secondary); font-size: 18px; padding: 60px 24px; }

/* ---------- Detail ---------- */
.detail-header { text-align: center; }
.detail-body { display: flex; align-items: center; justify-content: center; }
.detail-card {
  background: var(--bg-secondary);
  border-radius: 16px;
  padding: 32px 26px;
  width: 100%;
  text-align: center;
}
.d-english { font-size: 22px; color: var(--text-secondary); margin-bottom: 22px; }
.d-japanese { font-size: 46px; font-weight: 700; line-height: 1.25; margin-bottom: 18px; }
.d-romaji {
  font-size: 30px; font-weight: 600; color: var(--accent);
  letter-spacing: 0.3px; margin-bottom: 24px;
}
.d-pos { font-size: 15px; color: var(--text-muted); }

/* ---------- Control bar ---------- */
.control-bar {
  flex: 0 0 auto;
  display: flex; gap: 12px;
  padding: 12px 16px;
  background: var(--bg-primary);
  border-top: 1px solid var(--bg-tertiary);
}
.ctrl {
  flex: 1 1 0;
  height: 64px;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-size: 24px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
}
.fav-btn.active { color: var(--gold); }

/* ---------- Hint bar ---------- */
.hint-bar {
  flex: 0 0 auto;
  display: flex; justify-content: space-around; gap: 8px;
  padding: 10px 16px;
  background: var(--bg-primary);
  border-top: 1px solid var(--bg-tertiary);
  font-size: 13px; color: var(--text-muted);
}
