:root {
  --bg-page: #f8f5ef;
  --bg-surface: #ffffff;
  --bg-subtle: #f2ede3;
  --bg-sage-tint: #eef3ef;
  --bg-clay-tint: #fdf1ed;
  --bg-amber-tint: #fef7e6;
  --bg-danger-tint: #fff1f2;

  --sage-900: #1f3329;
  --sage-700: #2f4b3d;
  --sage-600: #3d614f;
  --sage-500: #4f7863;
  --sage-200: #cfe0d5;

  --clay-600: #c25e42;
  --clay-500: #d46f52;
  --amber-700: #b45309;
  --danger-700: #be123c;
  --danger-200: #fecdd3;

  --text-main: #252320;
  --text-secondary: #5c574f;
  --text-muted: #8a8378;
  --border-light: #e5dfd3;
  --border-strong: #cfc6b5;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 2px 8px rgba(37, 35, 32, 0.05);
  --shadow-md: 0 8px 24px rgba(37, 35, 32, 0.08);
  --shadow-lg: 0 18px 42px rgba(31, 51, 41, 0.16);

  --phase-1: #5b8a72;
  --phase-2: #4a7c9b;
  --phase-3: #c25e42;
  --phase-4: #8d6cab;
  --phase-5: #6c8ebf;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.55;
  font-size: 14px;
}

/* 顶部栏 */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 24px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-light);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--sage-700);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.brand-logo svg {
  width: 24px;
  height: 24px;
}

.brand-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--sage-900);
  letter-spacing: 0.2px;
}

.brand-title span {
  font-weight: 500;
  font-size: 14px;
  color: var(--sage-600);
  margin-left: 6px;
}

.brand-subtitle {
  font-size: 12px;
  color: var(--text-muted);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* 快捷预设条 */
.preset-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 24px;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border-light);
  overflow-x: auto;
}

.preset-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--sage-700);
  white-space: nowrap;
}

.preset-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
}

.preset-chip {
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--bg-surface);
  color: var(--text-main);
  font-size: 12.5px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.18s ease;
}

.preset-chip:hover,
.preset-chip.active {
  background: var(--sage-700);
  color: #fff;
  border-color: var(--sage-700);
}

/* 主工作区网格 */
.workspace-grid {
  display: grid;
  grid-template-columns: 400px minmax(0, 1fr);
  gap: 20px;
  max-width: 1640px;
  margin: 0 auto;
  padding: 18px 24px 48px;
  align-items: start;
}

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

.workspace-grid.sidebar-collapsed .input-sidebar {
  display: none;
}

/* 左侧参数栏 */
.input-sidebar {
  position: sticky;
  top: 70px;
  max-height: calc(100vh - 86px);
  overflow-y: auto;
  padding-right: 4px;
}

.input-sidebar::-webkit-scrollbar {
  width: 6px;
}

.input-sidebar::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 6px;
}

.form-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 15px 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
}

.card-danger-soft {
  background: #fffafb;
  border-color: #f7d4da;
}

.form-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--bg-sage-tint);
  color: var(--sage-700);
  font-size: 11.5px;
  font-weight: 700;
}

.step-num.danger {
  background: var(--bg-danger-tint);
  color: var(--danger-700);
}

.form-card-header h2 {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--sage-900);
}

.form-card-header h2 small {
  font-weight: 400;
  font-size: 12px;
  color: var(--text-muted);
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 10px;
}

.field-group:last-child {
  margin-bottom: 0;
}

.field-group label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
}

.field-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.field-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}

.mt-8 { margin-top: 8px; }
.mt-10 { margin-top: 10px; }

input[type="text"],
input[type="number"],
input[type="search"],
select,
textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text-main);
  font-size: 13px;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--sage-600);
  box-shadow: 0 0 0 3px rgba(61, 97, 79, 0.14);
}

.field-hint {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 8px;
}

/* 授课形式分段选择器 */
.segmented-control {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.seg-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border-light);
  background: var(--bg-page);
  cursor: pointer;
  text-align: left;
  transition: all 0.16s ease;
}

.seg-btn strong {
  font-size: 13.5px;
  color: var(--text-main);
}

.seg-btn small {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.seg-btn.active {
  background: var(--bg-sage-tint);
  border-color: var(--sage-600);
}

.seg-btn.active strong {
  color: var(--sage-900);
}

/* 时长快捷胶囊 */
.duration-Quick-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.duration-pills {
  display: flex;
  gap: 4px;
}

.dur-pill {
  padding: 6px 8px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--bg-page);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-secondary);
}

.dur-pill.active {
  background: var(--sage-700);
  border-color: var(--sage-700);
  color: #fff;
}

#classDuration {
  width: 68px;
  text-align: center;
  font-weight: 600;
}

/* 多选标签矩阵 */
.chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--border-light);
  background: var(--bg-page);
  color: var(--text-secondary);
  font-size: 12.5px;
  cursor: pointer;
  user-select: none;
  transition: all 0.15s ease;
}

.tag-chip:hover {
  border-color: var(--sage-500);
}

.tag-chip.selected {
  background: var(--sage-700);
  border-color: var(--sage-700);
  color: #fff;
  font-weight: 500;
}

.tag-chip.chip-issue.selected {
  background: var(--clay-600);
  border-color: var(--clay-600);
  color: #fff;
}

.tag-chip.chip-contra.selected {
  background: var(--danger-700);
  border-color: var(--danger-700);
  color: #fff;
}

.tag-chip.chip-taboo.selected {
  background: #6b4c3b;
  border-color: #6b4c3b;
  color: #fff;
}

.generate-bar {
  position: sticky;
  bottom: 0;
  display: flex;
  gap: 8px;
  padding: 12px;
  background: rgba(248, 245, 239, 0.96);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--border-light);
  border-radius: var(--radius-md);
}

/* 通用按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.16s ease;
  white-space: nowrap;
}

.btn-xs { padding: 4px 9px; font-size: 12px; }
.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn-lg { padding: 11px 18px; font-size: 14.5px; }
.btn-block { flex: 1; }

.btn-primary {
  background: var(--sage-700);
  color: #fff;
}
.btn-primary:hover {
  background: var(--sage-900);
}

.btn-accent {
  background: var(--clay-600);
  color: #fff;
}
.btn-accent:hover {
  background: #a84d33;
}

.btn-outline {
  background: #fff;
  border-color: var(--border-strong);
  color: var(--text-main);
}
.btn-outline:hover {
  border-color: var(--sage-600);
  color: var(--sage-700);
  background: var(--bg-sage-tint);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover {
  background: var(--bg-subtle);
  color: var(--text-main);
}

.badge-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--sage-700);
  color: #fff;
  font-size: 11px;
}

/* 右侧教案画布 */
.plan-canvas {
  min-width: 0;
}

.canvas-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
}

.toolbar-left,
.toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.cue-mode-switch {
  display: inline-flex;
  align-items: center;
  background: var(--bg-page);
  padding: 3px;
  border-radius: 8px;
  border: 1px solid var(--border-light);
}

.switch-label {
  font-size: 12px;
  color: var(--text-muted);
  padding: 0 8px;
}

.cue-tab {
  padding: 5px 10px;
  border: none;
  background: transparent;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
}

.cue-tab.active {
  background: #fff;
  color: var(--sage-900);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

/* 导出下拉菜单 */
.export-dropdown {
  position: relative;
}

.dropdown-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  width: 250px;
  background: #fff;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 60;
}

.dropdown-panel button {
  display: flex;
  width: 100%;
  text-align: left;
  padding: 9px 12px;
  border: none;
  background: transparent;
  border-radius: 8px;
  font-size: 13px;
  color: var(--text-main);
  cursor: pointer;
}

.dropdown-panel button:hover {
  background: var(--bg-sage-tint);
  color: var(--sage-900);
}

.hidden {
  display: none !important;
}

/* 教案头部概览卡 */
.plan-header-card {
  background: linear-gradient(135deg, #274034 0%, #3a5c4b 100%);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-md);
}

.plan-header-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}

.plan-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.header-badge {
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  font-size: 12px;
  font-weight: 600;
}

.header-badge.badge-mode {
  background: #e6b89c;
  color: #2c1d14;
}

.plan-main-title {
  font-size: 23px;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 6px;
}

.plan-sub-meta {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.84);
}

.plan-meta-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
}

.meta-stat-box {
  background: rgba(255, 255, 255, 0.09);
  border-radius: 10px;
  padding: 10px 12px;
}

.meta-stat-label {
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.72);
  margin-bottom: 3px;
}

.meta-stat-value {
  font-size: 13.5px;
  font-weight: 600;
  color: #fff;
}

/* 安全风控横幅 */
.safety-banner-wrap {
  margin-bottom: 16px;
}

.safety-alert-card {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.alert-panel {
  border-radius: var(--radius-md);
  padding: 13px 16px;
  border: 1px solid var(--border-light);
}

.alert-panel.posture-panel {
  background: var(--bg-clay-tint);
  border-color: #f2cfc4;
}

.alert-panel.contra-panel {
  background: var(--bg-danger-tint);
  border-color: var(--danger-200);
}

.alert-panel h4 {
  font-size: 13.5px;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.alert-panel.posture-panel h4 { color: #9a3e24; }
.alert-panel.contra-panel h4 { color: var(--danger-700); }

.alert-panel p {
  font-size: 12.5px;
  color: var(--text-secondary);
}

/* 通用文档区块 */
.doc-section {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

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

.section-heading h3 {
  font-size: 16.5px;
  font-weight: 700;
  color: var(--sage-900);
}

.section-desc {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

.duration-summary-badge {
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
  background: var(--bg-sage-tint);
  color: var(--sage-700);
}

.duration-summary-badge.mismatch {
  background: var(--bg-amber-tint);
  color: var(--amber-700);
}

/* 可视化时间轴 */
.timeline-bar {
  display: flex;
  width: 100%;
  height: 36px;
  border-radius: 10px;
  overflow: hidden;
  gap: 3px;
  margin-bottom: 12px;
  background: var(--bg-subtle);
}

.timeline-seg {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 0 8px;
  cursor: pointer;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  transition: filter 0.15s ease;
}

.timeline-seg:hover {
  filter: brightness(1.08);
}

.timeline-legend-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.timeline-legend-item {
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 9px 11px;
  background: var(--bg-page);
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.timeline-legend-item:hover {
  transform: translateY(-1px);
  border-color: var(--sage-500);
}

.legend-dot-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 3px;
}

.legend-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 5px;
}

.legend-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
}

.legend-sub {
  font-size: 11.5px;
  color: var(--text-muted);
}

/* 分段音乐卡片 */
.audio-widget {
  display: flex;
  align-items: center;
  gap: 8px;
}

.audio-status-text {
  font-size: 12px;
  color: var(--sage-600);
  font-weight: 600;
}

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

.music-card {
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 14px;
  background: #fcfbf8;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
}

.music-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.music-phase-tag {
  font-size: 12px;
  font-weight: 700;
  color: var(--sage-900);
}

.bpm-badge {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg-sage-tint);
  color: var(--sage-700);
  font-size: 11.5px;
  font-weight: 700;
}

.music-mood {
  font-size: 12px;
  color: var(--text-secondary);
}

.track-list {
  list-style: none;
  border-top: 1px dashed var(--border-light);
  border-bottom: 1px dashed var(--border-light);
  padding: 8px 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.track-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 12px;
}

.track-name {
  font-weight: 600;
  color: var(--text-main);
}

.track-search-link {
  font-size: 11px;
  color: var(--sage-600);
  text-decoration: none;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--bg-sage-tint);
  white-space: nowrap;
}

.track-search-link:hover {
  background: var(--sage-700);
  color: #fff;
}

.music-cue-tip {
  font-size: 11.5px;
  color: var(--text-muted);
}

.music-card-actions {
  display: flex;
  gap: 6px;
}

/* 动作序列卡片 */
.exercise-cards-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.phase-divider {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  border-radius: 8px;
  background: var(--bg-subtle);
  border-left: 4px solid var(--sage-700);
  margin-top: 6px;
}

.phase-divider-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--sage-900);
}

.phase-divider-meta {
  font-size: 12px;
  color: var(--text-secondary);
}

.ex-card {
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  background: #fff;
  overflow: hidden;
  transition: box-shadow 0.16s ease, border-color 0.16s ease;
}

.ex-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}

.ex-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 16px;
  background: #faf8f4;
  border-bottom: 1px solid var(--border-light);
}

.ex-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.ex-index-pill {
  padding: 3px 9px;
  border-radius: 6px;
  background: var(--sage-700);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.ex-time-range {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--clay-600);
  font-variant-numeric: tabular-nums;
}

.ex-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
}

.ex-en-name {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-muted);
}

.ex-tag-pill {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  background: var(--bg-sage-tint);
  color: var(--sage-700);
}

.ex-tag-pill.spring-pill {
  background: #eef2ff;
  color: #3730a3;
}

.ex-tag-pill.issue-hit-pill {
  background: var(--bg-clay-tint);
  color: var(--clay-600);
}

.ex-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.ex-card-body {
  padding: 15px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* 组次、时长、目的、关注位置四格行 */
.ex-metrics-grid {
  display: grid;
  grid-template-columns: 220px 1fr 1fr;
  gap: 12px;
}

.metric-box {
  background: var(--bg-page);
  border-radius: 9px;
  padding: 10px 12px;
  border: 1px solid var(--border-light);
}

.metric-label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.metric-val {
  font-size: 13px;
  color: var(--text-main);
  font-weight: 500;
}

.inline-dosage-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 5px;
}

.inline-dosage-controls input[type="text"] {
  padding: 4px 7px;
  font-size: 12.5px;
  font-weight: 600;
}

.min-stepper {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: #fff;
  overflow: hidden;
}

.min-stepper button {
  border: none;
  background: transparent;
  padding: 3px 7px;
  cursor: pointer;
  font-weight: 700;
  color: var(--sage-700);
}

.min-stepper button:hover {
  background: var(--bg-sage-tint);
}

.min-stepper span {
  font-size: 12px;
  font-weight: 700;
  padding: 0 5px;
  white-space: nowrap;
}

/* 呼吸与口令高亮区 */
.ex-cues-grid {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 12px;
}

.breath-box {
  background: #f3f7fa;
  border: 1px solid #d7e4ee;
  border-radius: 9px;
  padding: 11px 13px;
}

.breath-box .metric-label {
  color: #2b5b84;
}

.cue-box {
  background: var(--bg-sage-tint);
  border: 1px solid var(--sage-200);
  border-radius: 9px;
  padding: 11px 14px;
}

.cue-box .metric-label {
  color: var(--sage-900);
}

.cue-text-block {
  font-size: 13.5px;
  color: #1f2e26;
  line-height: 1.6;
}

.cue-dual-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.cue-sub-item {
  background: rgba(255, 255, 255, 0.7);
  border-radius: 7px;
  padding: 8px 10px;
}

.cue-sub-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  margin-bottom: 4px;
  background: var(--sage-700);
  color: #fff;
}

.cue-sub-tag.group-tag {
  background: var(--clay-600);
}

/* 退阶替代与风险提示双栏 */
.ex-safety-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.regression-box {
  background: #faf7ff;
  border: 1px solid #e4dbf5;
  border-radius: 9px;
  padding: 10px 13px;
}

.regression-box.regression-active {
  background: #ede9fe;
  border-color: #8b5cf6;
}

.regression-box .metric-label {
  color: #5b21b6;
}

.risk-box {
  background: var(--bg-amber-tint);
  border: 1px solid #fde68a;
  border-radius: 9px;
  padding: 10px 13px;
}

.risk-box .metric-label {
  color: var(--amber-700);
}

/* 课后作业栏 */
.homework-box {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.homework-card {
  background: var(--bg-page);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 12px 14px;
}

.homework-card h4 {
  font-size: 13.5px;
  color: var(--sage-900);
  margin-bottom: 6px;
}

.homework-card textarea {
  background: #fff;
  min-height: 74px;
}

/* 侧边抽屉（替换动作 & 课程档案） */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(25, 28, 26, 0.42);
  z-index: 90;
}

.side-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(540px, 94vw);
  height: 100vh;
  background: #fff;
  z-index: 100;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
}

.drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-page);
}

.drawer-header h3 {
  font-size: 16.5px;
  color: var(--sage-900);
}

.drawer-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 3px;
}

.icon-close-btn {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--border-light);
  background: #fff;
  cursor: pointer;
  font-size: 14px;
}

.drawer-filters {
  padding: 12px 20px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.drawer-filter-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 20px 28px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.candidate-card {
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 12px 14px;
  background: #fcfbf9;
  transition: border-color 0.15s ease;
}

.candidate-card:hover {
  border-color: var(--sage-600);
}

.candidate-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.candidate-name {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--sage-900);
}

.candidate-reason {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--clay-600);
  background: var(--bg-clay-tint);
  padding: 2px 8px;
  border-radius: 999px;
  margin-bottom: 6px;
}

.candidate-meta {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

/* 自定义动作弹窗 */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(25, 28, 26, 0.5);
  z-index: 110;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-box {
  width: min(680px, 96vw);
  max-height: 90vh;
  overflow-y: auto;
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 22px;
  border-bottom: 1px solid var(--border-light);
}

.modal-body {
  padding: 18px 22px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border-light);
}

/* 现场带课提词器全屏模式 */
.teleprompter-overlay {
  position: fixed;
  inset: 0;
  z-index: 150;
  background: #19241e;
  color: #f4f1ea;
  display: flex;
  flex-direction: column;
  padding: 20px 32px;
  overflow-y: auto;
}

.tele-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.tele-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.tele-badge {
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--clay-600);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.tele-controls {
  display: flex;
  gap: 10px;
}

.tele-btn-light {
  color: #f4f1ea !important;
  border-color: rgba(255, 255, 255, 0.3) !important;
  background: rgba(255, 255, 255, 0.08) !important;
}

.tele-main {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 28px;
  padding-top: 22px;
  align-items: start;
}

.tele-progress-meta {
  display: flex;
  gap: 14px;
  font-size: 14px;
  color: #9ec5b0;
  font-weight: 600;
  margin-bottom: 8px;
}

.tele-ex-name {
  font-size: 32px;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 10px;
}

.tele-setup-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.tele-setup-pills span {
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  font-size: 13px;
}

.tele-cue-card {
  background: rgba(255, 255, 255, 0.09);
  border-left: 5px solid #6fcf97;
  border-radius: 12px;
  padding: 18px 22px;
  margin-bottom: 16px;
}

.tele-card-label {
  font-size: 13px;
  font-weight: 700;
  color: #9ec5b0;
  margin-bottom: 6px;
}

.tele-cue-text {
  font-size: 22px;
  line-height: 1.6;
  font-weight: 600;
  color: #fff;
}

.tele-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}

.tele-sub-card {
  background: rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 15px;
  line-height: 1.55;
}

.tele-risk-card {
  background: rgba(217, 119, 6, 0.16);
  border: 1px solid rgba(251, 191, 36, 0.35);
}

.tele-mod-card {
  background: rgba(139, 92, 246, 0.14);
  border: 1px solid rgba(196, 181, 253, 0.3);
}

.tele-right {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.tele-timer-ring {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 16px;
  padding: 24px 20px;
  text-align: center;
}

.tele-timer-label {
  font-size: 13px;
  color: #b7c4bc;
}

.tele-timer-digits {
  font-size: 56px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: 2px;
  margin: 6px 0;
  color: #fff;
}

.tele-sets-text {
  font-size: 15px;
  color: #e6b89c;
  font-weight: 600;
  margin-bottom: 16px;
}

.tele-timer-btns {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.tele-music-box {
  background: rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 13.5px;
}

.tele-nav-btns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* Toast 提示 */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast-item {
  background: var(--sage-900);
  color: #fff;
  padding: 10px 16px;
  border-radius: 10px;
  box-shadow: var(--shadow-md);
  font-size: 13px;
  font-weight: 500;
}

/* 长图海报预览弹窗 */
.poster-modal-box {
  width: min(560px, 95vw);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.poster-scroll-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  background: #ebe6dc;
  text-align: center;
  -webkit-overflow-scrolling: touch;
}

.poster-preview-img {
  width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: var(--shadow-md);
  display: block;
}

/* 手机端底部类小程序导航栏（桌面端隐藏） */
.mobile-bottom-nav {
  display: none;
}

/* 平板适配 */
@media (max-width: 1120px) {
  .workspace-grid {
    grid-template-columns: 1fr;
  }
  .input-sidebar {
    position: static;
    max-height: none;
  }
  .ex-metrics-grid,
  .ex-cues-grid,
  .ex-safety-grid,
  .safety-alert-card,
  .homework-box,
  .tele-main {
    grid-template-columns: 1fr;
  }
  .plan-meta-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .timeline-legend-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* 手机微信内置浏览器专项适配（<= 860px 类小程序竖屏单手交互） */
@media (max-width: 860px) {
  .topbar {
    padding: 10px 14px;
  }
  .brand-subtitle,
  #btnToggleSidebar,
  #btnOpenSaved,
  #btnTeleprompter {
    display: none !important;
  }
  .brand-title {
    font-size: 16px;
  }
  .brand-title span {
    display: block;
    margin-left: 0;
    font-size: 12px;
  }
  .preset-strip {
    padding: 8px 14px;
    -webkit-overflow-scrolling: touch;
  }
  .workspace-grid {
    padding: 12px 12px calc(86px + env(safe-area-inset-bottom));
    gap: 12px;
  }

  /* 手机端按底部Tab切换「排课条件」与「完整教案」，免去上下翻找几千像素 */
  body.mob-view-plan .input-sidebar {
    display: none !important;
  }
  body.mob-view-form .plan-canvas,
  body.mob-view-form .preset-strip {
    display: none !important;
  }

  .field-row-2,
  .field-row-3,
  .cue-dual-split,
  .plan-meta-grid,
  .timeline-legend-grid {
    grid-template-columns: 1fr;
  }

  .plan-header-card {
    padding: 16px 16px;
    border-radius: 14px;
  }
  .plan-main-title {
    font-size: 18px;
  }
  .doc-section {
    padding: 14px 14px;
    border-radius: 14px;
  }
  .canvas-toolbar {
    padding: 10px 12px;
  }
  .cue-mode-switch {
    width: 100%;
    overflow-x: auto;
  }
  .switch-label {
    display: none;
  }
  .cue-tab {
    flex: 1;
    text-align: center;
    padding: 6px 6px;
    font-size: 11.5px;
    white-space: nowrap;
  }

  /* 手机竖屏带课提词器紧凑置顶计时器 */
  .teleprompter-overlay {
    padding: 14px 16px calc(24px + env(safe-area-inset-bottom));
  }
  .tele-main {
    display: flex;
    flex-direction: column-reverse;
    gap: 14px;
    padding-top: 12px;
  }
  .tele-right {
    width: 100%;
    gap: 10px;
  }
  .tele-timer-ring {
    padding: 14px 16px;
  }
  .tele-timer-digits {
    font-size: 40px;
  }
  .tele-ex-name {
    font-size: 22px;
  }
  .tele-cue-text {
    font-size: 17px;
  }
  .tele-two-col {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  /* 底部固定 5 格导航栏 */
  .mobile-bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 80;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--border-strong);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    box-shadow: 0 -4px 18px rgba(31, 51, 41, 0.08);
  }
  .mob-nav-btn {
    border: none;
    background: transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 4px 2px;
    color: var(--text-muted);
    cursor: pointer;
    font-family: inherit;
  }
  .mob-nav-icon {
    font-size: 17px;
    line-height: 1.1;
  }
  .mob-nav-text {
    font-size: 11px;
    font-weight: 600;
  }
  .mob-nav-btn.active {
    color: var(--sage-700);
  }
  .mob-nav-btn.active .mob-nav-text {
    font-weight: 700;
  }

  .toast-container {
    left: 16px;
    right: 16px;
    bottom: calc(74px + env(safe-area-inset-bottom));
    align-items: center;
  }
}

/* 专业 A4 教案打印与导出 PDF 样式 */
@media print {
  @page {
    size: A4 portrait;
    margin: 12mm;
  }

  body {
    background: #fff !important;
    color: #111 !important;
    font-size: 11.5px;
  }

  .no-print {
    display: none !important;
  }

  .workspace-grid {
    display: block !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .plan-header-card {
    background: #f3f6f4 !important;
    color: #111 !important;
    border: 1.5px solid #2f4b3d !important;
    box-shadow: none !important;
    padding: 14px 16px !important;
  }

  .plan-sub-meta,
  .meta-stat-label,
  .meta-stat-value,
  .header-badge {
    color: #111 !important;
    border: 1px solid #bbb;
  }

  .doc-section {
    box-shadow: none !important;
    border: 1px solid #ccc !important;
    padding: 12px 14px !important;
    margin-bottom: 10px !important;
    break-inside: avoid-page;
  }

  .ex-card {
    break-inside: avoid;
    border: 1px solid #bbb !important;
    margin-bottom: 8px !important;
  }

  .ex-metrics-grid {
    grid-template-columns: 160px 1fr 1fr !important;
  }

  .ex-cues-grid {
    grid-template-columns: 220px 1fr !important;
  }

  /* 一页纸带课速览卡精简打印模式 */
  body.print-compact #safetyBannerSection,
  body.print-compact #afterClassSection,
  body.print-compact .ex-metrics-grid,
  body.print-compact .track-list,
  body.print-compact .section-desc {
    display: none !important;
  }

  body.print-compact .ex-card-body {
    padding: 8px 12px !important;
    gap: 6px !important;
  }
}
