/* ==========================================================================
   《门内的同伴》 v1.6 观众体验层
   叠在 style.css 之后：故事化首页、线索、画内字幕、原地弹窗、复盘卡片。
   只新增本版需要的组件与覆盖，不改动基础排版体系。
   ========================================================================== */

/* ------------------------------------------------------------------ 首页 */
.screen--intro { padding-top: 4px; }

.intro__title {
  font-size: clamp(2.05rem, 9vw, 2.7rem);
  letter-spacing: .05em;
  margin-bottom: .75em;
}

.story p {
  font-size: 1.1rem;
  line-height: 1.95;
  color: var(--ink);
  margin-bottom: 1em;
}
.story__first {
  font-size: 1.2rem !important;
  color: var(--accent-ink) !important;
  font-weight: 600;
  letter-spacing: .02em;
}

.intro__lead {
  margin: 1.5em 0 0;
  padding-left: 14px;
  border-left: 3px solid #CFE0DE;
  font-size: 1rem;
  line-height: 1.85;
  color: var(--ink-2);
}
.intro__note {
  margin-top: 20px;
  font-size: .82rem;
  line-height: 1.7;
  color: var(--ink-3);
  text-align: center;
}

/* ------------------------------------------------------------------ 线索 */
.clues {
  margin-top: 20px;
  padding: 16px 18px 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
}
.clues__label {
  font-size: 12px;
  letter-spacing: .18em;
  font-weight: 650;
  color: var(--accent);
  margin-bottom: 10px;
}
.clues__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 9px;
}
@media (min-width: 640px) {
  .clues__list { grid-template-columns: 1fr 1fr; column-gap: 22px; }
}
.clues__list li {
  display: flex;
  gap: 9px;
  font-size: 1rem;
  line-height: 1.7;
  color: var(--ink);
}
.clues__no {
  flex: 0 0 auto;
  width: 19px; height: 19px;
  margin-top: .28em;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 11.5px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  font-variant-numeric: tabular-nums;
}

.bridge {
  margin-top: 20px;
  font-size: 1.05rem;
  line-height: 1.85;
  color: var(--ink);
}
.simnote {
  margin-top: 10px;
  font-size: .86rem;
  color: var(--ink-3);
}

/* ------------------------------------------------------------ 文字版折叠 */
details.textver {
  margin-top: 16px;
  border-top: 1px solid var(--line);
}
details.textver > summary {
  cursor: pointer;
  list-style: none;
  min-height: 46px;
  padding: 12px 0;
  display: flex; align-items: center; justify-content: space-between;
  font-size: .9rem; font-weight: 600; color: var(--ink-3);
}
details.textver > summary::-webkit-details-marker { display: none; }
details.textver > summary::after { content: "＋"; font-weight: 500; }
details.textver[open] > summary::after { content: "－"; }
details.textver p {
  font-size: .98rem;
  line-height: 1.85;
  color: var(--ink-2);
  padding-bottom: 6px;
}

/* -------------------------------------------------------- 播放器与字幕条 */
.playerbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
}
.ccbtn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink-2);
  font: inherit;
  font-size: .82rem;
  min-height: 40px;
  padding: 6px 13px;
  border-radius: 999px;
  cursor: pointer;
}
.ccbtn[aria-pressed="true"] {
  background: var(--accent-soft);
  border-color: #CFE0DE;
  color: var(--accent-ink);
}
.playerbar__time {
  font-size: .78rem;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

/* 画内字幕：压在画面下部，避开播放控件；最多两行 */
/* 画内字幕：压在画面下部，避开播放控件；最多两行。
   v1.7 位置策略（数值来自 probe_controlbar 实测，不是估的）：
     实测原生控件实体（进度条+按钮带）占底部 63px（桌面）/ 65px（手机竖屏）。
     因此"控件可见"时必须留 68–70px；"播放中且控件已自动隐藏"时下移 20px，
     把字幕真正压到接近画面底部。状态由 app.js 的 cc-low 类切换。 */
.player .cc {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 72px;
  z-index: 3;
  width: max-content;
  max-width: 84%;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  max-height: 3.2em;
  margin: 0;
  padding: 4px 11px;
  border: 0;
  border-radius: 5px;
  background: rgba(6, 10, 14, .72);
  color: #FFFFFF;
  font-size: clamp(15px, 3.9vw, 19px);
  line-height: 1.45;
  letter-spacing: .01em;
  text-align: center;
  white-space: pre-line;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .9);
  pointer-events: none;
  transition: bottom .22s cubic-bezier(.22,.61,.36,1);
}
.player .cc[hidden] { display: none !important; }

/* 播放中且控件已自动隐藏：字幕下移 20px，更贴近画面底部 */
.player.cc-low .cc { bottom: 52px; }

/* 窄屏的控件会换行变高：实测 360px 宽 72px、320px 宽 70px，比 390px 宽的 68px 更高。
   但 390 也是常见机型，不该套 13.5px 的小字号，所以断点取 380。
   所以断点不是按"手机"一刀切，而是留足余量。 */
@media (max-width: 560px) {
  .player .cc {
    bottom: 76px;
    max-width: 90%;
    font-size: clamp(14.5px, 4vw, 17px);
    padding: 3px 9px;
  }
  .player.cc-low .cc { bottom: 56px; }
}

@media (max-width: 380px) {
  .player .cc {
    bottom: 78px;
    max-width: 92%;
    font-size: 13.5px;
    line-height: 1.4;
    padding: 2px 8px;
  }
  .player.cc-low .cc { bottom: 58px; }
}

@media (prefers-reduced-motion: reduce) {
  .player .cc { transition: none; }
}

/* 包裹层全屏：字幕仍在画面内，字号放大；控件可见时留出 13%，隐藏时压到 8% */
.media:fullscreen .cc {
  left: 50%;
  right: auto;
  transform: translateX(-50%);
  bottom: max(15%, 72px);   /* 小播放器（如全屏后的手机）按像素兜底，避免百分比算出太小 */
  width: max-content;
  max-width: 82%;
  min-height: 0;
  max-height: none;
  padding: 8px 18px;
  border-radius: 8px;
  background: rgba(6, 10, 13, .74);
  font-size: clamp(20px, 2.6vw, 34px);
  line-height: 1.4;
}
.media:fullscreen .player.cc-low .cc { bottom: max(10%, 52px); }

/* ------------------------------------------------------------ 作答页头 */
.qhead { margin-bottom: 16px; }
.qhead__label {
  font-size: 12px;
  letter-spacing: .16em;
  font-weight: 650;
  color: var(--accent);
  margin-bottom: 6px;
}
.qhead__sub {
  font-size: 1.1rem;
  margin: 8px 0 0;
}

.qcontext {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 13px 16px;
  margin-bottom: 16px;
}
.qcontext__label {
  font-size: 11.5px;
  letter-spacing: .14em;
  font-weight: 650;
  color: var(--ink-3);
  margin-bottom: 8px;
}
.qcontext__list { list-style: none; margin: 0; padding: 0; }
.qcontext__list li {
  position: relative;
  padding-left: 14px;
  font-size: .97rem;
  line-height: 1.65;
  color: var(--ink);
  margin-bottom: 6px;
}
.qcontext__list li::before {
  content: "";
  position: absolute;
  left: 0; top: .62em;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--accent);
}
.qcontext__list li:last-child { margin-bottom: 0; }

.qcontext__grid {
  list-style: none;
  margin: 0; padding: 0;
  display: grid;
  gap: 6px;
}
@media (min-width: 520px) {
  .qcontext__grid { grid-template-columns: 1fr 1fr; }
}
.qcontext__grid li {
  font-size: .94rem;
  line-height: 1.55;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 10px;
}

.actions--wide .btn { width: 100%; }

/* ------------------------------------------------------------ 原地弹窗 */
body.is-modal { overflow: hidden; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal__scrim {
  position: absolute;
  inset: 0;
  background: rgba(14, 20, 26, .58);
}
.modal__card {
  position: relative;
  width: min(520px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  background: var(--card);
  border-radius: 16px;
  padding: 22px 22px 20px;
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, .45);
  animation: pop .22s cubic-bezier(.22,.61,.36,1) both;
}
@keyframes pop {
  from { opacity: 0; transform: translateY(10px) scale(.99); }
  to   { opacity: 1; transform: none; }
}
.modal__x {
  position: absolute;
  top: 6px; right: 6px;
  width: 40px; height: 40px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-3);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.modal__x:hover { background: var(--paper-2); }

.modal__title {
  font-family: inherit;
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0 0 10px;
  padding-left: 11px;
  border-left: 4px solid var(--accent);
  line-height: 1.6;
}
.modal--ok .modal__title { border-color: var(--accent); color: var(--accent-ink); }
.modal--risk .modal__title { border-color: #A2412F; color: #8E3626; }
.modal--partial .modal__title { border-color: var(--amber); color: var(--amber); }

.modal__body {
  font-size: 1rem;
  line-height: 1.85;
  color: var(--ink-2);
  margin: 0 0 18px;
}
.modal__actions .btn { width: 100%; }

@media (max-width: 560px) {
  .modal { align-items: flex-end; padding: 0; }
  .modal__card {
    width: 100%;
    max-height: 86vh;
    border-radius: 18px 18px 0 0;
    padding: 20px 20px calc(18px + env(safe-area-inset-bottom));
  }
}

.proceedbar {
  margin-top: 16px;
  animation: fadein .2s both;
}
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }

/* ------------------------------------------------------------------ 复盘 */
.refl-list {
  margin: 18px 0 0;
  display: grid;
  gap: 12px;
}
.refl-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 16px 18px;
  box-shadow: var(--shadow);
}
.refl-card__top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.refl-card__no {
  width: 22px; height: 22px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.refl-card h3 { margin: 0; font-size: 1rem; font-weight: 700; }
.refl-card__choice {
  margin: 0 0 8px;
  font-size: .98rem;
  line-height: 1.75;
  color: var(--ink);
}
.refl-card__choice span {
  display: inline;
  font-size: .82rem;
  color: var(--ink-3);
  margin-right: 4px;
}
.refl-card__remind {
  margin: 0;
  padding: 8px 11px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: .95rem;
  line-height: 1.7;
}
.refl-card__changed {
  margin: 8px 0 0;
  font-size: .82rem;
  color: var(--ink-3);
}
.refl-closing {
  margin: 20px 0 0;
  padding: 16px 18px;
  background: var(--paper-2);
  border-radius: var(--r);
  font-size: 1rem;
  line-height: 1.85;
  color: var(--ink);
}

/* ------------------------------------------------------------------ 收尾 */
.endnote {
  margin-top: 10px;
  font-size: .82rem;
  color: var(--ink-3);
  text-align: center;
}
.endlinks { margin-top: 26px; }
.endfoot {
  margin-top: 18px;
  font-size: .82rem;
  color: var(--ink-3);
  text-align: center;
}

.srclist { list-style: none; margin: 0; padding: 0; }
.srclist > li {
  padding: 12px 0;
  border-top: 1px solid var(--line-2);
}
.srclist > li:first-child { border-top: none; padding-top: 0; }
.srclist__org {
  font-size: .8rem;
  letter-spacing: .06em;
  color: var(--ink-3);
}
.srclist__title {
  font-size: .98rem;
  font-weight: 650;
  color: var(--ink);
  margin: 2px 0 4px;
  line-height: 1.6;
}
.srclist__note {
  margin: 0 0 6px;
  font-size: .9rem;
  line-height: 1.7;
  color: var(--ink-2);
}
.srclist__link { font-size: .86rem; }

.sect__lead { font-size: .88rem; color: var(--ink-3); margin-bottom: 8px; }

/* 制作说明：四段小标题 */
.makesec + .makesec { margin-top: 16px; }
.makesec__h {
  font-size: .95rem;
  font-weight: 700;
  letter-spacing: .02em;
  color: var(--ink);
  margin: 0 0 6px;
  padding-left: 10px;
  border-left: 3px solid var(--accent-soft);
  line-height: 1.6;
}
.makesec p {
  font-size: .92rem;
  line-height: 1.8;
  color: var(--ink-2);
  margin-bottom: .6em;
}
.makesec p:last-child { margin-bottom: 0; }

.sect__meta {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
  font-size: .82rem;
  line-height: 1.7;
  color: var(--ink-3);
}

/* ------------------------------------------------------------------ 小屏 */
@media (max-width: 380px) {
  main { padding-left: 16px; padding-right: 16px; }
  .story p { font-size: 1.06rem; }
  .opt { padding: 13px 13px; }
}
