:root {
  font-family: Inter, "Microsoft YaHei", sans-serif;
  color: #183047;
  background: #eaf1f5;
}

* { box-sizing: border-box; }
body { margin: 0; }
button, input, textarea { font: inherit; }
button { cursor: pointer; touch-action: manipulation; }

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 360px 1fr;
}

aside {
  background: white;
  padding: 42px 34px;
  border-right: 1px solid #d9e2e8;
}

.path, small, .note { color: #7990a4; }
h1 { font-size: 30px; margin: 14px 0 34px; }
aside section { border-top: 1px solid #e2e9ed; padding: 25px 0; line-height: 1.8; }
aside strong { display: block; color: #008b80; font-size: 21px; margin-top: 10px; }
.note { margin-top: 32px; font-size: 13px; }

.workspace {
  max-width: 1200px;
  width: 100%;
  margin: auto;
  padding: 28px 34px;
}

.workspace header { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.workspace h2 { font-size: 26px; margin: 6px 0 18px; }
.workspace header > span {
  flex: 0 0 auto;
  background: #d9f5f0;
  color: #008b80;
  padding: 9px 16px;
  border-radius: 999px;
}

.secondary {
  padding: 12px 18px;
  background: white;
  border: 1px solid #cad8e1;
  border-radius: 12px;
  color: #26445c;
}

.secondary:disabled { opacity: .42; cursor: not-allowed; }
.mobile-topline, .compact-label, .record-compact { display: none; }

.task-controls {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin: 0 0 12px;
}

.task-controls button { padding: 9px 13px; }
.control-icon { margin-right: 3px; }

.start-screen {
  min-height: 430px;
  height: 58vh;
  background: linear-gradient(145deg, #fff, #edf8f6);
  border: 1px solid #d8e3e9;
  border-radius: 22px;
  padding: 44px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.start-screen h3 { font-size: 26px; margin: 12px 0; }
.start-screen p { max-width: 520px; color: #61798c; line-height: 1.7; margin: 0 0 24px; }
.begin {
  border: 0;
  background: #078b80;
  color: white;
  border-radius: 14px;
  padding: 15px 34px;
  font-size: 17px;
  font-weight: 700;
}
.begin:disabled { opacity: .65; }

.conversation {
  height: 58vh;
  min-height: 430px;
  background: white;
  border: 1px solid #d8e3e9;
  border-radius: 22px;
  padding: 28px;
  overflow: auto;
  overscroll-behavior: contain;
}

.message { max-width: 72%; margin: 0 0 24px; }
.message.user { margin-left: auto; }
.label { font-size: 13px; color: #7a91a4; margin: 0 8px 7px; }
.bubble { padding: 16px 20px; border-radius: 18px; background: #edf2f5; font-size: 18px; line-height: 1.55; }
.user .bubble { background: #dff4f1; }
.system {
  margin: 12px auto 22px;
  text-align: center;
  color: #6b8192;
  font-size: 13px;
  background: #f1f4f6;
  border-radius: 999px;
  padding: 7px 14px;
  width: max-content;
  max-width: 100%;
}

.action {
  margin-top: 16px;
  background: #fff6df;
  border: 1px solid #ebcc79;
  border-radius: 18px;
  padding: 18px 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
}

.action strong { font-size: 19px; }
.action button, .workspace form button {
  border: 0;
  background: #078b80;
  color: white;
  border-radius: 12px;
  padding: 14px 24px;
  font-weight: 700;
}

.hidden { display: none !important; }

form { display: flex; gap: 12px; margin-top: 15px; }
.input-wrap {
  flex: 1;
  min-width: 0;
  border: 1px solid #ccd9e1;
  border-radius: 13px;
  background: white;
  display: flex;
  align-items: flex-end;
}
.input-wrap textarea {
  flex: 1;
  min-width: 0;
  max-height: 132px;
  padding: 15px 8px 15px 16px;
  border: 0;
  outline: 0;
  resize: none;
  overflow-y: auto;
  background: transparent;
  color: inherit;
  font-size: 17px;
  line-height: 1.45;
}
.workspace form .transcribe {
  flex: 0 0 auto;
  margin: 7px;
  padding: 8px 10px;
  border: 1px solid #92cfc8;
  background: white;
  color: #087f76;
  font-size: 13px;
  white-space: nowrap;
}
.workspace form .transcribe.recording { background: #078b80; color: white; border-color: #078b80; }

.workspace form .record {
  background: white;
  color: #087f76;
  border: 1px solid #92cfc8;
  min-width: 125px;
  padding: 14px;
}

.workspace form .record.recording { background: #078b80; color: white; border-color: #078b80; }
.speech-status { margin: 7px 2px 0; color: #6d8395; font-size: 13px; }
.message-tools { display: flex; align-items: center; gap: 12px; margin-top: 7px; }
.speak, .translate { border: 0; padding: 3px 0; background: transparent; color: #087f76; cursor: pointer; font-size: 14px; }
.translation { margin-top: 10px; padding-top: 10px; border-top: 1px solid #d5e0e5; color: #506b7e; font-size: 15px; }
.user-speak { margin-left: 10px; border: 0; background: transparent; color: #087f76; cursor: pointer; font-size: 14px; }
.suggestions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.suggestions button {
  border: 1px solid #cfdae1;
  background: white;
  color: #516a7e;
  border-radius: 999px;
  padding: 8px 12px;
}

.completion-actions {
  margin-top: 16px;
  background: white;
  border: 1px solid #d8e3e9;
  border-radius: 18px;
  padding: 18px 22px;
}

.completion-actions p { margin: 0 0 14px; color: #516a7e; }
.completion-actions > div { display: flex; gap: 12px; flex-wrap: wrap; }
.review { padding: 13px 20px; border: 0; border-radius: 12px; background: #247f4d; color: white; font-weight: 700; }
.review:disabled { opacity: .7; cursor: wait; }
.coach { margin-top: 15px; background: #eef9f2; border: 1px solid #b9dfc6; border-radius: 18px; padding: 22px; line-height: 1.7; }
.journey { margin-top: 15px; background: #edf8f6; border: 1px solid #a9d8d2; border-radius: 18px; padding: 22px; line-height: 1.7; }
.journey h3 { margin-top: 0; }
.journey ol { padding-left: 24px; }
.journey-advice { padding: 12px 14px; background: white; border-radius: 12px; color: #087f76; }
.journey-focus { margin: 14px 0; padding: 13px 15px; background: rgba(255,255,255,.7); border-radius: 12px; }
.journey-focus ul { margin-bottom: 0; padding-left: 22px; }
.coach ul { padding-left: 22px; }
.review-scores { display: grid; gap: 8px; margin-bottom: 16px; }
.score-row { display: grid; grid-template-columns: 110px minmax(0, 1fr); align-items: center; gap: 10px; }
.stars { display: flex; gap: 3px; color: #cbd5d1; line-height: 1; }
.star.active { color: #efad20; }
.review-summary { padding: 13px 15px; background: rgba(255,255,255,.62); border-radius: 12px; }
.review-examples { display: grid; gap: 10px; margin-top: 18px; }
.example-group { padding: 14px 15px; background: white; border: 1px solid #d6e8dc; border-radius: 13px; }
.example-group h4 { margin: 0 0 7px; color: #247f4d; }
.example-group p { margin: 5px 0; }
.example-original { color: #61798c; }
.error { color: #b43b3b; }
.toast { position: fixed; z-index: 20; left: 50%; bottom: 82px; transform: translateX(-50%); width: max-content; max-width: calc(100vw - 32px); padding: 11px 16px; border-radius: 999px; background: #183047; color: white; font-size: 14px; box-shadow: 0 8px 24px rgba(24,48,71,.24); pointer-events: none; }

@media (max-width: 800px) {
  :root { background: white; }
  body {
    min-width: 320px;
    padding-top: env(safe-area-inset-top);
  }

  .shell { display: block; height: calc(100dvh - env(safe-area-inset-top)); min-height: 0; }
  aside { display: none; }

  .workspace {
    height: 100dvh;
    min-height: 0;
    margin: 0;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
    overflow-y: auto;
  }

  .mobile-topline {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 27px;
  }
  .mobile-path {
    display: block;
    min-width: 0;
    margin: 0;
    color: #71889a;
    font-size: 11px;
    line-height: 27px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .workspace header { display: none; }
  .mobile-task-title {
    display: block;
    flex: 0 0 auto;
    overflow: hidden;
    color: #183047;
    font-size: 12px;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .task-controls {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    flex: 0 0 auto;
    margin: 3px 0 6px;
  }

  .task-controls button {
    min-height: 35px;
    padding: 5px;
    font-size: 12px;
    white-space: nowrap;
  }

  .wide-label { display: none; }
  .compact-label { display: inline; }
  .control-icon { display: inline; margin: 0 3px 0 0; font-size: 14px; line-height: 1; }

  .conversation, .start-screen { flex: 1 1 0; height: auto; min-height: 180px; border-radius: 17px; }

  .start-screen { padding: 28px 20px; }
  .start-screen h3 { font-size: 22px; line-height: 1.4; }
  .start-screen p { font-size: 14px; }
  .begin { min-width: 160px; min-height: 50px; }
  .conversation { padding: 18px 14px; }
  .message { max-width: 92%; margin-bottom: 17px; }
  .label { margin-bottom: 5px; }
  .bubble { padding: 13px 15px; border-radius: 16px; font-size: 16px; line-height: 1.55; }
  .speak, .translate { min-height: 38px; padding: 6px 2px; }
  .user-speak { min-height: 38px; margin-left: 5px; padding: 6px; }
  .system { margin-bottom: 16px; font-size: 12px; white-space: normal; }

  .action { flex-direction: column; align-items: stretch; padding: 16px; gap: 13px; border-radius: 15px; }
  .action strong { font-size: 17px; }
  .action button { width: 100%; min-height: 50px; }

  form {
    display: grid;
    grid-template-columns: 78px minmax(0, 1fr) auto;
    flex: 0 0 auto;
    gap: 7px;
    margin-top: 9px;
  }

  .workspace form .record {
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
    min-height: 52px;
    width: 100%;
    padding: 8px 5px;
    font-size: 14px;
    font-weight: 700;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
  }

  .record-wide { display: none; }
  .record-compact { display: inline; }
  .input-wrap { grid-column: 2; grid-row: 1; min-height: 52px; }
  .input-wrap textarea { min-height: 50px; padding: 13px 5px 12px 10px; font-size: 16px; }
  .workspace form .transcribe { min-height: 36px; margin: 7px 5px 7px 0; padding: 5px 7px; font-size: 11px; }
  .workspace form .send { grid-column: 3; grid-row: 1; min-height: 52px; padding: 10px 16px; }
  .speech-status, .suggestions { display: none !important; }

  .completion-actions { flex: 0 0 auto; margin-top: 9px; border-radius: 15px; padding: 10px 12px 12px; }
  .completion-actions p { margin: 0 0 8px; font-size: 13px; line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .completion-actions > div { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 7px; }
  .completion-actions button { width: 100%; min-height: 43px; padding: 8px 5px; font-size: 13px; white-space: nowrap; }
  .coach { border-radius: 15px; padding: 17px 15px; }
  .coach { font-size: 15px; overflow-wrap: anywhere; }
  .score-row { grid-template-columns: 88px minmax(0, 1fr); gap: 6px; }
  .stars { gap: 1px; font-size: 15px; }
  .example-group { padding: 12px; }
  .conversation.review-expanded { flex: 0 0 var(--review-conversation-height); height: var(--review-conversation-height); min-height: 180px; }
  .workspace.recording-active .conversation { background: #eaf9f7; border-color: #42aaa1; box-shadow: inset 0 0 0 2px rgba(7,139,128,.14); transition: background .12s, border-color .12s; }
  .workspace.recording-active form { border-radius: 14px; background: #dcf4f1; box-shadow: 0 0 0 5px #dcf4f1; }
  .toast { bottom: calc(76px + env(safe-area-inset-bottom)); }
}

@media (max-width: 380px) {
  .workspace { padding-left: 7px; padding-right: 7px; }
  .mobile-task-title { font-size: 16px; }
  form { grid-template-columns: 70px minmax(0, 1fr) auto; gap: 5px; }
  .workspace form .send { padding-left: 12px; padding-right: 12px; }
  .bubble { font-size: 15px; }
}
.voice-mode { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border: 1px solid #9fd8d2; border-radius: 16px; background: #f1fbfa; color: #557178; }
.voice-mode button { border: 1px solid #07958b; border-radius: 999px; padding: 10px 16px; background: #fff; color: #087d75; font-weight: 700; cursor: pointer; }
.voice-mode button.active { background: #07958b; color: #fff; }
.workspace.live-listening .conversation { box-shadow: inset 0 0 0 2px #79cbc3; background: #f4fcfb; }
.workspace.live-speaking .conversation { box-shadow: inset 0 0 0 3px #07958b; background: #eaf9f7; }
@media (max-width: 800px) { .voice-mode { padding: 6px 8px; min-height: 42px; } .voice-mode span { display: none; } .voice-mode button { width: 100%; padding: 8px; } }
