html { -webkit-text-size-adjust: 100%; }
html, body { background: #FBFAF7; }
body { overscroll-behavior-y: none; }
.sheet { width: 100% !important; max-width: none !important; }
.sheet > div:has(> section[aria-label="The day"]) { flex-direction: column; }
section[aria-label="The day"] { order: -1; flex: 1 1 auto !important; width: 100%; padding: 16px 16px 28px !important; }
section[aria-label="Month and week"] { flex: 1 1 auto !important; width: 100%; padding: 24px 16px !important; }
.mac-only { display: none !important; }
html.sync-off::after { content: 'Offline, changes will sync later'; position: fixed; z-index: 50; left: 0; right: 0; bottom: calc(58px + env(safe-area-inset-bottom)); padding: 6px 0; background: #F3F0EB; text-align: center; font-family: 'Jost', sans-serif; font-size: 12px; color: #6F655E; }
[role="img"][style*="height: 150px"] { height: auto !important; aspect-ratio: 264 / 150; }

/* iPhone layout */
body { padding-bottom: calc(66px + env(safe-area-inset-bottom)); }
input, textarea { font-size: 16px !important; }
.sheet > div:first-child { position: sticky; top: 0; z-index: 8; padding-top: calc(13px + env(safe-area-inset-top)) !important; }
.sheet { padding-top: 0 !important; overflow: visible !important; }
.sheet > div:first-child .dots { display: none; }
html.tab-moved section[aria-label="The day"], html.tab-moved section[aria-label="Month and week"] { animation: tab-in .18s ease-out; }
@keyframes tab-in { from { opacity: .4; } to { opacity: 1; } }

.phone-tabs { position: fixed; z-index: 40; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(5, 1fr); padding: 6px 8px calc(4px + env(safe-area-inset-bottom)); background: #FBFAF7; border-top: 1px solid #CFC8BF; }
.phone-tabs button { display: flex; flex-direction: column; align-items: center; gap: 3px; min-height: 48px; padding: 4px 0; background: transparent; border: 0; font-family: 'Jost', sans-serif; font-size: 11px; letter-spacing: .4px; color: #8A8077; -webkit-tap-highlight-color: transparent; }
.phone-tabs svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.1; }
.phone-tabs button.on { color: #3B2F2A; font-weight: 500; }
.phone-tabs button.on svg { stroke-width: 1.5; transform: translateY(-1px); }

html[data-tab="today"] section[aria-label="The day"] > div:has(#notes),
html[data-tab="today"] section[aria-label="Month and week"] > div:not(.verse-home):not(.verse-stars) { display: none !important; }
html[data-tab="today"] section[aria-label="Month and week"] { padding-top: 20px !important; padding-bottom: 20px !important; }
html[data-tab="habits"] section[aria-label="Month and week"],
html[data-tab="habits"] section[aria-label="The day"] > div:not(:has(#notes)),
html[data-tab="habits"] section[aria-label="The day"] > div:has(#notes) > div:has(#notes) { display: none !important; }
html[data-tab="notes"] section[aria-label="Month and week"],
html[data-tab="notes"] section[aria-label="The day"] > div:not(:has(#notes)),
html[data-tab="notes"] section[aria-label="The day"] > div:has(#notes) > div:not(:has(#notes)) { display: none !important; }
html[data-tab="notes"] #notes { min-height: 58vh; }
html[data-tab="month"] section[aria-label="The day"],
html[data-tab="month"] .verse-home { display: none !important; }
html[data-tab="month"] section[aria-label="Month and week"] { min-height: calc(100dvh - 110px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); box-sizing: border-box; }

.phone-lock { display: none; position: fixed; inset: 0; z-index: 60; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 32px; background: #FBFAF7; color: #3B2F2A; text-align: center; font-family: 'Jost', sans-serif; }
.phone-lock svg { width: 26px; height: 26px; fill: currentColor; }
.phone-lock h1 { margin: 6px 0 0; font-size: 13px; font-weight: 500; letter-spacing: 4px; text-transform: uppercase; }
.phone-lock p { margin: 0 0 14px; font-weight: 300; font-size: 17px; color: #6F655E; }
.phone-lock input { width: 100%; max-width: 300px; box-sizing: border-box; height: 44px; padding: 0 12px; background: #F3F0EB; border: 1px solid #CFC8BF; border-radius: 0; text-align: center; font-family: inherit; }
html.needs-link .phone-lock { display: flex; }
html.needs-link .phone-tabs, html.needs-link .sheet { display: none !important; }
html[data-tab="month"] body { background: #F3F0EB; }
html[data-tab="notes"] #notes { height: 62vh !important; }

.sky-layer { position: absolute; left: 0; right: 0; top: 0; height: 0; z-index: 5; pointer-events: none; }
html, body { overflow-x: clip; }

/* A finger leaves a hover behind, so the Mac's hover effects are switched off. */
html body section[aria-label="Month and week"]:not(:has(.verse-stars.on)) > :not(.verse-home):not(.verse-stars),
html body section[aria-label="Month and week"]:not(:has(.verse-stars.on)) .verse-home > :not(.verse):not(.verse-anchor) { opacity: 1; pointer-events: auto; }
html body section[aria-label="Month and week"]:not(:has(.verse-stars.on)) { background: #F3F0EB !important; }
html body section[aria-label="Month and week"]:not(:has(.verse-stars.on)) .verse-stars { opacity: 0; }
html body section[aria-label="Month and week"]:not(:has(.verse-stars.on)) .verse-stars * { animation-play-state: paused; }
html body section[aria-label="Month and week"]:not(:has(.verse-stars.on)) .verse,
html body section[aria-label="Month and week"]:not(:has(.verse-stars.on)) .verse span { color: #3B2F2A !important; }
html body section[aria-label="Month and week"]:not(:has(.verse-stars.on)) .verse span:last-child { color: #6F655E !important; }

/* The reflection unfolds beneath the verse, and melts away the way it does on the Mac. */
.verse-home { justify-content: flex-start !important; }
.verse-anchor { height: auto !important; }
.reflection { position: static !important; height: auto !important; margin-top: 92px; }
.reflection.leaving { position: absolute !important; top: auto !important; left: 16px; right: 16px; }
.reflection-scroll { flex: none !important; overflow: visible !important; -webkit-mask-image: none !important; mask-image: none !important; }
.verse-tools { animation: lineup 1s 3.3s ease both; }

/* The whole screen fades into the sky. */
.verse-stars { position: fixed !important; }
html, body, .desk, .sheet, section[aria-label="The day"], .sheet > div:first-child, .phone-tabs { transition: background-color .9s ease, opacity .9s ease; }
html.sky-open, html.sky-open body, html.sky-open .desk, html.sky-open .sheet { background: #2A3454 !important; }
html.sky-open:has(.verse-stars.sky-day), html.sky-open:has(.verse-stars.sky-day) body, html.sky-open:has(.verse-stars.sky-day) .desk, html.sky-open:has(.verse-stars.sky-day) .sheet { background: #B98F68 !important; }
html.sky-open section[aria-label="The day"], html.sky-open .sheet > div:first-child, html.sky-open .phone-tabs { opacity: 0; pointer-events: none; }
html.sky-open:not(.sky-full) .reflection:not(.leaving) { position: absolute !important; visibility: hidden; }
html.sky-full section[aria-label="The day"] { display: none !important; }
html.sky-full .verse-home > :not(.verse):not(.verse-anchor) { display: none !important; }

/* One calm set of sizes */
section[aria-label="The day"] span[style*="font-size: 18px"], .habit-name { font-size: 16px !important; }
section[aria-label="The day"] h2 { font-size: 66px !important; }
section[aria-label="Month and week"] span[style*="font-size: 14px"], div[style*="font-size: 14px"] { font-size: 13px; }

/* The habit tracker fills the page: the name above, its week beneath. */
[style*="repeat(7, minmax(32px, 44px)) 44px"] { grid-template-columns: repeat(7, 1fr) !important; }
[style*="repeat(7, minmax(32px, 44px)) 44px"] > :first-child { grid-column: 1 / 7; grid-row: 1; }
[style*="repeat(7, minmax(32px, 44px)) 44px"] > :last-child { grid-column: 7; grid-row: 1; }
[style*="repeat(7, minmax(32px, 44px)) 44px"] > :nth-child(n+2):not(:last-child) { grid-row: 2; }
[style*="repeat(7, minmax(32px, 44px)) 44px"]:not([data-habit]) > :first-child { padding: 6px 0 8px; font-size: 13px; }
[style*="repeat(7, minmax(32px, 44px)) 44px"]:not([data-habit]) > :last-child { align-self: center; padding-bottom: 2px; }
[data-habit] { padding: 12px 0 8px; }
[data-habit] > button:not(.hover) { height: 46px !important; }
[data-habit] > button:not(.hover) > span:first-child { width: 28px !important; height: 28px !important; }

/* The task row: tick first, the name with room to breathe, and small details beneath it. */
[data-task] > div:first-child { gap: 4px; padding: 8px 0; align-items: flex-start; }
[data-task] .task-grip { order: -2; align-self: center; }
[data-task] button[aria-pressed] { order: -1; flex: 0 0 38px !important; height: 34px !important; }
[data-task] .task-main { min-height: 34px !important; padding: 4px 4px 4px 2px !important; gap: 3px 10px !important; align-content: center; }
[data-task] .task-main > span:first-child { display: none !important; }
[data-task] .task-main > span:nth-child(2) { flex: 1 1 100% !important; line-height: 1.35; }
[data-task] .task-main > span:has(svg[aria-label="Add an alarm"]) { display: none !important; }
[data-task] .task-chevron { order: 3; flex: 0 0 28px; height: 34px; }

/* The Focus tab */
html[data-tab="focus"] section[aria-label="The day"], html[data-tab="focus"] section[aria-label="Month and week"] { display: none !important; }
.phone-focus { display: none; position: fixed; inset: 0; z-index: 30; overflow: hidden; background: #2A3454; color: #F4F0E6; font-family: 'Jost', sans-serif; }
.phone-focus.sky-day { background: #B98F68; }
html[data-tab="focus"] .phone-focus { display: block; }
html[data-tab="focus"] .sheet > div:first-child { display: none; }
html[data-tab="focus"], html[data-tab="focus"] body { background: #2A3454; }
html[data-tab="focus"] .phone-tabs { background: transparent; border-top-color: rgba(244, 240, 230, .18); }
html[data-tab="focus"] .phone-tabs button { color: rgba(244, 240, 230, .6); }
html[data-tab="focus"] .phone-tabs button.on { color: #F4F0E6; }
html[data-tab="focus"] .phone-tabs button[data-tab="focus"].on svg { fill: currentColor; }
html.focusing .phone-tabs button[data-tab="focus"] svg { fill: currentColor; }
.focus-star { position: absolute; fill: #F4F0E6; animation: focus-twinkle 3s ease-in-out infinite; }
@keyframes focus-twinkle { 0%, 100% { opacity: .2; transform: scale(.7); } 50% { opacity: 1; transform: scale(1); } }
.focus-shoot { position: absolute; left: 62%; top: 16%; width: 90px; height: 1px; background: linear-gradient(to right, #F4F0E6, transparent); opacity: 0; transform: rotate(150deg); animation: focus-shoot 13s ease-in infinite; }
@keyframes focus-shoot { 0%, 90% { opacity: 0; translate: 0 0; } 92% { opacity: 1; } 100% { opacity: 0; translate: -190px 110px; } }
.focus-bit { position: fixed; fill: #F4F0E6; pointer-events: none; }
.focus-body { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; box-sizing: border-box; padding: calc(44px + env(safe-area-inset-top)) 28px calc(92px + env(safe-area-inset-bottom)); text-align: center; }
.focus-verse { margin: 0; font-size: 17px; font-weight: 300; line-height: 1.5; text-wrap: balance; }
.focus-ref { margin-top: 6px; font-size: 11px; letter-spacing: 2.5px; text-transform: uppercase; opacity: .8; }
.focus-time { margin-top: auto; font-size: 84px; font-weight: 200; line-height: 1; font-variant-numeric: tabular-nums; }
.focus-task { min-height: 20px; margin: 12px 0 auto; font-size: 15px; font-weight: 300; opacity: .85; }
.focus-lengths { display: flex; gap: 8px; margin-bottom: 18px; }
.focus-lengths button { width: 46px; height: 34px; padding: 0; background: transparent; border: 1px solid rgba(244, 240, 230, .35); color: inherit; font-family: inherit; font-size: 14px; font-weight: 300; }
.focus-lengths button.on { background: #F4F0E6; border-color: #F4F0E6; color: #2A3454; }
html.focusing .focus-lengths { opacity: 0; pointer-events: none; }
.focus-go { width: 160px; height: 48px; background: transparent; border: 1px solid #F4F0E6; color: inherit; font-family: inherit; font-size: 13px; letter-spacing: 3px; text-transform: uppercase; }
.phone-note { position: fixed; z-index: 45; left: 16px; right: 16px; bottom: calc(76px + env(safe-area-inset-bottom)); padding: 10px 14px; background: #3B2F2A; color: #FBFAF7; text-align: center; font-family: 'Jost', sans-serif; font-size: 13px; }

/* The alarm wheel gets a little more room under a thumb. */
.alarm-dial { flex: 1 1 200px; max-width: 240px; }
