/* Strict, non-gamified study interface — flat surfaces, minimal shadows, one accent
   color for CTAs/warnings. See TZ.md §4. Deliberately not sharing character-rpg's
   palette/shadows/radii (that redesign is RPG-specific). */
:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --card-2: #eef1f5;
  --text: #1a1d21;
  --text-2: #5b6270;
  --text-3: #8b919d;
  --border: #e2e5ea;
  --accent: #2f5fdd;
  --accent-strong: #23479f;
  --fill-danger: #fdecec;
  --text-danger: #b3261e;
  --fill-good: #e7f6ee;
  --text-good: #1a7f4e;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(20,22,26,0.05);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161a;
    --card: #1d2024;
    --card-2: #24282e;
    --text: #eef0f2;
    --text-2: #a3a9b3;
    --text-3: #6d7280;
    --border: #2b2f36;
    --accent: #5b84ff;
    --accent-strong: #7fa0ff;
    --fill-danger: #3a1e1e;
    --text-danger: #ff8a80;
    --fill-good: #1b3327;
    --text-good: #5fd6a0;
    --shadow: 0 1px 2px rgba(0,0,0,0.4);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
.tabular-nums { font-variant-numeric: tabular-nums; }

#app { display: flex; flex-direction: column; min-height: 100vh; }

.topbar {
  position: sticky; top: 0; z-index: 5;
  padding: calc(10px + var(--safe-top)) 16px 10px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.topbar-title { font-weight: 700; font-size: 15px; margin-right: 4px; }
.tabbar { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
.tab-item {
  border: none; background: transparent; color: var(--text-2);
  font-size: 13px; font-weight: 600; padding: 6px 10px; border-radius: var(--radius-sm);
  cursor: pointer; white-space: nowrap;
}
.tab-item.active { background: var(--card-2); color: var(--text); }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  border: 1px solid var(--border); background: var(--card); color: var(--text-2);
  width: 30px; height: 30px; border-radius: var(--radius-sm); cursor: pointer; font-size: 15px;
}
.streak-badge {
  background: var(--card-2); border-radius: var(--radius-sm); padding: 4px 10px;
  font-weight: 700; font-size: 13px;
}
.btn-connect {
  border: none; background: var(--accent); color: #fff; font-weight: 600; font-size: 12px;
  padding: 6px 12px; border-radius: var(--radius-sm); cursor: pointer; white-space: nowrap;
}
.btn-connect:active { background: var(--accent-strong); }
.sync-status {
  position: absolute; right: 16px; top: 100%; font-size: 11px; color: var(--text-3);
  padding: 2px 0;
}

.content { flex: 1; padding: 16px; padding-bottom: calc(24px + var(--safe-bottom)); max-width: 720px; width: 100%; margin: 0 auto; }
.screen { display: none; }
.screen.active { display: block; }

.metric-row { display: flex; gap: 10px; margin-bottom: 20px; }
.metric-card {
  flex: 1; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px; box-shadow: var(--shadow); text-align: center;
}
.metric-value { font-size: 22px; font-weight: 700; }
.metric-label { font-size: 12px; color: var(--text-2); margin-top: 4px; }

.plan-list { display: flex; flex-direction: column; gap: 10px; }
.plan-card {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow); cursor: pointer;
}
.plan-card-accent { border-color: var(--text-danger); background: var(--fill-danger); }
.plan-card-title { font-weight: 600; font-size: 14px; }
.plan-card-sub { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.btn-start {
  border: none; background: var(--accent); color: #fff; font-weight: 600; font-size: 13px;
  padding: 8px 14px; border-radius: var(--radius-sm); cursor: pointer;
}
.btn-start:active { background: var(--accent-strong); }

.empty-note {
  color: var(--text-3); font-size: 13px; text-align: center; padding: 32px 12px;
  border: 1px dashed var(--border); border-radius: var(--radius);
}

/* Vocab SRS review (TZ.md §3.2) */
.vocab-summary { text-align: center; padding: 40px 12px; }
.vocab-summary-stat { font-size: 44px; font-weight: 700; }
.vocab-summary-label { font-size: 13px; color: var(--text-2); margin-top: 2px; }
.vocab-summary-sub { font-size: 12px; color: var(--text-3); margin-top: 10px; }
.btn-start-review {
  margin-top: 24px; border: none; background: var(--accent); color: #fff; font-weight: 700;
  font-size: 15px; padding: 12px 28px; border-radius: var(--radius); cursor: pointer;
}
.btn-start-review:active { background: var(--accent-strong); }

.vocab-progress { text-align: center; margin-bottom: 10px; }
.vocab-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 32px 20px; min-height: 200px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; cursor: pointer; text-align: center;
}
.vocab-word { font-size: 32px; font-weight: 700; }
.vocab-tap-hint { font-size: 13px; color: var(--text-3); }
.vocab-reveal { width: 100%; text-align: left; display: flex; flex-direction: column; gap: 8px; cursor: auto; }
.vocab-reveal label { font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.03em; }
.vocab-reveal input, .vocab-reveal textarea {
  width: 100%; border: 1px solid var(--border); background: var(--bg); color: var(--text);
  border-radius: var(--radius-sm); padding: 8px 10px; font-size: 14px; font-family: inherit; resize: vertical;
}
.vocab-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 2px; }
.vocab-tag {
  background: var(--card-2); color: var(--text-2); font-size: 11px; font-weight: 600;
  padding: 2px 8px; border-radius: 999px;
}
.grade-row { display: flex; gap: 8px; margin-top: 16px; }
.grade-btn {
  flex: 1; border: none; border-radius: var(--radius-sm); padding: 12px 4px;
  font-weight: 700; font-size: 13px; cursor: pointer; color: #fff;
}
.grade-again { background: var(--text-danger); }
.grade-hard { background: var(--card-2); color: var(--text); border: 1px solid var(--border); }
.grade-good { background: var(--accent); }
.grade-easy { background: var(--text-good); }
