/* ──────────────────────────────────────────────────────────────
   화사 + 아기자기 — 파스텔 카드 시스템
   ────────────────────────────────────────────────────────────── */

:root {
  /* Surfaces — warm cream */
  --bg-app: #fff8f3;
  --bg-card: #ffffff;
  --bg-soft: #fff3eb;

  /* Pastel scene tints (배경 mesh) */
  --tint-pink:   #ffd6e7;
  --tint-peach:  #ffd9c5;
  --tint-yellow: #fff0b8;
  --tint-mint:   #c8f5e3;
  --tint-sky:    #cfe7ff;
  --tint-lilac:  #e3d5ff;

  /* Text — 따뜻한 다크 (충분한 명도 대비) */
  --text-primary: #2d2438;
  --text-secondary: #7d758c;
  --text-tertiary: #b5adc2;

  /* Borders */
  --border: #f0e6db;
  --border-strong: #e0d3c2;

  /* Accent — 큐트 핑크 */
  --accent: #ff6b9d;
  --accent-hover: #ff5491;
  --accent-soft: #ffe1eb;
  --accent-strong: #d94b7e;

  /* Semantic */
  --danger: #ef4444;
  --warning: #f59e0b;
  --success: #10b981;

  /* Form — 통통한 corner */
  --radius-card: 22px;
  --radius-card-lg: 28px;
  --radius-input: 14px;
  --radius-pill: 980px;
  --radius-chip: 12px;

  /* Shadows — soft pastel glow */
  --shadow-sm: 0 2px 8px rgba(255, 107, 157, 0.08), 0 1px 3px rgba(45, 36, 56, 0.04);
  --shadow-md: 0 8px 24px rgba(255, 107, 157, 0.10), 0 2px 6px rgba(45, 36, 56, 0.05);
  --shadow-lg: 0 16px 40px rgba(255, 107, 157, 0.14), 0 4px 12px rgba(45, 36, 56, 0.06);

  /* Motion */
  --ease: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --bounce: 350ms cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Fonts */
  --display: "Nunito", "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR", system-ui, sans-serif;
  --body: "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR", -apple-system, system-ui, sans-serif;
}

/* ──────────────────────────────────────────────────────────────
   Base
   ────────────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font-family: var(--body);
  background: var(--bg-app);
  /* 화사한 mesh — 파스텔 무지개가 은은하게 깔림 */
  background-image:
    radial-gradient(at 5% 0%,   var(--tint-pink)   0px, transparent 45%),
    radial-gradient(at 95% 5%,  var(--tint-peach)  0px, transparent 45%),
    radial-gradient(at 0% 60%,  var(--tint-mint)   0px, transparent 50%),
    radial-gradient(at 100% 70%, var(--tint-lilac) 0px, transparent 50%),
    radial-gradient(at 50% 100%, var(--tint-yellow) 0px, transparent 45%);
  background-attachment: fixed;
  color: var(--text-primary);
  font-size: 15px;
  line-height: 1.55;
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  min-height: 100vh;
}

a { color: var(--accent-strong); text-decoration: none; transition: color var(--ease); }
a:hover { color: var(--accent); }

button { font-family: inherit; cursor: pointer; }

/* ──────────────────────────────────────────────────────────────
   Typography — 친근한 둥근 sans (Nunito) for display
   ────────────────────────────────────────────────────────────── */

.display {
  font-family: var(--display);
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.headline {
  font-family: var(--display);
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.015em;
  line-height: 1.2;
}

.title {
  font-family: var(--display);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.body { font-size: 15px; line-height: 1.55; letter-spacing: -0.005em; }
.body-sm { font-size: 13px; line-height: 1.45; color: var(--text-secondary); }
.caption { font-size: 12px; color: var(--text-secondary); }

.eyebrow {
  font-family: var(--display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.metric {
  font-family: var(--display);
  font-size: 44px;
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.05;
}

.muted { color: var(--text-secondary); }
.subtle { color: var(--text-tertiary); }

/* ──────────────────────────────────────────────────────────────
   Layout
   ────────────────────────────────────────────────────────────── */

.shell {
  max-width: 480px;
  margin: 0 auto;
  /* 하단: bottom-nav 높이(~70px) + iOS home indicator(safe-area) + 여유 */
  padding: 24px 18px calc(110px + env(safe-area-inset-bottom));
}

.stack > * + * { margin-top: 14px; }
.stack-lg > * + * { margin-top: 22px; }
.stack-sm > * + * { margin-top: 6px; }

.row { display: flex; align-items: center; gap: 12px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* ──────────────────────────────────────────────────────────────
   Cards — 통통하고 부드러운 파스텔
   ────────────────────────────────────────────────────────────── */

.card {
  background: var(--bg-card);
  border-radius: var(--radius-card);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: transform var(--ease), box-shadow var(--ease);
}

.card-lg {
  border-radius: var(--radius-card-lg);
  padding: 28px 24px;
  box-shadow: var(--shadow-md);
}

.card:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }

/* Hero — 파스텔 그라디언트 + 다크 텍스트 (가독성!) */
.card-hero {
  position: relative;
  background:
    linear-gradient(135deg,
      color-mix(in srgb, var(--tint, var(--accent-soft)) 90%, white) 0%,
      color-mix(in srgb, var(--tint, var(--accent-soft)) 60%, white) 60%,
      #fff 100%);
  border-radius: var(--radius-card-lg);
  padding: 32px 26px;
  box-shadow: var(--shadow-md);
  overflow: hidden;
  color: var(--text-primary);
}

.card-hero::before {
  /* 큐트 deco — 우측 상단 큰 도트 */
  content: "";
  position: absolute;
  top: -50px; right: -40px;
  width: 160px; height: 160px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--tint, var(--accent-soft)) 0%, transparent 70%);
  opacity: 0.7;
  pointer-events: none;
}
.card-hero::after {
  /* 좌측 하단 작은 도트 */
  content: "";
  position: absolute;
  bottom: -30px; left: -20px;
  width: 100px; height: 100px;
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--tint, var(--accent-soft)) 80%, white) 0%, transparent 70%);
  opacity: 0.5;
  pointer-events: none;
}
.card-hero > * { position: relative; z-index: 1; }

.card-empty {
  background: var(--bg-card);
  border-radius: var(--radius-card-lg);
  padding: 48px 24px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

/* ──────────────────────────────────────────────────────────────
   Buttons — 통통한 pill, 컬러풀
   ────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: var(--radius-pill);
  padding: 13px 24px;
  font-family: var(--display);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.005em;
  text-decoration: none;
  transition: transform var(--ease), background var(--ease), box-shadow var(--ease);
}
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: linear-gradient(135deg, var(--accent) 0%, #ff8db5 100%);
  color: #fff;
  box-shadow: 0 4px 14px rgba(255, 107, 157, 0.35);
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--accent-hover) 0%, #ff7ba8 100%);
  box-shadow: 0 6px 20px rgba(255, 107, 157, 0.45);
  color: #fff;
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1.5px solid var(--border-strong);
}
.btn-secondary:hover { background: var(--bg-soft); color: var(--text-primary); }

.btn-ghost {
  background: transparent;
  color: var(--accent-strong);
  padding: 10px 16px;
}
.btn-ghost:hover { background: var(--accent-soft); color: var(--accent-strong); }

.btn-block { display: flex; width: 100%; }

.btn-disabled, .btn[disabled] {
  background: var(--bg-soft);
  color: var(--text-tertiary);
  cursor: not-allowed;
  box-shadow: none;
}

/* Kakao */
.btn-kakao {
  background: #FEE500;
  color: #191919;
  box-shadow: 0 4px 14px rgba(254, 229, 0, 0.45);
}
.btn-kakao:hover {
  background: #FADA0A;
  color: #191919;
  box-shadow: 0 6px 20px rgba(254, 229, 0, 0.55);
}

/* ──────────────────────────────────────────────────────────────
   Forms
   ────────────────────────────────────────────────────────────── */

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; color: var(--text-secondary); font-weight: 600; }

.input {
  background: var(--bg-card);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-input);
  padding: 13px 16px;
  font-size: 15px;
  color: var(--text-primary);
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  display: block;
  font-family: inherit;
  transition: border-color var(--ease), box-shadow var(--ease);
}
/* iOS Safari에서 input[type=date]가 자체 width 가지는 문제 방지 */
input[type="date"].input,
input[type="time"].input {
  -webkit-appearance: none;
  appearance: none;
}
.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.input::placeholder { color: var(--text-tertiary); }

/* ──────────────────────────────────────────────────────────────
   Chips & dots
   ────────────────────────────────────────────────────────────── */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 7px 14px;
  border-radius: var(--radius-chip);
  background: #fff;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  box-shadow: 0 2px 6px rgba(45, 36, 56, 0.06);
}

.chip-pink { background: var(--tint-pink); color: #b8336f; }
.chip-mint { background: var(--tint-mint); color: #0d7a5d; }
.chip-yellow { background: var(--tint-yellow); color: #946800; }
.chip-sky { background: var(--tint-sky); color: #1d56a8; }
.chip-lilac { background: var(--tint-lilac); color: #6b3aa8; }
.chip-peach { background: var(--tint-peach); color: #b8501e; }

.dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.divider {
  height: 1px;
  background: var(--border);
  border: none;
  margin: 16px 0;
}

/* ──────────────────────────────────────────────────────────────
   Tabs (segmented)
   ────────────────────────────────────────────────────────────── */

.tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-card);
  padding: 4px;
  border-radius: var(--radius-pill);
  overflow-x: auto;
  box-shadow: var(--shadow-sm);
}
.tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: var(--radius-pill);
  font-family: var(--display);
  font-size: 14px;
  font-weight: 700;
  color: var(--text-secondary);
  background: transparent;
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--ease), color var(--ease);
  border: none;
}
.tab:hover { color: var(--text-primary); }
.tab.is-active {
  background: linear-gradient(135deg, var(--accent) 0%, #ff8db5 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(255, 107, 157, 0.35);
}

/* ──────────────────────────────────────────────────────────────
   Page emoji (큐트 포인트)
   ────────────────────────────────────────────────────────────── */

.page-emoji {
  font-size: 56px;
  line-height: 1;
  display: inline-block;
  filter: drop-shadow(0 4px 12px rgba(255, 107, 157, 0.18));
  animation: gentle-bounce 3s ease-in-out infinite;
}

.sudali {
  width: 96px;
  height: 96px;
  display: inline-block;
  filter: drop-shadow(0 6px 16px rgba(184, 136, 98, 0.25));
  animation: gentle-bounce 3s ease-in-out infinite;
}
.sudali-sm {
  width: 56px;
  height: 56px;
  display: inline-block;
  filter: drop-shadow(0 3px 8px rgba(184, 136, 98, 0.2));
}
.sudali-xs {
  width: 32px;
  height: 32px;
  display: inline-block;
}

@keyframes gentle-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

.icon {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}
.icon-sm { width: 18px; height: 18px; }
.icon-lg { width: 32px; height: 32px; }

/* ──────────────────────────────────────────────────────────────
   Bottom navigation
   ────────────────────────────────────────────────────────────── */

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(255, 248, 243, 0.92);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav-inner {
  max-width: 480px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}
.bottom-nav a, .bottom-nav button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 11px 4px 13px;
  font-family: var(--display);
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  text-decoration: none;
  transition: color var(--ease), transform var(--ease);
}
.bottom-nav a:hover, .bottom-nav button:hover { color: var(--text-primary); }
.bottom-nav a:active, .bottom-nav button:active { transform: scale(0.92); }
.bottom-nav a.is-active { color: var(--accent); }
.bottom-nav a.is-active svg { stroke: var(--accent); }

/* ──────────────────────────────────────────────────────────────
   Utilities
   ────────────────────────────────────────────────────────────── */

.scroll-x {
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.scroll-x::-webkit-scrollbar { display: none; }

.alert-warning {
  background: linear-gradient(135deg, var(--tint-yellow) 0%, #fff7d6 100%);
  border-radius: var(--radius-card);
  padding: 14px 18px;
  font-size: 14px;
  color: #946800;
  font-weight: 500;
}
.alert-error {
  background: linear-gradient(135deg, #ffd6d6 0%, #ffe8e8 100%);
  border-radius: var(--radius-card);
  padding: 14px 18px;
  font-size: 14px;
  color: #b91c1c;
  font-weight: 500;
}
.alert-info {
  background: var(--bg-soft);
  border-radius: var(--radius-card);
  padding: 14px 18px;
  font-size: 14px;
  color: var(--text-secondary);
}

/* day-card hover */
.day-card { transition: transform var(--ease), box-shadow var(--ease); }
.day-card:hover { transform: translateY(-3px) scale(1.02); box-shadow: var(--shadow-md); }

/* iOS 토글 — 큐트 핑크 */
.toggle {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 30px;
  flex-shrink: 0;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; cursor: pointer; inset: 0;
  background: #e5dfd5;
  border-radius: 30px;
  transition: background var(--ease);
}
.toggle-slider::before {
  position: absolute; content: "";
  height: 26px; width: 26px;
  left: 2px; top: 2px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(45, 36, 56, 0.2);
  transition: transform var(--bounce);
}
.toggle input:checked + .toggle-slider {
  background: linear-gradient(135deg, var(--accent) 0%, #ff8db5 100%);
}
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }

/* gradient text — 큐트 강조용 */
.gradient-text {
  background: linear-gradient(135deg, var(--accent) 0%, #ffa07a 50%, #ffd23f 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}
