/* =============================================================
   interiors.css — H5 interior experience / layered case-file UI
   专项增强：案件检索、剧情阅读、结算报告、图鉴、弹层与小屏适配
   ============================================================= */

/* 全站交互一致性 */
:where(button, a, input):focus-visible {
  outline: 3px solid #EBA878;
  outline-offset: 3px;
}
:where(button, a):disabled { cursor: not-allowed; }
:where(.btn, .home-tile, .case-filter, .script-card, .act-item, .knowledge-arrow):not(:disabled) {
  -webkit-tap-highlight-color: rgba(58,130,119,.12);
}
.home .scroll-area, .result .scroll-area, .game-story {
  scrollbar-width: thin;
  scrollbar-color: rgba(53,103,100,.23) transparent;
}

/* ─────────────────────────────────────────────────────────────
   首页：从浏览长列表升级为可检索案件档案库
   ───────────────────────────────────────────────────────────── */
.home-body { display: flex; flex-direction: column; }
.resume-card {
  display: flex; align-items: center; gap: 12px;
  width: 100%; text-align: left; padding: 14px 15px;
  margin: 0 0 21px; border-radius: 16px;
  background: linear-gradient(120deg,#E8F4EC,#EEF7F0);
  border: 1px solid #BDDDD0; color: #204A48;
  box-shadow: 0 5px 18px rgba(30,93,79,.08);
  transition: transform .18s ease, background .18s ease;
}
.resume-card:hover { transform: translateY(-2px); background: #E3F2E9; }
.resume-icon {
  display: grid; place-items: center; width: 42px; height: 42px; flex: 0 0 auto;
  background: #2C766C; border-radius: 12px; color: white;
  box-shadow: 0 4px 10px rgba(42,116,108,.17);
}
.resume-icon svg { width: 21px; height: 21px; }
.resume-text { display: flex; flex-direction: column; flex: 1 1 auto; min-width: 0; }
.resume-text small { font-size: 10px; letter-spacing: .08em; color: #63887E; font-weight: 750; }
.resume-text b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; }
.resume-go { display: inline-flex; gap: 2px; align-items: center; font-size: 11px; font-weight: 850; }
.resume-go svg { width: 15px; height: 15px; }
.case-index { margin-top: 3px; margin-bottom: 15px; }
.case-index-note { max-width: 119px; }
.case-toolbar { display: flex; flex-direction: column; gap: 11px; margin-bottom: 15px; }
.case-search {
  display: flex; align-items: center; gap: 8px;
  height: 44px; padding: 0 13px; width: 100%;
  border: 1px solid #DCE6DF; border-radius: 13px;
  background: #FFFEFC; box-shadow: 0 2px 9px rgba(26,66,65,.035);
  transition: border-color .18s, box-shadow .18s;
}
.case-search:focus-within { border-color: #529B8F; box-shadow: 0 0 0 3px rgba(75,158,144,.11); }
.case-search > svg { width: 17px; height: 17px; flex: 0 0 auto; color: #6C9088; }
.case-search-input {
  width: 100%; min-width: 0; height: 100%;
  outline: none; box-shadow: none; background: transparent;
  font-size: 13px; font-weight: 600; color: #294D4C;
}
.case-search-input::placeholder { color: #9BAAA4; font-weight: 500; }
.case-search-input:focus-visible { outline: none; }
.case-search-input::-webkit-search-cancel-button { cursor: pointer; }
.case-filter-row { display: flex; gap: 8px; align-items: center; justify-content: space-between; min-width: 0; }
.case-filters {
  display: flex; align-items: center; gap: 6px;
  min-width: 0; overflow-x: auto; scrollbar-width: none;
  padding: 2px 0; flex: 1 1 auto;
}
.case-filters::-webkit-scrollbar { display: none; }
.case-filter {
  display: inline-flex; align-items: center; justify-content: center;
  white-space: nowrap; padding: 7px 12px; min-height: 32px;
  color: #607D78; border: 1px solid #DDE9DF;
  border-radius: 9px; background: #FBFCF8;
  font-size: 11px; font-weight: 800;
  transition: all .18s ease;
}
.case-filter:hover { background: #E9F3EC; color: #2C6B65; }
.case-filter[aria-pressed="true"] {
  color: #fff; background: #286B66; border-color: #286B66;
  box-shadow: 0 3px 9px rgba(38,107,102,.17);
}
.case-count { white-space: nowrap; color: #86958D; font: 650 10px var(--ff-num); }
.case-list { min-height: 100px; }
.case-empty {
  display: flex; flex-direction: column; gap: 10px; align-items: center;
  padding: 36px 15px; border: 1px dashed #C7D8D1; border-radius: 18px;
  background: #FCFDF9; text-align: center; color: #607C77;
  margin-bottom: 14px;
}
.case-empty > svg { width: 31px; height: 31px; opacity: .6; }
.case-empty b { color: #355A56; font-size: 14px; }
.case-empty p { font-size: 11px; line-height: 1.75; }
.script-card { contain: layout style; }
.script-card .sc-title { overflow-wrap: anywhere; }
.sc-meta { margin-top: 9px; gap: 13px; }
.sc-meta i { color: #81928B; font-size: 10px; gap: 5px; }
.sc-meta svg { width: 12px; height: 12px; color: #5F968A; }
.sc-ring { flex: 0 0 auto; }
.home-tiles { margin-top: 4px; }

/* ─────────────────────────────────────────────────────────────
   剧情页：舞台身份 / 台词阅读 / 选择安全布局
   ───────────────────────────────────────────────────────────── */
.game .stage-scene { flex: 0 0 auto; position: relative; isolation: isolate; }
.game .stage-scene::after { z-index: 10; }
.scene-caption {
  position: absolute; z-index: 12;
  left: 17px; bottom: 14px; right: 17px;
  display: flex; flex-direction: column; gap: 3px;
  max-width: 68%; pointer-events: none;
  text-shadow: 0 2px 10px rgba(0,0,0,.46);
}
.scene-caption-kicker {
  font: 800 9px/1.5 var(--ff-num); letter-spacing: .13em;
  color: #F2CDA8;
}
.scene-caption-title {
  color: #FCFFF9; font-size: 17px; letter-spacing: .02em;
  font-weight: 850; line-height: 1.35;
}
.game .bar-top {
  position: relative; z-index: 14;
  background: #FFFEFA; border-bottom: 1px solid #DFE9E1;
}
.game .bar-top .gauges { min-height: 42px; }
.game .game-story {
  flex: 1 1 auto; min-height: 100px;
  scroll-padding-bottom: 16px;
}
.game-story .log-row:last-child { padding-bottom: 5px; }
.game .bar-bottom {
  flex: 0 1 auto; min-height: 0;
  max-height: min(45dvh, 370px);
  overflow-y: auto; scrollbar-width: thin;
  scrollbar-color: #B6CFC3 transparent;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  z-index: 16;
}
.game .bar-bottom:has(.choices) {
  padding: 13px 16px calc(var(--sab) + 13px);
  box-shadow: 0 -9px 24px rgba(16,65,58,.08);
  border-top: 1px solid #D9E5DC;
}
.game .bar-bottom:has(.choices)::before {
  content: ""; display: block;
  height: 3px; width: 34px; border-radius: 99px;
  background: #D6E6DC; margin: -5px auto 9px;
}
.choices-prompt { align-items: flex-start; font-size: 13px; font-weight: 850; line-height: 1.55; color: #244A46; }
.choices-prompt svg { margin-top: 1px; flex: 0 0 auto; color: #327B71; }
.choices-helper { color: #8DA197; font-size: 10px; font-weight: 650; line-height: 1.6; margin: -1px 0 2px 0; }
.choice { flex: 0 0 auto; box-shadow: 0 2px 8px rgba(27,71,67,.05); }
.choice:nth-of-type(2) { animation-delay: 45ms; }
.choice:nth-of-type(3) { animation-delay: 90ms; }
.choice .choice-idx { line-height: 1; }
.choice:focus-visible { background: #F0F8F2; border-color: #60A28F; }
.choice-body { display: block; }
.choice-label { line-height: 1.66; }
.continue-cue { display: flex; min-height: 49px; border: 1px solid #D5E8DC; transition: background .18s ease; }
.continue-cue:hover { background: #DFF0E7; }
.continue-cue:focus-visible { background: #DFF0E7; }
.continue-cue svg { animation: none; width: 18px; height: 18px; }
.continue-cue span { font-weight: 800; }
.log-row .bubble-body { max-width: 100%; }
.bubble-text { overflow-wrap: anywhere; }
.anchor-card { width: 100%; max-width: 100%; }
.game-story .log-narr { overflow-wrap: anywhere; }
.hist-list { gap: 8px; }
.hist-item { border: 1px solid #E5ECE5; border-left: 3px solid #6FABA0; padding: 12px; background: #FCFEF9; border-radius: 10px; }
.hist-item-who { flex-basis: 48px; color: #367F75; }
.hist-item-txt { color: #536D68; }

/* 保护短屏可见的剧情阅读区域；长选项独立滚动 */
@media (max-height: 720px) {
  .game .stage-scene { height: clamp(118px, 23dvh, 176px); min-height: 0; }
  .game .bar-top { padding-top: 8px; padding-bottom: 8px; }
  .game .game-story { min-height: 82px; padding-top: 12px; }
  .game .bar-bottom { max-height: min(39dvh, 260px); }
  .game .bar-bottom:has(.choices) { padding-top: 9px; }
  .choice { min-height: 50px; padding-top: 9px; padding-bottom: 9px; }
  .scene-caption { left: 13px; bottom: 10px; }
  .scene-caption-title { font-size: 15px; }
}
@media (max-height: 565px) {
  .game .stage-scene { height: 112px; }
  .game .bar-bottom { max-height: 35dvh; }
  .scene-caption-title { font-size: 13px; }
}
@media (max-width: 360px) {
  .game .bar-bottom:has(.choices) { padding-left: 10px; padding-right: 10px; }
  .game .bar-top { padding-left: 10px; padding-right: 10px; }
  .wallet { min-width: 74px; }
  .scene-caption-title { font-size: 15px; }
  .choice { padding-left: 10px; padding-right: 10px; }
}
/* 隐藏倍速内容后，保持场景工具大小 */
.scene-tool { white-space: nowrap; font-size: 11px; font-weight: 900; }

/* ─────────────────────────────────────────────────────────────
   结算页：从长报告优化为逐层阅读的复盘档案
   ───────────────────────────────────────────────────────────── */
.result-topline { width: 100%; display: flex; gap: 8px; align-items: center; font-size: 13px; font-weight: 850; }
.result-topline svg { width: 17px; height: 17px; }
.result-topline span { flex: 1; text-align: right; min-width: 0; max-width: 180px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 10px; font-weight: 650; color: #7C8C86; }
.result-section-kicker {
  font: 800 10px/1.7 var(--ff-num);
  letter-spacing: .12em; color: #7A978C;
  margin-bottom: -7px; padding-left: 3px;
}
.result-stats { display: grid; grid-template-columns: repeat(3,1fr); gap: 7px; }
.result-stat {
  min-width: 0; background: #FFFEFA; border: 1px solid #DFE8DF;
  border-radius: 14px; padding: 11px 9px;
  box-shadow: 0 4px 12px rgba(26,63,60,.04);
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px;
}
.result-stat span { display: block; width: 100%; font-size: 10px; font-weight: 750; color: #718B80; margin-bottom: 2px; }
.result-stat b { font: 900 26px/1.14 var(--ff-num); color: #286E69; font-variant-numeric: tabular-nums; letter-spacing: -.05em; }
.result-stat small { font-size: 9px; font-weight: 700; color: #A1AEA6; }
.result-stat:nth-child(2) b { color: #C48A58; }
.result-stat:nth-child(3) b { color: #427D9B; }
.result .panel { overflow: hidden; }
.result .panel-title { display: flex; align-items: center; }
.result .panel-title svg { color: #3D8378; }
.result .panel-title .rule { min-width: 12px; }
.result-body .kcard { width: 100%; text-align: left; display: block; min-height: 188px; }
.kcard-face { gap: 8px; }
.kcard-term { font-size: 21px; }
.kcard-text { font-size: 12px; color: #425F56; }
.kcard-quote { font-size: 10px; }
.knowledge-actions { display: flex; justify-content: space-between; gap: 8px; align-items: center; margin-top: 11px; }
.knowledge-arrow {
  border: 1px solid #D7E4DA; border-radius: 9px; min-height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  gap: 5px; padding: 7px 10px; background: #F6F9F3; color: #3B7167;
  font-size: 11px; font-weight: 800;
}
.knowledge-arrow svg { width: 13px; height: 13px; }
.knowledge-arrow:first-child svg { transform: rotate(180deg); }
.knowledge-arrow:hover:not(:disabled) { background: #E3F1E6; }
.knowledge-arrow:disabled { opacity: .38; }
.knowledge-index { font: 800 11px var(--ff-num); color: #62877C; }
.share-card { border: 1px solid #E2E8E0; border-radius: 15px; background: #F9F8F1; padding: 9px; }
.share-card img { width: 100%; height: auto; display: block; border-radius: 8px; }
.share-hint { text-align: center; margin: 12px 0; color: #87988A; font-size: 10px !important; }
.share-download { margin-top: 12px; text-decoration: none; }
.result-actions { gap: 10px; }
.result-actions .btn { min-height: 50px; }
.chart-legend { row-gap: 7px; }

/* ─────────────────────────────────────────────────────────────
   图鉴 / 设置 / 通用弹层
   ───────────────────────────────────────────────────────────── */
.sheet-host {
  padding: 12px 0 0;
  background: rgba(6,32,35,.64);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.sheet {
  background: #FAFBF6; border-top: 1px solid #D7E4DA;
  box-shadow: 0 -10px 50px rgba(4,31,33,.18);
  border-radius: 24px 24px 0 0; max-height: min(88dvh, 840px);
}
.sheet-head {
  position: relative; flex: 0 0 auto; padding: 18px 20px 13px;
  background: #FAFBF6; border-bottom: 1px solid #E4ECE5;
}
.sheet-head h2 { font-size: 17px; font-weight: 850; color: #254A46; letter-spacing: .02em; }
.sheet-head .btn { border-radius: 10px; min-height: 33px; min-width: 35px; padding: 6px 9px; }
.sheet-head .btn svg { width: 16px; height: 16px; }
.sheet-body { min-height: 0; padding: 16px 19px 24px; flex: 1 1 auto; overscroll-behavior: contain; }
.sheet-foot { padding: 13px 18px calc(12px + var(--sab)); flex: 0 0 auto; border-top: 1px solid #E3EBE2; }
.sheet-foot .btn { width: 100%; }
.sheet-body h3 { color: #375D55; line-height: 1.5; }
.gallery-grid { gap: 9px; }
.gal-item {
  border: 1px solid #DEE8DF;
  border-radius: 13px;
  background: #FFFEFA;
  min-height: 157px; padding: 10px;
  gap: 6px;
}
.gal-item svg { border-radius: 9px; }
.gal-item b { font-size: 12px; color: #365B57; }
.gal-item p { font-size: 10px; color: #7D8F86; }
.gal-item--locked { opacity: .67; filter: grayscale(.8); background: #F5F6F1; }
.gal-tag { border-radius: 6px; font-size: 9px; padding: 3px 8px; }
.gallery-summary {
  display: flex; gap: 13px; align-items: center;
  padding: 16px 17px; margin-bottom: 5px;
  border-radius: 15px; border: 1px solid #C7E2D3;
  background: linear-gradient(135deg,#E8F4EC,#FAFBF6);
}
.gallery-summary-icon { display: grid; place-items: center; flex: 0 0 auto; height: 42px; width: 42px; border-radius: 12px; background: #317B70; color: white; }
.gallery-summary-icon svg { width: 20px; height: 20px; }
.gallery-summary b { font-size: 16px; display: block; color: #2B6259; }
.gallery-summary p { font-size: 10px; color: #6F887D; margin-top: 2px; }
.gallery-progress { margin-top: 10px; height: 5px; border-radius: 99px; background: #D5E8DC; overflow: hidden; }
.gallery-progress i { height: 100%; background: #439684; border-radius: inherit; display: block; }
.set-row {
  flex-wrap: wrap; gap: 10px; padding: 14px 2px; border-bottom: 1px solid #E6EBE5;
}
.set-row-l { min-width: 0; font-size: 13px; font-weight: 780; color: #365B56; }
.set-row-l small { font-size: 10px; font-weight: 500; line-height: 1.65; color: #7E9288; }
.seg { flex: 0 0 auto; gap: 4px; }
.seg button { min-height: 33px; height: auto; min-width: 38px; padding: 5px 9px; font-size: 11px; border-width: 1px; border-radius: 9px; border-color: #D5E2D8; color: #638479; background: #FCFDF9; }
.seg button.on { background: #2E756D; color: white; border-color: #2E756D; }
.switch { border-color: #D3DED5; background: #DCE6DF; }
.switch.on { background: #408B7D; border-color: #408B7D; }
.sheet .empty-state { border-radius: 12px; background: #F4F7F1; }
@media (min-width: 768px) {
  .sheet-host { align-items: center; padding: 16px; }
  .sheet { width: min(420px, calc(100vw - 32px)); border-radius: 22px; max-height: min(82dvh, 730px); border: 1px solid #DAE7DD; }
}
@media (max-width: 375px) {
  .sheet-body { padding-left: 13px; padding-right: 13px; }
  .set-row { align-items: flex-start; flex-direction: column; }
  .set-row .seg { flex-wrap: wrap; }
  .case-filter { padding: 7px 10px; }
  .case-index-note { display: none; }
  .result-stats { gap: 5px; }
  .result-stat { padding: 10px 7px; }
  .result-stat b { font-size: 23px; }
}
@media (prefers-reduced-motion: reduce) {
  .resume-card, .choice, .home-tile, .script-card { transition-duration: .001s; }
}


/* 设置面板、提示层及长文本修整 */
.settings-intro {
  display: flex; gap: 12px; align-items: center; padding: 14px;
  background: linear-gradient(120deg, #EAF5ED, #F8FAF3);
  border: 1px solid #D3E7D8; border-radius: 13px; margin-bottom: 8px;
}
.settings-intro > svg {
  width: 39px; height: 39px; padding: 9px; flex: 0 0 auto;
  color: #2F7A6D; background: #D8EBDF; border-radius: 11px;
}
.settings-intro b { display: block; font-size: 13px; color: #305F57; }
.settings-intro p { font-size: 10px; color: #789289; line-height: 1.6; margin-top: 3px; }
.sheet-body > div { min-width: 0; }
.sheet-body p, .sheet-body small, .panel p { overflow-wrap: anywhere; }
@media (min-width: 768px) {
  .toast-host {
    position: fixed; bottom: clamp(55px, 12dvh, 145px);
    left: 50%; right: auto; transform: translateX(-50%);
    width: min(350px, calc(100vw - 35px));
  }
}
