/* The phone page, after docs/mockups/sharp/phone-day.png and phone-week.png. System fonts until the design pass. */
:root {
  --page: #FFFFFF;
  --soft: #F3F4F6;
  --border: #E1E4E9;
  --grid: #ECEEF1;
  --text: #1D2129;
  --muted: #6B7280;
  --free: #C9CED6;
  --red: #C8372D;
  --red-soft: #FCE9E7;
  --amber: #8A5A00;
  --amber-soft: #FFF3D6;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--page); color: var(--text); }
body {
  font: 16px/1.35 -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }

#app {
  display: flex; flex-direction: column; height: 100dvh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left);
}
.message { margin: auto; padding: 24px; max-width: 320px; text-align: center; color: var(--muted); }

/* ---------- Header ---------- */
.top { padding: 14px 16px 0; border-bottom: 1px solid var(--border); flex: none; }
.title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.kicker { font-size: 14px; color: var(--muted); }
h1 { margin: 2px 0 0; font-size: 28px; line-height: 1.1; letter-spacing: -0.01em; font-weight: 700; }
.switch { display: flex; background: var(--soft); border-radius: 12px; padding: 3px; flex: none; }
.switch button { min-height: 38px; min-width: 56px; padding: 0 12px; border-radius: 9px; font-size: 15px; color: var(--muted); }
.switch button.on { background: var(--page); color: var(--text); font-weight: 600; box-shadow: 0 1px 2px rgb(0 0 0 / 0.08); }

.strip { display: grid; grid-template-columns: repeat(7, 1fr); margin-top: 10px; }
.strip-day { display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 58px; }
.strip-day .letter, .wd .letter { font-size: 12px; color: var(--muted); }
.strip-day .num, .wd .num {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
  font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums;
}
.strip-day.is-today .num { color: var(--red); }
.strip-day.is-selected .num, .wd.is-today .num { background: var(--text); color: #fff; }

.status { display: flex; justify-content: space-between; align-items: center; min-height: 36px; font-size: 12px; }
.today { min-height: 32px; padding: 0 12px; border-radius: 16px; background: var(--soft); font-size: 13px; font-weight: 600; }
.fresh { color: var(--muted); }
.fresh.stale { color: var(--amber); background: var(--amber-soft); padding: 4px 10px; border-radius: 12px; font-weight: 600; }

.content { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior-y: contain; }

/* ---------- Day ---------- */
.day { padding: 14px 16px calc(28px + env(safe-area-inset-bottom)); }
.day-ribbons { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.ribbon {
  background: var(--line); color: #fff; font-size: 13px; font-weight: 600;
  padding: 4px 10px; border-radius: 999px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.done { margin-bottom: 14px; }
.done-head { display: flex; align-items: center; gap: 12px; text-align: left; min-height: 48px; width: 100%; }
.done-head > span:last-child { display: flex; flex-direction: column; font-size: 15px; min-width: 0; }
.done-head .muted { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bubbles { display: flex; flex: none; padding-left: 6px; }
.bubble {
  display: grid; place-items: center; width: 36px; height: 36px; margin-left: -8px; border-radius: 50%;
  background: var(--line); border: 2px solid var(--page);
}
.bubble svg { width: 17px; height: 17px; fill: none; stroke: #fff; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.done-list { list-style: none; margin: 6px 0 0; padding: 0 0 0 4px; font-size: 14px; color: var(--muted); }
.done-list li { padding: 4px 0; }

.timeline { position: relative; }
.timeline::before { /* the dotted thread through the capsules */
  content: ""; position: absolute; top: 0; bottom: 0; left: 75px; border-left: 2px dotted var(--free);
}
.timeline.past .row { opacity: 0.6; }
.row { position: relative; display: grid; grid-template-columns: 52px 48px 1fr; column-gap: 12px; align-items: start; padding: 4px 0; }
.time { font-size: 13px; color: var(--muted); padding-top: 12px; }
.capsule {
  display: grid; place-items: center; width: 48px; border-radius: 24px; background: var(--fill);
  border: 2px solid var(--line); position: relative;
}
.capsule svg { width: 20px; height: 20px; fill: none; stroke: var(--line); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.text { padding-top: 6px; min-width: 0; }
.title { font-size: 17px; font-weight: 600; overflow-wrap: anywhere; }
.meta { font-size: 14px; color: var(--muted); margin-top: 2px; }

.free { position: relative; padding: 8px 0 8px 112px; font-size: 14px; color: var(--muted); }
.overlap { position: relative; padding: 6px 0 6px 112px; }
.overlap::before {
  content: ""; position: absolute; top: -6px; bottom: -6px; left: 75px; border-left: 3px dotted var(--red); z-index: 1;
}
.warn {
  display: inline-block; background: var(--red-soft); color: var(--red); border: 1px solid #F1B7B1;
  border-radius: 999px; padding: 4px 12px; font-size: 14px; font-weight: 600;
}
.end { margin: 10px 0 0 112px; font-size: 14px; color: var(--muted); }

.now {
  position: relative; z-index: 1; margin: 6px -4px 10px; padding: 18px; border-radius: 28px;
  background: var(--fill); border: 2px solid var(--line); box-shadow: 0 6px 18px rgb(0 0 0 / 0.08);
}
.now-top { display: flex; gap: 14px; align-items: center; }
.now-icon { display: grid; place-items: center; flex: none; width: 52px; height: 52px; border-radius: 50%; background: var(--line); }
.now-icon svg { width: 24px; height: 24px; fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.now-label { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; color: var(--ink); }
.now-title { font-size: 24px; font-weight: 700; line-height: 1.15; overflow-wrap: anywhere; }
.now-type { font-size: 15px; color: var(--ink); }
.bar { height: 10px; margin: 16px 0 10px; border-radius: 5px; background: color-mix(in srgb, var(--line) 22%, var(--fill)); overflow: hidden; }
.bar > div { height: 100%; background: var(--line); border-radius: 5px; }
.now-times { display: flex; justify-content: space-between; font-size: 14px; color: var(--ink); }

/* ---------- Week ---------- */
.week { display: flex; flex-direction: column; min-height: 100%; padding: 0 6px calc(12px + env(safe-area-inset-bottom)) 4px; }
.week-head { position: sticky; top: 0; z-index: 3; background: var(--page); padding-top: 6px; border-bottom: 1px solid var(--border); }
.week-days { display: grid; grid-template-columns: 26px repeat(7, 1fr); }
.wd { display: flex; flex-direction: column; align-items: center; gap: 2px; padding-bottom: 6px; min-height: 44px; }
.wd .num { width: 32px; height: 32px; font-size: 16px; }
.lanes { position: relative; margin-bottom: 6px; }
.week .ribbon { position: absolute; height: 19px; padding: 1px 6px; font-size: 11px; border-radius: 10px; }
.week .ribbon.cut-after { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.week .ribbon.cut-before { border-top-left-radius: 0; border-bottom-left-radius: 0; }

.grid { position: relative; flex: 1; margin-top: 6px; }
.today-col { position: absolute; top: 0; bottom: 0; background: #F6F7F9; }
.col-line { position: absolute; top: 0; bottom: 0; border-left: 1px solid var(--grid); }
.hour { position: absolute; left: 0; width: 22px; text-align: right; transform: translateY(-50%); font-size: 11px; color: var(--muted); }
.block {
  position: absolute; min-height: 16px; border-radius: 9px;
  background: var(--fill); border: 1.5px solid var(--line); color: var(--ink);
}
.block.past { background: var(--line); color: #fff; }
.block.current { background: linear-gradient(to bottom, var(--line) var(--done), var(--fill) var(--done)); }
.block.current.ink-white .block-title { color: #fff; }
.block-title {
  display: block; padding: 2px 4px; font-size: 11px; font-weight: 700; line-height: 1.2;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center;
}
.block.overlaps { border-color: var(--red); }
.bang {
  position: absolute; left: -7px; top: -7px; z-index: 1; display: grid; place-items: center; width: 14px; height: 14px; border-radius: 50%;
  background: var(--red); color: #fff; font-size: 10px; font-weight: 800;
}
.gap {
  position: absolute; transform: translate(-50%, -50%); z-index: 2; padding: 0 5px; font-size: 10px; line-height: 15px;
  color: var(--muted); background: var(--page); border: 1px solid var(--free); border-radius: 8px; pointer-events: none;
}
.now-line { position: absolute; height: 2px; margin-top: -1px; background: var(--red); z-index: 2; pointer-events: none; }
.now-line::before { content: ""; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--red); }

/* ---------- Home Screen tip ---------- */
.tip {
  flex: none; display: flex; align-items: flex-start; gap: 10px; margin: 0 12px calc(12px + env(safe-area-inset-bottom));
  padding: 12px 12px 12px 14px; border-radius: 16px; background: var(--text); color: #fff; font-size: 14px;
}
.tip p { margin: 0; flex: 1; }
.tip button { min-width: 44px; min-height: 44px; margin: -10px -8px -10px 0; font-size: 16px; }

/* ---------- Passphrase ---------- */
.lock { margin: auto; padding: 24px; width: 100%; max-width: 380px; text-align: center; }
.lock-icon { display: inline-grid; place-items: center; width: 64px; height: 64px; border-radius: 18px; background: #6B4FBB; }
.lock-icon svg { width: 32px; height: 32px; fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.lock h1 { margin-top: 12px; }
.lock p { color: var(--muted); font-size: 15px; }
.lock form { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.lock input {
  font: 17px var(--mono); padding: 12px 14px; min-height: 48px; border: 1.5px solid var(--border); border-radius: 12px;
  background: var(--soft); color: var(--text); width: 100%;
}
.lock input:focus { outline: 2px solid #6B4FBB; outline-offset: 1px; }
.lock button { min-height: 48px; border-radius: 12px; background: var(--text); color: #fff; font-weight: 600; }
.lock button:disabled { opacity: 0.5; }
.lock-status { min-height: 1.4em; }
