:root {
  --bg: #f4f6f3;
  --surface: #ffffff;
  --ink: #18211f;
  --muted: #69736f;
  --line: #d9dfd7;
  --accent: #136f63;
  --accent-2: #c7502f;
  --soft: #e7f0ed;
  --warn-soft: #f8e8df;
  --shadow: 0 18px 40px rgba(24, 33, 31, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter, "Segoe UI", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
}

button,
textarea {
  font: inherit;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 292px;
  padding: 22px;
  background: #16211f;
  color: #eef5f2;
  overflow: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  color: #fff;
  font-weight: 800;
}

.brand h1 {
  margin: 0;
  font-size: 19px;
  letter-spacing: 0;
}

.brand p,
.goal,
.eyebrow {
  margin: 0;
  color: var(--muted);
}

.brand p {
  color: #aebbb6;
  font-size: 13px;
}

.progress-card {
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.sync-card {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.sync-card p {
  margin: 9px 0 0;
  color: #aebbb6;
  font-size: 12px;
  line-height: 1.45;
}

.sync-input {
  width: 100%;
  height: 38px;
  margin-top: 12px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: #eef5f2;
}

.sync-button {
  width: 100%;
  min-height: 36px;
  margin-top: 8px;
  border: 1px solid #5fd1bd;
  border-radius: 6px;
  background: #1d6f63;
  color: #fff;
  cursor: pointer;
}

.progress-top,
.panel-head,
.timer,
.hero,
.chat-actions,
.record-actions,
.timer-actions {
  display: flex;
  align-items: center;
}

.progress-top,
.panel-head,
.timer,
.hero {
  justify-content: space-between;
  gap: 16px;
}

.progress-track {
  height: 8px;
  margin-top: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
}

.progress-bar {
  width: 0;
  height: 100%;
  background: #5fd1bd;
}

.nav-section-title {
  margin: 22px 0 10px;
  color: #aebbb6;
  font-size: 12px;
}

.day-list {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 7px;
}

.day-button {
  height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  color: #eef5f2;
  cursor: pointer;
}

.day-button.active {
  border-color: #5fd1bd;
  background: #1d6f63;
}

.day-button.done {
  color: #15201d;
  background: #a9e1d5;
}

.app {
  min-height: 100vh;
  margin-left: 292px;
  padding: 28px;
}

.hero {
  min-height: 154px;
  padding: 28px;
  border-radius: 8px;
  background:
    linear-gradient(rgba(14, 31, 29, 0.72), rgba(14, 31, 29, 0.72)),
    url("https://images.unsplash.com/photo-1497366754035-f200968a6e72?auto=format&fit=crop&w=1400&q=80") center/cover;
  color: #fff;
  box-shadow: var(--shadow);
}

.hero h2 {
  margin: 6px 0 8px;
  font-size: clamp(28px, 4vw, 44px);
  letter-spacing: 0;
}

.hero .goal,
.hero .eyebrow {
  max-width: 760px;
  color: #d9e7e3;
}

.hero-actions,
.timer-actions,
.record-actions,
.chat-actions,
.material-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.word-pronunciation-hint {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 13px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 22px;
  margin-top: 22px;
}

.main-column,
.side-column {
  display: grid;
  gap: 22px;
  align-content: start;
}

.panel {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel h3,
.panel h4 {
  margin: 0;
  letter-spacing: 0;
}

.panel h3 {
  font-size: 18px;
}

.panel h4 {
  margin-bottom: 10px;
  font-size: 14px;
}

.panel-head {
  margin-bottom: 16px;
}

.panel-head span,
#timerStatus,
#recordStatus,
#levelLabel {
  color: var(--muted);
  font-size: 13px;
}

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

.segment {
  min-height: 112px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  cursor: pointer;
}

.segment.active {
  border-color: var(--accent);
  background: var(--soft);
}

.segment strong {
  display: block;
  margin-bottom: 5px;
}

.segment span,
.segment p {
  color: var(--muted);
  font-size: 13px;
}

.segment p {
  margin: 8px 0 0;
  line-height: 1.45;
}

.segment.target-warmup::after,
.segment.target-scene::after,
.segment.target-pattern::after,
.segment.target-output::after {
  display: block;
  margin-top: 10px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}

.segment.target-warmup::after {
  content: "对应：热身句";
}

.segment.target-scene::after {
  content: "对应：场景跟读文本";
}

.segment.target-pattern::after {
  content: "对应：外贸句型";
}

.segment.target-output::after {
  content: "对应：今日输出任务";
}

.timer {
  margin-top: 16px;
  padding: 16px;
  border-radius: 8px;
  background: #f7faf8;
}

.timer strong {
  display: block;
  margin-top: 2px;
  font-size: 34px;
}

.primary-btn,
.ghost-btn {
  min-height: 40px;
  padding: 0 14px;
  border-radius: 6px;
  cursor: pointer;
}

.primary-btn {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
}

.ghost-btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.hero .ghost-btn {
  border-color: rgba(255, 255, 255, 0.42);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.practice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.practice-block {
  scroll-margin-top: 18px;
  border-radius: 8px;
  transition:
    background 160ms ease,
    box-shadow 160ms ease,
    outline-color 160ms ease;
}

.practice-block.highlight {
  outline: 2px solid var(--accent);
  background: var(--soft);
  box-shadow: 0 0 0 6px rgba(19, 111, 99, 0.12);
}

.line-list,
.check-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.scene-script {
  margin: 0;
  line-height: 1.75;
  white-space: pre-line;
}

.scene-line {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  line-height: 1.55;
}

.scene-line:first-child {
  padding-top: 0;
}

.scene-line:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.scene-translation {
  margin: 12px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
  white-space: pre-line;
}

body.hide-notes .zh-note,
body.hide-notes .scene-translation {
  display: none;
}

body.hide-english .english-line,
body.hide-english .word-pronunciation-hint {
  display: none;
}

.line-list li,
.check-list li {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  line-height: 1.5;
}

.english-line {
  display: block;
}

.speakable-word {
  position: relative;
  appearance: none;
  padding: 0 1px;
  border: 0;
  border-bottom: 1px dotted rgba(19, 111, 99, 0.45);
  border-radius: 3px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  line-height: inherit;
}

.speakable-word[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  z-index: 20;
  min-width: max-content;
  max-width: 220px;
  padding: 6px 9px;
  border-radius: 8px;
  background: #1d2b2a;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: 0.01em;
  text-align: center;
  white-space: pre;
  box-shadow: 0 8px 18px rgba(29, 43, 42, 0.18);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.speakable-word[data-tooltip]::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: calc(100% + 3px);
  z-index: 21;
  border: 5px solid transparent;
  border-top-color: #1d2b2a;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.speakable-word:hover,
.speakable-word:focus-visible,
.speakable-word.speaking {
  background: #e5f2ed;
  color: var(--accent);
  outline: none;
}

.speakable-word[data-tooltip]:hover::after,
.speakable-word[data-tooltip]:hover::before,
.speakable-word[data-tooltip]:focus-visible::after,
.speakable-word[data-tooltip]:focus-visible::before {
  opacity: 1;
  transform: translate(-50%, 0);
}

.speakable-word:focus-visible {
  box-shadow: 0 0 0 2px rgba(19, 111, 99, 0.28);
}

.zh-note {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.script-box,
.scenario {
  margin-top: 16px;
  padding: 14px;
  border-radius: 8px;
  background: var(--soft);
  line-height: 1.55;
}

.scenario {
  margin-top: 0;
}

.chat-log {
  display: grid;
  gap: 10px;
  min-height: 180px;
  max-height: 300px;
  margin: 16px 0;
  overflow: auto;
}

.bubble {
  padding: 11px 12px;
  border-radius: 8px;
  background: #f1f4f2;
  line-height: 1.45;
}

.bubble.customer {
  border-left: 4px solid var(--accent-2);
  background: var(--warn-soft);
  cursor: pointer;
}

.bubble.customer.selected {
  outline: 2px solid var(--accent-2);
  box-shadow: 0 0 0 5px rgba(199, 80, 47, 0.12);
}

textarea {
  width: 100%;
  min-height: 112px;
  margin-top: 14px;
  padding: 12px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
}

.speech-recognition-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.recognition-status {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.recordings-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.recording-item {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faf8;
}

.recording-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.recording-remove {
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--accent-2);
  cursor: pointer;
  font-size: 12px;
}

.recording-item audio {
  width: 100%;
}

.recording-download {
  color: var(--accent);
  font-size: 13px;
  text-decoration: none;
}

.recordings-list.compact .recording-item {
  padding: 10px;
}

.review-box {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.review-box h4 {
  margin: 0 0 10px;
}

.audio-upload {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  min-width: 0;
}

.audio-upload-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
  margin: 12px 0;
}

.audio-upload input {
  width: 100%;
}

.remove-audio-btn {
  border-color: #e2b8b2;
  color: #a33a2d;
}

.remove-audio-btn:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.audio-preview {
  display: none;
  width: 100%;
  margin-bottom: 12px;
}

.audio-preview.has-audio {
  display: block;
}

.review-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.review-result {
  margin-top: 12px;
  padding: 12px;
  border-radius: 8px;
  background: var(--soft);
  line-height: 1.6;
  white-space: pre-line;
}

.review-result:empty {
  display: none;
}

.chat-review-box {
  margin-top: 14px;
}

@media (max-width: 1120px) {
  .layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .sidebar {
    position: static;
    width: auto;
  }

  .app {
    margin-left: 0;
    padding: 16px;
  }

  .hero,
  .timer,
  .panel-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .segments,
  .practice-grid {
    grid-template-columns: 1fr;
  }

  .day-list {
    grid-template-columns: repeat(6, 1fr);
  }
}
