/* Ritual · web · the app itself
   The phones are drawn at the app's own size — 390 × 844 points, the size of the
   artboards in design/canvas — and scaled as one piece to the room they have, so every
   value here is a point on the phone and reads the same as in the designs. */

/* ───────────────────────── The devices ───────────────────────── */

.device {
  position: relative;
  padding: 3.2%;
  border-radius: 13.5% / 6.4%;
  background: linear-gradient(150deg, #3a3a3e, #131315 45%, #232326);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.09) inset, 0 0 0 2px #0a0a0b, 0 40px 80px -30px rgba(0, 0, 0, 0.8);
}
.device[data-os="android"] { padding: 2.6%; border-radius: 10% / 4.8%; background: linear-gradient(150deg, #2c2a28, #121110 50%, #1d1b19); }
.device .glass {
  position: relative; overflow: hidden;
  aspect-ratio: 390 / 844;
  border-radius: 11% / 5.1%;
  background: #12100E;
  isolation: isolate;
}
.device[data-os="android"] .glass { border-radius: 8% / 3.7%; }
.device > img { display: block; width: 100%; height: auto; border-radius: 10% / 4.6%; }

/* ───────────────────────── The app, at the app's size ───────────────────────── */

.rapp {
  --s: 0.6;
  --ink: #12100E; --surface: #1A1714; --surface-hi: #221E19; --hairline: #241F1A; --rule: #302A24;
  --ring-idle: #4A423A; --faint: #6E655B; --muted: #A79E92; --dimmed: #CFC7BB; --bone: #F2EDE4;
  --empty: #201C17; --future: #191612; --brass: #C09B69; --button: #1F1B16; --garnet: #C79093;
  --scrim: rgba(0, 0, 0, 0.5);
  position: absolute; left: 0; top: 0;
  width: 390px; height: 844px;
  transform: scale(var(--s)); transform-origin: 0 0;
  background: var(--ink); color: var(--dimmed);
  font: 400 15px/1.4 var(--sans);
  overflow: hidden;
  user-select: none; -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: background-color .35s, color .35s;
}
.rapp[data-theme="light"] {
  --ink: #F6F1E7; --surface: #EFE8DA; --surface-hi: #E7DECB; --hairline: #E2D8C4; --rule: #D0C4AB;
  --ring-idle: #B3A68C; --faint: #867B67; --muted: #6B6152; --dimmed: #3B352C; --bone: #1C1A17;
  --empty: #E6DECD; --future: #F0EBE0; --brass: #7A5F3B; --button: #EFE8DA; --garnet: #8A4E52;
  --scrim: rgba(28, 26, 23, 0.28);
}
.rapp button { font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0; cursor: pointer; text-align: inherit; }
.rapp button:disabled { cursor: default; }
.rapp .lab { font: 500 10px/1.2 var(--sans); letter-spacing: 0.18em; text-transform: uppercase; }
.rapp h4, .rapp h5 { margin: 0; font-family: var(--serif); font-weight: 400; color: var(--bone); }
.rapp p { margin: 0; }
.rapp :focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; border-radius: 8px; }

/* The status bar sits over every screen, in the theme's own ink. */
.rapp .status {
  position: absolute; left: 0; right: 0; top: 0; z-index: 5; height: 50px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 30px 0 38px; pointer-events: none;
  font: 600 15px/1 -apple-system, "SF Pro Text", var(--sans); color: var(--bone);
}
.rapp[data-os="android"] .status { height: 34px; padding: 0 22px; font: 500 13px/1 var(--sans); }
.rapp .island { position: absolute; left: 50%; top: 11px; width: 120px; height: 34px; margin-left: -60px; border-radius: 999px; background: #000; }
.rapp .cam { position: absolute; left: 50%; top: 10px; width: 12px; height: 12px; margin-left: -6px; border-radius: 50%; background: #000; box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.35); }
.rapp .glyphs { display: inline-flex; align-items: center; gap: 6px; }
.rapp .glyphs i { display: block; background: currentColor; }
.rapp .glyphs .sig { width: 17px; height: 11px; clip-path: polygon(0 70%, 25% 70%, 25% 100%, 0 100%, 30% 100%, 30% 45%, 50% 45%, 50% 100%, 55% 100%, 55% 20%, 75% 20%, 75% 100%, 80% 100%, 80% 0, 100% 0, 100% 100%, 0 100%); }
.rapp .glyphs .wifi { width: 15px; height: 11px; border-radius: 50% 50% 0 0; clip-path: polygon(0 40%, 50% 100%, 100% 40%, 100% 0, 0 0); }
.rapp .glyphs .bat { width: 25px; height: 12px; border-radius: 3.5px; background: linear-gradient(90deg, currentColor 76%, transparent 76%); box-shadow: inset 0 0 0 1px currentColor; }

/* Screens: one on top, and for a moment the one it came from. */
.rapp .stage { position: absolute; inset: 0; }
.rapp .scr {
  position: absolute; inset: 0; background: var(--ink);
  display: flex; flex-direction: column;
  transition: transform 500ms var(--spring), opacity 300ms var(--ease-out), background-color .35s;
  will-change: transform;
}
.rapp .scr.right { transform: translateX(100%); }
.rapp .scr.aside { transform: translateX(-28%); }
.rapp .scr.aside::after { content: ""; position: absolute; inset: 0; background: rgba(0, 0, 0, 0.18); pointer-events: none; }
.rapp .scr.live { transition: none; }
.rapp .scr.fading { opacity: 0; transition: none; }
.rapp .scr:not(.fading) { opacity: 1; }
.rapp .scroll { flex: 1 1 auto; overflow-y: auto; overflow-x: hidden; scrollbar-width: none; padding-top: 50px; }
.rapp[data-os="android"] .scroll { padding-top: 34px; }
.rapp .scroll::-webkit-scrollbar { display: none; }

/* ───────────────────────── Today ───────────────────────── */

.rapp .head { display: flex; flex-direction: column; gap: 6px; padding: 12px 28px 0; }
.rapp .head > .lab { color: var(--faint); }
.rapp .title { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.rapp .title h4 { font-size: 52px; line-height: 1.02; }
.rapp .title em { font: italic 400 15px/1 var(--serif); color: var(--muted); padding-bottom: 10px; }
.rapp .back-today { align-self: flex-start; margin-top: 2px; color: var(--brass); font: 500 10px/1 var(--sans); letter-spacing: 0.18em; text-transform: uppercase; padding: 6px 0; }

.rapp .week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); padding: 22px 22px 18px; }
.rapp .wd { display: flex; flex-direction: column; align-items: center; gap: 9px; padding: 4px 0; border-radius: 12px; transition: transform 100ms ease-out; }
.rapp .wd .lab { color: var(--faint); }
.rapp .wd i { width: 6px; height: 6px; border-radius: 50%; background: var(--ring-idle); transition: background .3s; }
.rapp .wd i.full { background: var(--brass); }
.rapp .wd.on .lab { color: var(--bone); }
.rapp .wd.future i { background: var(--rule); }
.rapp .wd:not(:disabled):active { transform: scale(0.9); }
.rapp .rule { height: 1px; background: var(--hairline); margin: 0 28px; }

.rapp .list { display: flex; flex-direction: column; padding: 4px 28px 24px; }
.rapp .row, .rapp .group { display: flex; align-items: center; gap: 18px; padding: 15px 0; border-bottom: 1px solid var(--empty); }
.rapp .row.in { padding-left: 20px; }
.rapp .hit { flex: 0 0 auto; border-radius: 50%; transition: transform 100ms ease-out; }
.rapp .hit:active { transform: scale(0.9); }
.rapp .txt { display: flex; flex-direction: column; gap: 9px; flex: 1 1 auto; min-width: 0; padding: 4px 0; }
.rapp .nm { font: 400 21px/1.15 var(--serif); color: var(--dimmed); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: color .25s; }
.rapp .row.kept .nm, .rapp .group .nm { color: var(--bone); }
.rapp .meta { display: flex; align-items: center; gap: 12px; }
.rapp .meta .lab { color: var(--faint); }
.rapp .meta .lab.on { color: var(--a-dim); }
.rapp .strip { display: flex; gap: 4px; }
.rapp .strip i { width: 9px; height: 9px; border-radius: 2.5px; transition: background .3s; }

.rapp .ring {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--ring-idle);
  transition: background .25s, box-shadow .25s;
}
.rapp .ring.full { background: var(--a); box-shadow: none; }
.rapp .ring .tick { color: var(--ink); stroke-width: 2.6; }
.rapp .ring.part { box-shadow: none; }
.rapp .ring.part svg { position: absolute; inset: 0; }
.rapp .ring.part .track { fill: none; stroke: var(--ring-idle); stroke-width: 1.5; }
.rapp .ring.part .arc { fill: none; stroke: var(--a); stroke-width: 3; stroke-linecap: round; transition: stroke-dasharray .4s var(--spring); }
.rapp .ring.part .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--a); }
.rapp .pop .ring, .rapp .ring.pop { animation: app-pop var(--bounce-t) var(--bounce); }
@keyframes app-pop { 0% { transform: scale(0.8); } 100% { transform: scale(1); } }

.rapp .group .txt { gap: 7px; }
.rapp .group .lab { color: var(--faint); }
.rapp .group .chev { color: var(--faint); transition: transform .45s var(--spring); }
.rapp .group.open .chev { transform: rotate(180deg); }
.rapp .gring { position: relative; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; }
.rapp .gring svg { position: absolute; inset: 0; }
.rapp .gring path { fill: none; stroke: var(--ring-idle); stroke-linecap: round; transition: stroke .3s; }
.rapp .gring path.lit { stroke: var(--a); }
.rapp .gring b { font: 400 14px/1 var(--serif); color: var(--bone); }
.rapp .gring.full { background: var(--a); }
.rapp .gring .tick { color: var(--ink); stroke-width: 2.6; }
.rapp .empty { padding: 60px 0; text-align: center; }
.rapp .empty .nm { white-space: normal; color: var(--bone); }
.rapp .empty p:last-child { color: var(--faint); margin-top: 8px; }

/* The bar at the foot of Today and Streaks. */
.rapp .bar {
  flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 18px 28px 30px; border-top: 1px solid var(--hairline); background: var(--ink);
}
.rapp .tabs { display: flex; gap: 26px; }
.rapp .tabs button { font: 500 10px/1 var(--sans); letter-spacing: 0.18em; text-transform: uppercase; color: var(--faint); padding: 10px 0; transition: color .2s; }
.rapp .tabs button.on { color: var(--bone); }
.rapp .round { display: flex; gap: 10px; }
.rapp .round button, .rapp .icon-btn {
  width: 48px; height: 48px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--bone); transition: transform 100ms ease-out, background .2s;
}
.rapp .round button { background: var(--button); box-shadow: inset 0 0 0 1px var(--rule); }
.rapp .round button:active, .rapp .icon-btn:active { transform: scale(0.9); }

/* ───────────────────────── Streaks ───────────────────────── */

.rapp .note { color: var(--muted); font-size: 14px; margin-top: 10px; max-width: 30ch; }
.rapp .slist { display: flex; flex-direction: column; padding: 18px 28px 24px; }
.rapp .srow { display: flex; align-items: center; gap: 14px; padding: 16px 0; border-bottom: 1px solid var(--empty); transition: transform 100ms ease-out; }
.rapp .srow:active { transform: scale(0.98); }
.rapp .sdot { width: 10px; height: 10px; border-radius: 50%; background: var(--a); flex: 0 0 auto; }
.rapp .srow .nm { flex: 1 1 auto; font-size: 19px; color: var(--bone); }
.rapp .snum { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.rapp .snum b { font: 400 30px/1 var(--serif); color: var(--a); }
.rapp .snum .lab { color: var(--faint); font-size: 9px; }

/* ───────────────────────── A ritual ───────────────────────── */

.rapp .topnav { display: flex; align-items: center; justify-content: space-between; padding: 6px 16px 0; }
.rapp .icon-btn { width: 44px; height: 44px; }
.rapp .dhead { display: flex; flex-direction: column; gap: 12px; padding: 8px 28px 0; }
.rapp .dhead h4 { font-size: 34px; line-height: 1.08; }
.rapp .dhead .meta { gap: 10px; }
.rapp .adot { width: 8px; height: 8px; border-radius: 50%; background: var(--a); }
.rapp .dhead .lab { color: var(--muted); }
.rapp .sym { color: var(--muted); display: inline-flex; }
.rapp .stats { display: flex; margin: 26px 28px 0; border-top: 1px solid var(--hairline); border-bottom: 1px solid var(--hairline); }
.rapp .stats > div { flex: 1 1 0; display: flex; flex-direction: column; gap: 6px; padding: 18px 0 18px 20px; }
.rapp .stats > div:first-child { padding-left: 0; }
.rapp .stats > div + div { border-left: 1px solid var(--hairline); }
.rapp .stats b { font: 400 38px/1 var(--serif); color: var(--bone); }
.rapp .stats b.acc { color: var(--a); }
.rapp .stats .lab { color: var(--faint); }
.rapp .sec-h { display: flex; align-items: baseline; justify-content: space-between; padding: 28px 28px 12px; }
.rapp .sec-h .lab { color: var(--faint); }
.rapp .share { font-size: 12px; color: var(--a-dim); }
.rapp .heat { padding: 0 28px; }
.rapp .months { display: grid; grid-template-columns: repeat(15, 1fr); gap: 4px; margin-bottom: 4px; }
.rapp .months span { font: 500 8px/1 var(--sans); letter-spacing: 0.12em; text-transform: uppercase; color: var(--faint); white-space: nowrap; }
.rapp .cells { display: grid; grid-template-columns: repeat(15, 1fr); gap: 4px; }
.rapp .hc {
  aspect-ratio: 1; border-radius: 5px;
  display: inline-flex; align-items: center; justify-content: center;
  font: 500 8px/1 var(--sans) !important; color: var(--muted) !important; text-align: center !important;
  transition: background .3s, transform 100ms ease-out;
}
.rapp .hc.ink { color: var(--ink) !important; }
.rapp .hc.future { background: var(--future); color: var(--rule) !important; }
.rapp .hc.today { box-shadow: inset 0 0 0 1.5px var(--bone); font-weight: 700 !important; }
.rapp .hc:not(:disabled):active { transform: scale(0.85); }
.rapp .hc.pop { animation: app-pop var(--bounce-t) var(--bounce); }
.rapp .legend { display: flex; align-items: center; gap: 4px; padding: 12px 28px 0; }
.rapp .legend .lab { color: var(--faint); font-size: 8px; margin: 0 4px; }
.rapp .legend i { width: 9px; height: 9px; border-radius: 2.5px; }
.rapp .bars { display: flex; align-items: flex-end; gap: 4px; height: 70px; padding: 0 28px; }
.rapp .bar-c { flex: 1 1 0; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 3px; }
.rapp .bar-c em { font: 500 8px/1 var(--sans); font-style: normal; color: var(--faint); }
.rapp .bar-c i { display: block; width: 100%; border-radius: 2px; background: var(--a); transition: height .4s var(--spring); }
.rapp .big {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  height: 52px; margin: 28px 28px 0; width: calc(100% - 56px); border-radius: 26px;
  box-shadow: inset 0 0 0 1px var(--a-dim, var(--rule)); color: var(--a, var(--bone)) !important;
  font: 500 11px/1 var(--sans) !important; letter-spacing: 0.18em; text-transform: uppercase; text-align: center !important;
  transition: transform 100ms ease-out, background .25s, color .25s;
}
.rapp .big.done, .rapp .big.fill { background: var(--a, var(--brass)); color: var(--ink) !important; box-shadow: none; }
.rapp .big:not(:disabled):active { transform: scale(0.97); }
.rapp .big:disabled { opacity: 0.4; }
.rapp .under { display: flex; justify-content: center; gap: 10px; padding: 14px 0 0; color: var(--faint); font-size: 13px; }
.rapp .under button { color: var(--muted); padding: 6px 2px; }
.rapp .notes { display: flex; flex-direction: column; gap: 14px; padding: 0 28px; }
.rapp .note-row { padding-bottom: 14px; border-bottom: 1px solid var(--empty); }
.rapp .note-row .lab { color: var(--faint); }
.rapp .note-row p { font: italic 400 17px/1.35 var(--serif); color: var(--dimmed); margin-top: 6px; }
.rapp .detail { padding-bottom: 40px; }

/* ───────────────────────── The editor and settings ───────────────────────── */

.rapp .etitle { font-size: 40px; line-height: 1.05; padding: 6px 28px 0; }
.rapp .field { display: flex; flex-direction: column; gap: 14px; padding: 26px 28px 0; }
.rapp .field > .lab, .rapp .remind .lab { color: var(--faint); }
.rapp .field input[type="text"] {
  font: 400 24px/1.2 var(--serif); color: var(--bone); background: none;
  border: 0; border-bottom: 1px solid var(--rule); padding: 2px 0 12px; outline: none; border-radius: 0;
  user-select: text; -webkit-user-select: text; transition: border-color .2s;
}
.rapp .field input[type="text"]::placeholder { color: var(--faint); }
.rapp .field input[type="text"]:focus { border-color: var(--a); }
.rapp .swatches { display: flex; gap: 12px; overflow-x: auto; scrollbar-width: none; margin: -6px -28px; padding: 6px 28px; }
.rapp .swatches::-webkit-scrollbar { display: none; }
.rapp .sw { flex: 0 0 auto; width: 44px; height: 44px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; transition: box-shadow .2s, transform 100ms ease-out; }
.rapp .sw i { width: 34px; height: 34px; border-radius: 50%; background: var(--a); transition: transform .4s var(--bounce); }
.rapp .sw.on { box-shadow: inset 0 0 0 1px var(--a-dim); }
.rapp .sw:not(.on) i { transform: scale(1.18); }
.rapp .sw:active { transform: scale(0.9); }
.rapp .icons { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
.rapp .ic {
  aspect-ratio: 1; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface); box-shadow: inset 0 0 0 1px var(--hairline); color: var(--ring-idle);
  transition: color .2s, box-shadow .2s, background .2s, transform 100ms ease-out;
}
.rapp .ic.on { background: var(--surface-hi); box-shadow: inset 0 0 0 1px var(--a-dim); color: var(--a); }
.rapp .ic:active { transform: scale(0.9); }
.rapp .seg { display: flex; border-radius: 12px; box-shadow: inset 0 0 0 1px var(--hairline); overflow: hidden; }
.rapp .seg button { flex: 1 1 0; padding: 13px 0; text-align: center; font: 500 9.5px/1 var(--sans); letter-spacing: 0.16em; text-transform: uppercase; color: var(--faint); transition: background .25s, color .25s; }
.rapp .seg button + button { box-shadow: -1px 0 0 var(--hairline); }
.rapp .seg button.on { background: var(--surface-hi); color: var(--bone); }
.rapp .chips { display: flex; justify-content: space-between; gap: 6px; }
.rapp .chip { width: 38px; height: 38px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; box-shadow: inset 0 0 0 1px var(--rule); color: var(--faint); font: 500 10px/1 var(--sans); letter-spacing: 0.1em; text-align: center; transition: background .2s, color .2s, transform 100ms ease-out; }
.rapp .chip.on { background: var(--a); color: var(--ink); box-shadow: none; }
.rapp .chip:active { transform: scale(0.9); }
.rapp .stepper { display: flex; align-items: center; justify-content: space-between; }
.rapp .stepper > span { font: 400 20px/1 var(--serif); color: var(--bone); }
.rapp .stepper div { display: flex; gap: 8px; }
.rapp .stepper button { width: 40px; height: 40px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; box-shadow: inset 0 0 0 1px var(--rule); color: var(--bone); transition: transform 100ms ease-out; }
.rapp .stepper button:active { transform: scale(0.9); }
.rapp .remind { flex-direction: row; align-items: center; justify-content: space-between; }
.rapp .remind > div { display: flex; flex-direction: column; gap: 8px; }
.rapp .remind b { font: 400 26px/1 var(--serif); color: var(--bone); }
.rapp .remind b.off { color: var(--faint); font-size: 20px; }
.rapp .time { position: relative; display: inline-block; cursor: pointer; }
.rapp .time input { position: absolute; inset: 0; opacity: 0; width: 100%; cursor: pointer; }
.rapp .small { color: var(--muted); font-size: 13px; max-width: 32ch; }
.rapp .switch { flex: 0 0 auto; width: 50px; height: 30px; border-radius: 15px; background: var(--rule); padding: 3px !important; display: flex; transition: background .25s; }
.rapp .switch i { width: 24px; height: 24px; border-radius: 50%; background: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); transition: transform .45s var(--bounce); }
.rapp .switch.on { background: var(--a, var(--brass)); }
.rapp .switch.on i { transform: translateX(20px); }
.rapp .cta { padding: 34px 0 40px; }
.rapp .cta .big { margin-top: 0; }
.rapp .settings .big { margin: 4px 0 0; width: 100%; }

/* ───────────────────────── Menus, sheets, dialogs ───────────────────────── */

.rapp .overlay { position: absolute; inset: 0; z-index: 8; pointer-events: none; }
.rapp .overlay.on { pointer-events: auto; }
.rapp .scrim { position: absolute; inset: 0; background: var(--scrim); opacity: 0; transition: opacity .3s; }
.rapp .overlay.pop-menu .scrim { background: transparent; }
.rapp .overlay.on .scrim { opacity: 1; }
.rapp .menu {
  position: absolute; right: 18px; top: 98px; min-width: 190px; padding: 6px;
  background: var(--surface-hi); border-radius: 16px; box-shadow: inset 0 0 0 1px var(--rule), 0 20px 40px rgba(0, 0, 0, 0.35);
  transform-origin: top right; transform: scale(0.9); opacity: 0; filter: blur(3px);
  transition: transform .4s var(--spring), opacity .18s, filter .25s;
}
.rapp .overlay.on .menu { transform: none; opacity: 1; filter: none; }
.rapp .menu button { display: block; width: 100%; padding: 13px 14px; border-radius: 10px; font-size: 16px; color: var(--bone); }
.rapp .menu button:active { background: var(--surface); }
.rapp .danger { color: var(--garnet) !important; }
.rapp .sheet {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 12px 24px 34px;
  background: var(--surface-hi); border-radius: 26px 26px 0 0; box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.3);
  display: flex; flex-direction: column; gap: 14px;
  transform: translateY(100%); transition: transform .5s var(--spring);
}
.rapp .overlay.on .sheet { transform: none; }
.rapp .grab { align-self: center; width: 36px; height: 5px; border-radius: 3px; background: var(--rule); }
.rapp .sheet .lab { color: var(--faint); }
.rapp .sheet textarea {
  font: italic 400 20px/1.35 var(--serif); color: var(--bone); background: var(--surface);
  border: 0; border-radius: 14px; padding: 14px 16px; resize: none; outline: none;
  box-shadow: inset 0 0 0 1px var(--rule); user-select: text; -webkit-user-select: text;
}
.rapp .sheet textarea:focus { box-shadow: inset 0 0 0 1px var(--a); }
.rapp .sheet-actions { display: flex; align-items: center; gap: 14px; }
.rapp .sheet-actions > button:first-child { color: var(--muted); padding: 10px 6px; }
.rapp .sheet-actions .big { margin: 0; flex: 1 1 auto; width: auto; }
.rapp .overlay.center { display: grid; place-items: center; }
.rapp .dialog {
  position: relative; width: 300px; padding: 24px; border-radius: 22px; background: var(--surface-hi);
  box-shadow: inset 0 0 0 1px var(--rule), 0 30px 60px rgba(0, 0, 0, 0.4);
  transform: scale(1.08); opacity: 0; transition: transform .4s var(--spring), opacity .2s;
}
.rapp .overlay.on .dialog { transform: none; opacity: 1; }
.rapp .dialog h5 { font-size: 24px; }
.rapp .dialog p { color: var(--muted); margin-top: 10px; font-size: 14px; }
.rapp .dialog div { display: flex; justify-content: flex-end; gap: 20px; margin-top: 22px; }
.rapp .dialog div button { font: 500 11px/1 var(--sans); letter-spacing: 0.16em; text-transform: uppercase; padding: 10px 0; color: var(--muted); }
.rapp .toast {
  position: absolute; left: 20px; right: 20px; bottom: 100px; z-index: 9;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 18px; border-radius: 16px; background: var(--bone); color: var(--ink); font-size: 14px;
  transform: translateY(16px); opacity: 0; transition: transform .45s var(--spring), opacity .25s;
}
.rapp .toast.on { transform: none; opacity: 1; }
.rapp .toast button { font: 600 11px/1 var(--sans); letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink); opacity: 0.7; }

/* ───────────────────────── The row of phones on the page ───────────────────────── */

.phones.live { grid-auto-columns: minmax(250px, 1fr); }
.phones.live figure { gap: 18px; }
.phones .hint { color: var(--faint); margin-top: 18px; }

/* ───────────────────────── The printed year, touchable ───────────────────────── */

.paper-grid button, .paper-grid i { display: block; width: 100%; aspect-ratio: 1; border-radius: 1.5px; background: #E6DECD; padding: 0; border: 0; }
.paper-grid button { cursor: pointer; transition: transform 100ms ease-out, background .25s; }
.paper-grid button:hover { box-shadow: 0 0 0 1px #7A5F3B; }
.paper-grid button:active { transform: scale(0.8); }
.paper-grid [data-l="1"] { background: #D8CBB3; }
.paper-grid [data-l="2"] { background: #C9B899; }
.paper-grid [data-l="3"] { background: #A98E68; }
.paper-grid [data-l="4"] { background: #7A5F3B; }
.paper-grid [data-l="f"] { background: #EFE8DA; }
.paper-grid .today { box-shadow: 0 0 0 1px #1C1A17; }
.paper-grid .pop { animation: app-pop .5s var(--bounce); }
.paper-hint { color: var(--faint); text-align: center; margin-top: 22px; }

/* ───────────────────────── The home screen in edit mode ───────────────────────── */

.phone-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(14px, 3vw, 28px); align-items: start; width: 100%; }
.phone-slot { container-type: inline-size; display: flex; flex-direction: column; align-items: center; gap: 16px; }
.phone-slot .phone { --p: clamp(0.3px, calc(100cqw / 417), 0.9px); }
.phone-slot .lab { color: var(--faint); text-align: center; }
@media (max-width: 560px) {
  .phone-pair { grid-template-columns: minmax(0, 1fr); }
  .phone-slot .phone { --p: clamp(0.5px, calc(100cqw / 440), 0.9px); }
}

.home.edit { position: relative; display: block; padding: 0; margin: calc(18 * var(--p)) calc(27 * var(--p)) 0; height: calc(560 * var(--p)); }
.edit-phone .grid-room { position: relative; font-size: var(--p); width: 339em; height: 518em; }
.edit-phone .hi {
  position: absolute; left: 0; top: 0;
  transition: transform 520ms var(--spring), opacity .3s, filter .3s;
}
.edit-phone .hi.still, .edit-phone .hi.still * { transition: none !important; }
.edit-phone .hi.away { opacity: 0; transform: translate(170em, 600em) scale(0.5) !important; pointer-events: none; }
.edit-phone .hi .wg { box-shadow: 0 8em 24em rgba(0, 0, 0, 0.18); }
.edit-phone .hi .wlabel { position: absolute; left: -10em; right: -10em; top: calc(100% + 5 * var(--p)); margin: 0; font-size: calc(12 * var(--p)); text-align: center; }
.edit-phone .hi-cal { transform: translate(var(--x, 0), var(--y, 0)); width: 158em; height: 158em; z-index: 2; }
.edit-phone .hi-cal.held { z-index: 3; }
.edit-phone .hi-cal .cw-body { position: absolute; inset: 0; overflow: hidden; border-radius: 22em; background: var(--ink); box-shadow: 0 8em 24em rgba(0, 0, 0, 0.18); }
.edit-phone .hi-cal.held .cw-body { box-shadow: 0 20em 50em rgba(0, 0, 0, 0.35); }
.phone .cw-face { position: absolute; left: 0; top: 0; transition: opacity .25s; }
.phone .cw-face.out { opacity: 0; }
.phone .cw { color: var(--bone); font-family: var(--sans); }
.phone .cw-title { font-family: var(--serif); line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--bone); text-align: center; }
.phone .cw-title.with-streak { display: flex; align-items: center; gap: calc(6 * var(--p)); }
.phone .cw-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.phone .cw-streak { flex: 0 0 auto; font: 500 calc(9 * var(--p))/1 var(--sans); letter-spacing: 0.1em; text-transform: uppercase; color: var(--a-dim); }
.phone .cw-twin { visibility: hidden; }
.phone .cw-bands { display: flex; flex-direction: column; }
.phone .cw-band { display: flex; flex-direction: column; }
.phone .cw-months { display: flex; }
.phone .cw { box-sizing: border-box; overflow: hidden; }
.phone .cw-months span { flex: 0 0 auto; font: 500 calc(9 * var(--p))/calc(12 * var(--p)) var(--sans); letter-spacing: 0.1em; text-transform: uppercase; color: var(--faint); white-space: nowrap; overflow: visible; }
.phone .cw-row { display: flex; }
.phone .cw i { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; font-style: normal; color: var(--muted); background: var(--empty); line-height: 1; }
.phone .cw i.ink { color: var(--ink); }
.phone .cw i.f { background: var(--future); color: #332E28; }
.phone .cw i.t { box-shadow: inset 0 0 0 calc(1.5 * var(--p)) var(--bone); font-weight: 700; }
.phone .cw-day { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; font: 500 calc(9 * var(--p))/1 var(--sans); letter-spacing: 0.1em; text-transform: uppercase; color: var(--faint); }

/* The same calendar at its smallest on the iPhone living its day, where it stands in for
   the one-ritual square the iPhone does not have. Its days can be tapped. */
.mini-cal { position: relative; flex: 0 0 auto; width: 158em; height: 158em; }
.mini-cal .cw-body { position: absolute; inset: 0; overflow: hidden; border-radius: 22em; background: var(--ink); box-shadow: 0 8em 24em rgba(0, 0, 0, 0.18); }
.mini-cal .cw i[data-d] { cursor: pointer; -webkit-tap-highlight-color: transparent; transition: transform 100ms ease-out; }
.mini-cal .cw i[data-d]:active { transform: scale(0.88); }

.edit-phone .hi[data-c="1"] { width: 68em; height: 68em; }
.edit-phone .hi[data-c="2"]:not(.hi-cal) { width: 158em; height: 158em; }
.edit-phone .hi .wg { pointer-events: none; cursor: default; }
.edit-phone .icon { display: grid; justify-items: center; align-items: start; }
.edit-phone .icon img, .edit-phone .glass-icon { display: block; width: 60em; height: 60em; margin-top: 4em; border-radius: 14em; }
.edit-phone .icon img { box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2); }
.edit-phone .glass-icon { background: rgba(255, 255, 255, 0.45); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.5), 0 4px 14px rgba(0, 0, 0, 0.12); }
.edit-phone .icon + .wlabel { top: calc(68 * var(--p)); }
.phone .cw-body { --ink: #12100E; --bone: #F2EDE4; --faint: #6E655B; --muted: #A79E92; --empty: #201C17; --future: #191612; }

/* The handle iOS draws on a widget's corner while the page is being arranged. */
.edit-phone .handle {
  position: absolute; right: -14em; bottom: -14em; width: 44em; height: 44em;
  display: grid; place-items: center; cursor: nwse-resize; touch-action: none;
  opacity: 0; transform: scale(0.6); transition: opacity .25s, transform .4s var(--bounce);
}
.edit-phone .handle::before {
  content: ""; width: 20em; height: 20em; margin: -12em 0 0 -12em;
  border-right: 4em solid #fff; border-bottom: 4em solid #fff; border-bottom-right-radius: 16em;
  filter: drop-shadow(0 1em 3em rgba(0, 0, 0, 0.4));
}
.editing .edit-phone .handle, .edit-phone.editing .handle { opacity: 1; transform: none; }
.edit-phone .hi-cal.held .handle { transform: scale(1.15); }

/* The wobble: a small rock, a little out of step from one thing to the next. */
@keyframes wobble { 0% { rotate: -1.1deg; } 50% { rotate: 1.1deg; } 100% { rotate: -1.1deg; } }
.edit-phone.editing .hi > .wob { animation: wobble .28s ease-in-out infinite; }
.edit-phone.editing .hi:nth-child(2n) > .wob { animation-duration: .31s; animation-delay: -.12s; }
.edit-phone.editing .hi:nth-child(3n) > .wob { animation-delay: -.2s; }
.edit-phone.editing .hi-cal.held > .wob, .edit-phone .resizing .hi > .wob { animation: none; }
.edit-phone .wob { position: absolute; inset: 0; }

.edit-phone .edit-bar {
  position: absolute; left: 0; right: 0; top: calc(14 * var(--p)); z-index: 6;
  display: flex; justify-content: flex-end; padding: 0 calc(20 * var(--p));
  opacity: 0; transform: translateY(calc(-6 * var(--p))); transition: opacity .25s, transform .4s var(--spring); pointer-events: none;
}
.edit-phone.editing .edit-bar { opacity: 1; transform: none; pointer-events: auto; }
.edit-phone .edit-done {
  font: 600 calc(14 * var(--p))/1 -apple-system, "SF Pro Text", var(--sans); color: #1c1c1e;
  padding: calc(9 * var(--p)) calc(16 * var(--p)); border: 0; border-radius: 999px; cursor: pointer;
  background: rgba(255, 255, 255, 0.55); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.6); transition: transform 100ms ease-out;
}
.edit-phone .edit-done:active { transform: scale(0.94); }
.edit-phone.editing .status { opacity: 0; }
.edit-phone .status { transition: opacity .25s; }
.edit-phone .dots i:last-child { transition: opacity .3s, transform .4s var(--bounce); }
.edit-phone .dots:not(.more) i:last-child { opacity: 0.35; }
.edit-phone .dots.more i:last-child { background: rgba(0, 0, 0, 0.6); transform: scale(1.3); }
.edit-phone .dots { position: absolute; left: 0; right: 0; bottom: calc(118 * var(--p)); justify-content: center; margin: 0; }

@media (prefers-reduced-motion: reduce) {
  .edit-phone.editing .hi > .wob { animation: none; }
}
