/* Keep widget content in flow: Safari text metrics must never overlap it. */
html{-webkit-text-size-adjust:100%;text-size-adjust:100%}
button{-webkit-appearance:none;appearance:none}
.widget{display:flex;flex-direction:column;align-items:flex-start;justify-content:flex-start;min-width:0}
.profile-widget strong{margin-top:15px;font-size:23px;line-height:1.12;letter-spacing:-.8px}
.widget-top{font-size:8px;line-height:1.3;letter-spacing:.85px}
.wave{top:14px;right:13px;bottom:auto;width:23px;height:23px;font-size:0;line-height:0;transform:rotate(12deg)}
.wave svg{display:block;width:100%;height:100%}
.widget-bottom{position:static;margin-top:auto;font-size:8px;line-height:1.4;white-space:nowrap}
.date-widget{gap:2px}
.calendar-month{font-size:10px;line-height:1.3}
.date-widget strong{font-size:47px;line-height:1;letter-spacing:-1.5px;margin:0}
.date-widget>span:nth-of-type(2){font-size:10px;line-height:1.4;margin-top:1px}
.calendar-event{position:static;margin-top:auto;gap:6px;font-size:8px;line-height:1.4;min-height:14px}
.calendar-event i{height:14px;flex-shrink:0}

@media(max-width:500px){
  /* The actual phone already supplies its status bar, notch and home gesture. */
  :root{--mobile-top:env(safe-area-inset-top,0px);--mobile-bottom:max(12px,calc(env(safe-area-inset-bottom,0px) + 8px));--mobile-dock-height:86px}
  .device-area{position:fixed;inset:0;width:100%;height:100%;height:100dvh}
  .device-wrap,.phone,.screen{height:100%}
  .statusbar,.home-indicator{display:none}
  .home{padding:0}
  .home-page{padding:calc(24px + var(--mobile-top)) 22px calc(var(--mobile-bottom) + var(--mobile-dock-height) + 72px)}
  .home-page .widgets{gap:20px;margin-bottom:30px}
  .widget{aspect-ratio:auto;width:100%;height:clamp(146px,21dvh,166px);padding:17px 16px;border-radius:25px}
  .profile-widget strong{font-size:23px;margin-top:17px;line-height:1.14;letter-spacing:-.8px;white-space:nowrap}
  .wave{width:20px;height:20px;top:14px;right:13px}
  .widget-top{font-size:9px;letter-spacing:.65px}
  .widget-bottom{font-size:9px}
  .date-widget{gap:3px}
  .calendar-month{font-size:11px}
  .date-widget strong{font-size:47px}
  .date-widget>span:nth-of-type(2){font-size:11px}
  .calendar-event{font-size:9px;gap:6px;line-height:1.4}
  .app-grid{column-gap:18px;row-gap:29px;grid-template-columns:repeat(4,minmax(0,1fr))}
  .app-button{gap:8px}
  .app-icon{width:60px;height:60px;border-radius:15px}
  .app-label{font-size:11px;line-height:1.3}
  .dock{bottom:var(--mobile-bottom);left:12px;right:12px;height:var(--mobile-dock-height);padding:13px 14px;border-radius:30px;align-items:center}
  .home-controls{bottom:calc(var(--mobile-bottom) + var(--mobile-dock-height) + 17px);height:29px}
  .home-controls .search-pill{padding:7px 12px}
  .today-page,.library-page{padding-top:calc(24px + var(--mobile-top));padding-bottom:calc(22px + env(safe-area-inset-bottom,0px))}
  .today-page .glass-widget{margin-bottom:17px}
  .spotlight{padding-top:calc(24px + var(--mobile-top));padding-bottom:calc(24px + env(safe-area-inset-bottom,0px))}
  .app-window:not([hidden]):not(.browser-mode){display:flex;flex-direction:column}
  .app-nav{flex:0 0 auto;padding:calc(14px + var(--mobile-top)) 16px 14px;min-height:calc(56px + var(--mobile-top))}
  .app-window:not(.browser-mode) .app-content{flex:1;min-height:0;height:auto;padding-bottom:calc(24px + env(safe-area-inset-bottom,0px))}
  .browser-mode .app-content{inset:0;height:auto}
  .browser-header{height:calc(44px + var(--mobile-top));padding-top:var(--mobile-top)}
  .safari-toolbar{padding-bottom:max(12px,env(safe-area-inset-bottom,0px))}
  .browser-header>button:first-child{font-size:14px}
  .browser-tab-sheet{padding-top:calc(17px + var(--mobile-top))}
}
@media(max-width:500px) and (max-height:660px){
  .home-page{padding-top:calc(18px + var(--mobile-top))}
  .home-page .widgets{margin-bottom:23px}
  .widget{height:142px;padding:15px 16px}
  .profile-widget strong{font-size:22px;margin-top:14px}
  .date-widget strong{font-size:44px}
  .app-grid{row-gap:24px}
}
@media(max-width:350px){
  .home-page{padding-left:17px;padding-right:17px}
  .home-page .widgets{gap:14px}
  .widget{padding:15px 12px}
  .profile-widget strong{font-size:20px;letter-spacing:-.8px}
  .wave{width:17px;height:17px;right:10px}
  .widget-top{font-size:7px;letter-spacing:.5px}
  .widget-bottom{font-size:8px}
  .app-grid{column-gap:10px}
  .app-icon{width:56px;height:56px}
  .app-label{font-size:10px}
  .dock{padding-left:12px;padding-right:12px}
  .library-group{gap:10px;padding:12px 8px;min-height:132px}
  .library-group .app-icon{width:46px;height:46px}
}
