:root {
  --bg: #FBF3E8;
  --bg-dot: #F1E5D4;
  --panel: #FFFBF4;
  --panel-soft: #FFF6EA;
  --ink: #4A4059;
  --ink-soft: #7B7189;
  --line: #D9CCBB;
  --mint: #A8D8CB;
  --mint-deep: #6FAE9E;
  --sky: #A9D4F0;
  --sky-deep: #6F9FD0;
  --peach: #F7C6C0;
  --peach-deep: #D68F8D;
  --lemon: #F6E3A1;
  --lemon-deep: #C9A94E;
  --lav: #D8C7F0;
  --lav-deep: #A488D0;
  --rose: #EFA8B8;
  --rose-deep: #C9778C;
  --green: #9CCB9C;
  --green-deep: #5F9E6E;
  --red: #E39A9A;
  --shadow: rgba(74, 64, 89, 0.16);
  --pixel-border: 3px solid var(--ink);
  --radius: 6px;
  --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", "Courier New", monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
}

body {
  background-image:
    linear-gradient(45deg, rgba(210, 190, 165, 0.10) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(210, 190, 165, 0.10) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(210, 190, 165, 0.10) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(210, 190, 165, 0.10) 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}
.file-mode-banner {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--lemon);
  color: var(--ink);
  border-bottom: 3px solid var(--ink);
  padding: 8px 14px;
  font-size: 13px;
}

button, input, select, textarea {
  font-family: var(--font);
  color: var(--ink);
}

button { cursor: pointer; }

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

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 18px;
  background: linear-gradient(90deg, #FFF7EC, #FFF1E6 55%, #F3EAFB);
  border-bottom: var(--pixel-border);
  box-shadow: 0 3px 0 rgba(74, 64, 89, 0.08);
  position: sticky;
  top: 0;
  z-index: 40;
}

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

.brand-pixel {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  position: relative;
  image-rendering: pixelated;
  background:
    linear-gradient(90deg, var(--rose) 0 25%, transparent 25% 75%, var(--rose) 75%),
    linear-gradient(0deg, var(--sky) 0 25%, transparent 25% 75%, var(--sky) 75%);
  background-size: 16px 16px;
  border: 3px solid var(--ink);
  box-shadow: 3px 3px 0 rgba(74, 64, 89, 0.18);
}

.brand-pixel::after {
  content: "";
  position: absolute;
  width: 12px;
  height: 12px;
  background: var(--lemon);
  border: 2px solid var(--ink);
  right: 3px;
  top: 3px;
}

.brand-text { line-height: 1.15; }
.brand-text strong { display: block; font-size: 17px; }
.brand-text small { color: var(--ink-soft); font-size: 11px; }

.top-stats {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-wrap: wrap;
}

.stat-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--panel);
  border: 2px solid var(--ink);
  box-shadow: 2px 2px 0 var(--shadow);
  padding: 5px 9px;
  font-size: 12px;
  white-space: nowrap;
}

.stat-chip i { font-style: normal; color: var(--ink-soft); }
.stat-chip b { font-size: 13px; }
.stat-chip.xp { min-width: 120px; padding: 4px 8px; }

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

.layout {
  display: flex;
  flex: 1;
  min-height: 0;
}

.sidebar {
  width: 216px;
  flex: 0 0 216px;
  background: linear-gradient(180deg, #FFF8EF, #F5EFFB);
  border-right: var(--pixel-border);
  display: flex;
  flex-direction: column;
  padding: 14px 10px 10px;
}

.side-nav { display: flex; flex-direction: column; gap: 8px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 10px;
  border: 2px solid transparent;
  background: transparent;
  text-align: left;
  font-size: 13px;
  color: var(--ink);
  transition: transform 0.08s linear, background 0.12s linear;
}

.nav-item:hover { background: rgba(168, 216, 203, 0.25); }
.nav-item.active {
  background: var(--mint);
  border-color: var(--ink);
  box-shadow: 3px 3px 0 rgba(74, 64, 89, 0.16);
  transform: translate(-1px, -1px);
  font-weight: 700;
}

.nav-ico {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  display: inline-block;
  position: relative;
  background: var(--lav);
  border: 2px solid var(--ink);
  image-rendering: pixelated;
}

.nav-ico::before,
.nav-ico::after {
  content: "";
  position: absolute;
  background: var(--ink);
}

.ico-home::before {
  width: 8px; height: 6px; left: 5px; top: 6px;
  box-shadow: 0 -3px 0 -1px var(--ink), 4px 0 0 -1px var(--ink), 4px -3px 0 -1px var(--ink);
}
.ico-home::after {
  width: 10px; height: 8px; left: 4px; top: 10px; background: var(--peach);
  border: 2px solid var(--ink); box-shadow: none;
}

.ico-tasks { background: var(--lemon); }
.ico-tasks::before { width: 10px; height: 3px; left: 5px; top: 6px; box-shadow: 0 7px 0 var(--ink); }
.ico-tasks::after { width: 4px; height: 4px; left: 6px; top: 9px; background: var(--ink); box-shadow: 8px 0 0 var(--ink); }

.ico-progress { background: var(--mint); }
.ico-progress::before { width: 12px; height: 4px; left: 4px; top: 8px; box-shadow: 0 6px 0 var(--ink); }
.ico-progress::after { width: 4px; height: 4px; left: 6px; top: 8px; background: var(--ink); box-shadow: 6px 6px 0 var(--ink); }

.ico-words { background: var(--sky); }
.ico-words::before { content: "A"; font: 700 11px/1 var(--font); color: var(--ink); left: 4px; top: 3px; background: none; }
.ico-words::after { width: 12px; height: 3px; left: 4px; top: 15px; background: var(--ink); }

.ico-questions { background: var(--peach); }
.ico-questions::before { width: 10px; height: 8px; left: 4px; top: 5px; border: 2px solid var(--ink); background: var(--panel); }
.ico-questions::after { width: 4px; height: 4px; left: 9px; top: 14px; background: var(--ink); box-shadow: -2px 2px 0 -1px var(--ink); }

.ico-notes { background: var(--lav); }
.ico-notes::before { width: 9px; height: 12px; left: 5px; top: 4px; background: var(--panel); border: 2px solid var(--ink); }
.ico-notes::after { width: 5px; height: 3px; left: 8px; top: 8px; background: var(--ink); box-shadow: 0 5px 0 var(--ink); }

.ico-knowledge { background: var(--green); }
.ico-knowledge::before { width: 12px; height: 12px; left: 4px; top: 4px; background: var(--panel); border: 2px solid var(--ink); transform: rotate(45deg); }
.ico-knowledge::after { width: 6px; height: 6px; left: 7px; top: 7px; background: var(--lemon); border: 2px solid var(--ink); transform: rotate(45deg); }
.ico-lecture { background: var(--lav); }
.ico-lecture::before { width: 12px; height: 10px; left: 3px; top: 5px; background: var(--panel); border: 2px solid var(--ink); border-right: 0; }
.ico-lecture::after { width: 5px; height: 10px; left: 10px; top: 5px; background: var(--sky); border: 2px solid var(--ink); }

.ico-backup { background: var(--rose); }
.ico-backup::before { width: 8px; height: 10px; left: 7px; top: 5px; background: var(--panel); border: 2px solid var(--ink); }
.ico-backup::after { width: 6px; height: 2px; left: 8px; top: 10px; background: var(--ink); box-shadow: 0 4px 0 var(--ink); }

.sidebar-foot {
  margin-top: auto;
  padding-top: 14px;
  color: var(--ink-soft);
  font-size: 11px;
  text-align: center;
}

.foot-version {
  display: block;
  margin-top: 4px;
  font-size: 10px;
  color: var(--ink-soft);
}

.main {
  flex: 1;
  min-width: 0;
  padding: 20px;
  overflow-x: hidden;
}

.view { max-width: 1280px; margin: 0 auto; }

.panel {
  background: var(--panel);
  border: var(--pixel-border);
  box-shadow: 4px 4px 0 rgba(74, 64, 89, 0.10);
  padding: 16px;
  margin-bottom: 16px;
}

.panel.pastel-mint { background: #F3FBF7; }
.panel.pastel-sky { background: #F2F8FD; }
.panel.pastel-lemon { background: #FFF9E8; }
.panel.pastel-peach { background: #FFF4F1; }
.panel.pastel-lav { background: #F8F4FD; }

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.panel-title {
  margin: 0;
  font-size: 17px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-title .title-mark {
  display: inline-block;
  width: 12px;
  height: 12px;
  background: var(--rose);
  border: 2px solid var(--ink);
  box-shadow: 3px 3px 0 rgba(74, 64, 89, 0.18);
}

.panel-sub { color: var(--ink-soft); font-size: 12px; }

.grid {
  display: grid;
  gap: 14px;
}

.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.pixel-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 14px;
  background: var(--sky);
  border: 3px solid var(--ink);
  box-shadow: 3px 3px 0 var(--shadow);
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
  line-height: 1;
  transition: transform 0.06s linear, box-shadow 0.06s linear;
  white-space: nowrap;
}

.pixel-btn:hover { filter: brightness(1.03); }
.pixel-btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--shadow); }
.pixel-btn.small { padding: 6px 9px; font-size: 12px; box-shadow: 2px 2px 0 var(--shadow); }
.pixel-btn.mint { background: var(--mint); }
.pixel-btn.lemon { background: var(--lemon); }
.pixel-btn.peach { background: var(--peach); }
.pixel-btn.lav { background: var(--lav); }
.pixel-btn.lavender { background: var(--lav); }
.pixel-btn.rose { background: var(--rose); }
.pixel-btn.green { background: var(--green); }
.pixel-btn.ghost { background: #F4EDE4; }
.pixel-btn.danger { background: var(--red); }
.pixel-btn:disabled { opacity: 0.55; cursor: not-allowed; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  background: var(--lav);
  border: 2px solid var(--ink);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.chip.mint { background: var(--mint); }
.chip.sky { background: var(--sky); }
.chip.lemon { background: var(--lemon); }
.chip.peach { background: var(--peach); }
.chip.rose { background: var(--rose); }
.chip.green { background: var(--green); }
.chip.ghost { background: #EEE6DB; }
.bulk-check {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  margin-right: 8px;
  white-space: nowrap;
}
.bulk-check input { width: 15px; height: 15px; accent-color: var(--mint-deep); }

.xp-bar {
  display: inline-flex;
  gap: 2px;
  width: 100%;
  min-height: 16px;
  padding: 2px;
  background: #EFE6DA;
  border: 2px solid var(--ink);
  box-shadow: inset 2px 2px 0 rgba(74, 64, 89, 0.12);
}

.xp-seg {
  flex: 1 1 0;
  min-width: 4px;
  height: 10px;
  background: #E2D6C6;
  border: 1px solid rgba(74, 64, 89, 0.35);
}

.xp-seg.on {
  background: var(--mint);
  border-color: var(--ink);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.55);
}

.xp-bar.lemon .xp-seg.on { background: var(--lemon); }
.xp-bar.sky .xp-seg.on { background: var(--sky); }
.xp-bar.peach .xp-seg.on { background: var(--peach); }
.xp-bar.lav .xp-seg.on { background: var(--lav); }
.xp-bar.rose .xp-seg.on { background: var(--rose); }
.xp-bar.green .xp-seg.on { background: var(--green); }

.xp-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 11px;
  color: var(--ink-soft);
  margin-top: 5px;
}

.countdown-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.countdown-card {
  position: relative;
  padding: 16px;
  border: var(--pixel-border);
  box-shadow: 4px 4px 0 rgba(74, 64, 89, 0.12);
  background: linear-gradient(135deg, #F4FBF8, #EFF6FF 55%, #FFF4F1);
  overflow: hidden;
}

.countdown-card::before {
  content: "";
  position: absolute;
  right: -12px;
  top: -12px;
  width: 64px;
  height: 64px;
  background:
    linear-gradient(90deg, var(--lemon) 0 25%, transparent 25% 75%, var(--lemon) 75%),
    linear-gradient(0deg, var(--rose) 0 25%, transparent 25% 75%, var(--rose) 75%);
  background-size: 12px 12px;
  border: 3px solid var(--ink);
  transform: rotate(12deg);
  opacity: 0.85;
}

.countdown-name { font-size: 15px; font-weight: 700; }
.countdown-date { color: var(--ink-soft); font-size: 12px; margin-top: 3px; }
.countdown-num {
  font-size: 42px;
  font-weight: 800;
  line-height: 1.1;
  margin-top: 8px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.countdown-num small { font-size: 14px; font-weight: 600; color: var(--ink-soft); }
.countdown-tip { margin-top: 8px; font-size: 12px; }

.stat-tile {
  border: 3px solid var(--ink);
  box-shadow: 3px 3px 0 rgba(74, 64, 89, 0.12);
  background: var(--panel);
  padding: 14px;
}

.stat-tile .tile-label { font-size: 12px; color: var(--ink-soft); }
.stat-tile .tile-num { font-size: 28px; font-weight: 800; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat-tile .tile-sub { font-size: 11px; margin-top: 4px; color: var(--ink-soft); }
.lesson-count-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(56px, 1fr));
  gap: 6px;
  margin-top: 10px;
}
.lesson-count-cell {
  border: 2px solid var(--ink);
  background: var(--sky);
  box-shadow: 2px 2px 0 var(--shadow);
  padding: 6px 4px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.lesson-count-cell.empty { background: var(--ghost); color: var(--ink-soft); }
.lesson-count-no { font-size: 11px; font-weight: 700; }
.lesson-count-num { font-size: 16px; font-weight: 800; font-variant-numeric: tabular-nums; }

.subject-progress {
  display: grid;
  gap: 12px;
}

.subject-row {
  display: grid;
  grid-template-columns: 150px minmax(180px, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 12px;
  border: 2px solid var(--line);
  background: var(--panel-soft);
}

.subject-name { font-weight: 700; line-height: 1.25; }
.subject-name small { display: block; color: var(--ink-soft); font-size: 11px; font-weight: 500; }
.subject-stats { display: flex; gap: 10px; flex-wrap: wrap; }
.subject-stats .chip { font-size: 10px; }

.quick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 10px;
}

.quick-entry {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 12px;
  border: 3px solid var(--ink);
  box-shadow: 3px 3px 0 var(--shadow);
  background: var(--panel);
  font-weight: 700;
  font-size: 13px;
  text-align: left;
}

.quick-entry .q-ico {
  width: 26px;
  height: 26px;
  border: 2px solid var(--ink);
  background: var(--sky);
  position: relative;
}
.quick-entry .q-ico::after {
  content: "";
  position: absolute;
  width: 6px;
  height: 6px;
  left: 7px;
  top: 7px;
  background: var(--panel);
  border: 2px solid var(--ink);
}

.balance-box {
  border: 3px dashed var(--ink);
  background: #F6F9E9;
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.6;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.field { display: flex; flex-direction: column; gap: 5px; }
.field > label { font-size: 12px; font-weight: 700; color: var(--ink-soft); }
.field.full { grid-column: 1 / -1; }

.pixel-input, .pixel-select, .pixel-textarea {
  width: 100%;
  border: 3px solid var(--ink);
  background: #FFFDF8;
  padding: 8px 10px;
  font-size: 13px;
  box-shadow: inset 2px 2px 0 rgba(74, 64, 89, 0.08);
  outline: none;
}

.pixel-input:focus, .pixel-select:focus, .pixel-textarea:focus {
  box-shadow: inset 2px 2px 0 rgba(74, 64, 89, 0.08), 0 0 0 3px rgba(168, 216, 203, 0.55);
}

.pixel-textarea { min-height: 110px; resize: vertical; line-height: 1.55; }
.pixel-textarea.tall { min-height: 220px; }

.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.toolbar .spacer { flex: 1; }

.task-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 2px solid var(--line);
  background: var(--panel-soft);
  margin-bottom: 8px;
}

.task-row.done { opacity: 0.72; background: #EFF8F1; }
.task-row.deferred { background: #F6F3EA; }

.task-check {
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  border: 3px solid var(--ink);
  background: #FFFDF8;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 16px;
  color: var(--green-deep);
}

.task-main { flex: 1; min-width: 0; }
.task-title { font-weight: 700; }
.task-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; font-size: 11px; color: var(--ink-soft); }
.task-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.table-wrap { overflow-x: auto; border: 3px solid var(--ink); background: var(--panel); }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  min-width: 860px;
}

.data-table th {
  background: var(--mint);
  border: 2px solid var(--ink);
  padding: 8px;
  text-align: left;
  white-space: nowrap;
  font-size: 12px;
}

.data-table td {
  border: 2px solid var(--line);
  padding: 8px;
  vertical-align: top;
  background: #FFFDF8;
}

.data-table tr.clickable td { cursor: pointer; }
.data-table tr.clickable:hover td { background: #F4FBF7; }

.status-select {
  border: 2px solid var(--ink);
  background: #FFFDF8;
  padding: 4px 6px;
  font-size: 12px;
  width: 110px;
}

.badge {
  display: inline-block;
  padding: 2px 7px;
  border: 2px solid var(--ink);
  background: var(--sky);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.badge.one { background: var(--mint); }
.badge.two { background: var(--lemon); }
.badge.final { background: var(--rose); }
.badge.fuzzy { background: var(--peach); }
.badge.mastered { background: var(--green); }

.tab-bar { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.tab-btn {
  padding: 7px 12px;
  border: 2px solid var(--ink);
  background: var(--panel);
  font-size: 12px;
  font-weight: 700;
}
.tab-btn.active { background: var(--lemon); box-shadow: 2px 2px 0 var(--shadow); }

.word-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}

.word-card {
  border: 3px solid var(--ink);
  box-shadow: 3px 3px 0 var(--shadow);
  background: var(--panel);
  padding: 12px;
}

.word-card .word { font-size: 18px; font-weight: 800; }
.word-card .phon { color: var(--ink-soft); font-size: 11px; margin-top: 2px; }
.word-card .meaning { margin-top: 6px; font-size: 12px; line-height: 1.5; min-height: 38px; }
.word-card .actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }

.word-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 2px dashed var(--line);
  padding-bottom: 8px;
}

.word-head .word { font-size: 21px; font-weight: 800; }
.word-head .phon { color: var(--ink-soft); font-size: 12px; white-space: nowrap; }
.word-pos { margin-top: 9px; font-size: 12px; font-weight: 800; color: var(--peach-deep); }
.word-meanings { margin-top: 4px; line-height: 1.65; font-size: 12px; }
.meaning-line { margin-top: 2px; }
.meaning-line.missing { color: var(--ink-soft); }
.word-label { font-size: 11px; font-weight: 800; color: var(--mint-deep); margin: 8px 0 3px; }
.colloc-item { position: relative; font-size: 12px; line-height: 1.55; padding-left: 11px; }
.colloc-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 7px;
  width: 5px;
  height: 5px;
  background: var(--lemon);
  border: 1px solid var(--ink);
}
.word-example { margin-top: 2px; }
.example-en { font-size: 12px; line-height: 1.6; }
.example-cn { font-size: 12px; color: var(--ink-soft); margin-top: 2px; }
.word-answer { text-align: left; }
.word-raw {
  margin-top: 8px;
  border: 2px dashed var(--line);
  background: #FFF9E8;
  padding: 8px;
  font-size: 12px;
  line-height: 1.6;
  word-break: break-all;
}
.word-list-group { margin-bottom: 14px; }
.lesson-head {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--mint);
  border: 3px solid var(--ink);
  box-shadow: 3px 3px 0 var(--shadow);
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 8px;
}
.word-list-item {
  border: 2px solid var(--line);
  background: var(--panel-soft);
  margin-bottom: 6px;
}
.word-list-item summary {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 9px 10px;
  cursor: pointer;
  list-style: none;
}
.word-list-item summary::-webkit-details-marker { display: none; }
.word-list-item summary:hover { background: rgba(168, 216, 203, 0.22); }
.word-list-word { font-weight: 800; min-width: 120px; }
.word-list-phon { color: var(--ink-soft); font-size: 11px; min-width: 90px; }
.word-list-meaning { flex: 1; font-size: 12px; line-height: 1.5; min-width: 170px; }
.word-list-status { margin-left: auto; }
.word-list-detail {
  border-top: 2px dashed var(--line);
  padding: 10px 12px;
}
.compare-box {
  margin-top: 10px;
  border: 2px solid var(--ink);
  background: #FFFDF8;
  padding: 10px 12px;
  text-align: left;
}
.compare-row {
  font-size: 12px;
  line-height: 1.7;
  margin-top: 4px;
}
.compare-row b { font-weight: 800; }
.test-compare-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}
.test-panel {
  border: 3px solid var(--ink);
  background: var(--panel);
  box-shadow: 3px 3px 0 var(--shadow);
  padding: 12px;
  text-align: left;
}
.my-answer {
  font-size: 14px;
  font-weight: 700;
  margin-top: 6px;
  line-height: 1.6;
  word-break: break-word;
}
@media (max-width: 720px) {
  .test-compare-grid { grid-template-columns: 1fr; }
}

.quiz-card {
  border: 3px solid var(--ink);
  background: var(--panel);
  box-shadow: 3px 3px 0 var(--shadow);
  padding: 16px;
  margin-bottom: 12px;
}

.quiz-stem { font-weight: 700; line-height: 1.6; margin-bottom: 10px; }
.quiz-option {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 8px 10px;
  border: 2px solid var(--line);
  background: #FFFDF8;
  margin-bottom: 6px;
  cursor: pointer;
}
.quiz-option.selected { border-color: var(--ink); background: #EFF8F1; box-shadow: 0 0 0 2px rgba(111, 174, 158, 0.35); }
.quiz-option.correct { background: #E7F4E7; border-color: var(--green-deep); }
.quiz-option.wrong { background: #FBE7E7; border-color: var(--red); }

.answer-panel {
  border: 2px dashed var(--ink);
  padding: 10px 12px;
  background: #FFF9E8;
  font-size: 12px;
  line-height: 1.6;
}

.note-card {
  border: 3px solid var(--ink);
  background: var(--panel);
  box-shadow: 3px 3px 0 var(--shadow);
  padding: 14px;
  margin-bottom: 12px;
}

.note-card .note-title { font-size: 15px; font-weight: 800; margin-bottom: 6px; }
.note-card .note-summary { color: var(--ink-soft); font-size: 12px; line-height: 1.6; }
.note-card .note-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }

.review-doc {
  border: 3px solid var(--ink);
  background: #FFFDF8;
  box-shadow: 3px 3px 0 var(--shadow);
  padding: 16px;
  line-height: 1.75;
}

.review-doc h3 { margin: 14px 0 6px; font-size: 14px; }
.review-doc h3:first-child { margin-top: 0; }
.review-doc ul { margin: 0; padding-left: 20px; }
.review-doc li { margin: 3px 0; }
.note-raw-view {
  border: 3px solid var(--ink);
  background: #FFFDF8;
  box-shadow: 3px 3px 0 var(--shadow);
  padding: 14px 16px;
  line-height: 1.8;
  font-size: 13px;
  max-height: 58vh;
  overflow-y: auto;
}
.note-line { margin: 2px 0; }
.note-gap { height: 8px; }
.note-heading {
  font-size: 15px;
  font-weight: 800;
  margin: 10px 0 4px;
  border-left: 6px solid var(--rose);
  padding-left: 8px;
}
.note-bullet { position: relative; padding-left: 14px; margin: 2px 0; }
.note-bullet::before {
  content: "•";
  position: absolute;
  left: 2px;
  color: var(--peach-deep);
  font-weight: 800;
}
.note-num { padding-left: 18px; margin: 2px 0; }
.note-marker {
  display: inline-block;
  background: var(--lemon);
  border: 2px solid var(--ink);
  padding: 1px 6px;
  margin-right: 4px;
  font-weight: 800;
  font-size: 12px;
}
.note-highlight { background: var(--lemon); color: var(--ink); padding: 1px 2px; }
.note-image-loading {
  display: inline-block;
  background: var(--lemon);
  color: var(--ink);
  border: 2px dashed #9a8f6f;
  padding: 2px 8px;
  font-size: 12px;
  margin: 4px 0;
}
.note-img {
  display: block;
  max-width: 100%;
  margin: 8px 0;
  border: 3px solid var(--ink);
  box-shadow: 3px 3px 0 var(--shadow);
  background: #fff;
}
.pdf-original-box { margin-bottom: 10px; }
.pdf-inline-viewer {
  width: 100%;
  height: 68vh;
  border: 3px solid var(--ink);
  background: #fff;
  box-shadow: 3px 3px 0 var(--shadow);
}
.note-summary-view { margin-top: 6px; }
.summary-block {
  border: 3px solid var(--ink);
  background: #FFFDF8;
  box-shadow: 3px 3px 0 var(--shadow);
  margin-bottom: 10px;
  overflow: hidden;
}
.summary-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  background: var(--lemon);
  border-bottom: 3px solid var(--ink);
}
.summary-title { font-size: 13px; font-weight: 800; line-height: 1.4; }
.summary-body { padding: 10px 12px; }
.summary-item {
  position: relative;
  padding-left: 14px;
  font-size: 12px;
  line-height: 1.7;
  margin: 3px 0;
}
.summary-item::before {
  content: "▪";
  position: absolute;
  left: 0;
  top: 1px;
  color: var(--mint-deep);
  font-size: 10px;
}

.empty-state {
  border: 3px dashed var(--ink);
  background: #FFF9EF;
  padding: 26px;
  text-align: center;
  color: var(--ink-soft);
}

.backup-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 14px;
}

.backup-card {
  border: 3px solid var(--ink);
  background: var(--panel);
  box-shadow: 3px 3px 0 var(--shadow);
  padding: 16px;
}

.backup-card h3 { margin: 0 0 8px; font-size: 14px; }
.backup-card p { margin: 0 0 12px; color: var(--ink-soft); font-size: 12px; line-height: 1.6; }
.backup-card .actions { display: flex; gap: 8px; flex-wrap: wrap; }

.snapshot-code {
  width: 100%;
  min-height: 130px;
  border: 3px solid var(--ink);
  background: #F3EFE8;
  font-family: "Courier New", monospace;
  font-size: 11px;
  line-height: 1.5;
  padding: 10px;
  resize: vertical;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(74, 64, 89, 0.45);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 5vh 16px 24px;
  z-index: 100;
  overflow-y: auto;
}

.modal-window {
  width: min(720px, 100%);
  background: var(--panel);
  border: 4px solid var(--ink);
  box-shadow: 6px 6px 0 rgba(74, 64, 89, 0.28);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  background: var(--lemon);
  border-bottom: 3px solid var(--ink);
}

.modal-title { font-size: 15px; font-weight: 800; }
.modal-close {
  width: 30px;
  height: 30px;
  border: 3px solid var(--ink);
  background: var(--peach);
  font-weight: 800;
  line-height: 1;
}

.modal-body { padding: 14px; max-height: 68vh; overflow-y: auto; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 14px; border-top: 3px solid var(--ink); background: #F7F0E7; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: var(--panel);
  border: 3px solid var(--ink);
  box-shadow: 4px 4px 0 var(--shadow);
  padding: 10px 16px;
  z-index: 200;
  font-weight: 700;
  font-size: 13px;
  animation: toastIn 0.22s steps(3) both;
  max-width: min(90vw, 480px);
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(12px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.spark {
  position: absolute;
  width: 8px;
  height: 8px;
  background: var(--lemon);
  border: 2px solid var(--ink);
  pointer-events: none;
  animation: sparkPop 0.7s steps(4) both;
}

.spark::before {
  content: "";
  position: absolute;
  left: -5px;
  top: -5px;
  width: 14px;
  height: 14px;
  border: 2px solid var(--ink);
  background: var(--rose);
  clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
  animation: sparkTwinkle 0.5s steps(3) both;
}

@keyframes sparkPop {
  0% { opacity: 1; transform: translate(0, 0) scale(1); }
  100% { opacity: 0; transform: translate(var(--dx, 0px), var(--dy, -34px)) scale(0.4); }
}

@keyframes sparkTwinkle {
  0% { transform: rotate(0deg) scale(1); }
  100% { transform: rotate(45deg) scale(0.7); }
}

.section-note {
  font-size: 12px;
  color: var(--ink-soft);
  line-height: 1.6;
}

.divider { border: none; border-top: 3px dashed var(--line); margin: 14px 0; }

.progress-mini {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mini-row {
  display: grid;
  grid-template-columns: 92px 1fr 44px;
  gap: 8px;
  align-items: center;
  font-size: 11px;
}

.mini-row b { text-align: right; font-variant-numeric: tabular-nums; }

.number-big { font-size: 34px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1; }

@media (max-width: 980px) {
  .sidebar { width: 78px; flex: 0 0 78px; padding: 12px 8px 8px; }
  .nav-label, .sidebar-foot { display: none; }
  .nav-item { justify-content: center; padding: 10px 6px; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  .app { min-height: 100vh; }
  .topbar { flex-wrap: wrap; padding: 8px 12px; position: static; }
  .brand-text small { display: none; }
  .layout { flex-direction: column; }
  .sidebar {
    width: 100%;
    flex: none;
    border-right: none;
    border-bottom: var(--pixel-border);
    padding: 8px;
    position: sticky;
    top: 0;
    z-index: 30;
  }
  .side-nav { flex-direction: row; overflow-x: auto; gap: 6px; padding-bottom: 2px; }
  .nav-item { width: auto; min-width: 52px; padding: 8px; }
  .main { padding: 14px 10px 90px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .subject-row { grid-template-columns: 1fr; }
  .task-row { flex-wrap: wrap; }
  .task-actions { width: 100%; }
  .countdown-num { font-size: 34px; }
  .date-chip { display: none; }
  .top-stats { margin-left: 0; }
}

@media (max-width: 460px) {
  .brand-text strong { font-size: 14px; }
  .stat-chip.xp { display: none; }
  .top-actions .pixel-btn { padding: 6px 8px; }
  .pixel-btn, .pixel-input, .pixel-select { font-size: 12px; }
  .panel { padding: 12px; }
  .quick-entry { min-height: 74px; }
}
