:root {
  --ink: #202824;
  --muted: #6e7872;
  --line: #dfe5df;
  --paper: #fbfcf9;
  --white: #ffffff;
  --green: #348765;
  --green-deep: #246b50;
  --green-soft: #e9f6ef;
  --coral: #dd6b55;
  --yellow: #f2d37b;
  --shadow: 0 12px 36px rgba(30, 48, 39, .08);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: "DM Sans", "Noto Sans SC", sans-serif;
  letter-spacing: 0;
}
button, input, textarea { font: inherit; }
button { cursor: pointer; }

.app-header {
  min-height: 82px;
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.92);
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand-block, .session-meta, .view-controls, .section-heading { display: flex; align-items: center; }
.brand-block { gap: 12px; }
.brand-mark {
  width: 44px; height: 44px; display: grid; place-items: center;
  color: white; background: var(--green); font: 700 22px "Noto Sans SC";
  border-radius: 7px;
}
h1, h2, h3, p { margin: 0; }
h1 { font-size: 19px; line-height: 1.15; }
.brand-block p { font-size: 12px; color: var(--muted); margin-top: 3px; }
.session-meta { gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.session-meta label { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; }
.session-meta input {
  display: block; margin-top: 4px; min-width: 150px; height: 34px;
  border: 1px solid var(--line); border-radius: 6px; padding: 0 10px;
  background: var(--white); color: var(--ink); text-transform: none;
}

.workspace {
  min-height: calc(100vh - 82px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
}
.board-panel { padding: 30px 42px 132px; position: relative; min-width: 0; background: var(--white); }
.insights-panel { border-left: 1px solid var(--line); background: #f4f6f2; }
.panel-toolbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.eyebrow { display: block; font-size: 10px; font-weight: 800; color: var(--green); letter-spacing: 1.3px; margin-bottom: 5px; }
h2 { font-size: 20px; }
.view-controls { gap: 7px; }
.icon-button, .mini-action, .pin-button {
  border: 1px solid var(--line); background: var(--white); color: var(--muted);
  border-radius: 6px; font-weight: 700;
}
.icon-button { width: 38px; height: 36px; }
.icon-button.active { color: var(--green); border-color: #a9c8b7; background: var(--green-soft); }

.empty-state { text-align: center; padding: 110px 20px 60px; color: var(--muted); }
.empty-state.hidden { display: none; }
.empty-glyph { width: 66px; height: 66px; border: 1px solid var(--line); display: grid; place-items: center; margin: 0 auto 16px; font: 600 30px "Noto Sans SC"; background: white; border-radius: 8px; }
.empty-state h3 { color: var(--ink); font-size: 18px; margin-bottom: 6px; }
.empty-state p { font-size: 13px; }

.entries { display: grid; gap: 0; align-items: start; }
.entry-card {
  display: grid; grid-template-columns: 13px minmax(0, 1fr) auto; gap: 13px;
  padding: 17px 4px 18px; border-bottom: 1px solid var(--line); transition: .18s ease;
}
.entry-card:hover { background: #fbfdfb; }
.entry-card.pinned { background: #fffdf3; }
.entry-card.flash { animation: flash .55s ease; }
@keyframes flash { 50% { background: var(--green-soft); transform: translateY(-2px); } }
.entry-bullet { width: 9px; height: 9px; margin-top: 18px; border-radius: 50%; background: var(--green); }
.entry-content { min-width: 0; }
.entry-controls { display: flex; align-items: flex-start; gap: 6px; padding-top: 7px; opacity: .42; transition: opacity .16s ease; }
.entry-card:hover .entry-controls, .entry-card.pinned .entry-controls { opacity: 1; }
.pin-button { width: 27px; height: 27px; font-size: 18px; padding: 0; }
.entry-card.pinned .pin-button { color: #9a7414; background: #fff8da; }
.frequency { font-size: 11px; color: var(--muted); font-weight: 700; }
.entry-actions { display: flex; gap: 5px; }
.mini-action { min-width: 27px; height: 25px; padding: 0 6px; font-size: 10px; }
.mini-action:hover { color: var(--ink); border-color: #b5c0b9; }
.delete-action { font-size: 16px; font-weight: 400; }
.chinese-text { font: 600 34px/1.42 "Noto Sans SC", sans-serif; min-height: 48px; outline: none; }
.support-line { outline: none; min-height: 25px; margin-top: 4px; line-height: 1.45; }
.pinyin-text { color: var(--green-deep); font-size: 18px; }
.english-text { color: var(--muted); font-size: 16px; }
.english-text.translating { color: #7f9d8e; font-style: italic; }
.support-line.hidden { display: none; }
.english-text:empty::before { content: "Add English meaning…"; color: #a6aea9; }

.composer {
  position: fixed; left: 42px; bottom: 22px; right: 350px;
  display: flex; gap: 10px; padding: 10px;
  background: rgba(255,255,255,.95); border: 1px solid #ccd7d0; border-radius: 8px;
  box-shadow: 0 14px 40px rgba(26,49,37,.14); z-index: 10;
}
.composer-main { flex: 1; min-width: 0; }
.composer textarea { width: 100%; border: 0; resize: none; outline: 0; padding: 10px 9px; font: 500 24px/1.4 "Noto Sans SC"; color: var(--ink); background: transparent; }
.add-button { align-self: stretch; min-width: 120px; color: white; background: var(--green); border: 0; border-radius: 6px; font-weight: 700; }

.insight-section { padding: 25px 23px; border-bottom: 1px solid var(--line); }
.section-heading { justify-content: space-between; gap: 12px; }
.count-badge { min-width: 29px; height: 29px; border-radius: 50%; background: white; border: 1px solid var(--line); display: grid; place-items: center; font-size: 12px; font-weight: 700; }
.key-language { display: grid; gap: 7px; margin-top: 15px; }
.key-item { background: white; border: 1px solid var(--line); border-radius: 6px; padding: 9px 10px; display: grid; grid-template-columns: 1fr auto; gap: 4px 8px; }
.key-item strong { font: 600 16px "Noto Sans SC"; }
.key-item small { color: var(--muted); grid-column: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.key-score { grid-column: 2; grid-row: 1 / span 2; align-self: center; font-size: 11px; font-weight: 700; color: var(--green); }
.key-placeholder { color: var(--muted); font-size: 12px; padding: 14px 0; }
.export-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 15px; }
.button { min-height: 36px; border-radius: 6px; padding: 0 12px; border: 1px solid var(--line); font-weight: 700; font-size: 12px; }
.button.primary { grid-column: 1 / -1; color: white; background: var(--green); border-color: var(--green); }
.student-download { grid-column: 1 / -1; border-color: #a9cfbc; color: var(--green-deep); background: var(--green-soft); }
.button.secondary { background: white; color: var(--ink); }
.copy-status { min-height: 18px; margin-top: 7px; color: var(--green); font-size: 11px; }
.feedback-prompts { display: grid; gap: 7px; margin-top: 14px; }
.prompt-chip { text-align: left; padding: 9px 10px; border: 1px solid var(--line); border-radius: 6px; background: white; color: var(--ink); font-size: 12px; }
.prompt-chip:hover { border-color: #a9c8b7; background: var(--green-soft); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; padding: 9px 14px; border-radius: 6px; background: var(--ink); color: white; font-size: 12px; transition: .2s ease; z-index: 100; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

body.focus-mode .insights-panel, body.focus-mode .app-header { display: none; }
body.focus-mode .workspace { display: block; }
body.focus-mode .board-panel { min-height: 100vh; padding-top: 22px; }
body.focus-mode .composer { right: 30px; }
body.focus-mode .chinese-text { font-size: 40px; }
body.focus-mode .pinyin-text { font-size: 20px; }
body.focus-mode .english-text { font-size: 18px; }

@media (max-width: 900px) {
  .app-header { align-items: flex-start; flex-direction: column; }
  .session-meta { justify-content: flex-start; }
  .workspace { grid-template-columns: 1fr; }
  .insights-panel { border-left: 0; border-top: 1px solid var(--line); }
  .composer { left: 15px; right: 15px; bottom: 14px; }
  .board-panel { padding: 22px 16px 126px; }
  .entry-card { grid-template-columns: 10px minmax(0, 1fr); gap: 10px; }
  .entry-controls { grid-column: 2; opacity: 1; }
  .chinese-text { font-size: 29px; }
}

@media print {
  .app-header, .composer, .entry-actions, .pin-button, .insights-panel { display: none !important; }
  .workspace { display: block; }
  .board-panel { padding: 0; }
  .entry-card { break-inside: avoid; }
}
