/* 实体道具的材质与交互皮肤；台面落点归 landscape，经济与存档归运行时。
   透明 WebP 与背景共用暖光方向；九宫格保留木边，所有信息仍为实时文本。 */
.layout-b .game {
  --prop-cream: #fff0ce;
  --prop-ink: #3b2718;
  --prop-red: #8f3020;
  --prop-tag-width: min(98%, clamp(64px, 9vw, 108px));
  --prop-tag-height: clamp(34px, 3.6vw, 50px);
  --text-body: clamp(13px, 1.1vw, 16px);
}
.layout-b .game .hud {
  grid-template-columns: 1fr auto clamp(44px, 3.6vw, 50px);
  align-items: center;
  gap: clamp(10px, 1.4vw, 20px);
}
.layout-b .game .hud .day-block {
  gap: clamp(10px, 1.2vw, 18px);
  padding: 12px 18px;
  border: 0;
  border-radius: 0;
  color: var(--prop-cream);
  background: var(--prop-wood) center / 100% 100% no-repeat;
  filter: drop-shadow(0 5px 4px #150b08a6);
}
.layout-b .market-title {
  font-size: clamp(18px, 1.8vw, 26px);
  line-height: 1.15;
  text-shadow: 0 2px 2px #160b04;
}
.layout-b .game .day-block > strong {
  color: #f9dda5;
  font-size: clamp(12px, 1vw, 14px);
  line-height: 1.2;
  font-weight: 700;
  white-space: nowrap;
}
.layout-b .game .hud .cash-block,
.layout-b .game:not([data-state=select]) .hud .cash-block {
  position: relative;
  min-height: 54px;
  padding: 10px 20px 10px 52px;
  align-items: center;
  border: 0;
  border-radius: 0;
  background: var(--prop-wood) center / 100% 100% no-repeat;
  filter: drop-shadow(0 5px 4px #150b08a6);
}
.layout-b .cash-block::before {
  content: "";
  position: absolute;
  left: -8px;
  top: 50%;
  translate: 0 -50%;
  width: 58px;
  aspect-ratio: 1;
  background: var(--prop-money) center / contain no-repeat;
  pointer-events: none;
}
.layout-b #game .cash-block > strong {
  color: var(--prop-cream);
  font-size: clamp(20px, 1.8vw, 26px);
  line-height: 1.1;
  font-weight: 800;
  text-shadow: 0 2px 3px #1c0b03;
}
.layout-b #game .cash-block .cash-label {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  font-size: 0;
}
.layout-b .cash-block .cash-change {
  font-size: clamp(12px, 1.1vw, 16px);
  text-shadow: 0 2px 4px #160b04;
}
.layout-b .game .sound-button {
  position: relative;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  border: 0;
  border-radius: 50%;
  background: var(--prop-sound) center / contain no-repeat;
  filter: drop-shadow(0 4px 3px #150b08b3);
}
.layout-b .sound-button .icon { visibility: hidden; }
.layout-b .sound-button[aria-pressed=true]::after {
  content: "";
  position: absolute;
  inset: 24% 46%;
  rotate: -40deg;
  border-radius: 3px;
  background: #f8e5be;
  box-shadow: 0 0 0 2px #593818;
}
/* 一张完整纸牌承载品种和价格，避免两条表格单元的割裂感。 */
.layout-b .durian-choice::after {
  content: "";
  position: absolute;
  z-index: 1;
  left: 50%;
  top: calc(100% - 6px);
  translate: -50% 0;
  width: var(--prop-tag-width);
  height: var(--prop-tag-height);
  background: var(--prop-tag) center / 100% 100% no-repeat;
  filter: drop-shadow(1px 3px 2px #27140988);
  pointer-events: auto;
}
.layout-b .durian-choice > span,
.layout-b .durian-choice > strong {
  z-index: 2;
  /* 纸面中心位于素材宽度约44.5%处，右侧木托不计入文字居中。 */
  left: calc(50% - var(--prop-tag-width) * .055);
  top: calc(100% - 6px + var(--prop-tag-height) * .1);
  bottom: auto;
  width: calc(var(--prop-tag-width) * .74);
  height: auto;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  color: var(--prop-ink);
  background: none;
  font-size: clamp(10px, .95vw, 13px);
  font-weight: 800;
  line-height: 1.1;
  text-align: center;
  text-shadow: none;
  pointer-events: none;
}
.layout-b .durian-choice > strong {
  top: calc(100% - 6px + var(--prop-tag-height) * .43);
  font-size: clamp(11px, 1.05vw, 15px);
  color: var(--prop-red);
}
.layout-b .durian-choice[aria-disabled=true]::after { filter: saturate(.45) brightness(.85); }
.layout-b .durian-choice > .choice-unavailable {
  z-index: 3;
  top: 3px;
  right: 6%;
  padding: 3px 6px;
  color: #fff0d3;
  background: #572a1f;
  border: 1px solid #c79056;
  rotate: 5deg;
}
/* 对白只保留木框边缘，暗色纯底让位于文字，不延展斑驳的木板中央。 */
.layout-b .speech {
  width: calc(94% - clamp(78px, 7vw, 96px));
  height: clamp(66px, 9svh, 82px);
  padding: 4px clamp(10px, 1.2vw, 16px);
  grid-template-columns: clamp(32px, 2.9vw, 42px) minmax(0, 1fr);
  align-items: safe center;
  gap: clamp(10px, 1.1vw, 16px);
  background: #0e211a;
  background-clip: padding-box;
  border: 10px solid transparent;
  border-image: var(--prop-dialogue) 46 / 10px / 0 stretch;
  border-radius: 0;
  filter: drop-shadow(0 6px 5px #110a05a3);
  scrollbar-color: #b99458 #193324;
}
.layout-b .speech-avatar {
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  margin: 0;
  border: 2px solid #bd9150;
  box-shadow: 0 2px 4px #060e0d99;
}
.layout-b .speaker { color: #f0c47d; font-size: clamp(11px, .95vw, 13px); line-height: 1.2; }
.layout-b .speech .speech-line { margin-top: 3px; font-size: var(--text-body); line-height: 1.4; }
.layout-b .speech::after {
  content: "";
  position: absolute;
  right: 5px;
  bottom: 5px;
  width: 16px;
  height: 12px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 12'%3E%3Cpath d='m2 3 6 5 6-5' fill='none' stroke='%23e4bb70' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
  opacity: .8;
}
.layout-b .speech.is-typing::after { opacity: 0; }
.layout-b .collection-open {
  width: clamp(62px, 5.5vw, 80px);
  min-height: 0;
  aspect-ratio: .87;
  padding: 0;
  gap: 0;
  border: 0;
  border-radius: 0;
  color: var(--prop-cream);
  background: none;
  filter: drop-shadow(0 6px 4px #110a05b3);
}
.layout-b .collection-art { position: absolute; inset: 0 0 12%; background: var(--prop-book) center / contain no-repeat; }
.layout-b .collection-open > span:last-child {
  position: absolute;
  inset: auto 10% 1%;
  padding: 4px 0;
  background: var(--prop-wood) center / 100% 100% no-repeat;
  font-size: clamp(11px, .95vw, 13px);
  text-align: center;
  font-weight: 700;
}
.layout-b .mission {
  max-width: 40%;
  padding: 12px 26px 14px clamp(48px, 4.6vw, 66px);
  border: 0;
  border-radius: 0;
  background: var(--prop-wood) center / 100% 100% no-repeat;
  color: var(--prop-cream);
  filter: drop-shadow(0 4px 3px #150b08a6);
}
.layout-b .mission::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 50%;
  translate: 0 -50%;
  width: clamp(36px, 3.3vw, 48px);
  aspect-ratio: 1;
  background: var(--prop-trophy) center / contain no-repeat;
}
.layout-b .mission span { color: #f2cc8b; }
.layout-b .mission span::before { content: none; }
.layout-b .mission strong { font-size: clamp(10px, .95vw, 14px); }
/* 开果、回购、结算沿用原按钮与事件，只替换为同一套道具。 */
.layout-b :is(.room-prompt button, .room-continue-button, .continue-button, .buyback-buttons button, .room-breakdown-return, .restart-button) {
  color: var(--prop-ink);
  background: var(--prop-action) center / 100% 100% no-repeat;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  filter: drop-shadow(0 5px 4px #100a0780);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  /* 素材下缘含投影，内容中心上移到可见木板中央。 */
  padding: 7px 24px 13px;
  font-weight: 800;
}
.layout-b .room-prompt button {
  min-width: clamp(140px, 15vw, 190px);
  min-height: 48px;
  font-size: clamp(16px, 1.4vw, 20px);
}
.layout-b .game[data-state=cut-ready] #openingTitle { font-size: clamp(22px, 2.2vw, 30px); }
.layout-b .room-details h1 { font-size: clamp(20px, 2vw, 28px); }
.layout-b .game[data-state=room-reveal] .room-actions {
  position: static;
  margin-top: 24px;
  gap: 16px;
  backdrop-filter: none;
}
.layout-b .room-continue-button {
  justify-self: start;
  width: max-content;
  max-width: 100%;
  min-width: 160px;
  font-size: 14px;
}
.layout-b .room-breakdown-return {
  align-self: center;
  width: min(100%, 200px);
  font-size: 14px;
}
.layout-b :is(#roomCancelButton, .buyback-buttons button:last-child) {
  color: var(--prop-cream);
  background: var(--prop-wood) center / 100% 100% no-repeat;
}
/* 深色木牌的板心居中，不沿用浅色行动牌为下缘投影预留的上移量。 */
.layout-b :is(#roomCancelButton, #buybackContinueButton) { padding-block: 10px; }
.layout-b :is(.knife-choice, .room-continue-button, #buybackSellButton, #buybackContinueButton) {
  display: inline-flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  gap: 8px;
}
.layout-b #buybackSellButton::before {
  content: "";
  flex: 0 0 24px;
  width: 24px;
  aspect-ratio: 1;
  background: var(--prop-money) center / contain no-repeat;
}
.layout-b #game .room-progress {
  position: absolute;
  top: 50%;
  left: 50%;
  right: auto;
  translate: -50% -50%;
  width: max-content;
  max-width: 40%;
  grid-column: auto;
  grid-row: auto;
  height: auto;
  min-height: 44px;
  padding: 8px 18px;
  background: var(--prop-wood) center / 100% 100% no-repeat;
  color: var(--prop-cream);
}
.layout-b :is(.share-button, .room-breakdown-trigger, .collection-gain) {
  color: var(--prop-cream);
  background: var(--prop-wood) center / 100% 100% no-repeat;
  border: 0;
  border-radius: 0;
  padding: 10px 20px;
}
.layout-b .room-breakdown-trigger {
  border: 8px solid transparent;
  border-image: var(--prop-wood) 40 fill / 8px / 0 stretch;
  background: none;
  padding: 4px 12px;
  font-size: 13px;
}
.layout-b .opening-exit {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 0;
  color: var(--prop-cream);
  background: none;
  border: 0;
  text-shadow: 0 2px 4px #160b04;
}
.layout-b .game:is([data-state=cut-ready], [data-state=opening], [data-state=room-reveal]) .opening-exit { display: inline-flex; }
.layout-b .opening-exit::before {
  content: "";
  width: 44px;
  aspect-ratio: 1;
  background: var(--prop-return) center / contain no-repeat;
}
.layout-b :is(.collection-modal, .room-breakdown-modal, .fruit-summary-modal),
.layout-b .game[data-state=summary] .season-report {
  border: 10px solid transparent;
  /* 木框保留原材质，内部底纹单独压低对比，不降低文字或按钮的不透明度。 */
  border-image: var(--prop-dialogue) 46 / 10px / 0 stretch;
  border-radius: 0;
  background:
    linear-gradient(#10251edb, #10251edb),
    var(--prop-dialogue) center / 100% 100% no-repeat;
  background-clip: padding-box;
  color: var(--prop-cream);
  box-shadow: 0 18px 50px #0008;
  scrollbar-color: #b99458 #193324;
}
.layout-b .fruit-summary-header h2 { font-size: 18px; }
.layout-b .collection-heading { flex-direction: column; align-items: start; gap: 4px; }
.layout-b .collection-progress { margin: 0; font-size: 12px; }
.layout-b .collection-gallery:has(> .collection-card) { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.layout-b .collection-card > img,
.layout-b .collection-image-placeholder { height: clamp(110px, 22svh, 180px); }
.layout-b .collection-card-copy { padding: 8px; }
.layout-b .collection-card h3 { font-size: 14px; }
/* 横屏结局按横向阅读展开，两项操作与全部摘要始终位于同一屏内。 */
.layout-b .game[data-state=summary] .season-report {
  top: calc(50% + 24px);
  bottom: auto;
  left: 50%;
  right: auto;
  translate: -50% -50%;
  width: min(960px, calc(100% - 48px));
  height: min(520px, calc(100% - 96px));
  max-height: none;
  padding: clamp(14px, 2svh, 24px);
  overflow: visible;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-rows: auto 1fr auto;
  column-gap: clamp(24px, 4vw, 56px);
  row-gap: clamp(12px, 2svh, 24px);
}
.layout-b .report-header {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.layout-b .report-header .report-stamp { margin: 0; white-space: nowrap; }
.layout-b .report-outcome,
.layout-b .report-details {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: clamp(12px, 2svh, 24px);
}
.layout-b .report-outcome h1 { margin: 0; font-size: clamp(24px, 3vw, 40px); }
.layout-b .report-outcome .report-subtitle { font-size: 14px; }
.layout-b .report-outcome .report-money { padding: 0; }
.layout-b .report-outcome .report-money strong { font-size: clamp(36px, 4vw, 56px); }
.layout-b .report-details .report-stats { padding: 0; border: 0; gap: 16px 20px; }
.layout-b .report-details .report-stats strong { font-size: clamp(18px, 2vw, 26px); }
.layout-b .report-details .collection-report { padding: 12px 0 0; }
.layout-b .report-actions {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.layout-b .report-actions button { width: 100%; min-height: 44px; padding: 8px 12px; font-size: 14px; }
@media (max-height: 520px) and (orientation: landscape) {
  .layout-b .game[data-state=summary] .season-report {
    top: 64px;
    bottom: 12px;
    translate: -50% 0;
    width: calc(100% - 32px);
    height: auto;
    padding: 12px 16px;
    column-gap: 24px;
    row-gap: 8px;
  }
  .layout-b .report-outcome,
  .layout-b .report-details { gap: 8px; }
  .layout-b .report-header .report-label { font-size: 11px; letter-spacing: 0; }
  .layout-b .report-outcome h1 { font-size: 24px; }
  .layout-b .report-outcome .report-subtitle { font-size: 12px; }
  .layout-b .report-outcome .report-money strong { font-size: 36px; }
  .layout-b .report-outcome .report-money small { font-size: 13px; }
  .layout-b .report-details .report-stats { gap: 8px 16px; }
  .layout-b .report-details .report-stats strong { font-size: 18px; }
  .layout-b .report-details .collection-report { padding-top: 8px; }
  .layout-b .report-details .season-collection-copy { margin-top: 4px; }
  .layout-b .report-actions { gap: 8px; }
  .layout-b .report-actions button { font-size: 13px; }
}
@media (max-height: 360px) and (orientation: landscape) {
  /* 报告已含日期和最终资产，矮屏收起重复HUD，把高度留给完整结局。 */
  .layout-b .game[data-state=summary] .hud { display: none; }
  .layout-b .game[data-state=summary] .season-report { top: 12px; padding: 10px 12px; column-gap: 16px; }
}
/* 矮屏下只滚动对白/明细区域，下一日操作始终留在木框内。 */
.layout-b .game[data-state=result] .fruit-summary-modal[open] {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: max-content;
  max-width: min(520px, calc(100vw - 40px));
  max-height: min(78svh, 440px);
  padding: 14px;
  overflow: hidden;
}
.layout-b .fruit-summary-header { flex-shrink: 0; margin-bottom: 0; }
.layout-b .game[data-state=result] .whole-overview { flex-shrink: 0; margin-bottom: 0; }
.layout-b .game[data-state=result] .result-layout {
  display: flex;
  flex: 0 1 auto;
  align-self: stretch;
  border: 0;
  background: none;
  backdrop-filter: none;
  /* 解除 flex 默认最小高度，使明细滚动而非把底部按钮挤出短屏。 */
  min-height: 0;
}
.layout-b .game[data-state=result] .result-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  /* 随父级可用高度收缩，滚动内容让出底部操作空间。 */
  flex: 1;
  min-height: 0;
  overflow: hidden;
  backdrop-filter: none;
}

.layout-b .game[data-state=result] .result-scroll { flex: 1; min-height: 0; max-height: none; }
.layout-b .game[data-state=result] .continue-button {
  position: static;
  flex-shrink: 0;
  align-self: center;
  width: min(100%, 220px);
  padding: 2px 20px 6px;
  background: none;
  border: 8px solid transparent;
  border-image: var(--prop-action) 60 80 fill / 8px 18px / 0 stretch;
}
.layout-b .toast {
  border: 0;
  border-radius: 0;
  background: var(--prop-wood) center / 100% 100% no-repeat;
  padding: 14px 24px;
  color: var(--prop-cream);
  box-shadow: 0 5px 18px #0006;
}
.layout-b :is(.sound-button, .collection-open, .opening-exit, .speech) { transition: filter 160ms ease-out; }
@media (hover: hover) {
  .layout-b :is(.sound-button, .collection-open, .opening-exit, .speech):hover { filter: brightness(1.12) drop-shadow(0 6px 5px #160c0899); }
}
.layout-b :is(.sound-button, .collection-open, .opening-exit, .speech):active { filter: brightness(.88); }
.layout-b :is(.room-prompt button, .room-continue-button, .continue-button, .buyback-buttons button, .room-breakdown-return, .restart-button):disabled { filter: saturate(.4) brightness(.72); }
@media (max-height: 480px) and (orientation: landscape) {
  .layout-b .game .hud .day-block { padding: 10px 14px; gap: 10px; }
  .layout-b .game .hud .cash-block,
  .layout-b .game:not([data-state=select]) .hud .cash-block { min-height: 44px; padding: 8px 16px 8px 44px; }
  .layout-b .cash-block::before { width: 48px; left: -6px; }
  .layout-b .mission { padding: 9px 20px 11px 40px; }
  .layout-b .mission::before { width: 32px; left: 3px; }
  .layout-b .speech { height: 62px; border-width: 8px; border-image-width: 8px; padding: 4px 9px; grid-template-columns: 32px minmax(0, 1fr); gap: 9px; }
  .layout-b .speech .speech-line { margin-top: 2px; }
  .layout-b :is(.room-prompt button, .room-continue-button, .buyback-buttons button) { padding: 6px 20px 12px; }
  .layout-b .game[data-state=result] .fruit-summary-modal[open] { gap: 8px; padding: 12px; }


  .layout-b .collection-card > img,
  .layout-b .collection-image-placeholder { height: 28svh; }
}
@media (prefers-reduced-motion: reduce) {
  .layout-b :is(.sound-button, .collection-open, .opening-exit, .speech) { transition: none; }
}

/* 逐房结果与操作共用右侧文档流，短内容居中，长对白在可用高度内滚动。 */
.layout-b .game[data-state=room-reveal] .room-details {
  align-self: center;
  max-height: 100%;
  max-width: 440px;
  overflow: auto;
  pointer-events: auto;
  padding: 4px 8px 16px 0;
}
.layout-b .game[data-state=room-reveal] .room-details h1 {
  margin: 0;
  font-size: clamp(24px, 2.8vw, 40px);
}
.layout-b .game[data-state=room-reveal] .room-description {
  margin: 12px 0 20px;
  font-size: clamp(14px, 1.2vw, 18px);
  color: #dccdad;
}
.layout-b .game[data-state=room-reveal] .room-return {
  display: flex;
  align-items: baseline;
  gap: 12px;
  font-size: 14px;
}
.layout-b .game[data-state=room-reveal] .room-return strong {
  font-size: clamp(28px, 3vw, 42px);
  font-variant-numeric: tabular-nums;
}
.layout-b .game[data-state=room-reveal] .result-dialogues:has(> [hidden]):not(:has(> :not([hidden]))) {
  display: none;
}
@media (max-height: 480px) and (orientation: landscape) {
  .layout-b .game[data-state=room-reveal] .room-description { margin: 8px 0 12px; }
  .layout-b .game[data-state=room-reveal] .room-actions { margin-top: 16px; gap: 12px; }
}
