/* =========================================================================
 * 记词宝 · 今日说一段（AI 口语对话）—— 本页布局
 * -------------------------------------------------------------------------
 * 只放布局与组件样式；配色/主题一律用 css/speaking.css 里的变量，
 * 不要在这里写死颜色（否则 20 套主题里有 19 套会错）。
 *
 * 三端同一份文件：
 *   宽屏（≥900px）→ 左侧信息 + 中间对话 + 右侧实时反馈（桌面优势）
 *   窄屏（<900px）→ 纵向堆叠，反馈自动滚到眼前
 * ========================================================================= */

body { background: var(--bg); }

/* ---------------- 顶栏 ---------------- */
.tk-top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  height: 52px; padding: 0 12px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.tk-back {
  width: 34px; height: 34px; flex: none;
  display: flex; align-items: center; justify-content: center;
  border-radius: 9px; background: var(--soft);
  color: var(--ink); text-decoration: none; font-size: 18px; line-height: 1;
}
.tk-back:active { background: var(--accent-soft); }
.tk-title {
  flex: 1; min-width: 0; text-align: center;
  font-size: 16px; font-weight: 700; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* 右上角会员状态（2026-10-31：口语不再卖兑换码，统一进会员权益）
   未开通 = 描边「开通会员」；已开通 = 实底「会员 · 至 日期」 */
.tk-member {
  flex: none; border: 1px solid var(--accent);
  background: var(--accent-soft); color: var(--accent-ink);
  font-size: 12.5px; font-weight: 700; font-family: inherit;
  padding: 6px 11px; border-radius: 9px; cursor: pointer;
  white-space: nowrap;
}
.tk-member:active { opacity: .8; }
.tk-member.on { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ---------------- 通用容器（选一段 / 报告） ---------------- */
.tk-wrap {
  max-width: 900px; margin: 0 auto;
  padding: 16px 12px calc(28px + env(safe-area-inset-bottom, 0px));
}
.tk-intro {
  margin: 0 0 14px; font-size: 13.5px; line-height: 1.75; color: var(--muted);
}
.tk-intro b { color: var(--ink); }
.tk-dim { display: block; margin-top: 4px; font-size: 12px; color: var(--faint); }
.tk-sub { margin: 10px 0 8px; font-size: 12.5px; color: var(--faint); }
.tk-empty { margin: 22px 0; text-align: center; font-size: 13px; color: var(--faint); }
.tk-note { margin: 16px 0 0; text-align: center; font-size: 12px; color: var(--faint); }

/* ---------------- 未登录提示 ---------------- */
.tk-login {
  background: var(--warn-soft); border: 1px solid var(--warn);
  color: var(--warn); border-radius: 11px;
  padding: 11px 13px; margin-bottom: 13px;
  font-size: 13px; line-height: 1.7;
}
.tk-login b { font-weight: 700; }
.tk-login a { color: var(--accent-ink); font-weight: 700; text-decoration: underline; }
/* 非会员但还有免费试用 → 温和提示，不挡路 */
.tk-login.trial {
  background: var(--soft); border-color: var(--line); color: var(--muted);
}
.tk-login.trial b { color: var(--ink); }
.tk-login.trial a { color: var(--accent-ink); }
/* 试用用完 / 非会员时换成更醒目的强调色（不是错误，是引导开通） */
.tk-login.member {
  background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink);
}
.tk-login.member a { color: var(--accent-ink); }

/* ---------------- 三类型切换 ---------------- */
.tk-tabs {
  display: flex; gap: 7px;
  overflow-x: auto; overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 2px;
}
.tk-tab {
  flex: none; white-space: nowrap;
  border: 1px solid var(--line); background: var(--panel);
  color: var(--muted); font-family: inherit;
  font-size: 13.5px; font-weight: 600;
  padding: 9px 15px; border-radius: 10px; cursor: pointer;
}
.tk-tab.on {
  background: var(--accent); border-color: var(--accent);
  color: #fff;
}

/* ---------------- 模考二级切换（雅思 / 托福） ---------------- */
.tk-subtabs { display: flex; gap: 7px; margin: 0 0 11px; }
/* 🔴 给了 display:flex 就必须显式写 [hidden]，否则 hidden 属性失效、按钮一直显示 */
.tk-subtabs[hidden] { display: none; }
.tk-subtab {
  flex: 1; padding: 9px 6px; font-size: 13px; font-weight: 700; font-family: inherit;
  color: var(--muted); background: var(--soft);
  border: 1px solid var(--line); border-radius: 10px; cursor: pointer;
}
.tk-subtab:active { opacity: .85; }
.tk-subtab.on {
  color: var(--accent-ink); background: var(--accent-soft); border-color: var(--accent);
}
/* 分类多的那一栏（旅行生活 8 个）横向滚动，不换行、不显示滚动条 */
.tk-subtabs.scroll {
  overflow-x: auto; flex-wrap: nowrap;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none; padding-bottom: 2px;
}
.tk-subtabs.scroll::-webkit-scrollbar { display: none; }
.tk-subtabs.scroll .tk-subtab {
  flex: 0 0 auto; padding: 8px 13px; white-space: nowrap; font-size: 12.5px;
}

/* ---------------- 场景分组标题（旅行生活场景按高频分段） ---------------- */
.tk-grp {
  margin: 15px 2px 8px;
  font-size: 12px; font-weight: 700; color: var(--faint);
  letter-spacing: .03em;
}
.tk-grp:first-child { margin-top: 2px; }


/* ---------------- 岗位定制面试：入口卡 + 弹窗 ---------------- */
.tk-role {
  display: flex; align-items: center; gap: 11px; width: 100%;
  text-align: left; font-family: inherit; cursor: pointer;
  padding: 13px 12px; border-radius: 13px; margin-bottom: 10px;
  border: 1px dashed var(--accent);
  background: linear-gradient(135deg, var(--accent-soft), var(--panel) 72%);
}
.tk-role:active { opacity: .85; }
.tk-role-ico {
  width: 38px; height: 38px; flex: none; border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; background: var(--accent); color: #fff;
}
.tk-role-main { flex: 1; min-width: 0; }
.tk-role-main b { display: block; font-size: 14.5px; font-weight: 700; color: var(--ink); }
.tk-role-main small {
  display: block; margin-top: 2px; font-size: 11.5px; color: var(--muted); line-height: 1.5;
}
.tk-role-go {
  flex: none; font-size: 11.5px; font-weight: 700; color: #fff;
  background: var(--accent); padding: 6px 10px; border-radius: 8px;
}

/* ---------------- 岗位定制面试：独立整页（不用弹窗） ----------------
   2026-10-31 颖总：原来做成半透明浮层 + 遮罩，跟背后场景卡的标题/副标题叠在一起，
   整块糊得看不清。改成切走列表页、展开这一页 —— 没有任何背景文字重叠。
   下面这几条是「页面骨架」，输入框/麦克风/chips/题量档位仍复用 .tk-input / .tk-mic / .tk-chip / .tk-size。 */
.tk-rolepg { padding-bottom: 30px; }
.tk-rolepg-back {
  display: inline-flex; align-items: center;
  border: none; background: none; padding: 0;
  margin: 0 0 14px; color: var(--accent);
  font-size: 13px; font-family: inherit; cursor: pointer;
}
.tk-rolepg-t { margin: 0 0 7px; font-size: 19px; font-weight: 700; color: var(--ink); }
.tk-rolepg-sub { margin: 0 0 16px; font-size: 12.5px; line-height: 1.75; color: var(--muted); }
.tk-rolepg-sub b { color: var(--ink); }
.tk-rolepg-label { margin: 18px 0 0; font-size: 11.5px; color: var(--faint); }
.tk-rolepg-msg {
  min-height: 0; margin-top: 12px;
  font-size: 12.5px; line-height: 1.6; color: var(--danger);
}
.tk-rolepg-msg:empty { display: none; }
.tk-rolepg-go { width: 100%; margin-top: 16px; }
.tk-rolepg-go:disabled { opacity: .6; cursor: default; }
.tk-rolepg-tip {
  margin: 12px 0 0; text-align: center;
  font-size: 11.5px; color: var(--faint); line-height: 1.6;
}

.tk-role-row { display: flex; gap: 7px; align-items: stretch; }
.tk-input {
  flex: 1; min-width: 0; box-sizing: border-box;
  padding: 11px 12px; font-size: 14px; font-family: inherit;
  color: var(--ink); background: var(--soft);
  border: 1px solid var(--line); border-radius: 10px; outline: none;
}
.tk-input:focus { border-color: var(--accent); background: var(--panel); }
.tk-input::placeholder { color: var(--faint); font-size: 13px; }
.tk-mic {
  flex: none; width: 44px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--soft); color: var(--ink); font-size: 17px;
  cursor: pointer; font-family: inherit;
}
.tk-mic.rec {
  background: var(--danger); border-color: var(--danger); color: #fff;
  animation: tkPulse 1s ease-in-out infinite;
}
@keyframes tkPulse { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }

.tk-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 2px; }
.tk-chip {
  border: 1px solid var(--line); background: var(--soft); color: var(--muted);
  font-size: 11.5px; font-family: inherit; padding: 5px 9px;
  border-radius: 20px; cursor: pointer; line-height: 1.4;
}
.tk-chip:active { background: var(--accent-soft); color: var(--accent-ink); border-color: var(--accent); }
.tk-chip.on {
  background: var(--accent-soft); color: var(--accent-ink);
  border-color: var(--accent); font-weight: 600;
}
/* 岗位 chip 上的「公司类型」角标（2026-11-01）：
   决定要不要英文面试的不是岗位而是公司类型 —— 同一个会计，国内所纯中文、四大可能全英文。
   角标只标「外企 / 出海」，不标「国内」（不打扰用户，靠 title 兜底说明）。 */
.tk-chip-co {
  display: inline-block; margin-left: 4px; padding: 0 4px;
  border-radius: 4px; font-style: normal; font-size: 9.5px; line-height: 1.6;
  background: var(--accent-soft); color: var(--accent-ink);
  vertical-align: 1px; white-space: nowrap;
}

/* 题量选择（2026-10-31 颖总：6 题别把人卡死，给档位） */
.tk-size {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line);
}
.tk-size-t { font-size: 11.5px; color: var(--faint); margin-right: 2px; }
.tk-size .tk-chip { font-size: 12px; padding: 6px 11px; }

/* ---------------- 对话列表 ---------------- */
.tk-list { display: grid; gap: 9px; }
.tk-card {
  display: flex; align-items: center; gap: 11px;
  width: 100%; text-align: left; font-family: inherit;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r); padding: 13px 14px; cursor: pointer;
}
.tk-card:active { background: var(--soft); }
.tk-card-ico {
  width: 38px; height: 38px; flex: none; border-radius: 10px;
  background: var(--accent-soft); color: var(--accent-ink);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700;
}
.tk-card-main { flex: 1; min-width: 0; }
.tk-card-main b {
  display: block; font-size: 14.5px; font-weight: 600; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tk-card-main small {
  display: block; margin-top: 3px; font-size: 12px; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tk-card-go { flex: none; color: var(--faint); font-size: 15px; }

/* ---------------- 对话中：三栏 ---------------- */
.tk-room {
  display: grid;
  grid-template-columns: 214px minmax(0, 1fr) 258px;
  gap: 12px;
  max-width: 1180px; margin: 0 auto;
  padding: 12px 12px 0;
  height: calc(100vh - 52px);
  height: calc(100dvh - 52px);
}
.tk-pane {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  min-width: 0;
  overflow: hidden;
}

/* 左栏 */
.tk-pane-side { padding: 14px; display: flex; flex-direction: column; }
.tk-side-title {
  font-size: 14.5px; font-weight: 700; color: var(--ink);
  line-height: 1.45; word-break: break-word;
}
.tk-side-sub { margin-top: 5px; font-size: 12px; color: var(--muted); line-height: 1.6; }
.tk-prog {
  margin: 13px 0 7px; height: 5px; border-radius: 3px;
  background: var(--soft); overflow: hidden;
}
.tk-prog i { display: block; height: 100%; background: var(--accent); border-radius: 3px; transition: width .25s; }
.tk-side-step { font-size: 12px; color: var(--faint); }
.tk-side-tip {
  margin: 14px 0 auto; font-size: 11.5px; line-height: 1.7; color: var(--faint);
  border-top: 1px dashed var(--line); padding-top: 11px;
}

/* 中栏：对话流 */
.tk-pane-chat { display: flex; flex-direction: column; }
.tk-msgs {
  flex: 1 1 auto; min-height: 0;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 14px;
}
.tk-msg { display: flex; gap: 8px; margin-bottom: 13px; align-items: flex-start; }
.tk-msg-av {
  width: 28px; height: 28px; flex: none; border-radius: 8px;
  background: var(--soft); color: var(--muted);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
}
.tk-msg-bd { flex: 1; min-width: 0; }
.tk-msg-nm { display: block; font-size: 10.5px; color: var(--faint); margin-bottom: 3px; letter-spacing: .03em; }
.tk-msg-tx {
  display: inline-block; max-width: 100%;
  font-size: 14px; line-height: 1.65; color: var(--ink);
  background: var(--soft); border: 1px solid var(--line);
  border-radius: 12px; border-top-left-radius: 4px;
  padding: 8px 12px; word-break: break-word;
}
.tk-msg.me .tk-msg-tx {
  background: var(--accent-soft); border-color: var(--accent-soft);
  color: var(--accent-ink); border-radius: 12px; border-top-right-radius: 4px;
}
.tk-msg.me { flex-direction: row-reverse; }
.tk-msg.me .tk-msg-nm { text-align: right; }
.tk-msg-cn { display: block; margin-top: 4px; font-size: 12px; color: var(--faint); line-height: 1.6; }
.tk-replay {
  display: inline-block; margin-top: 5px;
  border: 1px solid var(--line); background: var(--panel);
  color: var(--accent-ink); font-family: inherit;
  font-size: 11.5px; font-weight: 600;
  padding: 3px 9px; border-radius: 7px; cursor: pointer;
}
.tk-ref {
  margin-top: 5px; font-size: 11.5px; color: var(--faint);
  border-left: 2px solid var(--line); padding-left: 8px; line-height: 1.65;
}
.tk-ref b { color: var(--muted); font-weight: 600; }

/* 中栏：录音条 */
.tk-recbar {
  flex: none; border-top: 1px solid var(--line);
  padding: 11px 14px calc(13px + env(safe-area-inset-bottom, 0px));
  background: var(--panel);
}
.tk-wave {
  height: 22px; display: flex; align-items: flex-end; justify-content: center;
  gap: 3px; margin-bottom: 8px; opacity: 0; transition: opacity .2s;
}
.tk-wave.on { opacity: 1; }
.tk-wave i {
  display: block; width: 3px; border-radius: 2px;
  background: var(--accent); height: 4px;
}
.tk-state {
  margin-top: 8px; text-align: center;
  font-size: 12px; color: var(--faint); line-height: 1.6;
}

/* ---------------- 右栏：反馈 ---------------- */
.tk-pane-fb {
  padding: 14px;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
}
.tk-fb-title {
  font-size: 12px; font-weight: 700; color: var(--ink);
  letter-spacing: .02em; margin-bottom: 9px;
}
.tk-fb-title.mt { margin-top: 16px; }
.tk-fb-empty { margin: 0; font-size: 12px; color: var(--faint); line-height: 1.7; }
.tk-fb-item {
  background: var(--soft); border: 1px solid var(--line);
  border-radius: 9px; padding: 9px 11px; margin-bottom: 7px;
}
.tk-fb-good { font-size: 12px; font-weight: 700; color: var(--ok); }
.tk-fb-tag {
  display: inline-block; font-size: 10px; font-weight: 700;
  padding: 1px 6px; border-radius: 5px; margin-bottom: 4px;
}
.tk-fb-tag.must { background: var(--danger-soft); color: var(--danger); }
.tk-fb-tag.sug { background: var(--warn-soft); color: var(--warn); }
.tk-fb-line { font-size: 12.5px; line-height: 1.65; color: var(--muted); word-break: break-word; }
.tk-fb-line s { color: var(--danger); text-decoration: line-through; }
.tk-fb-line em { color: var(--ok); font-style: normal; font-weight: 700; }
.tk-fb-why { margin: 4px 0 0; font-size: 11.5px; color: var(--faint); line-height: 1.6; }
.tk-fb-stat > div {
  display: flex; justify-content: space-between;
  font-size: 12.5px; color: var(--muted); padding: 5px 0;
  border-bottom: 1px dashed var(--line);
}
.tk-fb-stat > div:last-child { border-bottom: none; }
.tk-fb-stat b { color: var(--ink); font-weight: 700; }
.tk-fb-note { margin: 13px 0 0; font-size: 11px; color: var(--faint); line-height: 1.6; }

/* ---------------- 按钮 ---------------- */
.tk-btn {
  width: 100%; border: 1px solid var(--line);
  background: var(--panel); color: var(--ink);
  font-family: inherit; font-size: 14px; font-weight: 600;
  padding: 12px 14px; border-radius: 11px; cursor: pointer;
}
.tk-btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.tk-btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.tk-btn.ghost { background: var(--soft); color: var(--muted); }
.tk-btn.big { padding: 14px; font-size: 15px; }
.tk-btn.sm { padding: 8px 12px; font-size: 12.5px; }
.tk-btn:disabled { opacity: .55; cursor: default; }

/* ---------------- 报告 ---------------- */
.tk-rep-head { margin-bottom: 14px; }
.tk-rep-title { font-size: 19px; font-weight: 700; color: var(--ink); }
.tk-rep-sub { margin-top: 5px; font-size: 12.5px; color: var(--muted); }
.tk-rep-cards {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
  margin-bottom: 18px;
}
.tk-rep-card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 11px 9px; text-align: center;
}
.tk-rep-card span { display: block; font-size: 11px; color: var(--faint); }
.tk-rep-card b { display: block; margin-top: 4px; font-size: 18px; font-weight: 700; color: var(--ink); }
.tk-rep-sec { margin-bottom: 18px; }
.tk-rep-sec h2 { font-size: 14px; font-weight: 700; color: var(--ink); margin: 0 0 9px; }
.tk-rep-line {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 11px 13px; margin-bottom: 7px;
  font-size: 13px; line-height: 1.7; color: var(--muted); word-break: break-word;
}
.tk-rep-line .q { color: var(--faint); font-size: 12px; display: block; margin-bottom: 4px; }
.tk-rep-actions { display: flex; gap: 9px; margin-top: 6px; }
.tk-rep-actions .tk-btn { flex: 1; }

/* =========================================================================
 * 窄屏：纵向堆叠
 * ========================================================================= */
@media (max-width: 900px) {
  .tk-room {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr) auto;
    height: calc(100vh - 52px);
    height: calc(100dvh - 52px);
    gap: 8px;
    padding: 8px 8px 0;
  }
  .tk-pane-side {
    flex-direction: row; align-items: center; gap: 10px;
    padding: 10px 12px;
  }
  .tk-side-title { font-size: 13.5px; flex: 1 1 auto; min-width: 0; }
  .tk-side-sub, .tk-side-tip { display: none; }
  /* 窄屏不显示进度条（「第 1 / 6 句」这行字已经说清楚了），把空间让给退出按钮 */
  .tk-prog { display: none; }
  .tk-side-step { flex: none; font-size: 11px; }
  /* 🔴 2026-10-31 修：原来这里是 display:none，手机上「结束这一场」被藏掉了 ——
     用户想中途换一场（自由对话主题不满意时尤其常见）只能退回首页、再点进来，多两步。
     改成缩小的胶囊放在标题右侧。 */
  .tk-pane-side .tk-btn {
    display: inline-flex; align-items: center; justify-content: center;
    flex: none;
    /* 🔴 .tk-btn 基础样式是 width:100%，这里必须显式改回 auto，
       否则按钮会占满整行、把标题挤成一列竖排（第一版就这么翻的） */
    width: auto; white-space: nowrap;
    padding: 5px 9px; font-size: 11.5px; border-radius: 8px;
  }

  .tk-msgs { padding: 11px; }
  .tk-msg-tx { font-size: 13.5px; }

  /* 反馈栏收成一张紧凑卡片，跟对话一起滚 */
  .tk-pane-fb { max-height: 27vh; padding: 11px 12px; }
  .tk-fb-note { display: none; }
  .tk-recbar { padding: 9px 11px calc(11px + env(safe-area-inset-bottom, 0px)); }
  .tk-btn.big { padding: 13px; font-size: 14.5px; }

  .tk-rep-cards { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 380px) {
  .tk-tabs { gap: 6px; }
  .tk-tab { padding: 8px 12px; font-size: 13px; }
}
