/* A mobile-only floor preserves desktop typography and existing larger headings. */
.comparison-cell-source { display: none; }
.pei-intro-details { margin-top: .4rem; font-size: .875rem; }
.pei-intro-details summary { cursor: pointer; color: #a5becb; }
.pei-intro-details[open] p { margin-top: .5rem; }
@media (max-width: 900px) {
  #mobile-menu { max-height: calc(100vh - 190px); max-height: calc(100dvh - 190px - env(safe-area-inset-bottom)); overflow-y: auto; overscroll-behavior: contain; align-content: start; scroll-padding: 12px; }
  #mobile-menu a { min-width: 0; min-height: 44px; line-height: 1.65; overflow-wrap: anywhere; }
  #mobile-menu a[aria-current="page"] { color: var(--lime); background: #203317; box-shadow: inset 3px 0 var(--lime); }
}
@media (max-width: 760px) {
  :root { --pei-mobile-text-floor: .875rem; }
  body { font-size: 1rem; line-height: 1.7; padding-bottom: calc(100px + env(safe-area-inset-bottom)); }
  p, li, dd { font-size: 1rem !important; line-height: 1.8; overflow-wrap: anywhere; }
  input, textarea, select { font-size: 1rem !important; line-height: 1.6; max-width: 100%; }
  button, summary { min-height: 44px; line-height: 1.6; white-space: normal; }
  h1, h2, h3, label, a, button, dt, dd { overflow-wrap: anywhere; }
  .panel-heading, .page-heading, .preview-strip>span, .news-strip-bottom,
  .news-item-meta, .news-item-footer, .source-metadata, .map-mode-row,
  .full-map-toolbar, .dialog-actions, .note-footer { flex-wrap: wrap; gap: 12px; }
  .panel-heading>* , .page-heading>* { min-width: 0; }
  .panel-heading h2 { line-height: 1.6; }
  .see-all, .source-link, .source-workspace-nav a { min-height: 44px; display: inline-flex; align-items: center; white-space: normal; }
  .mobile-bottom-nav { height: auto; min-height: 76px; padding-bottom: env(safe-area-inset-bottom); align-items: stretch; }
  .mobile-bottom-nav a { min-width: 0; min-height: 64px; line-height: 1.4; white-space: normal; text-align: center; }
  .preview-strip { line-height: 1.7; letter-spacing: 0; }
  .preview-strip button { max-width: 100%; }
  .news-retrieval-metrics, .source-metadata { grid-template-columns: minmax(0,1fr); }
  .comparison-table { overflow-x: auto; }
  .comparison-table table { min-width: 800px; }
  .comparison-table .comparison-cell-source { display: block; margin-bottom: 10px; font-size: .875rem; line-height: 1.5; font-weight: 600; color: #8adeec; }
  .comparison-table td .source-save-button, .comparison-table .comparison-remove { min-height: 44px; }
  .source-note-editor textarea { min-height: 160px; }
  .site-header, .preview-strip, .workspace, .compare-tray { width: 100%; min-width: 0; }
  .site-header { padding-left: 16px; padding-right: 16px; gap: 8px; }
  .site-header .brand { min-width: 0; flex: 1 1 auto; }
  .site-header .main-pei-logo { width: 100%; max-width: 203px; height: auto; flex-shrink: 1; }
  .site-header .header-actions { flex: 0 0 auto; gap: 6px; margin-left: 0; }
  .preview-strip { display: grid; gap: 0; padding: 8px 16px; }
  .preview-strip>span { display: flex; justify-content: flex-start; flex-wrap: wrap; gap: 4px 8px; }
  .preview-strip b { margin-left: 0; font-weight: 400; }
  .preview-strip button { margin-top: 0; min-height: 36px; }
  .pei-home-intro { display: grid; grid-template-columns: minmax(0,1fr); gap: 10px; padding: 16px; margin-bottom: 16px; }
  .pei-home-intro h2 { font-size: 1.125rem; line-height: 1.5; }
  .pei-home-intro p { font-size: .875rem !important; line-height: 1.65; }
  .pei-home-intro>a { justify-self: start; min-height: 44px; }
  .pei-intro-details summary { min-height: 36px; line-height: 1.6; padding: 6px 0; }
  .compare-tray { position: static; padding: 10px 16px; gap: 8px; }
  .compare-tray-items { flex-basis: auto; flex: 1 1 100%; }
  .compare-tray>.outline-lime-button { min-height: 44px; max-width: 100%; white-space: normal; }
  /* Give long Japanese filter values the full phone width. */
  .news-reader-toolbar { display: grid; grid-template-columns: minmax(0,1fr); gap: 16px; }
  .news-reader-toolbar .reader-period { display: flex; flex-direction: column; align-items: stretch; gap: 8px; min-width: 0; width: 100%; }
  .news-reader-toolbar select { width: 100%; min-width: 0; min-height: 48px; padding: 10px 12px; }
  .news-reader-toolbar .filter-search { margin: 0; min-width: 0; width: 100%; }
  #news-filters, #news-topic-filters { display: flex; flex-wrap: wrap; gap: 8px; width: 100%; }
  #news-filters button, #news-topic-filters button { flex: 1 1 120px; min-height: 44px; padding: 10px 12px; white-space: normal; }
  .news-topic-row, .news-reading-link { display: flex; flex-wrap: wrap; gap: 12px; }
  .news-reading-link>button { width: 100%; min-height: 48px; white-space: normal; text-align: left; }
  .ask-facets { grid-template-columns: minmax(0,1fr); gap: 16px; }
  .ask-facets select { min-height: 48px; padding: 10px 12px; }
  .ask-news-controls .reader-period { flex-basis: 100%; display: flex; flex-direction: column; align-items: stretch; }
  .ask-news-controls select { width: 100%; min-width: 0; }
  .ask-form .ask-button { min-height: 48px; flex-shrink: 0; }
  .news-retrieval-summary header { flex-wrap: wrap; }
  /* Restore hierarchy and breathing room after increasing the type floor. */
  .workspace { padding-left: 16px; padding-right: 16px; }
  .page-heading { padding: 24px 0 20px; gap: 16px; }
  .page-heading h1 { font-size: 1.5rem; line-height: 1.4; }
  .panel-heading { align-items: baseline; row-gap: 6px; margin-bottom: 16px; }
  .panel-heading h2, .panel .panel-heading h2 { font-size: 1.125rem; line-height: 1.5; }
  .panel-heading .see-all { margin-left: 0; }
  .micro-note, .daily-footnote, .dialog-disclaimer, .news-collection-note,
  p.news-retrieval-note, .page-heading p { font-size: .875rem !important; line-height: 1.75; }
  .news-card h3, .news-card.compact h3 { font-size: 1.0625rem; line-height: 1.7; }
  .news-card, .news-source-panel, .ask-workspace { padding: 18px 16px; }
  .data-cards { grid-template-columns: minmax(0,1fr); gap: 16px; }
  .news-grid, .news-home-grid { gap: 16px; }
  /* Reading overlays have their own spacing, independent of page cards. */
  #detail-dialog {
    width: calc(100% - 24px); max-width: 36rem;
    padding: 12px 16px 24px; max-height: 88vh; max-height: 88dvh;
    overscroll-behavior: contain; scroll-padding-top: 64px;
  }
  #detail-dialog>.dialog-close {
    width: 44px; height: 44px; min-width: 44px; min-height: 44px;
    margin: 0 0 12px auto; top: 0; display: flex;
    align-items: center; justify-content: center;
  }
  #dialog-content { min-width: 0; }
  #dialog-content .dialog-kicker { flex-wrap: wrap; padding-right: 0; margin-bottom: 12px; letter-spacing: .04em; }
  #dialog-title { font-size: 1.25rem; line-height: 1.6; margin-bottom: 16px; }
  #dialog-content p, #dialog-content ul { line-height: 1.8; }
  #dialog-content h3 { font-size: 1.0625rem; line-height: 1.6; margin: 24px 0 12px; }
  #dialog-content .dialog-actions { display: grid; grid-template-columns: minmax(0,1fr); gap: 10px; margin-top: 16px; }
  #dialog-content .dialog-actions>a, #dialog-content .dialog-actions>button {
    width: 100%; min-width: 0; min-height: 48px; white-space: normal;
    justify-content: center; text-align: center; padding: 10px 12px;
  }
  #dialog-content>.source-tools { display: flex; flex-wrap: wrap; gap: 8px; }
  #dialog-content>.source-tools button { flex: 1 1 110px; min-height: 44px; }
  #dialog-content input:not([type=checkbox]):not([type=radio]), #dialog-content textarea { scroll-margin-top: 64px; }
}
@media (min-width: 400px) and (max-width: 760px) {
  .ask-facets { grid-template-columns: repeat(2,minmax(0,1fr)); }
}

/* Original-source access stays usable in cards and on mobile. */
.original-source-shortcut { display:inline-flex; flex-wrap:wrap; align-items:center; gap:4px 8px; min-height:44px; padding:6px 8px; max-width:100%; color:#a9d2d3; font-size:.875rem; line-height:1.5; border-radius:4px; overflow-wrap:anywhere; }
.original-source-shortcut span { color:#94aab5; }
.original-source-shortcut:hover { background:#10262d; color:#e5f8fa; }
.original-source-shortcut:focus-visible { outline:2px solid #d0ed79; outline-offset:3px; }

.source-reading-link { margin-top:16px; padding-top:12px; border-top:1px solid #29424c; }
.source-reading-link a { min-height:44px; display:flex; align-items:center; font-size:1rem; }
.original-source .source-link-check { margin-top:12px; line-height:1.7; }

.source-reuse-notice { margin:12px 0 16px; padding:14px; border-left:3px solid #719fa6; background:#102129; color:#bfd0d8; }
.source-reuse-notice strong { display:block; font-size:.875rem; line-height:1.7; }
.source-reuse-notice p { margin:6px 0 0; font-size:1rem; line-height:1.8; }

.sources-panel .source-logos button { min-height:44px; padding:8px 12px; font-size:.875rem; color:#b3d9e2; border:1px solid #29424c; border-radius:4px; }
.sources-panel .source-logos button:hover { background:#10262d; color:#e5f8fa; }
.sources-panel .source-logos button:focus-visible { outline:2px solid #d0ed79; outline-offset:3px; }
.source-network-list article { padding:16px 0; border-top:1px solid #29424c; }
.source-network-list h4 { margin:0; font-size:1rem; line-height:1.7; }
.source-network-list p { font-size:.875rem; line-height:1.7; }
.source-network-list .result-actions,.source-network-feeds>div { display:flex; flex-wrap:wrap; align-items:center; gap:8px 14px; }
.source-network-list .result-actions button { min-height:44px; font-size:.875rem; color:#a9d2d3; }
.source-network-feeds>div { padding:10px 0; }

.source-inline-original { margin:14px 0; border:1px solid #41606a; border-radius:6px; }
.source-inline-original summary { padding:16px; min-height:44px; cursor:pointer; color:#d5ed91; font-size:1rem; line-height:1.7; }
.source-inline-original summary:focus-visible { outline:2px solid #d0ed79; outline-offset:2px; }
.source-inline-body { padding:0 16px 16px; overflow-wrap:anywhere; }
.source-inline-body p { font-size:1rem; line-height:1.9; }
.source-inline-body blockquote { margin:16px 0; padding:16px; border-left:3px solid #d0ed79; background:#102129; color:#eef4f5; font-size:1.125rem; line-height:2; white-space:pre-wrap; }

.dialog-comparison { margin:18px 0; padding:16px; background:#102129; border:1px solid #41606a; border-radius:6px; overflow-wrap:anywhere; }
.dialog-comparison strong { font-size:1rem; line-height:1.8; }
.dialog-comparison ul { padding-left:20px; margin:10px 0; }
.dialog-comparison li,.dialog-comparison p { font-size:1rem; line-height:1.8; }
.dialog-comparison button { min-height:44px; white-space:normal; text-align:left; }
.dialog-comparison li { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:8px 0; }
.dialog-comparison li span { min-width:0; flex:1; }
.dialog-comparison [data-dialog-compare-remove] { flex:none; padding:8px; color:#bdd7de; border:1px solid #41606a; border-radius:4px; font-size:.875rem; }
.dialog-comparison [data-dialog-compare-remove]:focus-visible { outline:2px solid #d0ed79; outline-offset:2px; }
@media(max-width:480px){.dialog-comparison li { align-items:flex-start; flex-direction:column; }}
:root .daily-news-entry{padding:.65rem 1.25rem;border-bottom:1px solid #233b48;background:#08151e;font-size:1rem;line-height:1.6}
:root .daily-news-entry a{color:#c1ed8d;text-decoration:none;display:inline-block;padding:.25rem 0}
:root .daily-news-entry span{color:#b5cbd5;margin-left:.75rem;font-size:.9rem}
@media(max-width:480px){:root .daily-news-entry span{display:block;margin-left:0}}
