:root {
  --bg: #ffe7f0;
  --blush: #fff5f8;
  --pink: #ff9eb8;
  --pink-deep: #ff7d9e;
  --rose: #ff6b93;
  --ink: #4a3340;
  --muted: #c294a4;
  --soft: #8d6574;
  --line: #ffe0ea;
  --sheet: #ffffff;
  --shadow: 0 8px 22px rgba(255, 130, 166, .16);
  --serif: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: linear-gradient(180deg, #fff8fb 0%, #ffe9f1 32%, #ffd5e6 100%);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: default; }
p { margin: 0; }
h1, h2 { font-family: var(--sans); font-weight: 700; }
#view h1 { font-size: clamp(26px, 6vw, 32px); letter-spacing: -0.03em; margin: 0; color: var(--ink); }
h2 { font-size: 20px; margin: 22px 0 8px; }
::selection { background: #ffd0e0; }
:focus-visible { outline: 2px solid var(--pink-deep); outline-offset: 2px; }

.app {
  width: 100%;
  height: 100dvh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  background:
    radial-gradient(90% 42% at 100% 0%, rgba(255, 255, 255, .75), transparent 58%),
    linear-gradient(180deg, #fff7fa 0%, #ffe8f1 28%, #ffd9e8 100%);
  position: relative;
}
.top {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 58px;
  padding: calc(8px + env(safe-area-inset-top)) 16px 6px;
  background: transparent;
}
.top h1 {
  margin: 0;
  font-family: var(--sans);
  font-weight: 700;
  font-size: clamp(20px, 5vw, 26px);
  letter-spacing: 0.08em;
  color: var(--pink-deep);
}
.body {
  min-height: 0;
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
}
.body:has(nav[hidden]) { grid-template-columns: minmax(0, 1fr); }

nav {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 10px 8px calc(12px + env(safe-area-inset-bottom));
  background: transparent;
}
nav[hidden] { display: none; }
nav button {
  width: 62px;
  min-height: 68px;
  border: 0;
  background: transparent;
  color: #c9a0ad;
  border-radius: 18px;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
}
nav button .mark {
  font-size: 18px;
  line-height: 1;
}
nav button.on {
  background: linear-gradient(180deg, #ffb0c6 0%, #ff7d9e 100%);
  color: #fff;
  box-shadow: 0 8px 16px rgba(255, 125, 158, .38);
}

#view {
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 8px 14px calc(24px + env(safe-area-inset-bottom)) 6px;
  background: transparent;
}

.booting { color: var(--muted); margin-top: 18vh; }
.kicker {
  margin: 0 0 4px;
  color: var(--pink-deep);
  font-size: 12px;
  letter-spacing: .12em;
  font-weight: 600;
}
.lede { margin-top: 8px; line-height: 1.65; color: var(--soft); }
.fine { color: var(--muted); font-size: 12.5px; line-height: 1.6; margin-top: 6px; }
.form-error { color: var(--rose); margin: 10px 0 0; }
.mast { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.together {
  font-weight: 700;
  font-size: 16px;
  margin-top: 12px;
}
.together[hidden] { display: none; }

button.digest {
  display: block;
  width: 100%;
  text-align: left;
  margin: 14px 0 16px;
  padding: 14px 14px 12px;
  border-radius: 22px;
  border: 0;
  background: #fff;
  box-shadow: var(--shadow);
}
.digest .k {
  color: var(--pink-deep);
  font-size: 12px;
  letter-spacing: .12em;
  font-weight: 700;
}
.digest .line { display: block; margin-top: 8px; }
.digest i {
  display: block;
  font-style: normal;
  font-size: 11px;
  letter-spacing: .08em;
  margin-bottom: 2px;
}
.digest .ai i { color: var(--rose); }
.digest .nuclear i { color: #e07aa0; }
.digest b {
  display: block;
  font-weight: 700;
  font-size: 14.5px;
  line-height: 1.45;
}

.card {
  background: #fff;
  border: 0;
  border-radius: 22px;
  padding: 16px;
  margin: 12px 0;
  box-shadow: var(--shadow);
}
.card.theirs { background: #fff; }
.card header { display: flex; align-items: center; gap: 12px; }
.who-block { flex: 1; min-width: 0; }
.who { font-weight: 700; }
.when { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.count { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 13px; }
.trip {
  margin: 14px 0 0;
  color: var(--pink-deep);
  font-size: 13px;
  font-weight: 700;
}
.seal {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: none;
  color: #fff;
  font-family: var(--sans);
  font-weight: 700;
  font-size: 20px;
  background: var(--pink-deep);
  box-shadow: 0 6px 12px rgba(255, 125, 158, .28);
}
.seal.empty {
  background: #fff;
  color: var(--pink-deep);
  border: 1.5px solid #ffd0de;
  box-shadow: none;
}

.moods {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}
.mood {
  border: 0;
  background: #fff7fa;
  border-radius: 16px;
  min-height: 62px;
  padding: 7px 0 6px;
  box-shadow: inset 0 0 0 1px #ffe3ec;
}
.mood .seal-mini { display: block; font-weight: 700; font-size: 18px; }
.mood small { display: block; color: var(--muted); font-size: 12px; }
.mood.on { background: var(--c); color: #fff; box-shadow: 0 6px 12px rgba(180, 90, 120, .18); }
.mood.on small { color: rgba(255, 255, 255, .9); }

ul.tasks { list-style: none; margin: 10px 0 0; padding: 0; }
.task {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 9px 0;
  border-top: 1px solid #ffe6ee;
}
.task-text { flex: 1; line-height: 1.45; overflow-wrap: anywhere; }
.task.done .task-text { color: var(--muted); text-decoration: line-through; }
.check {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--pink-deep);
  background: #fff;
  padding: 0;
  flex: none;
  display: grid;
  place-items: center;
}
.check.on { background: var(--pink-deep); border-color: var(--pink-deep); }
.check.on::after {
  content: "";
  width: 5px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) translate(-1px, -1px);
}
.del {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  padding: 4px;
}
.empty { color: var(--muted); margin-top: 10px; }
.composer { display: flex; gap: 8px; margin-top: 12px; }
.composer input { min-width: 0; }
.composer button {
  border: 0;
  background: linear-gradient(180deg, #ffb0c6, #ff7d9e);
  color: #fff;
  border-radius: 999px;
  padding: 0 16px;
  min-height: 44px;
  flex: none;
  font-weight: 700;
  box-shadow: 0 6px 14px rgba(255, 125, 158, .35);
}

form { margin-top: 8px; }
label { display: block; margin: 14px 0; }
label span { display: block; margin-bottom: 6px; color: var(--soft); font-size: 13px; font-weight: 600; }
input {
  width: 100%;
  font-size: 16px;
  border: 0;
  background: #fff;
  padding: 12px 14px;
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.composer input {
  border: 0;
  background: #fff7fa;
  box-shadow: inset 0 0 0 1px #ffe0ea;
  border-radius: 999px;
  padding: 10px 14px;
}
::placeholder { color: #e0b3c2; }
.btn {
  width: 100%;
  border: none;
  background: linear-gradient(180deg, #ffb0c6, #ff6f9c);
  color: #fff;
  min-height: 48px;
  border-radius: 999px;
  margin-top: 6px;
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(255, 111, 156, .36);
}
.btn.ghost, .danger-btn {
  background: #fff;
  color: var(--rose);
  border: 0;
  box-shadow: var(--shadow);
}
.danger-btn { color: var(--rose); }
.btn.ghost { margin-top: 16px; }
.notify { margin-top: 12px; }
.notify .who { font-weight: 700; }
.notify .btn { margin-top: 10px; }
.notify .btn.ghost { margin-top: 10px; }
.back {
  border: 0;
  background: transparent;
  color: var(--pink-deep);
  padding: 0 0 8px;
  font-weight: 700;
}

.pick { display: grid; gap: 10px; margin-top: 14px; }
.pick button {
  text-align: left;
  background: #fff;
  border: 0;
  border-radius: 18px;
  min-height: 56px;
  padding: 0 16px;
  font-size: 20px;
  font-weight: 700;
  box-shadow: var(--shadow);
}
.pick button.on { background: linear-gradient(180deg, #ffb0c6, #ff7d9e); color: #fff; }
.pick.tight { grid-template-columns: 1fr 1fr; }
.pick.tight button { text-align: center; font-size: 17px; }

.switch { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 14px 0; }
.switch button {
  border-radius: 999px;
  border: 0;
  background: #fff;
  min-height: 40px;
  font-weight: 700;
  color: var(--soft);
  box-shadow: var(--shadow);
}
.switch button.on {
  background: linear-gradient(180deg, #ffb0c6, #ff7d9e);
  color: #fff;
}
.story {
  display: block;
  padding: 14px;
  margin-top: 10px;
  border: 0;
  border-radius: 20px;
  background: #fff;
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
}
.story .kicker { color: var(--rose); font-size: 12px; letter-spacing: .04em; }
.story strong {
  display: block;
  margin: 4px 0;
  font-size: 16px;
  line-height: 1.45;
  font-weight: 700;
  overflow-wrap: anywhere;
}
.story p { color: var(--muted); font-size: 13px; line-height: 1.55; }
.story:hover strong { color: var(--rose); }

.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; margin-top: 8px; }
.week button {
  border: 0;
  background: rgba(255, 255, 255, .55);
  padding: 6px 0 8px;
  border-radius: 14px;
  color: var(--muted);
}
.week button.today {
  background: #fff;
  box-shadow: var(--shadow);
}
.week .num { display: block; font-weight: 700; font-size: 16px; color: var(--ink); }
.week .wk { font-size: 11px; }
.week .mini { display: block; font-weight: 700; font-size: 12px; line-height: 1.25; }

.share {
  margin-top: 8px;
  padding: 14px;
  border-radius: 20px;
  background: #fff;
  box-shadow: var(--shadow);
}
.url {
  font-family: Consolas, "Sarasa Mono SC", ui-monospace, monospace;
  font-size: 14px;
  user-select: all;
  background: #fff7fa;
  border-radius: 12px;
  padding: 8px 10px;
  margin: 6px 0 0;
  overflow-wrap: anywhere;
}
.danger { margin-top: 28px; }
.danger summary { cursor: pointer; color: var(--muted); }

#toast {
  position: absolute;
  z-index: 3;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(8px);
  background: linear-gradient(180deg, #ffb0c6, #ff7d9e);
  color: #fff;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transition: .2s ease;
  max-width: 78%;
  text-align: center;
  box-shadow: 0 8px 16px rgba(255, 125, 158, .35);
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 380px) {
  .body { grid-template-columns: 72px minmax(0, 1fr); }
  .body:has(nav[hidden]) { grid-template-columns: minmax(0, 1fr); }
  nav button { width: 56px; min-height: 62px; font-size: 11px; }
  #view { padding-right: 10px; }
}

@media (min-width: 800px) {
  body {
    background: linear-gradient(160deg, #ffd0e2, #ffb7d0);
    display: grid;
    place-items: center;
  }
  .app {
    width: min(430px, calc(100% - 40px));
    height: min(900px, calc(100dvh - 40px));
    border-radius: 36px;
    overflow: hidden;
    border: 6px solid rgba(255, 255, 255, .72);
    box-shadow: 0 24px 60px rgba(255, 120, 160, .28);
  }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
