/* Word Roots Lab — restrained, printable, responsive monochrome learning UI */
:root {
  --page: #f7f7f6;
  --surface: #fff;
  --text: #1e1e1d;
  --muted: #656565;
  --faint: #8a8a87;
  --line: #e6e6e2;
  --line-dark: #d4d4d0;
  --chip: #f2f2f0;
  --ink: #252524;
  --radius: 13px;
  --display: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  background: var(--page); color: var(--text); margin: 0;
  font-family: var(--display); font-size: 14px; line-height: 1.62;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-underline-offset: 3px; }
button,input,select { font: inherit; }
button { cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible {
  outline: 2px solid #555; outline-offset: 3px;
}
button:disabled { opacity: .4; cursor: not-allowed; }
.site-header {
  height: 64px; display: flex; align-items: center; justify-content: space-between;
  gap: 15px; padding: 0 max(28px, calc((100vw - 1410px) / 2));
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; white-space: nowrap; font-size: 14px; font-weight: 650; }
.brand-mark { display: grid; place-items: center; background: var(--text); color: white; width: 28px; height: 28px; border-radius: 7px; font-weight: 800; }
.brand-slash { color: #c7c7c4; margin: 0 3px; font-weight: 400; }
.brand strong { font-weight: 690; }
.site-nav { display: flex; align-items: center; gap: 21px; }
.site-nav a { font-size: 12px; text-decoration: none; color: var(--muted); white-space: nowrap; }
.site-nav a:hover,.site-nav a:focus-visible { color: var(--text); }
.main { max-width: 1410px; padding: 0 28px 48px; margin: 0 auto; }
.intro { padding: 32px 0 17px; }
.intro-head { display: flex; align-items: start; justify-content: space-between; gap: 28px; }
.eyebrow { font-size: 10px; font-weight: 750; letter-spacing: 1.65px; color: #7b7b79; }
h1 { font-size: clamp(25px,3.1vw,35px); font-weight: 740; letter-spacing: -.7px; margin: 8px 0 7px; line-height: 1.32; }
.intro-desc { margin: 0; max-width: 740px; color: var(--muted); font-size: 13px; }
.meta-counts { display: flex; gap: 16px; color: var(--muted); white-space: nowrap; padding-top: 12px; }
.meta-pair { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.26; }
.meta-pair strong { font-size: 18px; color: var(--text); font-weight: 730; font-variant-numeric: tabular-nums; }
.meta-pair small { font-size: 11px; margin-top: 4px; }
.toolbar { margin-top: 23px; display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.exam-switch { display: flex; padding: 3px; border: 1px solid var(--line); background: #ececea; border-radius: 10px; gap: 3px; }
.exam-switch button { border: 0; border-radius: 7px; background: transparent; color: #656565; padding: 7px 14px; font-size: 12px; font-weight: 650; }
.exam-switch button.is-on { background: #fff; color: var(--text); box-shadow: 0 1px 2px #1111; }
.small-note { font-size: 11px; color: var(--faint); text-align: right; }
.work-grid { display: grid; grid-template-columns: 292px minmax(0,1fr); gap: 16px; min-height: 640px; align-items: start; }
.side-panel,.learning-pane { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.side-panel { padding: 20px 16px 15px; position: sticky; top: 18px; max-height: calc(100vh - 36px); display: flex; flex-direction: column; }
.side-head h2 { font-size: 16px; margin: 0; font-weight: 740; }
.side-subtitle { color: var(--muted); font-size: 11px; margin: 4px 0 16px; }
.search-wrap { position: relative; width: 100%; }
.search-wrap input {
  width: 100%; border: 1px solid var(--line-dark); border-radius: 9px; padding: 11px 12px 11px 32px;
  outline: 0; background: #fff; color: var(--text); min-width: 0; font-size: 12px;
}
.search-wrap input:focus { border-color: #878783; }
.search-wrap input::placeholder { color: #999; }
.search-icon { position: absolute; left: 11px; top: 7px; font-size: 22px; color: #888; }
.search-wrap kbd { position: absolute; right: 11px; top: 11px; color: #c4c4c4; font-size: 10px; font-weight: normal; }
.catalog-tabs { margin: 17px 0 5px; display: flex; border-bottom: 1px solid var(--line); gap: 7px; }
.catalog-tabs button { flex: 1; border: 0; border-bottom: 2px solid transparent; color: #757575; background: transparent; font-size: 12px; padding: 5px 1px 10px; white-space: nowrap; font-weight: 600; }
.catalog-tabs button.is-on { border-bottom-color: var(--text); color: var(--text); }
.catalog-status { font-size: 11px; color: var(--muted); margin: 9px 2px 10px; }
.catalog-list { overflow-y: auto; min-height: 160px; scrollbar-width: thin; }
.catalog-item {
  display: block; text-align: left; width: 100%; border: 1px solid transparent; border-radius: 8px;
  background: none; padding: 9px 10px; margin-bottom: 5px; transition: background .14s,border-color .14s;
}
.catalog-item:hover { background: #f8f8f7; }
.catalog-item.is-on { background: #f3f3f0; border-color: #e6e6e3; }
.catalog-item-top { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; }
.catalog-item strong { font-size: 15px; line-height: 1.25; font-weight: 690; }
.catalog-item .count { font-size: 10px; color: var(--faint); white-space: nowrap; }
.catalog-item .meaning { display: block; font-size: 11px; color: #777; margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aside-note { margin: 15px 2px 0; border-top: 1px solid var(--line); padding-top: 13px; font-size: 10px; line-height: 1.55; color: #93938f; }
.learning-pane { min-width: 0; padding: 27px 30px 25px; }
.loading-panel { display: grid; place-items: center; min-height: 330px; text-align: center; color: var(--faint); }
.loading-spinner { width: 22px; height: 22px; border: 2px solid #dededc; border-top-color: #333; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.topline { display: flex; gap: 7px; align-items: center; flex-wrap: wrap; margin-bottom: 11px; }
.mono-label { font-size: 10px; font-weight: 760; letter-spacing: 1.2px; text-transform: uppercase; color: var(--faint); }
.pill { display: inline-block; border-radius: 5px; padding: 2px 7px; color: #656565; background: #f1f1f0; font-size: 10px; font-weight: 600; }
.pill.dark { color: #fff; background: #3c3c3a; }
.pill.outline { border: 1px solid var(--line); background: #fff; }
.hero { display: flex; gap: 20px; justify-content: space-between; align-items: start; border-bottom: 1px solid var(--line); padding-bottom: 22px; }
.hero-term { font-size: clamp(29px,4vw,45px); letter-spacing: -1.1px; line-height: 1.16; font-weight: 760; margin: 5px 0 10px; word-break: break-word; }
.hero-meaning { font-size: 19px; font-weight: 600; line-height: 1.45; }
.hero-english { color: #777; font-size: 12px; margin-top: 2px; }
.hero-intro { color: #666; font-size: 12.5px; max-width: 650px; margin-top: 15px; }
.hero-meta { font-size: 11px; color: var(--muted); padding-top: 13px; line-height: 1.8; text-align: right; min-width: 80px; }
.root-reason { padding-top: 20px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 13px; }
.section-heading h3 { font-size: 14px; font-weight: 730; margin: 0; }
.section-heading .sub { font-size: 11px; color: var(--muted); }
.logic-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
.logic-card { border: 1px solid var(--line); border-radius: 10px; padding: 13px 14px; min-height: 96px; }
.logic-formula { font-size: 13px; font-weight: 700; }
.logic-meta { color: var(--muted); font-size: 11px; margin-top: 5px; }
.logic-word { margin-top: 8px; font-size: 11px; color: #555; }
.field-warning { padding: 11px 13px; background: #f8f8f7; border-left: 2px solid #999; margin: 13px 0; color: var(--muted); font-size: 11px; line-height: 1.62; border-radius: 0 7px 7px 0; }
.study-core { border-top: 1px solid var(--line); margin-top: 24px; padding-top: 24px; }
.word-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.word-chip { border: 1px solid var(--line); background: #fff; border-radius: 7px; color: #454545; font-size: 12px; padding: 6px 9px; }
.word-chip:hover,.word-chip.is-on { color: #fff; background: var(--ink); border-color: var(--ink); }
.word-chip-saved::after { content: ' ✓'; color: inherit; opacity: .65; }
.show-more { margin-top: 10px; background: transparent; border: 0; color: var(--muted); padding: 6px 0; text-decoration: underline; font-size: 11px; }
.detail { border-top: 1px solid var(--line); margin-top: 27px; padding-top: 23px; scroll-margin-top: 18px; }
.detail-head { display: flex; justify-content: space-between; align-items: start; gap: 12px; }
.big-word { font-size: clamp(29px,3.8vw,43px); font-weight: 720; letter-spacing: -.75px; line-height: 1.15; word-break: break-word; margin: 4px 0 7px; }
.phonetic { font-size: 12px; color: #757575; margin: 0 0 13px; }
.phonetic a { color: #666; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 7px; justify-content: end; }
.action-btn {
  color: #454545; background: #fff; border: 1px solid #d9d9d6; border-radius: 8px;
  min-height: 34px; padding: 6px 10px; font-size: 11px; font-weight: 600;
}
.action-btn:hover { background: #f4f4f2; }
.action-btn.primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.action-btn.primary:hover { background: #474747; }
.action-btn.saved { background: #f1f1ee; color: #555; }
.definition { font-size: 14px; font-weight: 650; line-height: 1.7; margin-bottom: 14px; }
.section-mini { font-size: 11px; color: var(--faint); font-weight: 760; letter-spacing: .35px; margin: 20px 0 9px; }
.morph-row { display: flex; align-items: stretch; flex-wrap: wrap; gap: 7px; }
.morph-piece { display: flex; flex-direction: column; min-width: 100px; flex: 0 1 auto; gap: 3px; background: #f7f7f5; border: 1px solid #e8e8e5; border-radius: 8px; padding: 11px 12px; max-width: 310px; }
.morph-piece strong { font-size: 17px; font-weight: 740; }
.morph-piece .role { font-size: 10px; color: var(--muted); }
.morph-piece .explain { font-size: 11px; color: #454545; }
.morph-plus { display: flex; align-items: center; color: #999; font-weight: 700; font-size: 16px; }
.etymology { color: #565656; font-size: 11.5px; line-height: 1.85; }
.example { border-left: 2px solid #dadad7; padding: 2px 0 5px 14px; margin: 14px 0 0; }
.example .en { font-size: 13px; line-height: 1.6; font-weight: 500; }
.example .cn { color: #666; font-size: 11.5px; margin-top: 6px; }
.example .cn[hidden] { display: none; }
.word-foot { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 19px; font-size: 10px; color: #90908d; }
.source-flag { color: #72726f; }
.root-links { margin: 8px 0; display: flex; flex-wrap: wrap; gap: 6px; }
.root-link { border: 0; background: #f2f2f0; padding: 5px 7px; border-radius: 6px; font-size: 10.5px; color: #555; }
.root-link:hover { background: #e2e2df; }
.quiz { border-top: 1px solid var(--line); margin-top: 24px; padding-top: 22px; }
.quiz-question { margin: 0 0 14px; font-size: 13px; }
.quiz-word { font-size: 21px; font-weight: 760; letter-spacing: -.3px; }
.quiz-options { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; }
.quiz-option { padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; text-align: left; background: #fff; font-size: 11px; color: #4a4a4a; min-height: 46px; }
.quiz-option:hover { background: #f7f7f6; }
.quiz-option.correct { border-color: #444; color: #222; background: #f3f3f1; font-weight: 700; }
.quiz-option.wrong { border-color: #bcbcb8; text-decoration: line-through; opacity: .65; }
.quiz-status { display: flex; align-items: center; gap: 10px; margin-top: 10px; font-size: 11px; color: #555; }
.method-strip { display: grid; grid-template-columns: repeat(3,1fr); border: 1px solid var(--line); background: #fff; border-radius: var(--radius); margin-top: 18px; padding: 17px 23px; gap: 15px; }
.method-strip > div { display: flex; align-items: center; gap: 12px; }
.step-no { font-family: Consolas,ui-monospace,monospace; font-size: 12px; color: #999; }
.method-strip span:last-child { display: flex; flex-direction: column; line-height: 1.4; }
.method-strip strong { font-size: 12px; }
.method-strip small { color: var(--muted); font-size: 11px; margin-top: 3px; }
.footer { color: #9a9a95; margin-top: 18px; font-size: 10px; line-height: 1.65; }
.footer p { margin: 3px 0; }
.footer a { color: #7a7a77; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translate(-50%,20px); padding: 10px 16px;
  background: #222; color: #fff; font-size: 12px; border-radius: 8px; box-shadow: 0 8px 25px #1112;
  opacity: 0; pointer-events: none; transition: opacity .2s,transform .2s; z-index: 30; max-width: 90vw; text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%,0); }
.empty { padding: 25px 10px; text-align: center; color: #898985; font-size: 12px; }
.empty strong { display: block; color: #555; margin-bottom: 6px; }
.skeleton-line { width: 90%; height: 27px; border-radius: 5px; background: #f4f4f3; margin: 11px 0; }
.skeleton-line.short { width: 60%; }
.muted { color: var(--muted); }
.search-context { background: #f5f5f3; border: 1px solid #e9e9e6; border-radius: 9px; padding: 11px 13px; color: #666; font-size: 11px; line-height: 1.7; }
.word-search-list { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 7px; }
.word-search-item { text-align:left;border:1px solid var(--line);background:#fff;border-radius:8px;padding:10px;min-width:0; }
.word-search-item:hover { background:#f7f7f6; }
.word-search-item strong { display:block;font-size:13px;overflow:hidden;text-overflow:ellipsis; }
.word-search-item small { color:#888;font-size:10px;display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap; }
.word-search-item.is-on { background:#f2f2f0;border-color:#cfcfcc; }
@media (max-width: 1150px) {
  .site-header { padding: 0 20px; }
  .site-nav { gap: 12px; }
  .main { padding: 0 20px 40px; }
  .work-grid { grid-template-columns: 270px minmax(0,1fr); }
  .learning-pane { padding: 22px 23px; }
}
@media (max-width: 840px) {
  .site-header { display:block; height:auto; padding: 12px 15px 8px; }
  .site-nav { overflow-x: auto; padding: 9px 0 3px; gap: 18px; -webkit-overflow-scrolling: touch; }
  .main { padding: 0 13px 35px; }
  .intro { padding-top: 24px; }
  .intro-head { flex-direction: column; gap: 10px; }
  .meta-counts { gap: 19px; padding-top: 2px; }
  .meta-pair { align-items:flex-start; }
  .toolbar { align-items: start; gap: 12px; flex-direction: column; }
  .small-note { text-align: left; }
  .work-grid { grid-template-columns: minmax(0,1fr); gap: 12px; width:100%; }
  .side-panel { position: static; max-height: none; padding: 15px; min-width:0; width:100%; }
  .side-head h2 { font-size: 15px; }
  .catalog-list { display: flex; overflow-x: auto; overflow-y: hidden; gap: 7px; min-height: auto; max-height: none; min-width:0; max-width:100%; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
  .catalog-item { flex:0 0 150px; margin:0; border:1px solid var(--line); }
  .catalog-item .meaning { white-space: nowrap; }
  .aside-note { display:none; }
  .learning-pane { padding: 20px 16px; }
  .meta-counts { justify-content: start; }
  .hero-term { font-size: 34px; }
  .hero-meta { min-width: 60px; }
  .method-strip { padding: 14px; gap: 10px; }
}
@media (max-width: 560px) {
  .intro { padding-top: 19px; }
  h1 { font-size: 25px; }
  .intro-desc { font-size: 12px; }
  .exam-switch { width: 100%; }
  .exam-switch button { flex: 1; padding: 8px 3px; }
  .logic-grid { grid-template-columns: 1fr; }
  .method-strip { grid-template-columns: 1fr; padding: 15px 19px; }
  .method-strip > div + div { border-top: 1px solid var(--line); padding-top: 11px; }
  .hero { flex-direction: column; gap: 5px; }
  .hero-meta { text-align: left; padding-top: 0; }
  .hero-term { font-size: 34px; letter-spacing: -.6px; }
  .hero-meaning { font-size: 17px; }
  .word-search-list { grid-template-columns: 1fr; }
  .quiz-options { grid-template-columns: 1fr; }
  .detail-head { flex-direction: column; align-items: flex-start; }
  .detail-actions { justify-content: start; }
  .big-word { font-size: 34px; }
}
@media print {
  .site-header,.side-panel,.toolbar,.detail-actions,.method-strip,.quiz,.footer,.search-wrap{display:none!important;}
  .main{max-width:100%;padding:0;}
  .work-grid{display:block;}
  .learning-pane{border:0;padding:0;}
  .logic-card,.morph-piece{break-inside:avoid;}
  body{background:#fff;color:#000;}
}
