/** 結果の項目は写真側まで広げ、紙の上を一列で読み進める。 */
.menu-toolbar {
  min-height: 22px;
  margin-bottom: 5px;
}
.result-tabs-shell {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  flex: 0 0 44px;
  margin-bottom: 12px;
}
.result-tabs-viewport {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
}
#result-tabs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 5px;
  margin: 0;
  width: 100%;
  overflow: visible;
}
#result-tabs button {
  min-width: 0;
  min-height: 44px;
  height: 44px;
  padding: 5px 4px;
  font-size: clamp(9px, 1.1vw, 12px);
  white-space: nowrap;
  text-wrap: nowrap;
}
.tab-page-control {
  display: none;
}

/* 全体の操作はノートの下部へ。長い文章を読む領域を固定して保つ。 */
.result-bottom-actions {
  flex: 0 0 auto;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
  min-width: 0;
  min-height: 44px;
  margin-top: 7px;
}
.result-bottom-actions .text-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 6px 20px;
  font-size: 10px;
  line-height: 1.4;
  white-space: nowrap;
}
body[data-result-tab]:not([data-result-tab='overview']) .result-bottom-actions #portrait-replay {
  display: inline-flex;
}

/* 写真の紙面中央を基準に、アカウント名と量を大きめにまとめる。 */
.bag-label {
  left: 57.8%;
  top: 25.5%;
  width: 24%;
  height: 18.5%;
  max-width: 24%;
  max-height: 18.5%;
  gap: 2cqi;
}
#bag-account { font-size: var(--bag-account-size, 3.9cqi); }
#bag-weight { font-size: 3.9cqi; }

#save-open,
#save-open:hover:not(:disabled),
#save-open:active:not(:disabled),
#save-open:focus-visible {
  width: min(100%, 300px);
  flex-basis: 300px;
  padding-inline: 35px;
  font-size: 11px;
}

/* コピー後も原画の比率を保ち、ウィンドウ一杯に引き延ばさない。 */
#save-dialog .menu-actions {
  display: flex;
  justify-content: center;
}
#save-dialog #copy-button,
#save-dialog #copy-button:hover:not(:disabled),
#save-dialog #copy-button:active:not(:disabled),
#save-dialog #copy-button:focus-visible {
  width: min(100%, 260px);
  min-height: 0;
  height: auto;
  aspect-ratio: 500 / 99;
  flex: 0 1 260px;
  padding: 0 30px;
  background: var(--ui-primary) center / contain no-repeat;
  font-size: 11px;
  line-height: 1.35;
  align-items: center;
  justify-content: center;
}

@media (max-width: 600px) {
  .menu-toolbar { min-height: 18px; margin-bottom: 5px; }
  .result-tabs-shell { gap: 4px; margin-bottom: 9px; }
  .result-tabs-viewport { overflow: hidden; }
  #result-tabs {
    display: flex;
    gap: 4px;
    transform: translateX(calc(var(--tab-page, 0) * (-100% - 4px)));
  }
  #result-tabs button {
    flex: 0 0 calc((100% - 8px) / 3);
    font-size: 10px;
    padding-inline: 4px;
  }
  .tab-page-control {
    display: inline-flex;
    flex: 0 0 32px;
    width: 32px;
    min-width: 32px;
    min-height: 44px;
    padding: 4px;
    align-items: center;
    justify-content: center;
    font-size: 11px;
  }
  .result-bottom-actions { justify-content: center; gap: 4px; margin-top: 5px; }
  .result-bottom-actions .text-link {
    padding: 6px 12px;
    font-size: 9px;
  }
  .result-bottom-actions #save-toolbar { min-width: 0; padding-inline: 11px; }
  #save-open,
  #save-open:hover:not(:disabled),
  #save-open:active:not(:disabled),
  #save-open:focus-visible { font-size: 10px; padding-inline: 30px; }
}
#dashboard-account { max-width: 100%; white-space: nowrap; }
/* 旧スタイルの折り返し指定を解除し、タブの行高を固定する。 */
.result-tabs-shell,.result-tabs-viewport,#result-tabs{height:44px;min-height:44px;max-height:44px}
#result-tabs{flex-wrap:nowrap}

/* ページ送りは紙の左右の余白に置き、額縁やボタンの絵柄を重ねない。 */
body .text-page-button,
body .page-arrow,
body .tab-page-control,
body #detail-prev,
body #detail-next,
body .text-page-button:hover:not(:disabled),
body .page-arrow:hover:not(:disabled),
body .tab-page-control:hover:not(:disabled),
body #detail-prev:hover:not(:disabled),
body #detail-next:hover:not(:disabled) {
  background: none !important;
  border: 0 !important;
  border-image: none !important;
  box-shadow: none !important;
  color: #70643d;
  padding: 0;
  min-width: 44px;
  width: 44px;
  min-height: 44px;
  height: 44px;
  font: 24px/1 sans-serif;
  text-align: center;
  transform: none;
}
body .text-page-button::before,body .text-page-button::after,
body .page-arrow::before,body .page-arrow::after,
body .tab-page-control::before,body .tab-page-control::after,
body #detail-prev::before,body #detail-prev::after,
body #detail-next::before,body #detail-next::after { content: none !important; }
body .text-page-button:disabled,body .page-arrow:disabled,
body .tab-page-control:disabled,body #detail-prev:disabled,body #detail-next:disabled { opacity: .22; }
body .text-page-button:focus-visible,body .page-arrow:focus-visible,
body .tab-page-control:focus-visible,body #detail-prev:focus-visible,body #detail-next:focus-visible {
  outline: 2px solid #70643d;
  outline-offset: 2px;
  border-radius: 50%;
}
body[data-result-tab]:not([data-result-tab='overview']) .menu-copy {
  width: min(76%, 980px);
}
#detail-pager {
  justify-content: center;
  min-height: 26px;
  font-size: 11px;
  padding: 0 0 12px;
}
#detail-prev,#detail-next {
  position: fixed;
  top: 52dvh;
  z-index: 5;
}
#detail-prev { left: max(14px, 4vw); }
#detail-next { right: max(14px, 4vw); }
.deep-insight { gap: 18px; }
.deep-insight h3 { font-size: clamp(24px, 2.1vw, 34px); line-height: 1.5; }
.deep-insight .insight-part { gap: 12px; }
.deep-insight .insight-part > strong { font-size: 12px; letter-spacing: .07em; }
.deep-insight .text-page-body { font-size: clamp(15px, 1.3vw, 18px); line-height: 1.95; }
.deep-insight > .evidence-trigger { margin-top: 8px; }
@media (max-width: 600px) {
  body[data-result-tab]:not([data-result-tab='overview']) .menu-copy { width: 100%; padding-inline: 20px; }
  #detail-prev { left: 0; }
  #detail-next { right: 0; }
  #detail-pager { min-height: 20px; padding-bottom: 4px; font-size: 9px; }
  body #detail-prev,body #detail-next { min-width: 34px; width: 34px; font-size: 20px; }
  .deep-insight { gap: 8px; }
  .deep-insight h3 { font-size: 20px; line-height: 1.45; }
  .deep-insight .insight-part { gap: 7px; }
  .deep-insight .insight-part > strong { font-size: 10px; letter-spacing: .02em; }
  .deep-insight .text-page-body { font-size: 13px; line-height: 1.9; }
  .deep-insight > .evidence-trigger { padding-inline: 12px; font-size: 9px; margin-top: 0; }
}

#overview .text-page-button,#palette .text-page-button {
  position: fixed;
  top: 52dvh;
  z-index: 5;
}
#overview .text-page-button:first-child,#palette .text-page-button:first-child { left: max(14px, 4vw); }
#overview .text-page-button:last-child,#palette .text-page-button:last-child { right: max(14px, 4vw); }
#overview .text-page-controls,#palette .text-page-controls { justify-content: center; }
@media (max-width: 600px) {
  #overview .text-page-button:first-child,#palette .text-page-button:first-child { left: 0; }
  #overview .text-page-button:last-child,#palette .text-page-button:last-child { right: 0; }
  body #overview .text-page-button,body #palette .text-page-button { width: 34px; min-width: 34px; font-size: 20px; }
  #overview .paged-copy,#palette .paged-copy { padding-inline: 14px; }
}

.deep-reading-body { flex: 1 1 auto; min-height: 0; overflow: hidden; display: flex; flex-direction: column; gap: 20px; }
.deep-reading-body .insight-part { flex: 0 0 auto; }
@media (max-width: 600px) { .deep-reading-body { gap: 12px; } }

/* 旧本文の43em上限に再び狭められないよう、ページ計算と実際の行幅を一致させる。 */
.deep-insight .insight-part,
.deep-insight .text-page-body { width: 100%; max-width: none; }
