/* All app text uses rem, so one reading size scales every screen. */
:root { font-size:16px; --text-supporting:.875rem; --text-main:1rem; --text-heading:1.5rem; --text-section:1.125rem; --weight-heading:600; --weight-item:500; --weight-body:400; }
:root[data-text-size="device"] { font-size:18px; }
@supports (font: -apple-system-body) {
  :root[data-text-size="device"] { font:-apple-system-body; }
}
:root[data-text-size="small"] { font-size:17px; }
:root[data-text-size="medium"] { font-size:18px; }
:root[data-text-size="large"] { font-size:20px; }
:root[data-text-size="extra-large"] { font-size:24px; }
body { font-size:1rem; line-height:1.5; font-weight:400; }
h1,h2,h3,h4 { font-weight:var(--weight-heading); }
strong,b { font-weight:700; }
input::placeholder,textarea::placeholder { color:var(--ink,#293a31); opacity:1; }
.text-size-settings { margin:24px 0; }
.text-size-settings h3 { margin:0 0 8px; }
.text-size-settings label { display:block; font-size:var(--text-main); }
.text-size-settings select {
  display:block; box-sizing:border-box; width:100%; min-width:0;
  margin-top:7px; padding:11px; border:1px solid var(--ring-track);
  border-radius:9px; background:var(--panel-bg); color:var(--ink); font:inherit;
}
.text-size-settings p { font-size:var(--text-supporting); line-height:1.5; }
/* Text stays within its own column when it wraps beside a checkbox or credit. */
#screen .app-tabs { flex-wrap:wrap; gap:4px; }
#screen .app-tabs a { flex:1 1 auto; white-space:normal; overflow-wrap:anywhere; padding:8px; }
#screen .header { gap:12px; }
#screen .header>div { min-width:0; overflow-wrap:anywhere; }
#screen .avatar { flex-shrink:0; }
.section-head,.todo-head,.weekly-list-head { gap:12px; flex-wrap:wrap; }
.section-head>span,.todo-head>span,.weekly-list-head>span { margin-left:auto; }
.section-head h3,.section-head>span { flex-shrink:0; white-space:nowrap; }
.commitment .weight,.weekly-goal .weekly-credit,.todo-list .todo-credit { min-width:0; }
.weekly-goal-heading>strong { min-width:0; overflow-wrap:anywhere; }
.todo-list label { min-width:0; }
.todo-copy { min-width:0; overflow-wrap:anywhere; }
.profile-name-row { flex-wrap:wrap; }
.profile-name-row input { flex:1 1 140px; min-width:0; }
#routine-section .actions { flex-wrap:wrap; }
#routine-section .actions button { flex:1 1 100px; }
#routine-section .timer { overflow-wrap:anywhere; }
#screen .hero .ring,#screen .weekly-ring { width:min(100%,6.3rem); height:auto; aspect-ratio:1; padding:.25rem; }
.hero .ring-inner { width:100%; height:100%; padding:0; }
/* Fixed percentage boxes grow with their contents, remaining compact. */
#screen :is(.admin-list-allocation,.allocation-row) input,
#screen :is(#add-weight,#todo-share,#todo-default-share),
#screen [data-todo-weight] { width:4.6rem; max-width:100%; }
#screen #admin .admin-list-allocation input { width:4.6rem; }
#screen .admin-row-top { flex-wrap:wrap; }
#screen .admin-row-top .select-item { flex:1 1 100px; }
#screen .admin-row-top .admin-list-allocation { margin-left:auto; }
#screen .admin-row-top .order-controls { flex-shrink:0; }
.todo-queue-head { flex-wrap:wrap; }
.todo-queue-head label { min-width:0; max-width:100%; }
.todo-queue-head select { max-width:100%; }
.theme-options { flex-wrap:wrap; overflow:visible; }
#screen #admin .fields { grid-template-columns:repeat(auto-fit,minmax(min(100%,140px),1fr)); }
@media (max-width:390px) {
  #screen>.phone,#routine-section .phone { padding-inline:16px; }
  #screen .hero,#screen .weekly-hero { padding-inline:14px; }
  #screen .admin-row-fields,#screen .day-boundary-fields { grid-template-columns:minmax(0,1fr); }
}
