:root {
  --cream: #fbf4ee;
  --cream-deep: #f3e6dc;
  --blush: #f6d5de;
  --rose: #e85a8c;
  --rose-deep: #c73e72;
  --lilac: #c5b4e3;
  --lilac-deep: #8e79b8;
  --ink: #3a2a34;
  --ink-soft: #6b5563;
  --muted: #a08996;
  --sos: #c1121f;
  --mint: #88c9a1;
  --sky: #7ec8e3;
  --card: rgba(255, 252, 250, 0.78);
  --card-solid: #fffaf7;
  --shadow: 0 18px 50px rgba(58, 42, 52, 0.1);
  --shadow-soft: 0 8px 24px rgba(232, 90, 140, 0.12);
  --radius: 28px;
  --radius-sm: 18px;
  --font-display: "Fraunces", "Palatino Linotype", Georgia, serif;
  --font-body: "Nunito Sans", "Segoe UI", system-ui, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bot: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(1200px 700px at 10% -10%, #f8d0e4 0%, transparent 55%),
    radial-gradient(900px 600px at 110% 10%, #d9c8f4 0%, transparent 50%),
    radial-gradient(800px 500px at 50% 120%, #fde4c8 0%, transparent 45%),
    var(--cream);
  min-height: 100%;
}

button, input, textarea, select {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
  border: 0;
  background: none;
}
img { max-width: 100%; display: block; }
a { color: var(--rose-deep); }

.device {
  min-height: 100%;
  display: flex;
  justify-content: center;
}
.app {
  width: 100%;
  max-width: 430px;
  min-height: 100vh;
  min-height: 100dvh;
  position: relative;
  padding: calc(12px + var(--safe-top)) 16px calc(92px + var(--safe-bot));
}

.splash {
  min-height: 70vh;
  display: grid;
  place-content: center;
  text-align: center;
  gap: 8px;
}
.splash-mark {
  font-size: 56px;
  animation: pulse 1.6s ease-in-out infinite;
}
.splash-word {
  font-family: var(--font-display);
  font-size: 36px;
  margin: 0;
  letter-spacing: 0.04em;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.brand {
  font-family: var(--font-display);
  font-size: 28px;
  margin: 0;
  letter-spacing: 0.02em;
}
.muted { color: var(--ink-soft); }
.tiny { font-size: 12px; color: var(--muted); }
.tagline {
  margin: 0 0 22px;
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1.45;
}

.partner {
  display: flex;
  gap: 14px;
  align-items: center;
  background: var(--card);
  backdrop-filter: blur(16px);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow-soft);
  margin-bottom: 16px;
}
.avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  flex: 0 0 64px;
  background: linear-gradient(145deg, var(--blush), var(--lilac));
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 22px;
  color: white;
  box-shadow: 0 8px 18px rgba(200, 120, 160, 0.25);
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.partner-name {
  font-family: var(--font-display);
  font-size: 22px;
  margin: 0 0 6px;
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #fff;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
  box-shadow: 0 2px 8px rgba(58, 42, 52, 0.06);
}
.chip.ghost { background: transparent; border: 1px dashed rgba(58,42,52,0.15); }

.unread {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 18px;
}
.card {
  background: var(--card);
  backdrop-filter: blur(16px);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-soft);
}
.card.urgent {
  background: linear-gradient(180deg, #fff5f5, #ffe4e6);
  box-shadow: 0 10px 30px rgba(193, 18, 31, 0.18);
  animation: sos-glow 1.6s ease-in-out infinite;
  border: 1px solid rgba(193, 18, 31, 0.2);
}
.signal-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
  margin-bottom: 10px;
}
.signal-title {
  font-family: var(--font-display);
  font-size: 18px;
  margin: 0;
}
.quick {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.quick button, .btn {
  min-height: 48px;
  border-radius: 16px;
  padding: 10px 14px;
  background: #fff;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(58, 42, 52, 0.06);
}
.quick button:active, .btn:active { transform: scale(0.98); }
.btn-primary {
  background: linear-gradient(180deg, var(--rose), var(--rose-deep));
  color: #fff;
  box-shadow: 0 10px 24px rgba(232, 90, 140, 0.28);
}
.btn-ghost {
  background: transparent;
  color: var(--ink-soft);
}
.btn-sos {
  background: linear-gradient(180deg, #e5383b, var(--sos));
  color: #fff;
}
.btn-row { display: flex; gap: 8px; }
.btn-row .btn { flex: 1; }

.grid-primary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}
.pooky-btn {
  min-height: 132px;
  border-radius: 28px;
  padding: 16px 12px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--ink);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.18s ease;
  -webkit-tap-highlight-color: transparent;
}
.pooky-btn::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.35), transparent 55%);
  pointer-events: none;
}
.pooky-btn:active { transform: scale(0.96); }
.pooky-btn .emo { font-size: 42px; line-height: 1; filter: drop-shadow(0 6px 10px rgba(0,0,0,0.08)); }
.pooky-btn .lab {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 650;
}
.pooky-btn.urgent {
  outline: 2px solid var(--sos);
  animation: sos-glow 1.4s ease-in-out infinite;
}

.secondary {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 4px 2px 14px;
  margin: 0 -4px 8px;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
}
.secondary::-webkit-scrollbar { display: none; }
.sec-btn {
  flex: 0 0 auto;
  min-width: 92px;
  min-height: 84px;
  border-radius: 22px;
  padding: 12px 14px;
  background: var(--card);
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  scroll-snap-align: start;
}
.sec-btn .emo { font-size: 26px; }
.sec-btn .lab { font-size: 12px; font-weight: 700; }

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 6px;
}
.stat {
  background: var(--card);
  border-radius: 22px;
  padding: 14px;
  box-shadow: var(--shadow-soft);
}
.stat b {
  display: block;
  font-family: var(--font-display);
  font-size: 26px;
  line-height: 1.1;
}
.memory-card {
  margin-top: 12px;
  font-size: 14px;
  line-height: 1.45;
  font-style: italic;
  color: var(--ink-soft);
}

.nav {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(10px + var(--safe-bot));
  width: min(398px, calc(100% - 24px));
  background: rgba(255, 250, 247, 0.9);
  backdrop-filter: blur(18px);
  border-radius: 999px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 6px;
  box-shadow: 0 12px 40px rgba(58, 42, 52, 0.16);
  z-index: 20;
}
.nav button {
  min-height: 52px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}
.nav button span { font-size: 18px; }
.nav button.active {
  background: linear-gradient(180deg, #fff, var(--blush));
  color: var(--ink);
}

.screen-title {
  font-family: var(--font-display);
  font-size: 30px;
  margin: 4px 0 6px;
}
.form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
label.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-soft);
}
input[type="text"], input[type="email"], input[type="password"], input[type="datetime-local"],
input[type="color"], textarea, select {
  width: 100%;
  min-height: 48px;
  border: 1px solid rgba(58, 42, 52, 0.08);
  background: #fff;
  border-radius: 16px;
  padding: 12px 14px;
  outline: none;
}
textarea { min-height: 110px; resize: vertical; }
input:focus, textarea:focus, select:focus {
  border-color: var(--lilac);
  box-shadow: 0 0 0 4px rgba(197, 180, 227, 0.35);
}
.check {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  min-height: 44px;
}
.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: rgba(255,255,255,0.5);
  padding: 4px;
  border-radius: 999px;
  margin-bottom: 18px;
}
.tabs button {
  min-height: 42px;
  border-radius: 999px;
  font-weight: 700;
  color: var(--ink-soft);
}
.tabs button.active {
  background: #fff;
  color: var(--ink);
  box-shadow: var(--shadow-soft);
}

.code-box {
  font-family: var(--font-display);
  font-size: 36px;
  letter-spacing: 0.28em;
  text-align: center;
  padding: 18px 8px;
  background: #fff;
  border-radius: 22px;
  margin: 8px 0 16px;
  user-select: all;
  -webkit-user-select: all;
}
.code-box.waiting {
  box-shadow: 0 0 0 4px rgba(232, 90, 140, 0.12);
  animation: code-glow 1.8s ease-in-out infinite;
}
.pair-card .btn-ghost { margin-top: 4px; width: 100%; }
.pair-wait-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin: 16px 0 8px;
}
.pair-wait-dots i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--rose);
  display: block;
  animation: pulse 1.2s ease-in-out infinite;
}
.pair-wait-dots i:nth-child(2) { animation-delay: 0.2s; }
.pair-wait-dots i:nth-child(3) { animation-delay: 0.4s; }
.wait-hint {
  margin: 0;
  text-align: center;
  color: var(--ink-soft);
  font-weight: 600;
  font-size: 14px;
  line-height: 1.4;
}
.pair-join {
  margin: 18px 0 8px;
  background: var(--card);
  border-radius: var(--radius);
  padding: 4px 16px 8px;
  box-shadow: var(--shadow-soft);
}
.pair-join summary {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-weight: 700;
  color: var(--ink-soft);
  cursor: pointer;
  list-style: none;
}
.pair-join summary::-webkit-details-marker,
.pair-join summary::marker { display: none; content: none; }
.pair-join summary::after {
  content: "＋";
  font-size: 18px;
  color: var(--muted);
  flex: 0 0 auto;
}
.pair-join[open] summary::after { content: "–"; }
.pair-join .form { padding-bottom: 10px; }
.pair-join input[name="code"] {
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-family: var(--font-display);
  font-size: 20px;
  text-align: center;
}
.pair-logout {
  width: 100%;
  margin-top: 8px;
}

.list { display: flex; flex-direction: column; gap: 10px; }
.row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border-radius: 20px;
  padding: 12px;
  text-align: left;
  min-height: 64px;
  width: 100%;
  box-shadow: var(--shadow-soft);
}
.row .emo { font-size: 26px; width: 40px; text-align: center; }
.row .grow { flex: 1; }
.row b { display: block; }
. pal { display: flex; flex-wrap: wrap; gap: 8px; }
.mood-pick, .radar-pick {
  min-height: 72px;
  min-width: calc(50% - 6px);
  flex: 1 1 140px;
  border-radius: 20px;
  background: var(--card);
  box-shadow: var(--shadow-soft);
  font-weight: 700;
}
.mood-pick.active, .radar-pick.active {
  outline: 2px solid var(--rose);
  background: #fff;
}

.history-item {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 10px;
  align-items: start;
  padding: 12px 0;
  border-bottom: 1px solid rgba(58,42,52,0.06);
}
.history-item .emo { font-size: 26px; }

.switch {
  width: 48px;
  height: 28px;
  border-radius: 999px;
  background: #e6d7df;
  position: relative;
  flex: 0 0 48px;
}
.switch.on { background: var(--rose); }
.switch i {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s ease;
}
.switch.on i { transform: translateX(20px); }

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid rgba(58,42,52,0.06);
}

.install-card {
  margin-bottom: 14px;
}
.install-card p {
  margin: 0 0 8px;
}
.install-card.compact {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px;
}
.install-lead {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-soft);
  line-height: 1.4;
}
.install-card .btn {
  width: 100%;
  min-height: 52px;
}
.install-ok {
  margin: 4px 0 0;
  font-weight: 700;
  color: var(--rose-deep);
}

.ios-share {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  vertical-align: middle;
  color: var(--rose-deep);
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(58, 42, 52, 0.08);
}

.sheet-root {
  position: fixed;
  inset: 0;
  z-index: 55;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(58, 42, 52, 0.35);
}
.sheet {
  position: relative;
  width: min(430px, 100%);
  background: var(--card-solid);
  border-radius: 28px 28px 0 0;
  padding: 22px 18px calc(22px + var(--safe-bot));
  box-shadow: 0 -18px 50px rgba(58, 42, 52, 0.18);
}
.sheet-title {
  font-family: var(--font-display);
  font-size: 24px;
  margin: 0 0 10px;
}
.sheet-note {
  margin: 0 0 12px;
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink-soft);
}
.sheet-steps {
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  counter-reset: ios-step;
}
.sheet-steps li {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-start;
  gap: 10px;
  background: var(--cream);
  border-radius: 18px;
  padding: 12px 14px;
  min-height: 56px;
  font-size: 15px;
  line-height: 1.4;
  font-weight: 600;
  color: var(--ink);
  counter-increment: ios-step;
}
.sheet-steps li > span {
  flex: 1;
  min-width: 0;
  padding-top: 2px;
}
.sheet-steps li::before {
  content: counter(ios-step);
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(180deg, var(--rose), var(--rose-deep));
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  display: grid;
  place-items: center;
}
.sheet .btn {
  width: 100%;
  min-height: 52px;
  margin-top: 8px;
}
.card > .btn {
  width: 100%;
}

.more-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.more-grid button {
  min-height: 96px;
  border-radius: 24px;
  background: var(--card);
  box-shadow: var(--shadow-soft);
  font-weight: 700;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.more-grid .emo { font-size: 26px; }

.toast {
  position: fixed;
  left: 50%;
  top: calc(18px + var(--safe-top));
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  z-index: 50;
  max-width: 90%;
}

.fx {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 40;
  overflow: hidden;
}
.fx-kiss {
  position: absolute;
  font-size: 64px;
  animation: fly-kiss 1.15s ease-in forwards;
  filter: drop-shadow(0 10px 18px rgba(232, 90, 140, 0.35));
}
.fx-bubble {
  position: absolute;
  left: 50%;
  top: 42%;
  width: 90px;
  height: 90px;
  margin: -45px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #fff, #7ec8e3 55%, #4aa7c9);
  opacity: 0.85;
  animation: bubble 0.9s ease-out forwards;
}
.fx-pop {
  position: absolute;
  left: 50%;
  top: 42%;
  font-size: 42px;
  animation: pop-bits 0.7s ease-out forwards;
}
.fx-hug {
  position: absolute;
  top: 38%;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  overflow: hidden;
  background: linear-gradient(145deg, var(--blush), var(--lilac));
  display: grid;
  place-items: center;
  font-size: 28px;
  color: #fff;
}
.fx-hug.a { left: 18%; animation: hug-in-l 0.9s ease-in-out forwards; }
.fx-hug.b { right: 18%; animation: hug-in-r 0.9s ease-in-out forwards; }
.fx-star {
  position: absolute;
  font-size: 28px;
  animation: float-star 1.4s ease-out forwards;
}
.error { color: var(--sos); font-size: 13px; font-weight: 700; min-height: 18px; }
.back {
  min-height: 44px;
  font-weight: 700;
  color: var(--ink-soft);
  padding: 0 0 8px;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}
@keyframes code-glow {
  0%, 100% { box-shadow: 0 0 0 4px rgba(232, 90, 140, 0.1); }
  50% { box-shadow: 0 0 0 8px rgba(232, 90, 140, 0.22); }
}
@keyframes sos-glow {
  0%, 100% { box-shadow: 0 8px 18px rgba(193, 18, 31, 0.16); }
  50% { box-shadow: 0 8px 28px rgba(193, 18, 31, 0.38); }
}
@keyframes fly-kiss {
  0% { transform: translate(-42vw, 28vh) scale(0.4) rotate(-24deg); opacity: 0; }
  18% { opacity: 1; }
  100% { transform: translate(38vw, -26vh) scale(1.35) rotate(18deg); opacity: 0; }
}
@keyframes bubble {
  0% { transform: scale(0.2); opacity: 0.7; }
  70% { transform: scale(2.1); opacity: 0.9; }
  100% { transform: scale(2.6); opacity: 0; }
}
@keyframes pop-bits {
  0% { transform: translate(-50%, -50%) scale(0.6); opacity: 1; }
  100% { transform: translate(-50%, -80%) scale(1.4); opacity: 0; }
}
@keyframes hug-in-l {
  0% { transform: translateX(0); }
  45% { transform: translateX(72px); }
  100% { transform: translateX(0); opacity: 0; }
}
@keyframes hug-in-r {
  0% { transform: translateX(0); }
  45% { transform: translateX(-72px); }
  100% { transform: translateX(0); opacity: 0; }
}
@keyframes float-star {
  0% { transform: translateY(20px) scale(0.6); opacity: 0; }
  25% { opacity: 1; }
  100% { transform: translateY(-90px) scale(1.2); opacity: 0; }
}

@media (min-width: 720px) {
  .device { padding: 24px 0; }
  .app {
    min-height: 780px;
    height: min(860px, calc(100vh - 48px));
    border-radius: 36px;
    box-shadow: 0 30px 80px rgba(58, 42, 52, 0.18);
    background: linear-gradient(180deg, rgba(255,255,255,0.35), rgba(255,255,255,0.08));
    overflow: auto;
    border: 1px solid rgba(255,255,255,0.5);
  }
  .nav { bottom: 28px; }
  .sheet-root {
    position: absolute;
    border-radius: 36px;
    overflow: hidden;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
