/* V364: final, scoped reading layer. Keep content readable at narrow widths and zoom.
   WCAG reference: 1.4.3 text contrast, 1.4.10 reflow; 44px targets are intentional. */
#hayato-root,
#hayato-ptt {
  --read-ink: #24364f;
  --read-muted: #45566f;
  --read-link: #2f4fac;
  --read-focus: #1e4dc1;
  color: var(--read-ink);
  font-size: 16px;
  line-height: 1.8;
  letter-spacing: .015em;
  text-rendering: optimizeLegibility;
}
#hayato-root :is(.hayato-layout,.conversation-column,.conversation-scroll,.hayato-workspace,.work-card,.list-item,.card-actions,.hayato-header-meta),
#hayato-ptt :is(.ptt-header,.ptt-main,.ptt-footer,.ptt-draft) { min-width: 0; }

/* Text is sized by its job; ruby, math glyphs and code keep their own structure. */
#hayato-root :is(.message-text,.message.user .message-text,.message.local .message-text,.message-rich,.work-card,.practice-card),
#hayato-root .work-card :is(p,li,dt,dd,.practice-prompt,.practice-original,.criterion-evidence,.criterion-feedback,.criterion-next,.question-prompt,.answer-option,.task-steps,.point-list,.plan-day),
#hayato-root :is(.welcome-heading p,.presence-intro,.presence-bottom p,.list-item p,.practice-material p,.practice-hints p,.practice-next-fix>b) {
  font-size: 16px;
  line-height: 1.85;
  color: var(--read-ink);
}
#hayato-root .work-card h3 { font-size: 20px; line-height: 1.6; color: var(--read-ink); }
#hayato-root :is(.work-card h4,.answer-label,.criterion-heading>b,.practice-outcome h4,.practice-next-fix h4,.practice-catalog-choice h4,.practice-material h4,.account-section-title) {
  font-size: 16px;
  line-height: 1.7;
  color: #304b6b;
}
#hayato-root .work-card .card-note {
  /* The older studio skin uses !important for these two properties. */
  font-size: 14px !important;
  color: var(--read-muted) !important;
  line-height: 1.8;
}
#hayato-root :is(small,.draft-note,.card-note,.topic-meta,.topic-meta span,.video-channel,.criterion-status,.practice-limit,.practice-review-date,.practice-change-label,.practice-save-confirmation,.account-feature,.account-feature strong,.account-quota,.account-quota>b,.account-form-field,.account-check,.feature-link,.media-status,.privacy-note,.voice-connection-note,.voice-quota-note,.voice-caption,.voice-interim,.attachment-preview,.empty-message,.workspace-resources,.conversation-history>summary,.hayato-public-info,.hayato-public-info summary,.composer-foot,.working-tip,.copy-note) {
  font-size: 14px;
  line-height: 1.75;
  color: var(--read-muted);
}
#hayato-root :is(.card-kicker,.eyebrow,.message-label,.working-kicker,.message-code-head,.presence-caption .eyebrow) {
  font-size: 12px;
  line-height: 1.7;
  color: var(--read-muted);
  letter-spacing: .04em;
}
#hayato-root :is(.work-card,.message-rich,.list-item,.account-facts,.phone-pair) { overflow-wrap: anywhere; }
#hayato-root .work-card .practice-prompt { font-size: 16px; color: var(--read-ink); }
#hayato-root :is(.practice-cycle b,.practice-signal>b,.progress-fact small,.studio-guide b) { font-size: 16px; color: #304b6b; }
#hayato-root .practice-cycle small { font-size: 14px; line-height: 1.65; }
#hayato-root .practice-cycle-number { width: 26px; height: 26px; font-size: 14px; }
#hayato-root .criterion-heading { flex-wrap: wrap; gap: 7px 12px; }
#hayato-root .criterion-status { white-space: normal; color: #3e536d; background: #eef3fa; }
#hayato-root .practice-next-action { color: #304b6b !important; }
#hayato-root :is(.feature-available,.practice-signal,.practice-save-confirmation) { color: #285b49; }
#hayato-root :is(.feature-limited,.inline-notice,.copy-note) { color: #784718; }
#hayato-root .practice-limit[data-over-limit="true"] { color: #8d2438 !important; }

/* Visible labels and controls never shrink to make a row fit. */
#hayato-root :is(button,.primary-button,.file-button),
#hayato-ptt :is(button,.ptt-file) {
  min-height: 44px;
  min-width: 44px;
  max-width: 100%;
  font-size: 14px;
  line-height: 1.6;
  white-space: normal;
  overflow-wrap: anywhere;
}
#hayato-root :is(button,.file-button):not(.primary-button):not(.send-button):not(.video-play):not(.icon-button):not(.ptt-primary):not(.ptt-hold) { color: #344b6a; }
#hayato-root :is(button.primary-button,.primary-button,.send-button),
#hayato-ptt :is(.ptt-primary,.ptt-hold) {
  color: #fff;
  background: #334db7;
  border-color: #334db7;
}
#hayato-root :is(button.primary-button,.send-button):hover:not(:disabled),
#hayato-ptt :is(.ptt-primary,.ptt-hold):hover:not(:disabled) { color: #fff; background: #293f9b; border-color: #293f9b; }
#hayato-root :is(a,.source-link,.feature-link) { color: var(--read-link); }
#hayato-root :is(.source-link,.feature-link,.file-button) { display: inline-flex; align-items: center; min-height: 44px; line-height: 1.7; }
#hayato-root :is(input:not([type="checkbox"]):not([type="radio"]),textarea,select),
#hayato-ptt :is(textarea,select) { min-height: 44px; font-size: 16px; line-height: 1.75; color: var(--read-ink); }
#hayato-root :is(input,textarea)::placeholder,
#hayato-ptt textarea::placeholder { color: #526177; opacity: 1; -webkit-text-fill-color: #526177; }
#hayato-root :is(button,a,input,textarea,select,summary):focus-visible,
#hayato-ptt :is(button,a,input,textarea,select,summary):focus-visible {
  outline: 3px solid var(--read-focus);
  outline-offset: 3px;
  box-shadow: 0 0 0 2px #fff;
}
#hayato-root .file-button:focus-within,
#hayato-ptt .ptt-file:focus-within { outline: 3px solid var(--read-focus); outline-offset: 3px; }
#hayato-root :is(summary,.question-hint summary,.plan-days summary) { min-height: 44px; font-size: 14px; line-height: 1.75; color: #344b6a; }
#hayato-root .card-actions { flex-wrap: wrap; }
#hayato-root .account-check { min-height: 44px; }
#hayato-root .account-check input { flex: none; width: 20px; height: 20px; }

/* Header and sidebar labels are useful information, not fine print. */
#hayato-root .hayato-header { height: auto; min-height: 80px; padding-block: 12px; flex-wrap: wrap; gap: 12px 20px; }
#hayato-root .hayato-brand { min-width: 0; }
#hayato-root .hayato-brand>span { font-size: 19px; }
#hayato-root .hayato-brand small { font-size: 14px; color: var(--read-muted); letter-spacing: .01em; }
#hayato-root .hayato-header-meta { display: flex; flex-wrap: wrap; gap: 10px; max-width: 100%; }
#hayato-root .account-entry { max-width: 260px; min-width: 150px; padding: 8px 12px; }
#hayato-root .account-entry>span:first-child { white-space: normal; font-size: 16px; line-height: 1.5; color: var(--read-ink); }
#hayato-root .account-entry small { font-size: 14px; color: var(--read-muted); }
#hayato-root .new-chat-button { font-size: 14px; min-height: 44px; }
#hayato-root .presence-identity h1 { font-size: 18px; }
#hayato-root .presence-status { font-size: 14px; color: #315d4b; }
#hayato-root .presence-context :is(p,small) { white-space: normal; overflow: visible; text-overflow: clip; }
#hayato-root .presence-context p { font-size: 16px; }
#hayato-root .presence-context small { font-size: 14px; color: var(--read-muted); }
#hayato-root :is(.studio-guide small,.studio-guide li>span) { font-size: 14px; color: var(--read-muted); }
#hayato-root .welcome-starters b { font-size: 16px; color: var(--read-ink); }
#hayato-root .welcome-starters small { font-size: 14px; color: var(--read-muted); }
#hayato-root .welcome-pill { font-size: 14px; color: #405571; }
#hayato-root .welcome-heading .welcome-reassurance { font-size: 14px; color: var(--read-muted); }

/* The return point can fold; larger text still wraps in its available space. */
#hayato-root .learning-desk summary { min-height: 48px; gap: 10px; }
#hayato-root .learning-desk .desk-label { font-size: 14px; color: #405571; }
#hayato-root #hayato-desk-title { font-size: 16px; color: var(--read-ink); line-height: 1.65; }
#hayato-root :is(.desk-body>p,.desk-experience p) { font-size: 16px; line-height: 1.8; color: #344b6a; }
#hayato-root :is(.desk-counts>span,.desk-note,.desk-experience small,#hayato-desk-save-status,.desk-count-badge) { font-size: 14px; line-height: 1.75; color: #405571; }
#hayato-root :is(.desk-primary-row button,.desk-shortcuts button,.desk-experience a) { font-size: 14px; min-height: 44px; line-height: 1.6; }
#hayato-root .desk-shortcuts { flex-wrap: wrap; }
#hayato-root .desk-shortcuts button { flex: 1 1 110px; }
#hayato-root .desk-experience nav { gap: 8px; }
#hayato-root .desk-experience a { flex: 1 1 130px; padding: 8px 10px; }

/* Saved work, contract details and support use the same readable hierarchy. */
#hayato-root :is(.account-facts,.account-feature,.plan-comparison,.account-form-field,.account-check) { font-size: 16px; line-height: 1.8; }
#hayato-root :is(.account-facts dt,.account-section-title,.account-form-field,.account-check) { color: #344b6a; }
#hayato-root .account-feature { flex-wrap: wrap; gap: 6px 14px; }
#hayato-root .account-feature strong { max-width: 100%; font-size: 14px; text-align: left; }
#hayato-root .account-quota>b { font-size: 16px; }
#hayato-root .account-quota .quota-value { color: #344b6a; font-size: 16px; }
#hayato-root .plan-comparison :is(th,td) { min-width: 105px; padding: 12px 10px; color: #344b6a; }
#hayato-root .plan-comparison th { background: #edf3fa; }
#hayato-root .plan-price { font-size: 24px; line-height: 1.65; color: #304b80; }
#hayato-root .notification-item h4 { font-size: 18px; }
#hayato-root .notification-item.is-read { color: #45566f; background: #f4f7fb; }
#hayato-root .table-scroll { max-width: 100%; overflow-x: auto; }
#hayato-root .message-code pre { max-width: 100%; overflow-x: auto; white-space: pre; font-size: 14px; line-height: 1.8; }
#hayato-root .message-code-head { font-size: 12px; }
#hayato-root .message-code-head button { font-size: 14px; }

/* The composer stays in the normal flex layout; it cannot cover saved records. */
#hayato-root .conversation-bottom { position: relative; }
#hayato-root .hayato-composer textarea { min-height: 44px; font-size: 16px; }
#hayato-root .composer-actions :is(button,.voice-start) { min-height: 44px; min-width: 44px; font-size: 14px; }
#hayato-root .composer-foot { flex-wrap: wrap; gap: 4px 12px; color: var(--read-muted); }
#hayato-root .composer-foot #hayato-connection { max-width: 100%; }
#hayato-root .latest-message { min-height: 44px; white-space: normal; max-width: calc(100% - 24px); }
#hayato-root :is(#hayato-working-text,.inline-notice,.attachment-preview p) { font-size: 16px; line-height: 1.8; }
#hayato-root :is(#hayato-working-note,.working-elapsed) { font-size: 14px; color: var(--read-muted); }

/* Dialogs, including voice, scroll internally without reducing text to fit. */
#hayato-root .hayato-dialog { max-width: calc(100% - 24px); max-height: calc(100dvh - 24px); overflow-y: auto; color: var(--read-ink); font-size: 16px; }
#hayato-root .hayato-dialog :is(p,label,.privacy-note,.media-status,.voice-connection-note,.voice-quota-note) { font-size: 16px; line-height: 1.8; color: #344b6a; }
#hayato-root .hayato-dialog .dialog-head h2 { font-size: 24px; }
#hayato-root .hayato-dialog .dialog-head { align-items: flex-start; gap: 12px; }
#hayato-root .hayato-dialog .icon-button { flex: none; width: 44px; height: 44px; }
#hayato-root .media-options { flex-wrap: wrap; }
#hayato-ptt :is(h2,.ptt-subtitle,.ptt-privacy,.ptt-user,.ptt-reply,.ptt-draft label,.ptt-consent-heading) { font-size: 16px; line-height: 1.8; color: #344b6a; }
#hayato-ptt :is(.ptt-help,.ptt-footnote,.ptt-settings,.ptt-preferences,.ptt-preferences label,.ptt-draft small,.ptt-tools button,.ptt-file,.ptt-error,.ptt-close,.ptt-download button,.ptt-cancel-slot button,.ptt-mic) { font-size: 14px; line-height: 1.75; color: var(--read-muted); }
#hayato-ptt .ptt-eyebrow { font-size: 12px; color: var(--read-muted); }
#hayato-ptt :is(.ptt-primary,.ptt-hold) { font-size: 16px; }
#hayato-ptt .ptt-settings>summary { min-height: 44px; font-size: 14px; padding: 9px 12px; }
#hayato-ptt .ptt-preferences { bottom: 48px; }
#hayato-ptt .ptt-header { flex-wrap: wrap; align-items: flex-start; }
#hayato-ptt .ptt-header>div { min-width: 0; flex: 1 1 160px; }
#hayato-ptt .ptt-footer { flex-shrink: 0; }
#hayato-ptt[data-state="recording"] .ptt-hold { color: #fff; background: #914b2d; border-color: #914b2d; }

@media (max-width: 850px) {
  #hayato-root .hayato-presence { height: auto; min-height: 74px; padding-block: 10px; flex-wrap: wrap; }
  #hayato-root .presence-context { max-width: 58%; }
  #hayato-root .presence-context p { white-space: normal; }
}
@media (max-width: 620px) {
  #hayato-root .hayato-header { display: grid; grid-template-columns: minmax(0,1fr); gap: 10px; padding-block: 12px; }
  #hayato-root .hayato-brand { justify-self: start; }
  #hayato-root .hayato-brand small { display: none; }
  #hayato-root .hayato-header-meta { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; width: 100%; }
  #hayato-root .hayato-header-meta>button { min-width: 0; max-width: none; width: 100%; padding: 8px; }
  #hayato-root .account-entry small { white-space: normal; line-height: 1.6; }
  #hayato-root .desk-shortcuts { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 4px; }
  #hayato-root .desk-shortcuts button { width: 100%; padding: 8px 6px; }
  #hayato-root .welcome-starters { grid-template-columns: minmax(0,1fr); }
  #hayato-root .practice-v364 .practice-cycle { grid-template-columns: minmax(0,1fr); }
  #hayato-root .practice-cycle li { display: grid; grid-template-columns: 26px minmax(0,1fr); gap: 4px 9px; }
  #hayato-root .practice-cycle-number { grid-row: span 2; }
  #hayato-root .practice-cycle small { grid-column: 2; }
  #hayato-root .account-facts { grid-template-columns: minmax(0,1fr); gap: 4px; }
  #hayato-root .account-facts dd { margin-bottom: 12px; }
  #hayato-root .hayato-composer { padding: 10px 12px; }
  #hayato-root .composer-actions { gap: 8px; flex-wrap: wrap; }
  #hayato-root .composer-foot { font-size: 14px; }
  #hayato-root .card-actions button { max-width: 100%; }
  #hayato-ptt .ptt-shell { padding-inline: 16px; }
  #hayato-ptt .ptt-privacy { padding: 16px; }
}
@media (max-width: 380px) {
  #hayato-root .presence-context { max-width: 100%; margin: 0; text-align: left; width: 100%; }
  #hayato-root .card-actions { display: grid; grid-template-columns: minmax(0,1fr); }
  #hayato-root .card-actions button { width: 100%; }
  #hayato-root .hayato-dialog { padding: 18px; }
}
@media (forced-colors: active) {
  #hayato-root :is(button,a,input,textarea,select,summary):focus-visible,
  #hayato-ptt :is(button,a,input,textarea,select,summary):focus-visible { outline-color: Highlight; box-shadow: none; }
}
