:root {
  --bg: #fbfaf6;
  --ink: #1d1d1b;
  --muted: #8b8a84;
  --line: #ebe9e2;
  --soft: #f2f1ec;
  /* TicTac: white and mint. NicNac: red and yellow. */
  --mint: #7fd6b6;
  --mint-ink: #17795a;
  --mint-soft: #e4f6ee;
  --red: #e2231a;
  --yellow: #ffc93c;
  --red-ink: #c01b13;
  --red-soft: #fde9e5;
  --pad: 20px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-tap-highlight-color: transparent;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--bg); overscroll-behavior-y: none; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
h1, h2, h3, p { margin: 0; }

#app {
  max-width: 480px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 14px) var(--pad) calc(env(safe-area-inset-bottom) + 32px);
}

/* ---------- top */

.top { display: flex; align-items: center; justify-content: space-between; height: 44px; }
.mark { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; color: var(--muted); }
.mark .tt { color: var(--mint-ink); }
.mark .nn { color: var(--red); }

.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; margin-right: -12px; }
.icon-btn svg { width: 22px; height: 22px; fill: var(--ink); stroke: var(--ink); stroke-width: 0; }
.month-nav .icon-btn svg { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.month-nav .icon-btn:first-child { margin: 0 0 0 -12px; }
.icon-btn:active { background: var(--soft); }

/* ---------- month */

.month { margin-top: 18px; }
.month-nav { display: flex; align-items: center; justify-content: space-between; }
.month-nav h2 { font-size: 22px; font-weight: 650; letter-spacing: -0.02em; }
.weekdays, .grid { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; }
.weekdays { margin-top: 14px; font-size: 12px; color: var(--muted); }
.weekdays span { padding: 6px 0; }
.grid { row-gap: 2px; touch-action: pan-y; }

.cell { height: 50px; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding-top: 4px; gap: 3px; }
.cell .n { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; font-size: 16px; font-variant-numeric: tabular-nums; }
.cell.out { visibility: hidden; }
.cell.today .n { font-weight: 700; box-shadow: inset 0 0 0 1.5px var(--ink); }
.cell.sel .n { background: var(--ink); color: #fff; box-shadow: none; }
.dots { display: flex; gap: 3px; height: 6px; }
.dot { width: 6px; height: 6px; border-radius: 50%; }
.dot.tictac { background: var(--mint); }
.dot.nicnac { background: var(--red); }

/* ---------- day */

.day { margin-top: 22px; border-top: 1px solid var(--line); padding-top: 18px; }
.day-head { display: flex; align-items: center; justify-content: space-between; min-height: 40px; }
.day-head h3 { font-size: 15px; font-weight: 600; color: var(--muted); }
.add { width: 40px; height: 40px; border-radius: 50%; background: var(--ink); display: grid; place-items: center; }
.add svg { width: 20px; height: 20px; stroke: #fff; stroke-width: 2.2; stroke-linecap: round; fill: none; }
.add:active { transform: scale(0.94); }

.moments { list-style: none; margin: 8px 0 0; padding: 0; }
.moments li + li { margin-top: 4px; }
.moment-row { width: 100%; display: flex; align-items: center; gap: 14px; text-align: left; padding: 10px 0; }
.moment-row .thumb { flex: none; width: 52px; height: 52px; border-radius: 12px; object-fit: cover; background: var(--soft); }
.moment-row .bar { flex: none; width: 4px; align-self: stretch; border-radius: 2px; }
.bar.tictac { background: var(--mint); }
.bar.nicnac { background: var(--red); }
.moment-row .t, .moment-row .s { display: block; }
.moment-row .t { font-size: 17px; font-weight: 600; line-height: 1.3; }
.moment-row .s { font-size: 14px; color: var(--muted); margin-top: 2px; }
.empty { color: var(--muted); font-size: 15px; padding: 10px 0; }

.who { display: inline-block; font-size: 13px; font-weight: 600; padding: 3px 9px; border-radius: 99px; }
.who.tictac { background: var(--mint-soft); color: var(--mint-ink); }
.who.nicnac { background: var(--red-soft); color: var(--red-ink); }

/* ---------- sheet (detail, form, menu) */

.sheet {
  position: fixed; inset: 0; z-index: 10; background: var(--bg); overflow-y: auto; -webkit-overflow-scrolling: touch;
  animation: up 0.22s ease-out;
}
@keyframes up { from { transform: translateY(24px); opacity: 0; } }
.sheet-in { max-width: 480px; margin: 0 auto; padding: calc(env(safe-area-inset-top) + 8px) var(--pad) calc(env(safe-area-inset-bottom) + 40px); }
.sheet-bar { display: flex; align-items: center; justify-content: space-between; height: 48px; margin-bottom: 8px; }
.sheet-bar .ttl { font-size: 16px; font-weight: 600; }
.link { font-size: 16px; color: var(--muted); padding: 10px 0; min-width: 72px; text-align: left; }
.link.r { text-align: right; }
.link.strong { color: var(--ink); font-weight: 600; }
.link:disabled { opacity: 0.4; }

.detail .photo { width: 100%; border-radius: 18px; display: block; background: var(--soft); margin-bottom: 20px; }
.detail h2 { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; }
.detail .meta { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 10px; color: var(--muted); font-size: 15px; }
.detail .note { margin-top: 22px; font-size: 17px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---------- form */

.form label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin: 18px 0 6px; }
.form input[type=text], .form input[type=date], .form textarea {
  width: 100%; font: inherit; font-size: 17px; color: var(--ink); background: #fff; border: 1px solid var(--line);
  border-radius: 12px; padding: 12px 14px; outline: none; -webkit-appearance: none; appearance: none;
}
.form input[type=date] { min-height: 48px; }
.form textarea { min-height: 110px; resize: vertical; line-height: 1.45; }
.form input:focus, .form textarea:focus { border-color: var(--ink); }
.photo-pick { display: flex; align-items: center; gap: 14px; }
.form label.btn { display: inline-flex; margin: 0; font-size: 16px; color: var(--ink); }
.photo-pick img { width: 84px; height: 84px; border-radius: 14px; object-fit: cover; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: 0 18px;
  border-radius: 12px; background: #fff; border: 1px solid var(--line); font-size: 16px; font-weight: 600; text-decoration: none; color: var(--ink);
}
.btn.dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn:disabled { opacity: 0.5; }
.danger { display: block; margin: 40px auto 0; color: var(--red-ink); font-size: 16px; padding: 12px; }
.error { color: var(--red-ink); font-size: 15px; margin-top: 14px; }

/* ---------- menu */

.block { padding: 20px 0; border-top: 1px solid var(--line); }
.block:first-of-type { border-top: 0; padding-top: 4px; }
.block h3 { font-size: 17px; font-weight: 650; }
.block p { color: var(--muted); font-size: 15px; line-height: 1.45; margin-top: 4px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.state { font-size: 15px; font-weight: 600; color: var(--mint-ink); }

.seg { display: inline-flex; background: var(--soft); border-radius: 12px; padding: 3px; margin-top: 14px; }
.seg button { padding: 9px 16px; border-radius: 10px; font-size: 15px; font-weight: 600; color: var(--muted); }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgb(0 0 0 / 0.08); }
.qr { width: min(260px, 70vw); aspect-ratio: 1; margin: 26px auto 10px; }
.qr svg { width: 100%; height: 100%; display: block; }
.center { text-align: center; }
.muted { color: var(--muted); font-size: 15px; }
#push-row .link.r { margin-left: auto; }

/* ---------- gate (not linked yet) */

.gate { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 40px var(--pad); }
.gate-in { max-width: 360px; }
.gate .mark { font-size: 26px; color: var(--muted); }
.gate p { margin-top: 16px; font-size: 17px; line-height: 1.5; }
.gate ol { margin: 18px 0 0; padding-left: 22px; font-size: 17px; line-height: 1.7; }
.gate .link { margin-top: 28px; font-size: 15px; text-decoration: underline; }
.share-ic { display: inline-block; width: 18px; height: 18px; vertical-align: -3px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- intro */

.intro { position: fixed; inset: 0; z-index: 20; background: #000; display: grid; place-items: center; }
.intro video { width: 100%; height: 100%; object-fit: contain; }
.intro .play { position: absolute; width: 84px; height: 84px; border-radius: 50%; background: #fff; display: grid; place-items: center; }
.intro .play svg { width: 30px; height: 30px; fill: var(--ink); margin-left: 5px; }
.intro .skip { position: absolute; right: var(--pad); bottom: calc(env(safe-area-inset-bottom) + 20px); color: #fff; opacity: 0.75; font-size: 15px; padding: 10px; }
