:root {
  --bg: #f4faff;
  --bg-grad: linear-gradient(180deg, #f4faff 0%, #eef7ff 100%);
  --bg-dot1: #d6efff;
  --bg-dot2: #ffe1ec;
  --bg-dot3: #d9f9e2;
  --ink: #17324f;
  --muted: #5b7391;
  --line: #c6d9ec;
  --accent: #2c7df9;
  --panel: rgba(255, 255, 255, 0.9);
  --panel-strong: rgba(255, 255, 255, 0.84);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "LXGW WenKai", "ZCOOL KuaiLe", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  min-height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(circle at 8% 14%, var(--bg-dot1) 0%, transparent 28%),
    radial-gradient(circle at 88% 18%, var(--bg-dot2) 0%, transparent 26%),
    radial-gradient(circle at 22% 86%, var(--bg-dot3) 0%, transparent 25%),
    var(--bg-grad);
}

body[data-theme="notebook"] {
  --bg-grad: linear-gradient(180deg, #fff9ef 0%, #fff4da 100%);
  --bg-dot1: #ffecc2;
  --bg-dot2: #ffd9bd;
  --bg-dot3: #f6e2ff;
  --accent: #d36a2f;
  --line: #e4c79f;
  --panel: rgba(255, 252, 245, 0.92);
  --panel-strong: rgba(255, 251, 243, 0.9);
}

body[data-theme="sunset"] {
  --bg-grad: linear-gradient(180deg, #fff2f1 0%, #ffe9d7 100%);
  --bg-dot1: #ffcfd6;
  --bg-dot2: #ffe3a8;
  --bg-dot3: #d8e7ff;
  --accent: #ff6b55;
  --line: #e9b9ad;
  --panel: rgba(255, 251, 249, 0.92);
  --panel-strong: rgba(255, 250, 247, 0.9);
}

.bg-shape {
  position: fixed;
  border-radius: 1000px;
  filter: blur(42px);
  opacity: 0.38;
  pointer-events: none;
  z-index: 0;
}

.bg-1 { width: 300px; height: 300px; left: -120px; top: 30%; background: #89d5ff; }
.bg-2 { width: 340px; height: 340px; right: -130px; top: 14%; background: #ffbfdd; }
.bg-3 { width: 260px; height: 260px; right: 22%; bottom: -92px; background: #9ff0bc; }

.topbar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid #cfe1f2;
  background: var(--panel-strong);
  backdrop-filter: blur(8px);
}

.topbar h1 {
  margin: 0;
  font-size: 26px;
  letter-spacing: 0.5px;
}

.topbar p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.theme-select {
  border: 1px solid #c6d9ec;
  border-radius: 10px;
  padding: 7px 10px;
  background: #fff;
  color: #214a73;
  font-weight: 700;
  font-size: 13px;
  max-width: 132px;
}

.top-actions .theme-select,
.top-actions .btn {
  height: 46px;
  min-height: 46px;
  padding: 0 18px;
  border-radius: 16px;
  border: 1px solid #b7d0e7;
  background: linear-gradient(180deg, #f7fbff 0%, #edf5ff 100%);
  color: #1f4f7d;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(31, 79, 125, 0.08);
}

.top-actions .theme-select {
  min-width: 166px;
  max-width: 186px;
}

.top-actions .btn,
.top-actions .btn.ghost {
  color: #1f4f7d;
  background: linear-gradient(180deg, #f7fbff 0%, #edf5ff 100%);
}

.top-actions .btn:hover,
.top-actions .theme-select:hover {
  border-color: #8eb6da;
  box-shadow: 0 3px 10px rgba(30, 78, 122, 0.14);
}

.account-badge {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  height: 46px;
  min-height: 46px;
  max-width: 230px;
  padding: 0 14px;
  border-radius: 16px;
  border: 1px solid #b7d0e7;
  background: linear-gradient(180deg, #f7fbff 0%, #edf5ff 100%);
  color: #1f4f7d;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(31, 79, 125, 0.08);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.account-badge.active {
  border-color: #8eb6da;
  background: linear-gradient(180deg, #eef7ff 0%, #deefff 100%);
}

.settings-wrap {
  position: relative;
}

.settings-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 168px;
  border: 1px solid #c6d9ec;
  border-radius: 12px;
  padding: 6px;
  background: #fff;
  box-shadow: 0 10px 22px rgba(23, 62, 96, 0.16);
  z-index: 12;
}

.settings-menu.hidden {
  display: none;
}

.settings-menu-item {
  width: 100%;
  border: 1px solid #d6e7f6;
  border-radius: 10px;
  background: #f7fbff;
  color: #1f4f7d;
  font-size: 13px;
  font-weight: 700;
  text-align: left;
  padding: 9px 10px;
  cursor: pointer;
}

.settings-menu-item + .settings-menu-item {
  margin-top: 6px;
}

.settings-menu-item:hover {
  border-color: #8eb6da;
  background: #eaf4ff;
}

.settings-menu-item:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.layout {
  position: relative;
  z-index: 1;
  display: grid;
  --detail-width: 190px;
  --detail-height: 320px;
  grid-template-columns: minmax(220px, 1fr) 10px minmax(180px, var(--detail-width));
  height: calc(100vh - 84px);
}

.layout.collapsed {
  grid-template-columns: minmax(0, 1fr) 0 0;
}

.map-wrap {
  padding: 14px;
  overflow: auto;
}

.splitter {
  position: relative;
  cursor: col-resize;
  background: linear-gradient(180deg, rgba(194, 214, 232, 0.3), rgba(170, 197, 221, 0.5));
  border-left: 1px solid #c7dbef;
  border-right: 1px solid #c7dbef;
}

.splitter::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 4px;
  height: 82px;
  border-radius: 99px;
  background: linear-gradient(180deg, #7aa9d8 0%, #a8c9e8 100%);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.58);
}

.layout.collapsed .splitter {
  width: 0;
  border: 0;
  overflow: hidden;
}

body.is-resizing {
  cursor: col-resize;
}

body.is-resizing-rows {
  cursor: row-resize;
}

body.is-resizing * {
  user-select: none !important;
  pointer-events: none;
}

body.is-resizing-rows * {
  user-select: none !important;
  pointer-events: none;
}

.mindmap-stage {
  position: relative;
  min-width: 2100px;
  min-height: 1500px;
  height: 100%;
  border-radius: 20px;
  border: 1px solid #cfe1f2;
  background:
    linear-gradient(0deg, rgba(255,255,255,0.78), rgba(255,255,255,0.78)),
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 33px,
      rgba(190, 214, 234, 0.16) 34px,
      rgba(190, 214, 234, 0.16) 35px
    );
  box-shadow: 0 12px 28px rgba(34, 75, 112, 0.12);
}

.links-layer,
.nodes-layer {
  position: absolute;
  inset: 0;
}

.links-layer path {
  fill: none;
  stroke: var(--line);
  stroke-width: 2;
}

.node {
  position: absolute;
  transform: translate(-50%, -50%);
  border: 2px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 8px 20px rgba(26, 61, 96, 0.2);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1.2;
  cursor: pointer;
  user-select: none;
  transition: transform 180ms ease, box-shadow 180ms ease, filter 180ms ease;
}

.node:hover {
  transform: translate(-50%, -50%) scale(1.09);
  box-shadow: 0 12px 28px rgba(26, 61, 96, 0.28);
  filter: saturate(1.05);
}

.node.center {
  width: 194px;
  height: 194px;
  border-radius: 56% 44% 50% 50% / 42% 52% 48% 58%;
  background: linear-gradient(145deg, #17a8ff, #365dff);
  font-size: 27px;
  font-weight: 700;
  letter-spacing: 1px;
}

.node.category {
  width: 142px;
  height: 142px;
  border-radius: 42px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 19px;
  font-weight: 700;
}

.node.category .emoji {
  font-size: 28px;
}

.node.topic {
  width: 124px;
  height: 60px;
  border-radius: 18px;
  font-size: 14px;
  font-weight: 700;
  padding: 6px;
}

.node.tip {
  width: 88px;
  height: 88px;
  border-radius: 999px;
  padding: 8px 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.node.tip .tip-no {
  font-size: 11px;
  font-weight: 700;
  opacity: 0.92;
  line-height: 1;
}

.node.tip .tip-text {
  font-size: 13px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: 0.2px;
  max-width: 70px;
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.node.tip.active {
  outline: 3px solid #2488ff;
  outline-offset: 3px;
}

.node.tip.checkin-hot {
  filter: saturate(calc(1 + var(--checkin-hit, 0) * 0.45))
    brightness(calc(1 + var(--checkin-hit, 0) * 0.08));
  box-shadow:
    0 9px 22px rgba(24, 62, 99, 0.24),
    0 0 0 calc(var(--checkin-hit, 0) * 4px) rgba(43, 119, 196, 0.18);
}

.detail {
  border-left: 1px solid #cfe1f2;
  background: var(--panel);
  backdrop-filter: blur(8px);
  padding: 16px 14px;
  overflow: auto;
  min-width: 0;
  position: relative;
}

.layout.collapsed .detail {
  opacity: 0;
  pointer-events: none;
}

.detail h2 {
  margin: 0 0 8px;
  font-size: 22px;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.tag {
  padding: 5px 9px;
  border-radius: 999px;
  background: #ebf3fd;
  color: #214c79;
  font-size: 12px;
}

.player-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.btn {
  border: 0;
  border-radius: 10px;
  padding: 8px 12px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
}

.btn.ghost {
  background: #e6f1ff;
  color: #1f5b90;
}

.btn:disabled,
.btn.disabled {
  opacity: 0.52;
  pointer-events: none;
}

#videoPlayer {
  width: 100%;
  min-height: 160px;
  border-radius: 12px;
  border: 1px solid #d4e4f2;
  background: #eaf3ff;
}

.script-overlay {
  position: absolute;
  inset: 12px;
  z-index: 16;
  border: 1px solid #c7dbef;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 12px 26px rgba(20, 50, 75, 0.24);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.script-overlay.hidden { display: none; }

.script-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid #d4e4f2;
  background: #f6fbff;
  cursor: move;
  user-select: none;
}

.script-toolbar strong {
  color: #1f4f7d;
  font-size: 15px;
}

.script-content {
  padding: 12px 14px;
  overflow: auto;
  height: 100%;
  color: #1b3a58;
  background: #fff;
}

.script-content h1,
.script-content h2,
.script-content h3 {
  margin: 10px 0 8px;
  line-height: 1.3;
  color: #173a5b;
}

.script-content h1 { font-size: 20px; }
.script-content h2 { font-size: 17px; }
.script-content h3 { font-size: 15px; }

.script-content p {
  margin: 7px 0;
  line-height: 1.6;
  font-size: 14px;
}

.script-content ul {
  margin: 6px 0 10px 18px;
  padding: 0;
}

.script-content li {
  margin: 4px 0;
  line-height: 1.55;
  font-size: 14px;
}

.script-content pre {
  margin: 8px 0;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid #d4e4f2;
  background: #f8fbff;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 12px;
  line-height: 1.45;
}

.script-figure {
  margin: 10px 0 14px;
  border: 1px solid #d6e5f4;
  border-radius: 10px;
  overflow: hidden;
  background: #f6fbff;
}

.script-figure img {
  display: block;
  width: 100%;
  height: auto;
  background: #eaf3ff;
}

.script-figure figcaption {
  padding: 6px 10px;
  font-size: 12px;
  color: #4a6b8b;
}

.script-empty {
  color: #4a6b8b;
  font-size: 14px;
}

.tip-card-content {
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.tip-card-head {
  border: 1px solid #d6e6f5;
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 10px;
  background: #f7fbff;
}

.tip-card-head h3 {
  margin: 0 0 6px;
  color: #1d4f7d;
  font-size: 18px;
}

.tip-card-head p {
  margin: 0;
  color: #3a6286;
  font-size: 14px;
  line-height: 1.6;
}

.tip-card-section {
  margin-bottom: 10px;
  border: 1px solid #d8e7f5;
  border-radius: 10px;
  background: #fff;
  padding: 9px 10px;
}

.tip-card-section strong {
  display: block;
  margin-bottom: 6px;
  color: #205585;
  font-size: 14px;
}

.tip-card-example strong {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tip-card-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1;
  font-weight: 700;
}

.tip-card-badge.good {
  color: #17653f;
  background: #d9f4e6;
  border: 1px solid #97d7b5;
}

.tip-card-badge.bad {
  color: #8f2c24;
  background: #fde4df;
  border: 1px solid #efb8af;
}

.tip-card-scene {
  font-size: 15px;
  font-weight: 700;
}

.tip-card-section p {
  margin: 0;
  color: #214a6a;
  font-size: 13px;
  line-height: 1.55;
}

.tip-card-example.good {
  border-color: #b8e2ca;
  background: #f2fbf6;
}

.tip-card-example.bad {
  border-color: #f3cdc4;
  background: #fff6f3;
}

.tip-card-note {
  margin-top: 6px !important;
  color: #466a86 !important;
}

.tip-card-list {
  margin: 0;
  padding-left: 18px;
}

.tip-card-list li {
  margin: 4px 0;
  color: #204968;
  font-size: 13px;
  line-height: 1.5;
}

.tip-card-drill {
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px dashed #9dc0e0;
  background: #ecf5ff;
  color: #1f4f7c;
  font-size: 13px;
  line-height: 1.55;
}

.draft-panel {
  position: fixed;
  z-index: 32;
  left: 34px;
  top: 94px;
  width: min(1120px, calc(100vw - 40px));
  height: min(760px, calc(100vh - 118px));
  border: 1px solid #c8ddef;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 22px 44px rgba(18, 48, 75, 0.24);
  backdrop-filter: blur(8px);
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
}

.draft-panel.hidden {
  display: none;
}

.draft-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid #d2e4f3;
  background: linear-gradient(180deg, #f5fbff 0%, #eef7ff 100%);
  cursor: move;
  user-select: none;
}

.draft-panel-header strong {
  font-size: 17px;
  color: #1a4a73;
}

.draft-header-main {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}

.draft-meta-info {
  color: #4d7191;
  font-size: 12px;
  white-space: nowrap;
}

.draft-panel-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.draft-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(0, 1fr);
  gap: 0;
  min-height: 0;
  min-width: 0;
}

.draft-editor-column {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 12px 14px;
  border-right: 1px solid #d8e8f6;
  background: #fff;
}

.draft-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.field-inline {
  color: #244d77;
  font-size: 13px;
  font-weight: 700;
}

#draftDateInput {
  border: 1px solid #cadff0;
  border-radius: 8px;
  padding: 6px 8px;
  color: #21496f;
  background: #fbfdff;
}

.draft-tags {
  min-height: 30px;
  margin-bottom: 8px;
}

#draftTitleInput {
  width: 100%;
  border: 1px solid #cadff0;
  border-radius: 10px;
  padding: 9px 10px;
  font-size: 14px;
  color: #1f466d;
  background: #fbfdff;
  margin-bottom: 8px;
}

.draft-structured-editor {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 2px;
  margin-bottom: 8px;
}

.draft-structured-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

.draft-structured-row .field-inline {
  width: auto;
  flex: none;
  white-space: nowrap;
}

.draft-structured-editor .btn {
  flex: 0 0 auto;
}

#draftLevel1Input,
#draftLevel2Input,
#draftLevel3Input {
  flex: 0 0 170px;
  border: 1px solid #cadff0;
  border-radius: 10px;
  padding: 7px 10px;
  color: #1f466d;
  background: #fbfdff;
  font-size: 13px;
}

#draftDateInput {
  flex: 0 0 176px;
}

.draft-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  background: #e9f3ff;
  color: #1f527f;
  font-size: 12px;
}

.draft-tag.auto-level {
  background: #dcecff;
  border: 1px solid #aac8e8;
  color: #184d84;
  font-weight: 700;
}

.draft-tag .remove-tag {
  border: 0;
  padding: 0;
  width: 16px;
  height: 16px;
  border-radius: 99px;
  cursor: pointer;
  background: rgba(28, 83, 129, 0.12);
  color: #245482;
  line-height: 1;
  font-weight: 700;
}

.draft-tag-editor {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

#draftTagInput,
#draftChatInput {
  flex: 1;
  border: 1px solid #cadff0;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 13px;
  color: #1f466d;
  background: #fbfdff;
}

#draftContentInput {
  flex: 1;
  min-height: 0;
  width: 100%;
  border: 1px solid #cadff0;
  border-radius: 12px;
  padding: 12px 14px;
  line-height: 1.65;
  font-size: 16px;
  resize: none;
  color: #1f3f5f;
  background: #fcfeff;
}

.draft-editor-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.draft-save-status {
  font-size: 12px;
  color: #47698a;
}

.draft-chat-column {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 12px;
  background: #fafdff;
}

.draft-chat-column h3 {
  margin: 0 0 8px;
  font-size: 16px;
  color: #20517d;
}

.draft-panel.compact .draft-workspace {
  display: flex;
  align-items: stretch;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scrollbar-gutter: stable;
}

.draft-panel.compact .draft-editor-column {
  flex: 0 0 560px;
  min-width: 560px;
  border-right: 1px solid #d8e8f6;
  border-bottom: 0;
}

.draft-panel.compact .draft-chat-column {
  flex: 0 0 340px;
  min-width: 340px;
}

.draft-chat-messages {
  flex: 1;
  min-height: 0;
  border: 1px solid #d2e4f2;
  border-radius: 12px;
  padding: 10px;
  overflow: auto;
  background: #fff;
}

.draft-chat-quick {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.draft-chat-quick .btn {
  padding: 6px 12px;
  font-size: 12px;
}

.draft-chat-quick .btn.active {
  border-color: #6ba7df;
  background: linear-gradient(180deg, #dff0ff 0%, #cce6ff 100%);
  color: #1e4f7b;
}

.chat-empty {
  color: #5d7a97;
  font-size: 13px;
}

.chat-msg {
  margin-bottom: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.chat-msg.user {
  background: #e7f2ff;
  color: #1d4f7d;
}

.chat-msg.assistant {
  background: #f3f8ed;
  color: #2c5a2a;
}

.chat-line + .chat-line {
  margin-top: 4px;
}

.chat-line-highlight {
  background: #fff8cc;
  border-left: 3px solid #e1b92f;
  padding: 3px 6px;
  border-radius: 6px;
}

.chat-line-problem {
  color: #7f2f2f;
  font-weight: 700;
}

.chat-line-reason {
  color: #6b4d29;
}

.chat-line-fix {
  color: #1e5f2b;
  font-weight: 700;
}

.chat-line-links {
  margin-top: 8px;
  color: #204f78;
  font-weight: 700;
}

.chat-tip-link {
  display: inline-flex;
  align-items: center;
  margin: 0 4px;
  padding: 1px 8px;
  border: 1px solid #9bc0df;
  border-radius: 999px;
  background: #e9f4ff;
  color: #1f527f;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.chat-tip-link:hover {
  background: #d7ebff;
}

.draft-chat-input-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

#draftChatInput {
  min-height: 84px;
  resize: none;
}

.draft-library-drawer {
  position: fixed;
  right: 20px;
  top: 86px;
  bottom: 16px;
  width: min(600px, calc(100vw - 40px));
  border: 1px solid #cfe2f2;
  border-radius: 14px;
  box-shadow: 0 12px 28px rgba(20, 53, 82, 0.24);
  display: flex;
  flex-direction: column;
  background: #fbfdff;
  z-index: 34;
}

.draft-library-drawer.stacked-with-checkin {
  left: 20px;
  right: auto;
  width: clamp(320px, 42vw, 560px);
  z-index: 35;
}

.draft-library-drawer.hidden {
  display: none;
}

.draft-library-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid #d8e8f6;
  background: #f4f9ff;
  cursor: move;
  user-select: none;
}

.draft-library-header strong {
  color: #1e507d;
  font-size: 15px;
}

.draft-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px 12px 8px;
  border-bottom: 1px solid #e0eef9;
}

.draft-filters select,
.draft-filters input[type="date"],
.draft-filters input[type="search"] {
  border: 1px solid #cadff0;
  border-radius: 8px;
  padding: 6px 8px;
  color: #1f466d;
  background: #fff;
  font-size: 12px;
}

#draftFilterTitle {
  min-width: 180px;
}

#draftFilterTag {
  min-width: 150px;
}

.draft-filter-range-sep {
  color: #537596;
  font-weight: 700;
  line-height: 1;
}

.draft-list {
  flex: 1;
  min-height: 0;
  border: 0;
  border-radius: 0;
  overflow: auto;
  background: #fff;
  padding: 10px 12px;
}

.checkin-total {
  color: #2e618f;
  font-size: 13px;
  font-weight: 700;
}

.checkin-tags-card h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: #315b82;
}

.checkin-panel {
  position: fixed;
  right: 20px;
  top: 86px;
  bottom: 16px;
  width: min(620px, calc(100vw - 40px));
  border: 1px solid #cfe2f2;
  border-radius: 14px;
  box-shadow: 0 12px 28px rgba(20, 53, 82, 0.24);
  display: flex;
  flex-direction: column;
  background: #fbfdff;
  z-index: 34;
}

.checkin-panel.hidden {
  display: none;
}

.checkin-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid #d8e8f6;
  background: #f4f9ff;
  cursor: move;
  user-select: none;
}

.floating-draggable {
  transform: translate(var(--drag-x, 0px), var(--drag-y, 0px));
}

.floating-draggable.dragging {
  transition: none !important;
}

.checkin-panel-header strong {
  color: #1e507d;
  font-size: 16px;
}

.checkin-panel-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.checkin-panel-body {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px 12px 12px;
}

.checkin-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.checkin-tab {
  border: 1px solid #c8def1;
  border-radius: 999px;
  padding: 7px 14px;
  background: #edf6ff;
  color: #2e5f8d;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.checkin-tab.active {
  border-color: #7daed7;
  background: linear-gradient(180deg, #dbeefe 0%, #cde6fb 100%);
  color: #1e4f7b;
}

.checkin-view {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.checkin-view.hidden {
  display: none;
}

.checkin-calendar-card,
.checkin-tags-card {
  border: 1px solid #d9e8f6;
  border-radius: 12px;
  background: #fff;
  padding: 10px;
}

.checkin-calendar-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.checkin-calendar-toolbar strong {
  color: #24527c;
  font-size: 14px;
}

.checkin-calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 6px;
}

.checkin-calendar-weekdays span {
  text-align: center;
  color: #5c7ea0;
  font-size: 12px;
  font-weight: 700;
}

.checkin-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.checkin-day {
  min-height: 54px;
  border: 1px solid #dfedf9;
  border-radius: 10px;
  padding: 6px;
  background: #fbfdff;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-start;
}

.checkin-day.clickable {
  cursor: pointer;
}

.checkin-day.empty {
  border: 0;
  background: transparent;
}

.checkin-day .day-num {
  font-size: 12px;
  color: #41688b;
}

.checkin-day .day-count {
  font-size: 11px;
  line-height: 1;
  border-radius: 999px;
  background: #1f5f95;
  color: #fff;
  padding: 4px 6px;
}

.checkin-day.active {
  border-color: #8fb8df;
  background: #eef7ff;
}

.checkin-day.active.clickable:hover {
  background: #deefff;
  border-color: #77abd8;
}

.checkin-day.today {
  box-shadow: 0 0 0 2px rgba(89, 146, 198, 0.24);
}

.checkin-tag-overview {
  position: relative;
  min-height: 360px;
  margin-top: 8px;
  border: 1px solid #dbe9f7;
  border-radius: 12px;
  background: #fff;
  overflow: auto;
  padding: 0;
}

.checkin-tag-sections {
  display: grid;
  gap: 12px;
  padding: 12px;
}

.checkin-tag-section-card {
  border: 1px solid #d7e6f5;
  border-radius: 12px;
  background: #fbfdff;
  padding: 10px;
}

.checkin-tag-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.checkin-tag-section-title {
  border: 1px solid #9dc4e7;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 14px;
  font-weight: 800;
  color: #1e5684;
  background: #eaf4ff;
  cursor: pointer;
}

.checkin-tag-section-title.static {
  cursor: default;
}

.checkin-tag-section-stats {
  color: #4a7092;
  font-size: 12px;
  font-weight: 700;
}

.checkin-topic-block {
  border-top: 1px dashed #d8e8f7;
  padding-top: 8px;
  margin-top: 8px;
}

.checkin-topic-block:first-of-type {
  border-top: 0;
  padding-top: 0;
  margin-top: 0;
}

.checkin-topic-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #8db7dd;
  border-radius: 999px;
  padding: 5px 10px;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 800;
  color: #1f5a89;
  background: #e9f3ff;
  cursor: pointer;
}

.checkin-topic-chip em {
  font-style: normal;
  font-size: 11px;
  font-weight: 800;
  border-radius: 999px;
  padding: 2px 6px;
  background: rgba(255, 255, 255, 0.84);
}

.checkin-tip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.checkin-tip-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #8db7dd;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 700;
  color: #235c8a;
  background: #eef6ff;
  cursor: pointer;
}

.checkin-tip-chip em {
  font-style: normal;
  font-size: 10px;
  font-weight: 800;
  border-radius: 999px;
  padding: 2px 5px;
  background: rgba(255, 255, 255, 0.84);
}

.checkin-custom-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.checkin-custom-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px dashed #d1ab8e;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 700;
  color: #8d5a37;
  background: linear-gradient(140deg, rgba(240, 180, 138, 0.52), rgba(211, 129, 78, 0.34));
  cursor: pointer;
}

.checkin-custom-chip em {
  font-style: normal;
  font-size: 10px;
  font-weight: 800;
  border-radius: 999px;
  padding: 2px 5px;
  color: #7a4a2a;
  background: rgba(255, 255, 255, 0.84);
}

.checkin-tag-map-stage {
  position: relative;
  margin: 0;
}

.checkin-tag-map-links,
.checkin-tag-map-nodes {
  position: absolute;
  inset: 0;
}

.checkin-tag-map-links {
  pointer-events: none;
}

.checkin-tag-map-links path {
  fill: none;
  opacity: 0.86;
}

.checkin-map-tip {
  position: relative;
}

.checkin-map-tip .tip-count {
  position: absolute;
  right: 6px;
  bottom: 6px;
  font-style: normal;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  border-radius: 999px;
  padding: 3px 5px;
  background: rgba(255, 255, 255, 0.84);
  color: #1d4f79;
}

.checkin-map-tip.untrained .tip-count {
  background: rgba(255, 255, 255, 0.72);
  color: #4f6e8d;
}

.checkin-map-tip.trained {
  box-shadow:
    0 8px 20px rgba(26, 61, 96, 0.24),
    0 0 0 calc(var(--hit-ratio, 0) * 4px) rgba(28, 102, 176, 0.2);
}

.checkin-custom-tag {
  border-style: dashed;
  border-color: rgba(255, 240, 228, 0.98);
  box-shadow:
    0 8px 20px rgba(104, 62, 28, 0.2),
    0 0 0 calc(var(--hit-ratio, 0) * 4px) rgba(217, 139, 71, 0.24);
}

.checkin-custom-tag-label {
  position: absolute;
  transform: translate(-50%, -50%);
  border: 1px dashed #d8b296;
  border-radius: 999px;
  padding: 6px 14px;
  background: rgba(255, 245, 236, 0.95);
  color: #9b673f;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.3px;
  pointer-events: none;
}

.checkin-empty {
  color: #5d7a97;
  font-size: 13px;
  margin: 8px 0 0;
}

.draft-row {
  border: 1px solid #ddebf7;
  border-radius: 10px;
  padding: 8px 10px;
  margin-bottom: 8px;
  background: #fcfeff;
}

.draft-row.active {
  border-color: #7fb6f5;
  box-shadow: 0 0 0 2px rgba(120, 176, 245, 0.22);
}

.draft-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.draft-row-date {
  color: #446788;
  font-size: 12px;
}

.draft-row-preview {
  color: #1f466d;
  font-size: 13px;
  line-height: 1.45;
  margin-bottom: 6px;
}

.draft-row-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.draft-row-tags .tag {
  margin: 0;
}

.draft-resize-handle {
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 16px;
  height: 16px;
  border-radius: 4px;
  cursor: nwse-resize;
  background:
    linear-gradient(135deg, transparent 0 38%, #8fb6dc 40% 55%, transparent 57% 100%),
    linear-gradient(135deg, transparent 0 58%, #8fb6dc 60% 75%, transparent 77% 100%),
    linear-gradient(135deg, transparent 0 78%, #8fb6dc 80% 95%, transparent 97% 100%);
}

.hover-tip {
  position: fixed;
  z-index: 20;
  max-width: 300px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid #bdd5ea;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 8px 18px rgba(17, 43, 67, 0.22);
  color: #123252;
  font-size: 13px;
  line-height: 1.35;
  pointer-events: none;
  white-space: pre-wrap;
}

.hover-tip.hidden { display: none; }

@media (max-width: 980px) {
  .topbar {
    align-items: flex-start;
    flex-wrap: wrap;
    padding: 10px 12px;
    gap: 8px;
  }

  .topbar > div:first-child {
    width: 100%;
    min-width: 0;
  }

  .topbar h1 {
    font-size: 20px;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .top-actions {
    width: 100%;
    gap: 6px;
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 2px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }

  .top-actions > * {
    flex: 0 0 auto;
  }

  .top-actions .theme-select,
  .top-actions .btn,
  .account-badge {
    height: 38px;
    min-height: 38px;
    border-radius: 12px;
    padding: 0 12px;
    font-size: 12px;
  }

  .top-actions .theme-select {
    min-width: 136px;
    max-width: 152px;
  }

  .account-badge {
    max-width: 144px;
    padding: 0 10px;
  }

  .settings-menu {
    left: 0;
    right: auto;
  }

  .layout {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(220px, 1fr) 10px var(--detail-height);
  }

  .layout.collapsed {
    grid-template-rows: 1fr 0 0;
  }

  .splitter {
    display: block;
    cursor: row-resize;
    border-left: 0;
    border-right: 0;
    border-top: 1px solid #c7dbef;
    border-bottom: 1px solid #c7dbef;
    background: linear-gradient(90deg, rgba(194, 214, 232, 0.3), rgba(170, 197, 221, 0.5));
  }

  .splitter::before {
    width: 82px;
    height: 4px;
    background: linear-gradient(90deg, #7aa9d8 0%, #a8c9e8 100%);
  }

  .detail {
    border-left: 0;
    border-top: 1px solid #cfe1f2;
    min-height: 0;
  }

  .mindmap-stage {
    min-width: 1860px;
    min-height: 1280px;
  }

  .draft-panel {
    left: 8px;
    top: 72px;
    width: calc(100vw - 16px);
    height: calc(100vh - 80px);
    grid-template-rows: auto 1fr;
  }

  .draft-panel-header {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .draft-header-main {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }

  .draft-meta-info {
    white-space: normal;
    font-size: 11px;
  }

  .draft-workspace {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(260px, 1fr) minmax(220px, 1fr);
  }

  .draft-editor-column {
    border-right: 0;
    border-bottom: 1px solid #d8e8f6;
  }

  .draft-library-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .draft-library-drawer {
    top: 74px;
    right: 8px;
    bottom: 8px;
    left: 8px;
    width: auto;
  }

  .draft-library-drawer.stacked-with-checkin {
    left: 8px;
    right: 8px;
    width: auto;
  }

  .checkin-panel {
    top: 74px;
    right: 8px;
    bottom: 8px;
    left: 8px;
    width: auto;
  }

  .checkin-tag-overview {
    min-height: 320px;
  }

  .draft-resize-handle {
    display: none;
  }
}

@media (max-width: 560px) {
  .topbar h1 {
    font-size: 18px;
  }

  .account-badge {
    display: none;
  }

  .top-actions .theme-select,
  .top-actions .btn {
    height: 36px;
    min-height: 36px;
    font-size: 12px;
  }
}
