:root {
  --bg: #0C1017;
  --surface: #151B26;
  --surface-soft: #1C2433;
  --surface-raised: #222C3E;
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #F4F6FA;
  --text-muted: #94A3B8;
  --primary: #E63950;
  --primary-deep: #C4253C;
  --gold: #F4B942;
  --jade: #10B981;
  --sky: #38BDF8;
  --danger: #F87171;
  --radius-card: 20px;
  --radius-inner: 12px;
  --radius-control: 10px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  background-color: var(--bg);
  color: var(--text);
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans SC', sans-serif;
  line-height: 1.5;
  min-height: 100dvh;
  overflow-x: hidden;
}

.app-shell {
  max-width: 500px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-bottom: calc(82px + env(safe-area-inset-bottom, 0px));
}

/* HEADER */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 16px;
  background: rgba(12, 16, 23, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.brand > div {
  min-width: 0;
  overflow: hidden;
}

.brand-badge {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 11px;
  background: linear-gradient(150deg, var(--primary), var(--primary-deep));
  border: 1px solid rgba(244, 185, 66, 0.48);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Noto Sans SC', sans-serif;
  font-weight: 800;
  font-size: 1.2rem;
  color: #FFFCF6;
  box-shadow: 0 4px 14px rgba(230, 57, 80, 0.32);
}

.top-bar h1 {
  font-size: 0.96rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.subtitle {
  font-size: 0.69rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.pill-btn {
  border: 1px solid var(--border-strong);
  background: var(--surface-soft);
  color: var(--text);
  font-size: 0.69rem;
  font-weight: 700;
  padding: 5px 8px;
  border-radius: 99px;
  cursor: pointer;
  white-space: nowrap;
}

.install-pill {
  border-color: rgba(230, 57, 80, 0.55);
  background: rgba(230, 57, 80, 0.16);
  color: #FDA4AF;
}

.sync-pill {
  border-color: rgba(16, 185, 129, 0.45);
  background: rgba(16, 185, 129, 0.14);
  color: #6EE7B7;
}

.sync-pill.syncing {
  opacity: 0.7;
}

.net-badge {
  font-size: 0.69rem;
  font-weight: 700;
  padding: 5px 9px;
  border-radius: 99px;
  background: var(--surface);
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.net-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--jade);
}

.net-badge.online {
  color: #6EE7B7;
}

.net-badge.offline {
  color: #FCD34D;
  border-color: rgba(244, 185, 66, 0.45);
}

.net-badge.offline::before {
  background: var(--gold);
}

.icon-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* STATS BAR */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 12px 16px 4px;
}

.stat-pill {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 8px 4px;
  text-align: center;
  color: inherit;
  font-family: inherit;
}

button.stat-pill {
  cursor: pointer;
}

.stat-num {
  display: block;
  font-size: 1.15rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

#statDue { color: var(--gold); }
#statDraft { color: var(--sky); }
#statMastered { color: var(--jade); }

.stat-label {
  display: block;
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* MAIN CONTENT & CARDS */
.main-content {
  padding: 10px 16px 18px;
  flex: 1;
}

.tab-panel {
  display: none;
  flex-direction: column;
  gap: 14px;
}

.tab-panel.active {
  display: flex;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
}

.hero-capture-card {
  background: linear-gradient(180deg, #192131 0%, var(--surface) 100%);
  border-color: rgba(255, 255, 255, 0.11);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.card-header h2,
.card-header h3 {
  font-size: 0.96rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.badge-hint {
  font-size: 0.68rem;
  background: rgba(244, 185, 66, 0.14);
  color: var(--gold);
  border: 1px solid rgba(244, 185, 66, 0.25);
  padding: 3px 9px;
  border-radius: 99px;
  font-weight: 700;
}

.badge-hint.ai-ready {
  background: rgba(16, 185, 129, 0.14);
  color: #6EE7B7;
  border-color: rgba(16, 185, 129, 0.3);
}

.engine-pill {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 99px;
  background: rgba(56, 189, 248, 0.14);
  color: #7DD3FC;
  border: 1px solid rgba(56, 189, 248, 0.28);
}

.helper-text {
  font-size: 0.77rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

/* CAPTURE CONTROLS */
.capture-mode-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.segmented-control {
  display: inline-flex;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 3px;
}

.seg-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.74rem;
  font-weight: 700;
  padding: 5px 11px;
  border-radius: 99px;
  cursor: pointer;
}

.seg-btn.active {
  background: var(--surface-raised);
  color: var(--text);
}

.hd-audio-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.73rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}

.hd-audio-toggle input {
  accent-color: var(--primary);
  width: 15px;
  height: 15px;
}

.hero-action-grid {
  display: grid;
  grid-template-columns: 1.55fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}

.btn-record-hero {
  background: linear-gradient(145deg, var(--primary), var(--primary-deep));
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 14px;
  padding: 13px 12px;
  color: #FFFFFF;
  font-family: inherit;
  display: flex;
  align-items: center;
  gap: 11px;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(230, 57, 80, 0.28);
  transition: transform 0.12s ease, box-shadow 0.15s ease;
}

.btn-record-hero:active {
  transform: scale(0.98);
}

.btn-record-hero.recording {
  background: linear-gradient(145deg, #DC2626, #991B1B);
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.28), 0 8px 20px rgba(220, 38, 38, 0.4);
}

.mic-orb {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.16);
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-record-hero.recording .mic-orb {
  background: rgba(255, 255, 255, 0.24);
  animation: pulseOrb 1.1s ease-in-out infinite;
}

.record-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.record-copy strong {
  font-size: 0.92rem;
  font-weight: 800;
  line-height: 1.2;
}

.record-copy small {
  font-size: 0.69rem;
  color: rgba(255, 255, 255, 0.84);
  margin-top: 2px;
  line-height: 1.25;
}

.camera-action-col {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.btn-camera-tile {
  flex: 1;
  background: var(--surface-soft);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  padding: 9px 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.74rem;
  font-weight: 700;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
}

.btn-gallery-mini {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 5px 8px;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
}

.voice-status {
  margin-bottom: 10px;
  padding: 9px 11px;
  border-radius: 10px;
  background: rgba(230, 57, 80, 0.14);
  border: 1px solid rgba(230, 57, 80, 0.35);
  color: #FECDD3;
  font-size: 0.77rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 9px;
}

.voice-status-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.voice-status-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.voice-timer {
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  color: var(--gold);
  flex-shrink: 0;
}

.vu-meter-track {
  width: 100%;
  height: 5px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}

.vu-meter-fill {
  width: 4%;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #10B981, #F4B942, #E63950);
  transition: width 0.06s linear;
}

.recorded-audio-bar {
  margin-bottom: 10px;
  padding: 6px 8px;
  border-radius: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
}

.recorded-audio-bar audio {
  width: 100%;
  height: 32px;
}

.pulse-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #FB7185;
  flex-shrink: 0;
  animation: pulseOrb 1s infinite;
}

/* VISION PREVIEW */
.vision-preview-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  margin-bottom: 10px;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
}

.vision-preview-box img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 8px;
  outline: 1px solid rgba(255, 255, 255, 0.12);
  outline-offset: -1px;
  flex-shrink: 0;
}

.vision-preview-meta {
  flex: 1;
  min-width: 0;
}

.vision-preview-meta strong {
  font-size: 0.8rem;
  display: block;
}

.mini-close-btn {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 28px;
  height: 28px;
  border-radius: 8px;
  cursor: pointer;
  flex-shrink: 0;
}

/* QUICK INPUT */
.quick-input-wrap textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-inner);
  padding: 10px 12px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.93rem;
  resize: vertical;
  margin-bottom: 8px;
}

.quick-input-wrap textarea:focus,
input:focus,
select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(230, 57, 80, 0.18);
}

.quick-sub-actions {
  display: grid;
  grid-template-columns: 1.45fr 1fr auto;
  gap: 8px;
}

.btn-analyze {
  background: linear-gradient(135deg, #F4B942, #D9961E);
  border: none;
  color: #16120A;
  padding: 10px 12px;
  border-radius: var(--radius-control);
  font-family: inherit;
  font-size: 0.83rem;
  font-weight: 800;
  cursor: pointer;
}

.btn-analyze:disabled {
  opacity: 0.65;
  cursor: wait;
}

.btn-hold {
  background: rgba(56, 189, 248, 0.14);
  border: 1px solid rgba(56, 189, 248, 0.36);
  color: #7DD3FC;
  padding: 10px 10px;
  border-radius: var(--radius-control);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
}

.btn-ghost-sm {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 10px 10px;
  border-radius: var(--radius-control);
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.ai-error-box {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(244, 185, 66, 0.12);
  border: 1px solid rgba(244, 185, 66, 0.35);
  color: #FDE68A;
  font-size: 0.75rem;
}

/* DETECTION BANNER & CANDIDATE CHIPS */
.detection-banner {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-inner);
  padding: 10px 11px;
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.source-context-row {
  font-size: 0.76rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.ctx-label {
  display: block;
  font-size: 0.69rem;
  color: var(--text-muted);
  margin-bottom: 4px;
  font-weight: 600;
}

.ctx-text {
  color: var(--text);
  font-family: 'Noto Sans SC', sans-serif;
}

.candidate-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.cand-chip {
  background: var(--surface-soft);
  border: 1px solid var(--border-strong);
  color: var(--text);
  border-radius: 99px;
  padding: 5px 11px;
  font-family: 'Noto Sans SC', 'Plus Jakarta Sans', sans-serif;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.cand-chip.active {
  background: rgba(244, 185, 66, 0.18);
  border-color: var(--gold);
  color: var(--gold);
}

.cand-chip .saved-mark {
  font-size: 0.7rem;
  color: var(--jade);
}

.duplicate-alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 11px;
  margin-bottom: 11px;
  border-radius: 10px;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: #BAE6FD;
  font-size: 0.76rem;
}

.btn-dup-act {
  background: var(--surface-raised);
  border: 1px solid var(--border-strong);
  color: var(--text);
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 5px 9px;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
}

/* DRAFT QUEUE SECTION */
.draft-section {
  margin-top: 12px;
  background: rgba(12, 16, 23, 0.72);
  border: 1px dashed rgba(56, 189, 248, 0.4);
  border-radius: 14px;
  padding: 11px;
}

.draft-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 9px;
}

.draft-header h3 {
  font-size: 0.85rem;
  color: #7DD3FC;
}

.btn-magic-sm {
  background: linear-gradient(135deg, #F4B942, #D9961E);
  border: none;
  color: #16120A;
  padding: 7px 11px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.74rem;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}

.draft-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.draft-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.draft-text {
  font-size: 0.83rem;
  flex: 1;
  word-break: break-word;
}

.draft-time {
  display: block;
  font-size: 0.67rem;
  color: var(--text-muted);
}

.draft-actions {
  display: flex;
  gap: 5px;
}

.btn-draft-act {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 5px 9px;
  border-radius: 7px;
  font-family: inherit;
  font-size: 0.73rem;
  font-weight: 700;
  cursor: pointer;
}

.btn-draft-act.primary {
  background: rgba(244, 185, 66, 0.16);
  border-color: var(--gold);
  color: var(--gold);
}

.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 14px 0;
}

/* FORM */
.vocab-form {
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.form-row.two-col {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 10px;
}

.form-group label {
  display: block;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.req {
  color: var(--primary);
}

.form-group input,
.form-group select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-control);
  padding: 9px 11px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.91rem;
}

#inputHanzi {
  font-family: 'Noto Sans SC', sans-serif;
  font-size: 1.3rem;
  font-weight: 800;
}

#inputPinyin {
  color: var(--gold);
  font-weight: 700;
}

.input-with-btn {
  display: flex;
  gap: 6px;
}

.mini-btn {
  background: var(--surface-soft);
  border: 1px solid var(--border-strong);
  color: var(--text);
  border-radius: var(--radius-control);
  padding: 0 11px;
  cursor: pointer;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.example-box-group {
  background: rgba(12, 16, 23, 0.55);
  border: 1px solid var(--border);
  border-radius: var(--radius-inner);
  padding: 10px;
}

.example-box-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 7px;
}

.example-box-header label {
  font-size: 0.75rem;
  font-weight: 700;
  color: #CBD5E1;
  margin-bottom: 0;
}

.mini-btn-text {
  background: var(--surface-soft);
  border: 1px solid var(--border-strong);
  color: var(--text);
  border-radius: 7px;
  padding: 4px 9px;
  font-family: inherit;
  font-size: 0.71rem;
  font-weight: 700;
  cursor: pointer;
}

.form-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.btn-primary {
  flex: 1;
  background: linear-gradient(145deg, var(--primary), var(--primary-deep));
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #FFFFFF;
  padding: 13px 16px;
  border-radius: var(--radius-inner);
  font-family: inherit;
  font-size: 0.94rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(230, 57, 80, 0.25);
}

.btn-primary:active {
  transform: scale(0.99);
}

.btn-secondary {
  background: var(--surface-soft);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 10px 14px;
  border-radius: var(--radius-inner);
  font-family: inherit;
  font-size: 0.83rem;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
}

.link-btn {
  background: none;
  border: none;
  color: var(--gold);
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
}

.btn-outline-sm {
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 6px 10px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
}

.select-sm {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 5px 8px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.74rem;
}

/* VOCAB LIST & CATEGORIES */
.vocab-mini-list,
.vocab-full-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.category-group {
  margin-top: 6px;
}

.category-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  background: var(--surface-soft);
  border-left: 3px solid var(--primary);
  border-radius: 9px;
  margin-bottom: 8px;
  font-size: 0.83rem;
  font-weight: 700;
}

.category-count-badge {
  font-size: 0.69rem;
  background: var(--bg);
  color: var(--text-muted);
  padding: 2px 8px;
  border-radius: 99px;
  font-variant-numeric: tabular-nums;
}

.vocab-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 12px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.vocab-main {
  flex: 1;
  min-width: 0;
}

.vocab-top-line {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.vocab-hanzi {
  font-family: 'Noto Sans SC', sans-serif;
  font-size: 1.4rem;
  font-weight: 800;
  color: #FFFFFF;
}

.vocab-pinyin {
  font-size: 0.9rem;
  color: var(--gold);
  font-weight: 700;
}

.vocab-cat-tag {
  font-size: 0.66rem;
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(230, 57, 80, 0.14);
  color: #FDA4AF;
  font-weight: 700;
}

.vocab-meta-tag {
  font-size: 0.66rem;
  padding: 2px 7px;
  border-radius: 99px;
  background: var(--surface-soft);
  color: var(--text-muted);
}

.vocab-meaning {
  font-size: 0.93rem;
  color: var(--text);
  margin-top: 3px;
  font-weight: 600;
}

.vocab-example-card {
  margin-top: 8px;
  padding: 8px 10px;
  background: var(--surface);
  border-left: 2px solid var(--gold);
  border-radius: 7px;
}

.ex-zh {
  font-family: 'Noto Sans SC', sans-serif;
  font-size: 0.89rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-inline-speak {
  background: none;
  border: none;
  color: var(--gold);
  cursor: pointer;
  font-size: 0.86rem;
}

.ex-py {
  font-size: 0.76rem;
  color: #FDE68A;
  margin-top: 2px;
}

.ex-id {
  font-size: 0.76rem;
  color: var(--text-muted);
}

.vocab-similar {
  display: inline-block;
  margin-top: 7px;
  font-size: 0.72rem;
  background: rgba(56, 189, 248, 0.12);
  color: #93C5FD;
  padding: 3px 8px;
  border-radius: 6px;
}

.vocab-context-note {
  margin-top: 5px;
  font-size: 0.71rem;
  color: var(--text-muted);
}

.vocab-actions {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex-shrink: 0;
}

.action-icon {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  width: 34px;
  height: 34px;
  border-radius: 9px;
  cursor: pointer;
  font-size: 0.85rem;
}

/* FLASHCARD REVIEW (SRS) */
.review-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.review-controls {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.quiz-mode-toggle {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 99px;
  padding: 2px;
}

.mode-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 99px;
  cursor: pointer;
}

.mode-btn.active {
  background: var(--primary);
  color: #FFFFFF;
}

.flashcard {
  background: linear-gradient(180deg, #192131 0%, var(--surface) 100%);
  border: 1px solid var(--border-strong);
  border-radius: 22px;
  padding: 22px 16px;
  text-align: center;
  min-height: 360px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.34);
}

.fc-progress {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-variant-numeric: tabular-nums;
}

.fc-front {
  margin: 18px 0 12px;
}

.fc-mode-label {
  display: inline-block;
  font-size: 0.71rem;
  color: var(--text-muted);
  margin-bottom: 8px;
  font-weight: 600;
}

.fc-hanzi {
  font-family: 'Noto Sans SC', sans-serif;
  font-size: 3.2rem;
  font-weight: 800;
  letter-spacing: 2px;
  margin-bottom: 10px;
}

.fc-indo-prompt {
  font-size: 1.75rem;
  font-weight: 800;
  margin-bottom: 10px;
  line-height: 1.3;
}

.fc-audio-btn {
  background: var(--surface-soft);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 8px 16px;
  border-radius: 99px;
  font-family: inherit;
  font-size: 0.83rem;
  font-weight: 700;
  cursor: pointer;
}

.fc-answer {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  margin: 10px 0 16px;
  text-align: center;
}

.fc-pinyin {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--gold);
}

.fc-meaning {
  font-size: 1.12rem;
  font-weight: 700;
  margin-top: 3px;
}

.fc-example-box {
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
}

.fc-similar {
  font-size: 0.75rem;
  color: #93C5FD;
  margin-top: 8px;
}

.srs-buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.srs-btn {
  border: none;
  border-radius: 12px;
  padding: 10px 6px;
  font-family: inherit;
  font-weight: 800;
  font-size: 0.8rem;
  cursor: pointer;
  color: #FFFFFF;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.srs-btn span.srs-time {
  font-size: 0.67rem;
  opacity: 0.88;
  font-weight: 600;
}

.srs-again { background: #DC2626; }
.srs-hard { background: #F4B942; color: #16120A; }
.srs-good { background: #2563EB; }
.srs-easy { background: #059669; }

/* SEARCH & FILTER */
.search-bar input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-inner);
  padding: 10px 14px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.91rem;
  margin-bottom: 10px;
}

.filter-pills,
.category-chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 4px;
  scrollbar-width: none;
}

.filter-pills::-webkit-scrollbar,
.category-chips::-webkit-scrollbar {
  display: none;
}

.filter-pill,
.cat-chip {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: 99px;
  font-family: inherit;
  font-size: 0.74rem;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}

.filter-pill.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #FFFFFF;
}

.cat-chip.active {
  background: #2563EB;
  border-color: #2563EB;
  color: #FFFFFF;
}

/* BOTTOM NAVIGATION */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 500px;
  margin: 0 auto;
  background: rgba(12, 16, 23, 0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 6px 8px calc(10px + env(safe-area-inset-bottom, 0px));
  z-index: 30;
}

.nav-item {
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 0;
  cursor: pointer;
  position: relative;
}

.nav-item.active {
  color: #FFFFFF;
}

.nav-icon {
  font-size: 1.2rem;
}

.nav-label {
  font-size: 0.71rem;
  font-weight: 700;
}

.nav-badge {
  position: absolute;
  top: 2px;
  right: 22%;
  background: var(--primary);
  color: #FFFFFF;
  font-size: 0.63rem;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 99px;
  font-variant-numeric: tabular-nums;
}

.nav-badge.badge-draft {
  background: #0284C7;
}

/* MODAL */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.74);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 50;
}

.modal-card {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  width: 100%;
  max-width: 440px;
  max-height: 88dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 18px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.status-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
}

.status-card-title {
  font-size: 0.78rem;
  font-weight: 800;
  color: #E2E8F0;
}

.settings-details {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
}

.settings-details summary {
  font-size: 0.8rem;
  font-weight: 700;
  color: #CBD5E1;
  cursor: pointer;
}

.details-body {
  margin-top: 10px;
}

.inline-btn-row {
  display: flex;
  gap: 8px;
}

.api-test-result {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 9px;
  font-size: 0.76rem;
  font-weight: 600;
}

.api-test-result.ok {
  background: rgba(16, 185, 129, 0.14);
  color: #6EE7B7;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.api-test-result.err {
  background: rgba(248, 113, 113, 0.14);
  color: #FCA5A5;
  border: 1px solid rgba(248, 113, 113, 0.3);
}

.backup-actions {
  display: flex;
  gap: 10px;
  margin-top: 6px;
}

.file-label {
  cursor: pointer;
}

.ios-install-note {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(244, 185, 66, 0.1);
  border: 1px solid rgba(244, 185, 66, 0.28);
  font-size: 0.74rem;
  color: #FDE68A;
}

.modal-footer {
  margin-top: 16px;
  display: flex;
  justify-content: flex-end;
}

/* TOAST */
.toast {
  position: fixed;
  bottom: calc(86px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  background: var(--jade);
  color: #052E16;
  font-weight: 800;
  font-size: 0.83rem;
  padding: 9px 18px;
  border-radius: 99px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  z-index: 60;
  text-align: center;
  max-width: 90%;
}

.hidden {
  display: none !important;
}

@media (hover: hover) {
  .btn-camera-tile:hover,
  .btn-gallery-mini:hover,
  .btn-secondary:hover,
  .icon-btn:hover,
  .action-icon:hover,
  .cand-chip:hover {
    border-color: rgba(255, 255, 255, 0.28);
  }
  .btn-record-hero:hover {
    box-shadow: 0 10px 24px rgba(230, 57, 80, 0.38);
  }
}

@media (max-width: 410px) {
  .net-badge {
    font-size: 0;
    padding: 7px;
    gap: 0;
  }
  .net-badge::before {
    width: 8px;
    height: 8px;
  }
}

@media (max-width: 390px) {
  .hero-action-grid {
    grid-template-columns: 1.35fr 1fr;
  }
  .form-row.two-col {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

@keyframes pulseOrb {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.65; transform: scale(0.95); }
}
