:root {
  color-scheme: light;
  --bg: #fff8f5;
  --surface: rgba(255, 253, 251, 0.92);
  --ink: #3c3439;
  --muted: #91858a;
  --muted-strong: #776a70;
  --rose: #af5f6d;
  --rose-soft: #f9e8e9;
  --rose-line: #efd5d8;
  --lavender: #75658f;
  --line: rgba(92, 67, 74, 0.1);
  --shadow: 0 20px 50px rgba(111, 71, 78, 0.08);
}

* { box-sizing: border-box; }

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 6% 2%, rgba(241, 203, 207, 0.38), transparent 27rem),
    radial-gradient(circle at 94% 18%, rgba(218, 207, 233, 0.28), transparent 24rem),
    linear-gradient(180deg, #fffaf8 0%, #fff7f3 52%, #fdf8f5 100%);
  color: var(--ink);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button:focus-visible, input:focus-visible { outline: 3px solid rgba(175, 95, 109, 0.22); outline-offset: 2px; }
.ui-icon { display: block; width: 100%; height: 100%; overflow: visible; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }
.ui-icon--heart { stroke-width: 1.8; }

.ambient {
  position: fixed;
  z-index: -1;
  width: 220px;
  height: 220px;
  border-radius: 999px;
  filter: blur(20px);
  pointer-events: none;
}
.ambient--rose { top: -130px; left: -90px; background: rgba(238, 190, 196, 0.28); }
.ambient--lavender { top: 260px; right: -150px; background: rgba(205, 195, 222, 0.2); }

.app-shell {
  width: min(100%, 720px);
  min-height: 100dvh;
  margin: 0 auto;
  padding: max(24px, env(safe-area-inset-top)) 18px calc(36px + env(safe-area-inset-bottom));
}

.entry-shell { display: grid; width: min(100%,520px); min-height: 100dvh; margin: 0 auto; padding: 24px 18px; place-items: center; }
.entry-card { width: 100%; padding: 34px 28px; border: 1px solid var(--line); border-radius: 28px; background: var(--surface); box-shadow: var(--shadow); text-align: center; }
.entry-card h1 { margin: 8px 0 7px; font: 500 27px/1.3 Georgia,"Songti SC",serif; }
.entry-card p:last-child { margin: 0; color: var(--muted); font-size: 13px; }

.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.eyebrow { margin: 0; color: var(--rose); font-size: 10px; font-weight: 700; letter-spacing: 0.19em; }
.brand h1 { margin: 4px 0 2px; font: 500 clamp(30px, 8.4vw, 38px)/1.2 Georgia, "Times New Roman", "Songti SC", serif; letter-spacing: -0.03em; }
.brand h1 span { color: #c68a93; font-style: italic; font-weight: 400; }
.brand__line { margin: 0; color: var(--muted); font-size: 13px; }

.identity {
  display: inline-flex;
  min-height: 42px;
  flex: none;
  align-items: center;
  gap: 7px;
  margin-top: 2px;
  padding: 0 13px;
  border: 1px solid var(--rose-line);
  border-radius: 999px;
  background: rgba(255, 253, 251, 0.75);
  color: var(--rose);
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 6px 20px rgba(119, 72, 80, 0.05);
  backdrop-filter: blur(12px);
  cursor: default;
  user-select: none;
}
.identity__dot { width: 7px; height: 7px; border-radius: 50%; background: #ca7b87; box-shadow: 0 0 0 4px rgba(202, 123, 135, 0.12); }

.today-card, .mood-card {
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}
.today-card { padding: 20px; }
.section-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.today-card__date { margin: 0 0 2px; color: var(--muted); font-size: 12px; }
.today-card h2, .section-top h2 { margin: 0; font-size: 18px; font-weight: 650; letter-spacing: -0.015em; }
.sync-state { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11px; white-space: nowrap; }
.sync-state span { width: 6px; height: 6px; border-radius: 50%; background: #81a684; box-shadow: 0 0 0 4px rgba(129, 166, 132, 0.11); }
.sync-state em { font-style: normal; }
.sync-state[data-state="syncing"] span { background: #c5a16f; box-shadow: 0 0 0 4px rgba(197,161,111,.11); }
.sync-state[data-state="error"] { color: #b45c67; }
.sync-state[data-state="error"] span { background: #c96d78; box-shadow: 0 0 0 4px rgba(201,109,120,.11); }
.partner-clock { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.partner-clock__time { max-width: 135px; overflow: hidden; color: var(--muted); font-size: 10px; text-align: right; text-overflow: ellipsis; white-space: nowrap; }

.glance-list { display: grid; gap: 8px; margin-top: 17px; }
.glance { display: flex; min-height: 58px; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 17px; }
.glance--rose { background: #fff4f3; }
.glance--lavender { background: #f6f2fa; }
.glance--sand { background: #faf5ee; }
.glance__icon { display: grid; width: 36px; height: 36px; flex: none; place-items: center; border-radius: 50%; background: rgba(255,255,255,.7); color: var(--rose); }
.glance__icon .ui-icon { width: 21px; height: 21px; }
.glance--lavender .glance__icon { color: var(--lavender); }
.glance--sand .glance__icon { color: #9c755a; }
.glance__copy { display: flex; min-width: 0; flex: 1; align-items: baseline; justify-content: space-between; gap: 10px; }
.glance__copy span { color: var(--muted-strong); font-size: 13px; }
.glance__copy strong { overflow: hidden; color: var(--ink); font-size: 15px; font-weight: 650; text-align: right; text-overflow: ellipsis; white-space: nowrap; }

.quick-actions { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; margin: 12px 0; }
.action {
  position: relative;
  display: flex;
  min-height: 118px;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  overflow: hidden;
  padding: 16px;
  border: 1px solid transparent;
  border-radius: 22px;
  text-align: left;
  transition: transform 160ms ease, box-shadow 160ms ease, filter 160ms ease;
}
.action::after { position: absolute; right: -28px; bottom: -38px; width: 100px; height: 100px; border: 1px solid rgba(255,255,255,.38); border-radius: 50%; content: ""; }
.action--miss { border-color: #f1d3d6; background: linear-gradient(145deg,#fbe7e8,#f8dadd); color: #954b59; }
.action--hug { border-color: #ddd5e9; background: linear-gradient(145deg,#f0ecf7,#e5def0); color: #66547f; }
.action:active { transform: scale(.975); filter: saturate(1.08); }
.action__icon { display: grid; width: 31px; height: 31px; place-items: center; }
.action__text strong, .action__text small { display: block; }
.action__text strong { font-size: 17px; font-weight: 650; }
.action__text small { margin-top: 1px; opacity: .68; font-size: 11px; }
.action__arrow { position: absolute; top: 15px; right: 15px; opacity: .44; font-size: 14px; }

.mood-card { padding: 20px; }
.section-top--mood .eyebrow, .section-top--history .eyebrow { margin-bottom: 3px; }
.section-hint { align-self: flex-end; padding-bottom: 2px; color: var(--muted); font-size: 11px; white-space: nowrap; }
.mood-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; margin-top: 16px; }
.mood-chip { min-height: 48px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 15px; background: #fffbf9; color: var(--muted-strong); font-size: 13px; text-align: center; transition: 150ms ease; }
.mood-chip:last-child:nth-child(odd) { grid-column: 1 / -1; }
.mood-chip[aria-checked="true"] { border-color: #ddaeb5; background: var(--rose-soft); color: #944b59; box-shadow: inset 0 0 0 1px rgba(175,95,109,.05); }

.note-field { position: relative; display: block; margin-top: 12px; }
.note-field input { width: 100%; min-height: 50px; padding: 0 58px 0 14px; border: 1px solid var(--line); border-radius: 15px; background: #fffcfa; color: var(--ink); font-size: 16px; appearance: none; }
.note-field input::placeholder { color: #b3a8ac; }
.note-field__count { position: absolute; top: 50%; right: 13px; color: #b5aaae; font-size: 11px; transform: translateY(-50%); }
.primary-button { width: 100%; min-height: 50px; margin-top: 9px; border: 0; border-radius: 15px; background: linear-gradient(135deg,#b96371,#a95362); color: #fff; font-weight: 650; box-shadow: 0 10px 24px rgba(169,83,98,.2); transition: 150ms ease; }
.primary-button span { margin-left: 5px; font-family: Georgia, serif; }
.primary-button:disabled { background: #eee6e4; color: #ab9fa3; box-shadow: none; cursor: not-allowed; }
.primary-button:not(:disabled):active { transform: scale(.985); }

.history { margin-top: 29px; }
.section-top--history { align-items: flex-end; padding: 0 2px; }
.timeline { position: relative; margin-top: 16px; padding-left: 34px; }
.timeline::before { position: absolute; top: 9px; bottom: 12px; left: 12px; width: 1px; background: linear-gradient(#e2c9cd,rgba(226,201,205,.1)); content: ""; }
.timeline-item { position: relative; margin-bottom: 10px; padding: 14px 15px; border: 1px solid var(--line); border-radius: 17px; background: rgba(255,253,251,.72); }
.timeline-item::before { position: absolute; top: 19px; left: -27px; width: 9px; height: 9px; border: 3px solid var(--bg); border-radius: 50%; background: #d68f99; box-shadow: 0 0 0 1px #e8c8cd; content: ""; }
.timeline-item--hug::before { background: #9c8eb4; box-shadow: 0 0 0 1px #d9d0e5; }
.timeline-item--mood::before { background: #b89a7f; box-shadow: 0 0 0 1px #e5d8ca; }
.timeline-item__top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.timeline-item__person { font-size: 13px; font-weight: 650; }
.timeline-item__time-block { display: flex; flex: none; flex-direction: column; align-items: flex-end; }
.timeline-item time { color: var(--muted); font-size: 11px; }
.timeline-item__source-time { color: #b2a6aa; font-size: 9px; }
.timeline-item__message { margin: 3px 0 0; color: var(--muted-strong); font-size: 14px; }
.timeline-item__note { margin: 7px 0 0; padding: 8px 10px; border-radius: 10px; background: #faf3f0; color: #766970; font-size: 13px; }
.timeline-item--surprise { border-color: rgba(205,151,161,.28); background: linear-gradient(145deg,rgba(255,253,251,.9),rgba(255,247,246,.78)); }
.timeline-item__surprises { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 9px; }
.surprise-badge { display: inline-flex; min-height: 24px; align-items: center; padding: 3px 8px; border: 1px solid rgba(207,153,163,.2); border-radius: 999px; background: rgba(249,232,233,.72); color: #9b5663; font-size: 10px; line-height: 1.35; }
.surprise-badge--returned-hug { border-color: rgba(139,120,166,.18); background: rgba(238,233,247,.82); color: #6f5d88; }
.surprise-badge--heard-you { border-color: rgba(181,144,112,.18); background: rgba(249,242,233,.86); color: #8c6b50; }
.surprise-badge--same-moment { border-color: rgba(172,150,179,.18); background: rgba(246,240,247,.82); color: #7f6b86; }
.timeline-empty { padding: 28px 18px; border: 1px dashed #e2d4d1; border-radius: 18px; color: var(--muted); text-align: center; }
.timeline-empty span { display: block; margin-bottom: 6px; color: #d08b95; font: 26px Georgia, serif; }

footer { display: flex; flex-direction: column; gap: 4px; padding: 28px 0 4px; color: #b2a5aa; font: 12px Georgia,"Songti SC",serif; text-align: center; }
footer small { color: #c1b5b9; font: 9px/1.4 -apple-system,BlinkMacSystemFont,"SF Pro Text",sans-serif; letter-spacing: .06em; }
.toast { position: fixed; z-index: 20; bottom: calc(22px + env(safe-area-inset-bottom)); left: 50%; max-width: calc(100vw - 36px); padding: 11px 17px; border: 1px solid rgba(255,255,255,.12); border-radius: 999px; background: rgba(56,47,52,.94); color: #fff; opacity: 0; font-size: 13px; white-space: nowrap; box-shadow: 0 12px 30px rgba(49,37,42,.2); transform: translate(-50%,16px); transition: opacity 220ms ease,transform 220ms ease; pointer-events: none; backdrop-filter: blur(12px); }
.toast--visible { opacity: 1; transform: translate(-50%,0); }
.toast--surprise { border-color: rgba(255,235,238,.2); background: linear-gradient(135deg,rgba(121,72,84,.97),rgba(80,65,97,.97)); box-shadow: 0 14px 34px rgba(75,48,66,.28); }
.particle-layer { position: fixed; z-index: 19; inset: 0; overflow: hidden; pointer-events: none; }
.particle { position: absolute; color: #c56f7c; font-family: Georgia,serif; animation: float-heart 900ms cubic-bezier(.22,.75,.32,1) forwards; }
.particle--hug { color: #8774a2; }
.particle--surprise { animation-duration: 1200ms; text-shadow: 0 3px 14px rgba(117,75,92,.16); }
.particle--returned-hug { color: #8875a2; }
.particle--heard-you { color: #b77b71; }
.particle--same-moment { color: #a48bab; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@keyframes float-heart {
  0% { opacity: 0; transform: translate(-50%,8px) scale(.7) rotate(0); }
  20% { opacity: 1; }
  100% { opacity: 0; transform: translate(calc(-50% + var(--drift)),-92px) scale(1.15) rotate(var(--rotate)); }
}

@media (hover:hover) {
  .action:hover { transform: translateY(-2px); box-shadow: 0 12px 26px rgba(90,62,70,.12); }
  .mood-chip:hover { border-color: #dec5c8; background: #fff7f5; }
}

@media (min-width:620px) {
  .app-shell { padding-right: 24px; padding-left: 24px; }
  .glance-list { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .glance { min-height: 104px; flex-direction: column; align-items: flex-start; }
  .glance__copy { flex-direction: column; gap: 1px; }
  .glance__copy strong { text-align: left; }
  .action { min-height: 126px; }
  .mood-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .mood-chip:last-child:nth-child(odd) { grid-column: auto; }
}

/* iPhone 13 Pro: 390 × 844 CSS pixels */
@media (max-width:430px) {
  .app-shell { padding-right: 16px; padding-left: 16px; }
  .topbar { margin-bottom: 18px; }
  .brand__line { max-width: 230px; }
  .identity { min-height: 40px; padding: 0 11px; }
  .today-card, .mood-card { border-radius: 24px; }
  .today-card, .mood-card { padding: 18px; }
  .action { min-height: 112px; padding: 15px; }
  .action__text strong { font-size: 16px; }
}

@media (max-width:360px) {
  .brand__line { display: none; }
  .identity { padding: 0 10px; }
  .glance__copy { align-items: flex-end; }
  .action__text small, .section-hint { display: none; }
}

@media (prefers-reduced-motion:reduce) {
  *,*::before,*::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
