@font-face { font-family: 'Fraunces'; src: url(fonts/fraunces.woff2) format('woff2'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: 'Instrument Sans'; src: url(fonts/instrument-sans.woff2) format('woff2'); font-weight: 100 900; font-display: swap; }

:root {
  --phone: #f7f5f0;
  --ink: #1f2430;
  --ink-2: #5a6070;
  --line: #d9d4c8;
  --circle: #1f2430;
  --circle-ink: #f7f5f0;
  --chip: rgba(31,36,48,.22);
  --field: rgba(31,36,48,.06);
  --body: #c9d9d0; --mind: #d5d0e6; --spirit: #ead9c0; --love: #ecc9c9; --people: #dcd6b8; --work: #c8d3e2; --money: #cfdcc6; --play: #f0d6b8; --home: #d7cbbf;
  --display: 'Fraunces', Georgia, serif;
  --sans: 'Instrument Sans', 'Helvetica Neue', Arial, sans-serif;
  --ease: cubic-bezier(.2,.8,.2,1);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --phone: #1f232c; --ink: #eef0f4; --ink-2: #9aa2b3; --line: #343a47; --circle: #eef0f4; --circle-ink: #1f232c;
    --chip: rgba(238,240,244,.28); --field: rgba(238,240,244,.08);
    --body: #2f4a40; --mind: #3d3757; --spirit: #5a4a33; --love: #5a3838; --people: #4d4a2c; --work: #2f3c50; --money: #354a2f; --play: #5c4327; --home: #4a3f36;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--phone); color: var(--ink); font-family: var(--sans);
  -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%;
  overscroll-behavior: none; touch-action: manipulation;
}
button { font-family: inherit; color: inherit; }
input, textarea { font-family: inherit; color: inherit; font-size: 16px; }

.app {
  position: relative; min-height: 100dvh; max-width: 540px; margin: 0 auto;
  display: flex; flex-direction: column; overflow: hidden;
  padding: calc(env(safe-area-inset-top) + 14px) 16px calc(env(safe-area-inset-bottom) + 14px);
}

/* header */
.top { display: flex; justify-content: space-between; align-items: flex-start; padding: 4px 4px 10px; }
.top .date { font-family: var(--display); font-size: 24px; font-weight: 500; letter-spacing: -.01em; line-height: 1.1; }
.top .sub { font-size: 12px; color: var(--ink-2); letter-spacing: .05em; text-transform: uppercase; margin-top: 4px; }
.top-actions { display: flex; gap: 8px; align-items: center; }
.pill { background: var(--ink); color: var(--phone); border: 0; border-radius: 999px; padding: 7px 14px; font-size: 13px; font-weight: 600; cursor: pointer; }
.icon-btn { background: transparent; border: 1px solid var(--line); border-radius: 999px; width: 36px; height: 36px; font-size: 20px; line-height: 1; cursor: pointer; display: grid; place-items: center; padding: 0 0 6px; }

/* board */
.board-wrap { flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: stretch; min-height: 0; padding-bottom: 16px; }
.board {
  position: relative; width: min(100%, calc(100dvh - 270px)); min-width: 260px; aspect-ratio: 1; margin: 0 auto;
  container-type: inline-size;
}
.tile {
  position: absolute; border-radius: 5.5cqw; padding: 3.6cqw; overflow: hidden; cursor: pointer;
  display: flex; flex-direction: column; justify-content: space-between; color: var(--ink); text-align: left;
  transition: left .45s var(--ease), top .45s var(--ease), width .45s var(--ease), height .45s var(--ease), border-radius .45s var(--ease), opacity .3s;
}
.tile:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.tile .head { display: flex; justify-content: space-between; align-items: flex-start; gap: 2cqw; }
.tile .name { font-family: var(--display); font-weight: 500; font-size: 5.6cqw; line-height: 1; letter-spacing: -.01em; }
.tile .abbr { display: none; font-family: var(--display); font-weight: 600; font-size: 4cqw; }
.tile .back { display: none; font-size: 3cqw; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; opacity: .6; cursor: pointer; padding: .6cqw 0; }
.tile .dots { display: flex; gap: 1.2cqw; }
.tile .dots i { width: 1.9cqw; height: 1.9cqw; border-radius: 50%; background: var(--ink); opacity: .16; }
.tile .dots i.on { opacity: .75; }
.tile.grid.center .name { font-size: 4cqw; }
.tile.grid.center .dots { position: absolute; right: 3.6cqw; bottom: 4cqw; }
.tile.quiet:not(.big) { opacity: .55; }

.tile.small { padding: 0; display: grid; place-items: center; border-radius: 3cqw; }
.tile.small .name, .tile.small .dots, .tile.small .detail { display: none; }
.tile.small .abbr { display: block; }
.tile.small .head { display: contents; }

.tile.big { padding: 4.5cqw; cursor: default; z-index: 3; }
.tile.big .name { font-size: 7cqw; }
.tile.big .back { display: block; }
.tile.big .dots { gap: 2cqw; }
.tile.big .dots i { width: 2.6cqw; height: 2.6cqw; }

.tile .detail { display: none; }
.tile.big .detail { display: flex; flex-direction: column; gap: 2.6cqw; flex: 1; min-height: 0; overflow-y: auto; margin: 3cqw 0 2.5cqw; font-size: 3.6cqw; line-height: 1.4; cursor: default; scrollbar-width: thin; }
.detail .rooms { display: flex; flex-wrap: wrap; gap: 1.6cqw; }
.detail .chip { border: 1px solid var(--chip); background: transparent; border-radius: 999px; padding: 1.1cqw 2.6cqw; font-size: 3.3cqw; font-weight: 500; display: inline-flex; align-items: center; gap: 1.5cqw; line-height: 1.2; }
.detail .chip .x { opacity: .5; font-size: 3.6cqw; line-height: 1; cursor: pointer; padding: 0 .4cqw; }
.detail .chip.add { cursor: pointer; border-style: dashed; opacity: .75; }
.detail .chip-input { border: 1px solid var(--chip); background: var(--field); border-radius: 999px; padding: 1.1cqw 2.6cqw; font-size: 16px; width: 34cqw; outline: none; }
.detail .touch { border: 1.5px solid var(--ink); background: transparent; border-radius: 999px; padding: 2.2cqw 3.4cqw; font-size: 3.6cqw; font-weight: 600; cursor: pointer; align-self: flex-start; display: inline-flex; align-items: center; gap: 2cqw; }
.detail .touch::before { content: ''; width: 2.6cqw; height: 2.6cqw; border-radius: 50%; border: 1.5px solid currentColor; }
.detail .touch.on { background: var(--ink); color: var(--phone); }
.detail .touch.on::before { background: currentColor; }
.detail .line { border: 0; border-bottom: 1px solid var(--chip); background: transparent; padding: 1.5cqw 0; font-family: var(--display); font-style: italic; font-size: 16px; width: 100%; outline: none; }
.detail .line::placeholder { opacity: .5; font-style: italic; }
.detail .todos { display: flex; flex-direction: column; gap: 1.4cqw; }
.detail .todo { display: flex; align-items: center; gap: 2.4cqw; }
.detail .todo .box { width: 4.2cqw; height: 4.2cqw; border: 1.5px solid currentColor; border-radius: 1.2cqw; flex: none; opacity: .7; display: grid; place-items: center; font-size: 2.8cqw; cursor: pointer; background: transparent; padding: 0; }
.detail .todo.done .box::after { content: '\2713'; }
.detail .todo.done .t { text-decoration: line-through; opacity: .5; }
.detail .todo .t { flex: 1; }
.detail .todo .x { opacity: .4; cursor: pointer; padding: 0 1cqw; background: transparent; border: 0; font-size: 4cqw; line-height: 1; }
.detail .todo-add { border: 0; background: var(--field); border-radius: 2.4cqw; padding: 2cqw 2.8cqw; font-size: 16px; width: 100%; outline: none; }
.detail .muted { opacity: .6; font-size: 3.2cqw; }

.circle {
  position: absolute; left: 50%; top: 50%; width: 16.5cqw; height: 16.5cqw; margin: -8.25cqw 0 0 -8.25cqw; border-radius: 50%; z-index: 5;
  background: var(--circle); color: var(--circle-ink); border: 1cqw solid var(--phone); display: grid; place-items: center; align-content: center; cursor: pointer;
  font-family: var(--display); font-weight: 700; line-height: 1; padding: 0;
  transition: transform .35s var(--ease), opacity .3s; box-shadow: 0 6px 18px rgba(0,0,0,.18);
}
.circle b { font-size: 7.4cqw; font-weight: 700; }
.circle small { display: block; font-family: var(--sans); font-weight: 600; font-size: 2cqw; letter-spacing: .12em; text-transform: uppercase; margin-top: .4cqw; }
.circle.hide { transform: scale(.2); opacity: 0; pointer-events: none; }
.circle:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* day dots */
.days-nav { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 4px; }
.days { display: flex; gap: 6px; }
.days button { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: transparent; color: var(--ink-2); font-size: 11px; font-weight: 600; cursor: pointer; display: grid; place-items: center; align-content: center; gap: 3px; padding: 0; }
.days button i { width: 5px; height: 5px; border-radius: 50%; background: var(--ink); opacity: .12; }
.days button.has i { opacity: .7; }
.days button.today { border-color: var(--ink); color: var(--ink); }
.days button.selected { background: var(--ink); color: var(--phone); border-color: var(--ink); }
.days button.selected i { background: var(--phone); }
.days button:disabled { opacity: .3; cursor: default; }
.arrow { background: transparent; border: 0; color: var(--ink-2); font-size: 24px; line-height: 1; width: 24px; height: 34px; cursor: pointer; padding: 0 0 4px; }
.arrow:disabled { opacity: .25; cursor: default; }
.days-label { text-align: center; font-size: 11px; color: var(--ink-2); margin: 10px 0 0; letter-spacing: .04em; text-transform: uppercase; min-height: 14px; }

/* sheets */
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.25); opacity: 0; pointer-events: none; transition: opacity .3s; z-index: 9; }
.scrim.on { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; top: 0; margin: 0 auto; max-width: 540px; z-index: 10; background: var(--phone);
  padding: calc(env(safe-area-inset-top) + 26px) 22px calc(env(safe-area-inset-bottom) + 22px);
  transform: translateY(102%); transition: transform .4s var(--ease); display: flex; flex-direction: column; overflow-y: auto;
}
.sheet.open { transform: translateY(0); }
.sheet h2 { font-family: var(--display); font-weight: 500; font-size: 28px; margin: 10px 0 4px; }
.sheet .sub { color: var(--ink-2); font-size: 14px; margin: 0 0 18px; line-height: 1.4; }
.close { position: absolute; top: calc(env(safe-area-inset-top) + 22px); right: 22px; background: transparent; border: 1px solid var(--line); color: var(--ink); border-radius: 999px; padding: 7px 14px; font-size: 13px; font-weight: 600; cursor: pointer; }
.task { display: grid; grid-template-columns: 24px 1fr auto; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); }
.task:last-of-type { border-bottom: 1px solid var(--line); }
.task .box { width: 22px; height: 22px; border: 1.5px solid var(--ink); border-radius: 7px; background: transparent; padding: 0; display: grid; place-items: center; font-size: 13px; cursor: pointer; }
.task.done .box::after { content: '\2713'; }
.task.done .t { text-decoration: line-through; opacity: .5; }
.task .t { border: 0; background: transparent; padding: 6px 0; width: 100%; outline: none; font-size: 16px; font-weight: 500; }
.task .t::placeholder { opacity: .45; font-weight: 400; }
.task .tag { border: 0; border-radius: 999px; padding: 5px 10px; font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; cursor: pointer; white-space: nowrap; }
.task .n { font-family: var(--display); font-size: 14px; color: var(--ink-2); }
.jl { display: block; margin: 22px 0 6px; font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-2); }
#journal { width: 100%; border: 0; border-bottom: 1px solid var(--line); background: transparent; padding: 8px 0; font-family: var(--display); font-style: italic; font-size: 17px; line-height: 1.4; resize: none; outline: none; }
.rule { margin-top: auto; padding-top: 16px; font-size: 12.5px; color: var(--ink-2); line-height: 1.5; border-top: 1px dashed var(--line); }
.menu-list { display: flex; flex-direction: column; gap: 10px; }
.menu-item { text-align: left; background: var(--field); border: 0; border-radius: 14px; padding: 16px 18px; font-size: 16px; font-weight: 500; cursor: pointer; }
.menu-item.danger { color: #b0352f; }
.menu-note { font-size: 13px; color: var(--ink-2); line-height: 1.5; padding: 0 4px; }
.menu-note:empty { display: none; }

@media (prefers-reduced-motion: reduce) { .tile, .circle, .sheet, .scrim { transition: none; } }

/* welcome */
.welcome .how { padding-left: 20px; margin: 4px 0 26px; font-size: 16px; line-height: 1.5; color: var(--ink); }
.welcome .how li { margin-bottom: 12px; }
.welcome .how b { font-weight: 600; }
.pill.big { font-size: 16px; padding: 14px 22px; align-self: flex-start; }
