/* Desktop text is measured in visible CSS pixels, independent of layout zoom.
   The phone rules, toolbar and approved reading width stay
   under their existing styles. Desktop messages, input, progress and menus
   share 16px text; chat titles use 14px. */
@media screen and (hover:hover) and (pointer:fine) and (min-width:821px) and (min-height:601px),
       screen and (hover:hover) and (pointer:fine) and (min-width:1101px) {
  :root {
    --desktop-answer-size:calc(16px / var(--desktop-ui-scale,1));
    --desktop-navigation-size:calc(16px / var(--desktop-ui-scale,1));
    --desktop-chat-title-size:calc(14px / var(--desktop-ui-scale,1));
    --top-menu-item-size:calc(14px / var(--desktop-ui-scale,1));
    --menu-body-size:calc(16px / var(--desktop-ui-scale,1));
    --desktop-caption-size:calc(14px / var(--desktop-ui-scale,1));
  }
  :root .app-shell .message.assistant .message-content,
  :root .app-shell .message.assistant .message-content :is(.response,.response-neutral),
  :root .app-shell .live-output-text {
    font-size:var(--desktop-answer-size);
    line-height:1.5;
  }
  :root .app-shell .message.user .message-content,
  :root .app-shell .composer #message-input {
    font-size:var(--desktop-navigation-size);
  }
  :root .app-shell .section-nav .sidebar-shortcut,
  :root .app-shell .sidebar-footer .settings-button,
  :root .app-shell .sidebar .section-caption,
  :root .app-shell .sidebar .search-box input {
    font-size:var(--desktop-navigation-size);
  }
  :root .app-shell .sidebar .brand strong {
    font-size:var(--desktop-navigation-size);
  }
  :root .app-shell .chat-list .chat-open {font-size:var(--desktop-chat-title-size);}
  :root .app-shell .sidebar .shortcut-label {
    white-space:normal;
    overflow-wrap:anywhere;
    min-width:0;
  }
  :root .app-shell .sidebar .nav-body155 {grid-template-columns:minmax(0,1fr);}
  :root .app-shell .sidebar .search-box input {min-width:0;}
  :root .chat-menu,
  :root .chat-menu button {
    font-size:var(--desktop-navigation-size);
    line-height:1.4;
  }
  /* Explicit sizes on view controls otherwise override inherited menu text. */
  :root .app-shell .view:not(#chat-view) :is(button:not(.icon-button),input,select,textarea:not(#code-content),summary,.project-title,.notice,blockquote,h4),
  :root .app-shell #uploads-panel :is(button:not(.icon-button),p,label,small,.help),
  :root dialog :is(textarea,summary) {
    font-size:var(--menu-body-size);
    line-height:1.4;
  }
  :root .app-shell .view:not(#chat-view) h2,
  :root dialog h2 {font-size:calc(24px / var(--desktop-ui-scale,1));}
  :root .app-shell .view:not(#chat-view) h3 {font-size:calc(22px / var(--desktop-ui-scale,1));}
  :root .app-shell :is(.model-panel-heading,.uploads-panel-heading) {font-size:var(--menu-body-size);}
  /* Native select popups may ignore option sizes: match their control size,
     rather than the larger side-panel typography, in the custom report menu. */
  :root .app-shell .top-controls select option,
  :root .app-shell #test-modes156 button {font-size:var(--top-menu-item-size);font-weight:400;line-height:1.4;}
  /* These panels do not inherit the menu font: several previously rendered
     at only 9–13px after page zoom. Keep code editors and custom documents
     outside this correction. */
  :root .app-shell .activity-drawer,
  :root .app-shell .activity-drawer :is(p,li,dd,dt,button,textarea,.activity-summary),
  :root .app-shell #activity-report-text,
  :root .app-shell #sources-read,
  :root .app-shell #sources-cited {
    font-size:var(--menu-body-size);
    line-height:1.5;
  }
  :root .app-shell .activity-drawer h2 {
    font-size:var(--menu-body-size);
  }
  :root .app-shell .activity-drawer :is(.activity-meta,.activity-event strong,.activity-event span),
  :root .app-shell .work-action,
  :root .app-shell .work-progress-history .work-note,
  :root .app-shell .work-history > summary,
  :root .app-shell .answer-status,
  :root .app-shell .answer-mode156 {
    font-size:var(--desktop-caption-size);
    line-height:1.5;
  }
  :root .app-shell .answer-action {
    font-size:calc(15px / var(--desktop-ui-scale,1));
  }
  :root .app-shell .top-controls .protocol-name {
    font-size:calc(15px / var(--desktop-ui-scale,1));
  }
  :root .app-shell .top-controls .task-calendar {
    font-size:calc(13px / var(--desktop-ui-scale,1));
  }
  :root .app-shell .sidebar-build {
    font-size:calc(12px / var(--desktop-ui-scale,1));
  }
  /* Public explanations and stage names follow desktop navigation;
     diagnostic history remains a caption. */
  :root .app-shell #inline-activity .work-action,
  :root .app-shell #inline-activity .work-note,
  :root .app-shell #inline-activity #completed-stages160,
  :root .app-shell #inline-activity #inline-activity-current {
    font-size:var(--desktop-navigation-size);
    line-height:1.5;
  }
  /* Protocol typography must follow the answer size, not the scaled root. */
  :root .app-shell .message.assistant .message-content .response h2 {font-size:1.08em;}
  :root .app-shell .message.assistant .message-content .response h3 {font-size:.98em;}
  :root .app-shell .message.assistant .message-content .response .main-result {font-size:1.02em;}
}

/* The later mobile request concerns side-section submenus only. Do not
   inherit this size into the conversation, toolbar or composer popovers. */
@media screen and (hover:none) and (pointer:coarse),
       screen and (max-width:820px),
       screen and (max-width:1100px) and (max-height:600px) {
  :root .app-shell .chat-list .chat-open {font-size:15px;}
  :root .app-shell .view:not(#chat-view),
  :root .chat-menu,
  :root dialog {--menu-body-size:18px;}
  :root .chat-menu,
  :root .chat-menu button,
  :root .app-shell .view:not(#chat-view) :is(button:not(.icon-button),input,select,textarea:not(#code-content),summary,.project-title,.notice,blockquote,h4),
  :root dialog :is(textarea,summary) {font-size:var(--menu-body-size);line-height:1.4;}
}
