/* LexiDeck · Vocabulary Studio Stylesheet */
:root {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --bg: #f6f7f3;
  --card-bg: #ffffff;
  --card-subtle: #f9fbf7;
  --text: #22352c;
  --text-muted: #748377;
  --text-light: #94a397;
  --line: #dfe5da;
  --line-strong: #c8d4c3;
  --green: #244f3e;
  --green-hover: #1b3d30;
  --green-light: #edf4e7;
  --lime: #d9ed9c;
  --lime-dark: #274720;
  --amber: #b26a27;
  --amber-light: #fcf4e8;
  --red: #b84a39;
  --red-light: #fdf0ed;
  --blue: #2b5b84;
  --blue-light: #edf4fa;
  --purple: #6a4c93;
  --purple-light: #f5f0fb;
  --sidebar-w: 240px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 14px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 28px rgba(0,0,0,0.1);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --serif: Cambria, "Times New Roman", "Noto Serif", serif;
}

[data-theme="dark"] {
  --bg: #141b18;
  --card-bg: #1d2622;
  --card-subtle: #232e29;
  --text: #e6ede7;
  --text-muted: #9aa89e;
  --text-light: #6e7d72;
  --line: #2b3832;
  --line-strong: #3b4d45;
  --green: #377057;
  --green-hover: #438769;
  --green-light: #20352b;
  --lime: #9cdb7d;
  --lime-dark: #122810;
  --amber: #d98a3b;
  --amber-light: #332414;
  --red: #d96250;
  --red-light: #331915;
  --blue: #4a8cc4;
  --blue-light: #162836;
  --purple: #9a76d1;
  --purple-light: #2a1f3d;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.25);
  --shadow-md: 0 4px 14px rgba(0,0,0,0.35);
}

[data-theme="sepia"] {
  --bg: #f4ecdc;
  --card-bg: #fcf6e9;
  --card-subtle: #f8efe0;
  --text: #3d3023;
  --text-muted: #857461;
  --text-light: #a69581;
  --line: #e3d5c1;
  --line-strong: #cebeaa;
  --green: #4d4432;
  --green-hover: #3c3425;
  --green-light: #ede2cf;
  --lime: #e5cd97;
  --lime-dark: #3b2c15;
  --amber: #b26829;
  --amber-light: #f5e8d5;
  --red: #b34a36;
  --red-light: #f7e6e2;
  --blue: #41627e;
  --blue-light: #e4edf4;
  --purple: #6c537d;
  --purple-light: #eee5f5;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  transition: background 0.2s ease, color 0.2s ease;
}

button, input, select, textarea { font: inherit; color: inherit; }
button {
  cursor: pointer;
  border: 0;
  background: transparent;
  transition: all 0.15s ease;
}
button:disabled {
  cursor: default;
  opacity: 0.5;
  pointer-events: none;
}
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

/* Sidebar */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: var(--card-bg);
  border-right: 1px solid var(--line);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  z-index: 50;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}
.brand {
  text-decoration: none;
  display: flex;
  gap: 12px;
  align-items: center;
  color: var(--text);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.5px;
}
.logo {
  display: grid;
  place-items: center;
  border-radius: var(--radius-md);
  background: var(--green);
  color: var(--lime);
  width: 38px;
  height: 40px;
  font-family: var(--serif);
  font-size: 28px;
  font-weight: bold;
}
.brand small {
  display: block;
  font-size: 9px;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  font-weight: 600;
  margin-top: 2px;
}
.workspace {
  font-size: 11px;
  margin: 22px 6px 18px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.workspace-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.dot {
  width: 7px;
  height: 7px;
  background: #7ca856;
  border-radius: 50%;
  display: inline-block;
}
.workspace small {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-muted);
}
nav {
  display: grid;
  gap: 6px;
  margin-top: 4px;
}
nav button {
  text-align: left;
  color: var(--text-muted);
  padding: 11px 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 500;
}
nav button span {
  font-size: 13px;
  flex: 1;
}
nav button:hover {
  background: var(--green-light);
  color: var(--green);
}
nav button.active {
  background: var(--green-light);
  color: var(--green);
  font-weight: 600;
}
nav b {
  font-size: 11px;
  background: var(--card-bg);
  border: 1px solid var(--line);
  padding: 2px 7px;
  border-radius: 12px;
  margin-left: auto;
  color: var(--text);
}
.sidebar-bottom {
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.motto {
  font-family: var(--serif);
  font-style: italic;
  font-size: 16px;
  line-height: 1.4;
  color: var(--text-muted);
}
.sidebar-bottom p {
  font-size: 11px;
  color: var(--text-light);
  line-height: 1.6;
  margin: 8px 0 14px;
}
.theme-selector {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}
.theme-btn {
  flex: 1;
  padding: 5px;
  font-size: 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--card-subtle);
  color: var(--text-muted);
  text-align: center;
}
.theme-btn.active {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
}
.backup-actions {
  display: flex;
  gap: 8px;
}
.backup-btn {
  flex: 1;
  border: 1px solid var(--line);
  background: var(--card-subtle);
  color: var(--text-muted);
  font-size: 11px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  text-align: center;
}
.backup-btn:hover {
  background: var(--green-light);
  color: var(--green);
}

/* Main Area */
main {
  margin-left: var(--sidebar-w);
  padding: 24px 36px 60px;
  max-width: 1400px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
header.top-bar {
  height: 38px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10px;
  letter-spacing: 1.5px;
  color: var(--text-light);
  font-weight: 600;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
  margin-bottom: 24px;
}
.local-badge {
  letter-spacing: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-muted);
}
.local-badge i {
  width: 7px;
  height: 7px;
  background: #7ca856;
  border-radius: 50%;
}
.local-badge .user-avatar {
  width: 26px;
  height: 26px;
  background: var(--green-light);
  color: var(--green);
  font-weight: bold;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 11px;
}

/* Page Headers */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin: 10px 0 24px;
  flex-wrap: wrap;
}
.eyebrow {
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--green);
  font-weight: 700;
  text-transform: uppercase;
}
h1 {
  font-family: var(--serif);
  font-size: 34px;
  line-height: 1.25;
  font-weight: 600;
  letter-spacing: -0.6px;
  margin: 6px 0;
  color: var(--text);
}
p.subtitle {
  color: var(--text-muted);
  line-height: 1.7;
  font-size: 14px;
  margin: 4px 0 0;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: var(--card-bg);
  color: var(--text-muted);
  font-size: 11px;
  padding: 5px 12px;
  border-radius: 20px;
  white-space: nowrap;
}
.pill.topic {
  font-weight: 600;
  border-color: transparent;
  color: #fff;
}
.pill.level {
  background: var(--card-subtle);
  color: var(--text-muted);
}

/* Dashboard Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(280px, 1fr);
  gap: 20px;
}
.hero {
  position: relative;
  overflow: hidden;
  background: var(--green);
  border-radius: var(--radius-lg);
  padding: 30px;
  color: white;
  min-height: 240px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-md);
}
.hero::after {
  content: "Aa";
  font-family: var(--serif);
  font-size: 180px;
  color: rgba(255,255,255,0.05);
  position: absolute;
  right: -8px;
  bottom: -36px;
  pointer-events: none;
}
.hero .eyebrow {
  color: var(--lime);
}
.hero h2 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 28px;
  margin: 12px 0 8px;
  line-height: 1.3;
}
.hero p {
  color: rgba(255,255,255,0.85);
  font-size: 13px;
  line-height: 1.6;
  margin: 0 0 16px;
  max-width: 480px;
}
.hero-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.primary {
  background: var(--green);
  color: #ffffff;
  border: 0;
  border-radius: var(--radius-sm);
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-sm);
}
.primary:hover {
  background: var(--green-hover);
}
.hero .primary {
  background: var(--lime);
  color: var(--lime-dark);
}
.hero .primary:hover {
  filter: brightness(0.95);
}
.secondary {
  background: var(--card-bg);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.secondary:hover {
  background: var(--card-subtle);
  border-color: var(--line-strong);
}
.text-button {
  border: 0;
  background: none;
  color: var(--green);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 10px;
}
.hero .text-button {
  color: var(--lime);
}
.panel {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}
.plan {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}
.plan-step {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.step-number {
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  background: var(--card-subtle);
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--green);
  flex-shrink: 0;
}
.plan-step strong {
  font-size: 13px;
  display: block;
}
.plan-step p {
  font-size: 12px;
  color: var(--text-muted);
  margin: 3px 0 0;
  line-height: 1.5;
}

/* Stat strip */
.stat-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin: 20px 0;
  border: 1px solid var(--line);
  background: var(--card-bg);
  border-radius: var(--radius-md);
  padding: 16px 0;
  box-shadow: var(--shadow-sm);
}
.stat-strip > div {
  padding: 0 20px;
  border-right: 1px solid var(--line);
}
.stat-strip > div:last-child {
  border-right: 0;
}
.stat-strip strong {
  font-size: 26px;
  font-weight: 600;
  display: block;
  color: var(--text);
  font-family: var(--serif);
}
.stat-strip small {
  display: block;
  color: var(--text-muted);
  font-size: 11px;
  margin-top: 4px;
}

/* Readings section */
.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 28px 0 14px;
}
.section-title h2 {
  font-size: 18px;
  font-weight: 600;
  margin: 0;
}
.reading-category-filter {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.reading-filter-pill {
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: 20px;
  font-size: 12px;
  background: var(--card-bg);
  color: var(--text-muted);
  white-space: nowrap;
}
.reading-filter-pill.active {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
}
.reading-tiles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.tile {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 18px;
  text-align: left;
  display: flex;
  flex-direction: column;
  color: var(--text);
  box-shadow: var(--shadow-sm);
  transition: all 0.15s ease;
}
.tile:hover {
  border-color: var(--line-strong);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.tile-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.tile .tile-icon {
  font-family: var(--serif);
  background: var(--green-light);
  color: var(--green);
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-weight: bold;
}
.tile strong {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 6px;
}
.tile p {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
  margin: 0;
}
.tile-footer {
  margin-top: auto;
  padding-top: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--text-light);
}

/* Insights & Chart */
.home-bottom {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 22px;
}
.activity-chart {
  display: flex;
  gap: 10px;
  justify-content: space-between;
  padding-top: 14px;
}
.activity-chart > div {
  flex: 1;
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
}
.bar-track {
  height: 75px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  margin: 6px 0;
  background: var(--card-subtle);
  border-radius: var(--radius-sm);
  padding-bottom: 2px;
}
.bar-track i {
  width: 60%;
  max-width: 24px;
  background: var(--lime);
  border-radius: 4px 4px 0 0;
  transition: height 0.3s ease;
}
[data-theme="dark"] .bar-track i {
  background: var(--green);
}
.upcoming {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin: 18px 0;
}
.upcoming > div {
  text-align: center;
  flex: 1;
  background: var(--card-subtle);
  padding: 10px 4px;
  border-radius: var(--radius-sm);
}
.upcoming span {
  display: block;
  font-size: 10px;
  color: var(--text-muted);
}
.upcoming strong {
  display: block;
  font-size: 18px;
  font-weight: 600;
  color: var(--green);
  margin-top: 4px;
  font-family: var(--serif);
}

/* Learning Session View */
.learn-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 24px;
  max-width: 1150px;
  margin: auto;
}
.learning-card {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 32px 36px;
  min-height: 380px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}
.session-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 12px;
}
.progress {
  height: 5px;
  background: var(--line);
  border-radius: 3px;
  margin: 10px 0 24px;
  overflow: hidden;
}
.progress > div {
  height: 100%;
  background: var(--green);
  transition: width 0.3s ease;
}
.word-line {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 20px 0 8px;
}
.word-line h2 {
  font-family: var(--serif);
  font-size: 38px;
  font-weight: 600;
  overflow-wrap: anywhere;
  margin: 0;
  color: var(--text);
  line-height: 1.2;
}
.audio {
  background: var(--card-subtle);
  border: 1px solid var(--line);
  color: var(--green);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-size: 16px;
}
.audio:hover {
  background: var(--green-light);
}
.phrase {
  font-size: 15px;
  color: var(--text-muted);
  font-style: italic;
  margin-bottom: 18px;
}
.meaning {
  font-size: 22px;
  color: var(--green);
  font-weight: 600;
  margin: 16px 0;
  line-height: 1.4;
}
.example {
  background: var(--card-subtle);
  border-left: 3px solid var(--green);
  padding: 16px 20px;
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.7;
  margin: 16px 0;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text);
}
.example small {
  display: block;
  font: 13px/1.7 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text-muted);
  margin-top: 8px;
  font-style: normal;
}
.source {
  font-size: 11px;
  color: var(--text-light);
  line-height: 1.6;
  margin-top: 14px;
}
.study-actions {
  display: flex;
  gap: 12px;
  margin-top: auto;
  padding-top: 24px;
  flex-wrap: wrap;
}
.ratings {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 16px;
}
.ratings button {
  background: var(--card-subtle);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px 10px;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  transition: all 0.15s ease;
}
.ratings button:hover {
  background: var(--green-light);
  border-color: var(--green);
  color: var(--green);
}
.ratings button:first-child {
  background: var(--red-light);
  border-color: #f2cfc7;
  color: var(--red);
}
.ratings button small {
  display: block;
  font-size: 11px;
  opacity: 0.75;
  margin-top: 4px;
  font-weight: normal;
}
.answer-input {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}
.answer-input input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 15px;
  background: var(--card-bg);
  color: var(--text);
}
.feedback {
  font-size: 13px;
  line-height: 1.6;
  margin: 14px 0;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--green-light);
  color: var(--green);
  border: 1px solid var(--line);
}
.feedback.wrong {
  background: var(--red-light);
  color: var(--red);
  border-color: #f2cfc7;
}
.session-tools {
  display: flex;
  justify-content: space-between;
  margin-top: 14px;
  padding: 0 4px;
}

/* Reader View & Click-to-Lookup Engine */
.reader-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.75fr) minmax(300px, 1fr);
  gap: 24px;
  align-items: start;
}
.reader-paper {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 34px 40px;
  box-shadow: var(--shadow-sm);
}
.reader-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
  gap: 12px;
}
.font-size-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--card-subtle);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 3px 6px;
}
.font-btn {
  padding: 3px 9px;
  border-radius: 14px;
  font-size: 12px;
  color: var(--text-muted);
}
.font-btn.active {
  background: var(--green);
  color: #fff;
}
.passage {
  font-family: var(--serif);
  line-height: 2.1;
  color: var(--text);
  white-space: pre-wrap;
  user-select: text;
}
.passage.font-sm { font-size: 17px; }
.passage.font-md { font-size: 20px; }
.passage.font-lg { font-size: 23px; }

/* Interactive Token in Reader */
.reader-token {
  display: inline;
  padding: 1px 2px;
  margin: 0 -2px;
  border-radius: 3px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.reader-token:hover {
  background: var(--green-light);
  color: var(--green);
}
.reader-token.card-phrase {
  border-bottom: 2px dashed #86a873;
}
.reader-token.card-word {
  border-bottom: 1px dashed #9cb58b;
}
.reader-token.active-token {
  background: #eaf3d4 !important;
  color: #274720 !important;
  border-radius: 4px;
}
[data-theme="dark"] .reader-token.active-token {
  background: #375741 !important;
  color: #c9f5ab !important;
}
.reader-token.looked {
  background: var(--card-subtle);
}

/* Reader Side & Gloss */
.reader-side {
  position: sticky;
  top: 24px;
  display: grid;
  gap: 18px;
}
.gloss h3 {
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 600;
  margin: 10px 0 6px;
  color: var(--text);
}
.gloss-pos {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}
.gloss-meaning {
  font-size: 17px;
  font-weight: 600;
  color: var(--green);
  line-height: 1.5;
  margin: 8px 0;
}
.gloss-lemma {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.gloss-example {
  background: var(--card-subtle);
  border-left: 2px solid var(--line-strong);
  padding: 10px 14px;
  font-size: 13px;
  line-height: 1.6;
  margin: 10px 0;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.gloss-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 12px;
  margin: 6px 0 12px;
}
.gloss-status-pill.in-deck {
  background: var(--green-light);
  color: var(--green);
}
.gloss-status-pill.new-word {
  background: var(--amber-light);
  color: var(--amber);
}

/* Question & Comprehension */
.question {
  margin: 24px 0;
}
.question > p {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--text);
}
.choices {
  display: grid;
  gap: 8px;
}
.choice {
  border: 1px solid var(--line);
  background: var(--card-subtle);
  color: var(--text);
  text-align: left;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  transition: all 0.15s ease;
}
.choice:hover:not(:disabled) {
  background: var(--green-light);
  border-color: var(--green);
}
.choice.selected {
  background: var(--green-light);
  border-color: var(--green);
  font-weight: 600;
}
.choice.correct {
  border-color: #669e48;
  background: #eaf5e1;
  color: #274c1a;
}
.choice.wrong {
  border-color: #d18275;
  background: #fbeee9;
  color: #8c2e21;
}

/* Words Table View */
.controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin: 18px 0;
}
input, select, textarea {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  padding: 10px 14px;
  color: var(--text);
  font-size: 13px;
}
textarea {
  width: 100%;
  resize: vertical;
  line-height: 1.6;
}
input.search {
  flex: 1;
  min-width: 200px;
}
.words-table {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.word-row {
  display: grid;
  grid-template-columns: minmax(140px, 1.2fr) minmax(180px, 1.8fr) 140px 100px;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  align-items: center;
}
.word-row:last-child {
  border-bottom: 0;
}
.word-row strong {
  font-size: 15px;
  display: block;
}
.word-row small {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
}
.word-row .translation {
  font-size: 13px;
  color: var(--text);
}
.word-row button {
  border: 1px solid var(--line);
  background: var(--card-subtle);
  color: var(--text);
  border-radius: var(--radius-sm);
  font-size: 12px;
  padding: 6px 10px;
}
.word-row button:hover {
  background: var(--green-light);
  border-color: var(--green);
  color: var(--green);
}

/* Modal Dialog */
dialog {
  border: 1px solid var(--line-strong);
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 28px;
  max-width: 560px;
  width: calc(100% - 32px);
  max-height: 90vh;
  overflow: auto;
  color: var(--text);
  box-shadow: var(--shadow-lg);
}
dialog::backdrop {
  background: rgba(16, 26, 20, 0.6);
  backdrop-filter: blur(2px);
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.close {
  border: 0;
  background: none;
  color: var(--text-muted);
  font-size: 24px;
  line-height: 1;
  padding: 4px;
}
.form-grid {
  display: grid;
  gap: 14px;
}
.form-grid label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  display: grid;
  gap: 6px;
}

/* Toast */
#toast {
  display: none;
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  max-width: 90vw;
  background: var(--green);
  color: #fff;
  z-index: 100;
  padding: 12px 22px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
}

/* Divider & Misc */
.divider {
  height: 1px;
  background: var(--line);
  margin: 20px 0;
}
.mini {
  font-size: 11px;
  color: var(--text-muted);
}
.empty {
  text-align: center;
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 48px 24px;
}
.empty h2 {
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 500;
  margin-bottom: 8px;
}

/* Responsive */
@media (max-width: 1080px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .learn-layout { grid-template-columns: 1fr; }
  .reader-layout { grid-template-columns: 1fr; }
  .reader-side { position: static; }
  .reading-tiles { grid-template-columns: repeat(2, 1fr); }
  .word-row { grid-template-columns: 1fr 1.5fr 100px 70px; }
}

@media (max-width: 768px) {
  .sidebar {
    position: static;
    width: 100%;
    padding: 16px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  main {
    margin-left: 0;
    padding: 16px;
  }
  nav {
    display: flex;
    overflow-x: auto;
    padding-bottom: 4px;
    gap: 4px;
  }
  nav button {
    flex-shrink: 0;
    padding: 8px 12px;
    font-size: 13px;
  }
  nav b { display: none; }
  .workspace, .motto, .sidebar-bottom p { display: none; }
  .sidebar-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 12px;
  }
  .stat-strip {
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    padding: 14px 0;
  }
  .stat-strip > div:nth-child(2) { border-right: 0; }
  .stat-strip > div { padding: 0 14px; }
  .reading-tiles { grid-template-columns: 1fr; }
  .home-bottom { grid-template-columns: 1fr; }
  .word-row {
    grid-template-columns: 1fr 1fr 60px;
    gap: 10px;
    padding: 12px;
  }
  .word-row .level-cell { display: none; }
  .learning-card, .reader-paper { padding: 20px; }
  .word-line h2 { font-size: 30px; }
  h1 { font-size: 26px; }
}

/* Quick Hover Definition Tooltip Popover */
.word-tooltip {
  position: fixed;
  z-index: 10000;
  max-width: 380px;
  min-width: 260px;
  background: var(--card-bg);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 12px 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.16), 0 2px 8px rgba(0, 0, 0, 0.08);
  pointer-events: auto;
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: opacity 0.14s ease, transform 0.14s cubic-bezier(0.16, 1, 0.3, 1);
  opacity: 0;
  transform: translateY(4px);
}

.word-tooltip.visible {
  opacity: 1;
  transform: translateY(0);
}

.tooltip-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 6px;
}

.tooltip-word-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
}

.tooltip-word {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.tooltip-pos {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--card-subtle);
  padding: 1px 6px;
  border-radius: 4px;
}

.tooltip-audio {
  background: var(--card-subtle);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 50%;
  width: 24px;
  height: 24px;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}

.tooltip-audio:hover {
  background: var(--green-light);
  color: var(--green);
}

.tooltip-vi-meaning {
  font-size: 14px;
  font-weight: 600;
  color: var(--green);
  margin-bottom: 4px;
  line-height: 1.4;
}

.tooltip-en-def {
  font-size: 12.5px;
  color: var(--text);
  margin-bottom: 4px;
  line-height: 1.45;
}

.tooltip-en-def strong {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.tooltip-example {
  font-size: 11.5px;
  font-style: italic;
  color: var(--text-muted);
  background: var(--card-subtle);
  padding: 4px 8px;
  border-radius: 4px;
  margin-top: 4px;
  border-left: 2px solid var(--accent);
}

.tooltip-collocation {
  font-size: 12px;
  color: var(--text-muted);
  margin: 3px 0;
}

.tooltip-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 99px;
  margin-top: 6px;
}

.tooltip-badge.in-deck {
  background: var(--green-light);
  color: var(--green);
}

.tooltip-badge.new-word {
  background: var(--amber-light);
  color: var(--amber);
}

.tooltip-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid var(--line);
}

.tooltip-btn {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  transition: all 0.12s;
}

.tooltip-btn:hover {
  background: var(--card-subtle);
  border-color: var(--line-strong);
}

.tooltip-btn.primary {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
}

.tooltip-btn.primary:hover {
  background: #23421d;
}

/* Chapter Navigation for Book Reader */
.chapter-nav-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
  gap: 12px;
}

.chapter-badge {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 8px;
  border-radius: 6px;
  background: #fdf2e9;
  color: #c25934;
  border: 1px solid #f6d2b8;
}

[data-theme="dark"] .chapter-badge {
  background: #38241b;
  color: #f7a072;
  border-color: #5c3524;
}

.reader-book-meta {
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
  flex-wrap: wrap;
}
