:root {
  color-scheme: light;
  --bg: #edf1f6;
  --panel: #fff;
  --soft: #f6f8fb;
  --text: #172033;
  --muted: #667085;
  --line: #d7dee9;
  --accent: #2856b6;
  --accent_soft: #e8efff;
  --danger: #ad2f2f;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); }
button, input, select { font: inherit; }

.learning_app {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  height: 100vh;
  overflow: hidden;
}

.learning_menu, .learning_content { min-width: 0; height: 100vh; overflow-y: auto; }
.learning_menu { border-right: 1px solid var(--line); padding: 14px 16px 18px; }
.learning_content { background: var(--panel); padding: 24px clamp(22px, 3vw, 42px) 48px; }

.menu_header {
  position: sticky;
  top: -14px;
  z-index: 4;
  margin: -14px -16px 8px;
  padding: 12px 16px 10px;
  border-bottom: 1px solid var(--line);
  background: rgba(237, 241, 246, .97);
  backdrop-filter: blur(8px);
}

.menu_header h1 { margin: 0 0 8px; font-size: 20px; line-height: 1.2; }
.menu_search, select, input[type="datetime-local"] {
  width: 100%; min-width: 0; height: 34px; border: 1px solid #c9d2df; border-radius: 7px;
  background: #fff; color: var(--text); padding: 5px 8px; outline: none;
}
.menu_search:focus, select:focus, input:focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent_soft); }
.control_row, .filter_row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 6px; margin-top: 6px; }
.filter_row { grid-template-columns: minmax(110px, .7fr) minmax(0, 1.3fr); }
.preset_buttons { display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px; }
.preset_buttons button {
  min-width: 0; border: 1px solid #c9d2df; border-radius: 6px; background: #fff; color: #475467;
  padding: 0 3px; font-size: 12px; cursor: pointer;
}
.preset_buttons button.is_active { border-color: var(--accent); background: var(--accent_soft); color: var(--accent); font-weight: 700; }
.datetime_row { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 6px; }
.datetime_row label { display: grid; grid-template-columns: 16px minmax(0, 1fr); align-items: center; gap: 3px; color: var(--muted); font-size: 11px; }
.datetime_row input { height: 32px; padding: 3px 5px; font-size: 11px; }

.menu_group { margin: 12px 3px 4px; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .04em; }
.menu_super_group { margin: 16px 0 5px; border-bottom: 1px solid #bdc9dc; color: #173d91; padding: 0 3px 5px; font-size: 13px; font-weight: 850; }
.menu_subgroup { margin: 8px 3px 3px 12px; color: #3d5177; font-size: 11px; font-weight: 800; }
.menu_leaf_group { margin: 6px 3px 2px 24px; color: var(--muted); font-size: 10px; font-weight: 750; }
.menu_item {
  display: grid; grid-template-columns: 64px minmax(0, 1fr) minmax(0, auto) 22px; align-items: center; gap: 8px;
  width: 100%; margin: 2px 0; border: 1px solid transparent; border-radius: 7px;
  background: transparent; color: var(--text); padding: 6px 7px; text-align: left; cursor: pointer;
}
.menu_item:hover { border-color: #c3cedf; background: rgba(255,255,255,.65); }
.menu_item.is_active { border-color: #a7bbe4; background: var(--accent_soft); color: #173d91; }
.menu_item.nested_item { width: calc(100% - 12px); margin-left: 12px; }
.menu_item.deep_nested_item { width: calc(100% - 24px); margin-left: 24px; }
.menu_id { grid-column: 1; grid-row: 1; color: var(--accent); font: 700 11px ui-monospace, SFMono-Regular, Menlo, monospace; }
.menu_name { grid-column: 2; grid-row: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 650; }
.menu_meaning { grid-column: 3; grid-row: 1; width: 100%; min-width: 0; overflow: hidden; color: var(--muted); font-size: 11px; line-height: 1.35; text-align: right; text-overflow: ellipsis; white-space: nowrap; }
.menu_badge { grid-column: 4; grid-row: 1; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: #fff; color: var(--danger); font-size: 10px; font-weight: 800; }
body[data-page-type="vocabulary"] .menu_item { grid-template-columns: 64px minmax(0, 1fr) minmax(0, 1fr) 22px; }
body[data-page-type="daily"] .menu_item { grid-template-columns: 96px minmax(0, 1fr) minmax(0, auto) 22px; }
.menu_links { display: flex; gap: 6px; margin-top: 16px; padding-top: 10px; border-top: 1px solid var(--line); }
.menu_links a { color: var(--accent); font-size: 12px; font-weight: 700; text-decoration: none; }
.empty_result { display: none; margin: 16px 5px; color: var(--muted); font-size: 12px; }
.empty_result.is_visible { display: block; }

.content_panel { display: none; }
.content_panel.is_active { display: block; }
.detail_heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 8px; }
.detail_heading h2 { margin: 1px 0 0; color: #143777; font-size: clamp(24px, 2.5vw, 34px); line-height: 1.2; }
.detail_id { color: var(--accent); font: 800 12px ui-monospace, SFMono-Regular, Menlo, monospace; }
.count_chip { border-radius: 999px; background: var(--accent_soft); color: var(--accent); padding: 4px 9px; font-size: 12px; font-weight: 800; }
.mistake_total { flex: 0 0 auto; min-width: 82px; border: 1px solid #f0c7c7; border-radius: 10px; background: #fff7f7; padding: 7px 10px; text-align: center; }
.mistake_total strong { display: block; color: var(--danger); font-size: 24px; line-height: 1; }
.mistake_total span { color: #8e3434; font-size: 11px; }
.meta_line { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 14px; }
.meta_line span { border-radius: 999px; background: var(--soft); color: var(--muted); padding: 3px 7px; font-size: 11px; }

.principle, .detail_section { margin: 16px 0; }
.principle { border-left: 4px solid var(--accent); border-radius: 0 8px 8px 0; background: var(--accent_soft); padding: 10px 13px; }
h3 { margin: 0 0 7px; color: #29416f; font-size: 16px; }
p, li { line-height: 1.65; }
.principle p, .detail_section p { margin: 0; }
ul, ol { margin: 6px 0; padding-left: 22px; }
blockquote { margin: 8px 0; border-left: 3px solid var(--accent); background: var(--accent_soft); padding: 8px 11px; }
code { border-radius: 4px; background: #edf1f6; color: #133e89; padding: .08em .3em; font: .92em ui-monospace, SFMono-Regular, Menlo, monospace; }
a { color: var(--accent); }
.mistake_section h3 span { color: var(--danger); }
.zero_state { color: var(--muted); font-size: 13px; }
.mistake_list article { border: 1px solid var(--line); border-radius: 8px; padding: 10px; }
.mistake_list article span { margin-left: 8px; color: var(--muted); font-size: 12px; }
.review_part { margin-top: 24px; padding-top: 24px; border-top: 2px solid var(--line); }
.review_part:first-of-type { margin-top: 14px; padding-top: 14px; border-top: 0; }
.review_part_heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: #29416f; font-size: 17px; font-weight: 800; }
.question_options { margin-top: 8px; }
.question_options li { padding-left: 4px; }

.table_wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { border: 1px solid var(--line); padding: 7px 8px; text-align: left; vertical-align: top; line-height: 1.5; }
th { background: var(--soft); color: #344054; font-weight: 750; }
.overview_table tbody tr { cursor: pointer; }
.overview_table tbody tr:hover { background: var(--accent_soft); }
.ipa { display: flex; flex-wrap: wrap; gap: 5px 16px; margin-bottom: 7px; color: #344054; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.focus_tag { display: inline-block; margin-right: 5px; border-radius: 4px; background: #fff0cf; color: #8a5500; padding: 1px 4px; font-size: 10px; }
.wiki_section, .vocabulary_pos { margin: 20px 0; }
.wiki_section { padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.wiki_section p { margin: 0; }
.vocabulary_pos > h3 { padding-bottom: 6px; border-bottom: 2px solid #d8e2f5; }
.vocabulary_sense { padding: 10px 0 12px; border-bottom: 1px solid #edf0f5; }
.sense_meaning { font-size: 15px; font-weight: 700; }
.sense_example { margin: 7px 0 1px; color: #243b67; font-size: 15px; }
.sense_translation { margin: 0; color: var(--muted); font-size: 13px; }

@media (max-width: 820px) {
  .learning_app { grid-template-columns: 1fr; height: auto; overflow: visible; }
  .learning_menu, .learning_content { height: auto; overflow: visible; }
  .learning_menu { border-right: 0; border-bottom: 1px solid var(--line); }
  .menu_header { position: static; }
  .learning_content { min-height: 55vh; }
}

@media print {
  .learning_app { display: block; height: auto; }
  .learning_menu { display: none; }
  .learning_content { height: auto; overflow: visible; padding: 0; }
  .content_panel { display: block; break-after: page; }
}
