/* ==========================================================
   우리집 위키 · 가족 대시보드  (포켓몬 레트로 파스텔)
   ========================================================== */

/* ---------- 1. 기본 ---------- */
* { box-sizing: border-box; }

:root {
  --sky-1: #7fd3f7;
  --sky-2: #c9ecfc;
  --sky-3: #e9f8ff;

  --grass-1: #8bd45c;
  --grass-2: #4f9e2f;
  --grass-deep: #35721d;

  --mint-bg: #eef8ea;
  --cream: #fffdf4;
  --cream-2: #fff8e6;
  --white: #ffffff;

  --navy: #26324d;
  --navy-soft: #5a6a88;
  --navy-faint: #93a0b6;

  --pink: #ec3f77;
  --pink-soft: #ffe4ee;

  --green: #3fa63f;
  --green-soft: #e3f5d9;

  --blue: #2f7fd1;
  --blue-soft: #e2f0ff;

  --gold: #e0a72a;
  --gold-soft: #fff3d6;

  --orange: #e08a2e;
  --orange-soft: #ffedcc;

  --purple: #8a6ad4;

  --radius: 18px;
  --radius-sm: 12px;
  --line: 2px solid var(--navy);
  --pop: 0 3px 0 var(--navy);
  --pop-sm: 0 2px 0 var(--navy);
  --shadow: 0 10px 26px -16px rgba(38, 50, 77, .55);
}

html { font-size: clamp(15px, 0.55vw + 8px, 19px); height: 100%; }

body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  color: var(--navy);
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo',
    'Noto Sans KR', 'Malgun Gothic', system-ui, sans-serif;
  background:
    radial-gradient(circle at 1px 1px, rgba(63, 166, 63, .13) 1px, transparent 0) 0 0 / 16px 16px,
    linear-gradient(180deg, #f4fcf0 0%, var(--mint-bg) 55%, #e6f4e2 100%);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
img { user-select: none; -webkit-user-drag: none; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(38, 50, 77, .22); border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

.app { display: flex; flex-direction: column; height: 100dvh; }

/* ---------- 2. 헤더 ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: clamp(10px, 1.2vw, 22px);
  padding: clamp(8px, .9vh, 14px) clamp(12px, 1.4vw, 22px);
  background:
    radial-gradient(ellipse 90px 26px at 12% 18%, rgba(255, 255, 255, .75) 0 60%, transparent 62%),
    radial-gradient(ellipse 120px 30px at 46% 26%, rgba(255, 255, 255, .55) 0 60%, transparent 62%),
    radial-gradient(ellipse 100px 24px at 82% 16%, rgba(255, 255, 255, .6) 0 60%, transparent 62%),
    linear-gradient(180deg, var(--sky-1) 0%, var(--sky-2) 62%, var(--sky-3) 100%);
  position: relative;
  z-index: 5;
}

.brand { display: flex; align-items: center; gap: .6rem; flex: none; }

.brand__ball {
  width: 34px; height: 34px; border-radius: 50%;
  border: 3px solid var(--navy);
  background: linear-gradient(180deg, var(--pink) 0 50%, #fff 50% 100%);
  position: relative; flex: none;
  box-shadow: inset 0 0 0 2px var(--navy), 0 2px 0 rgba(38, 50, 77, .3);
}
.brand__ball::after {
  content: ''; position: absolute; left: 50%; top: 50%; width: 9px; height: 9px;
  margin: -4.5px 0 0 -4.5px; border-radius: 50%;
  background: #fff; border: 2.5px solid var(--navy);
}

.brand__info { line-height: 1.15; }
.brand__title {
  margin: 0; font-size: 1.02rem; font-weight: 900; letter-spacing: -.01em;
  text-shadow: 1px 1px 0 #fff;
}
.brand__date { margin: 1px 0 0; font-size: .72rem; font-weight: 800; color: #2f4a6b; }
.brand__stamp { margin: 1px 0 0; font-size: .62rem; font-weight: 700; color: #4b6c86; }

.clock {
  display: flex; align-items: baseline; gap: .28rem; flex: none;
  padding: .1rem .7rem .1rem .5rem;
  background: rgba(255, 255, 255, .55);
  border: 2px solid rgba(38, 50, 77, .22);
  border-radius: 14px;
}
.clock__ampm { font-size: .68rem; font-weight: 900; color: #2f4a6b; }
.clock__time {
  font-family: 'Courier New', ui-monospace, monospace;
  font-size: clamp(1.6rem, 2.4vw, 2.3rem);
  font-weight: 900; letter-spacing: .02em; line-height: 1;
  text-shadow: 2px 2px 0 #fff;
}

.weather {
  display: flex; align-items: center; gap: .75rem;
  padding: .35rem .8rem;
  background: rgba(255, 255, 255, .82);
  border: var(--line); border-radius: 14px;
  box-shadow: var(--pop-sm);
  min-height: 52px;
  flex: 0 1 auto;
  min-width: 0;
}
.weather__main { display: flex; align-items: center; gap: .55rem; }
.weather__icon { font-size: 1.9rem; line-height: 1; filter: drop-shadow(0 2px 0 rgba(38, 50, 77, .12)); }
.weather__temp { margin: 0; font-size: 1.35rem; font-weight: 900; line-height: 1; }
.weather__sky { margin: 2px 0 0; font-size: .68rem; font-weight: 800; color: var(--navy-soft); }
.weather__sep { width: 2px; align-self: stretch; background: rgba(38, 50, 77, .14); border-radius: 2px; }
.weather__air { display: flex; flex-direction: column; gap: 2px; }
.air-pill {
  display: inline-flex; align-items: center; gap: .3rem;
  font-size: .64rem; font-weight: 800; white-space: nowrap;
}
.air-pill__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--navy-faint); }
.air-pill--good .air-pill__dot { background: #3fa63f; }
.air-pill--normal .air-pill__dot { background: #e0a72a; }
.air-pill--bad .air-pill__dot { background: #e2662e; }
.air-pill--worst .air-pill__dot { background: #d0332f; }
.weather__next { display: flex; flex-direction: column; gap: 2px; }
.weather__next span { font-size: .62rem; font-weight: 800; color: var(--navy-soft); white-space: nowrap; }
.weather__msg { display: none; }
.weather__load { font-size: .72rem; font-weight: 800; color: var(--navy-soft); }

.tabs { display: flex; gap: .4rem; margin-left: auto; flex-wrap: wrap; justify-content: flex-end; }
.tab {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .5rem .85rem;
  border: var(--line); border-radius: 999px;
  background: #fff; color: var(--navy);
  font-size: .78rem; font-weight: 900;
  box-shadow: var(--pop-sm);
  transition: transform .08s ease, background .15s ease;
}
.tab:hover { background: var(--cream-2); }
.tab:active { transform: translateY(2px); box-shadow: none; }
.tab.is-active { background: var(--pink); color: #fff; box-shadow: 0 2px 0 #a82150; }

/* 잔디 픽셀 보더 */
.grass {
  height: 16px; flex: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='16'%3E%3Cpath d='M0 0h28v5l-5 11-4-9-5 9-4-11-5 11-5-11z' fill='%235fa83c'/%3E%3C/svg%3E");
  background-repeat: repeat-x;
  background-size: 28px 16px;
  background-color: var(--grass-2);
  box-shadow: 0 2px 0 rgba(38, 50, 77, .18);
  position: relative;
  z-index: 4;
}

/* ---------- 3. 화면(탭) ---------- */
.views { flex: 1; min-height: 0; position: relative; }
.view {
  height: 100%;
  overflow: auto;
  padding: clamp(10px, 1.2vh, 16px) clamp(12px, 1.4vw, 22px) clamp(14px, 1.6vh, 20px);
}
.view[hidden] { display: none; }

/* ---------- 4. 카드 공통 ---------- */
.card {
  background: var(--cream);
  border: var(--line);
  border-radius: var(--radius);
  box-shadow: var(--pop), var(--shadow);
  padding: .85rem .95rem;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.card__head {
  display: flex; align-items: center; gap: .5rem;
  margin-bottom: .55rem;
}
.card__title {
  margin: 0; font-size: .95rem; font-weight: 900; letter-spacing: -.01em;
  display: flex; align-items: center; gap: .4rem;
  text-shadow: 1px 1px 0 #fff;
}
.card__title::before {
  content: ''; width: 6px; height: 16px; border-radius: 3px;
  background: var(--pink); flex: none;
  box-shadow: 0 1px 0 rgba(38, 50, 77, .25);
}
.card--tasks .card__title::before { background: var(--blue); }
.card--days .card__title::before { background: var(--green); }
.card--pet .card__title::before { background: var(--pink); }
.card--dex .card__title::before { background: var(--purple); }
.card--stickers .card__title::before { background: var(--gold); }
.card--cal .card__title::before { background: var(--orange); }
.card__hint { margin-left: auto; font-size: .62rem; font-weight: 800; color: var(--navy-faint); }
.card__sub { margin: .1rem 0 .4rem; font-size: .68rem; font-weight: 800; color: var(--navy-soft); }

.badge {
  margin-left: auto;
  padding: .12rem .5rem;
  border: 2px solid var(--navy); border-radius: 999px;
  background: var(--green-soft); color: var(--navy);
  font-size: .66rem; font-weight: 900; white-space: nowrap;
}
.badge--soft { background: var(--cream-2); }
.badge.is-full { background: var(--green); color: #fff; }

.subhead {
  margin: .7rem 0 .35rem; font-size: .74rem; font-weight: 900;
  color: var(--navy-soft); letter-spacing: .02em;
}
.empty-note { margin: .3rem 0; font-size: .74rem; font-weight: 700; color: var(--navy-faint); line-height: 1.45; }

/* ---------- 5. 버튼 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .62rem 1rem;
  border: var(--line); border-radius: 14px;
  background: #fff; color: var(--navy);
  font-size: .86rem; font-weight: 900;
  box-shadow: var(--pop-sm);
  transition: transform .08s ease, filter .15s ease;
}
.btn:hover { filter: brightness(1.03); }
.btn:active { transform: translateY(2px); box-shadow: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; transform: none; }
.btn--primary { background: var(--pink); color: #fff; box-shadow: 0 2px 0 #a82150; }
.btn--sticker { background: var(--gold); color: #3b2a00; box-shadow: 0 2px 0 #a37711; }
.btn--wide { width: 100%; margin-top: .55rem; padding: .7rem 1rem; font-size: .9rem; }

.icon-btn {
  width: 32px; height: 32px; flex: none;
  display: inline-grid; place-items: center;
  border: var(--line); border-radius: 10px;
  background: #fff; font-size: .9rem; font-weight: 900;
  box-shadow: var(--pop-sm);
}
.icon-btn:active { transform: translateY(2px); box-shadow: none; }

.mini-btn {
  padding: .18rem .5rem; border: 2px solid var(--navy); border-radius: 9px;
  background: #fff; font-size: .72rem; font-weight: 900;
  box-shadow: 0 1px 0 var(--navy);
}
.mini-btn:active { transform: translateY(1px); box-shadow: none; }

.linkish {
  margin-left: auto; padding: .1rem .2rem;
  background: none; border: 0; color: var(--blue);
  font-size: .72rem; font-weight: 900; text-decoration: underline;
}

/* ---------- 6. 대시보드 ---------- */
.dash {
  display: grid;
  grid-template-columns: minmax(0, 1.06fr) minmax(0, .94fr);
  gap: clamp(10px, 1vw, 16px);
  align-items: stretch;
  min-height: calc(100dvh - 206px);
}
.dash__col { display: flex; flex-direction: column; gap: clamp(10px, 1vw, 16px); min-width: 0; }
.card--cal { flex: 1 1 auto; }
.card--summary { flex: 1 1 auto; }
.card--summary .btn--wide { margin-top: auto; }

/* 달력 */
.cal__nav { margin-left: auto; display: flex; gap: .3rem; }
.cal {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-auto-rows: minmax(44px, 1fr);
  gap: 4px;
  flex: 1 1 auto;
}
.cal__dow {
  text-align: center; font-size: .64rem; font-weight: 900; color: var(--navy-soft);
  padding-bottom: 2px;
}
.cal__dow--sun { color: #d33a3a; }
.cal__dow--sat { color: #2f7fd1; }
.cal__cell {
  min-height: 0;
  height: 100%;
  padding: 3px 4px 4px;
  border: 1.5px solid rgba(38, 50, 77, .18);
  border-radius: 9px;
  background: #fff;
  overflow: hidden;
  position: relative;
}
.cal__cell.is-out { opacity: .32; background: #f7f7f7; }
.cal__cell.is-today { border-color: var(--pink); border-width: 2px; background: #fff6f9; }
.cal__cell.is-weekend-sun .cal__num { color: #d33a3a; }
.cal__cell.is-weekend-sat .cal__num { color: #2f7fd1; }
.cal__num { font-size: .72rem; font-weight: 900; line-height: 1; }
.cal__cell.is-today .cal__num {
  background: var(--pink); color: #fff; border-radius: 6px;
  padding: 1px 4px; display: inline-block;
}
.cal__ev {
  display: block;
  margin-top: 2px;
  font-size: .53rem;
  font-weight: 800;
  line-height: 1.12;
  padding-left: 3px;
  border-left: 3px solid var(--navy-faint);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: var(--navy-soft);
}
.cal__more { display: block; font-size: .52rem; font-weight: 900; color: var(--navy-faint); line-height: 1.2; }
.cal__dots { display: none; gap: 2px; justify-content: center; margin-top: 3px; }
.cal__dot { width: 5px; height: 5px; border-radius: 50%; display: inline-block; }

.legend {
  display: flex; flex-wrap: wrap; gap: .1rem .65rem;
  margin: .45rem 0 0; padding: 0; list-style: none;
}
.legend li { display: flex; align-items: center; gap: .25rem; font-size: .62rem; font-weight: 800; color: var(--navy-soft); }
.legend i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; border: 1.5px solid var(--navy); }

/* 오늘 · 내일 */
.days { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
.day-col { min-width: 0; }
.day-col__head {
  display: flex; align-items: baseline; gap: .35rem;
  padding-bottom: .25rem; margin-bottom: .35rem;
  border-bottom: 2px dashed rgba(38, 50, 77, .16);
}
.day-col__title { font-size: .82rem; font-weight: 900; }
.day-col__date { font-size: .66rem; font-weight: 800; color: var(--navy-soft); }
.day-col__rel {
  margin-left: auto; font-size: .6rem; font-weight: 900;
  background: var(--green-soft); border-radius: 999px; padding: .05rem .35rem;
}
.day-col__rel.is-today { background: var(--pink); color: #fff; }
.day-col__note { margin: 0; font-size: .68rem; font-weight: 700; color: var(--navy-faint); }

.mini-events { margin: 0 0 .4rem; padding: 0; list-style: none; }
.mini-events li {
  display: flex; gap: .3rem; align-items: baseline;
  font-size: .68rem; font-weight: 800; line-height: 1.3;
  padding: .15rem 0;
}
.mini-events time { font-size: .62rem; font-weight: 900; color: var(--blue); flex: none; }
.mini-events .dot { width: 6px; height: 6px; border-radius: 50%; flex: none; margin-top: .35rem; }

.mini-checks { margin: 0; padding: 0; list-style: none; }
.mini-checks li { display: flex; }
.check {
  display: flex; align-items: flex-start; gap: .35rem;
  width: 100%; padding: .12rem 0;
  font-size: .7rem; font-weight: 700; line-height: 1.3;
  cursor: pointer;
}
.check input { position: absolute; opacity: 0; width: 0; height: 0; }
.check__box {
  width: 16px; height: 16px; flex: none; margin-top: .05rem;
  border: 2px solid var(--navy); border-radius: 5px; background: #fff;
  display: grid; place-items: center;
}
.check input:checked + .check__box { background: var(--green); border-color: var(--green); }
.check input:checked + .check__box::after {
  content: '✓'; color: #fff; font-size: .68rem; font-weight: 900; line-height: 1;
}
.check input:checked ~ .check__text { color: var(--navy-faint); text-decoration: line-through; }
.check input:focus-visible + .check__box { outline: 3px solid var(--blue-soft); }
.check__text { min-width: 0; }
.checklist { margin: 0; padding: 0; list-style: none; }
.checklist__item.is-done .check__text { color: var(--navy-faint); text-decoration: line-through; }

/* 할 일 */
.tasks { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
.task-group { min-width: 0; }
.task-group--wide { grid-column: 1 / -1; }
.task-group__head {
  display: flex; align-items: center; gap: .35rem;
  font-size: .74rem; font-weight: 900; margin-bottom: .3rem;
}
.task-group__head i { width: 10px; height: 10px; border-radius: 3px; border: 1.5px solid var(--navy); }
.task-group__count { margin-left: auto; font-size: .62rem; font-weight: 900; color: var(--navy-soft); }
.task-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: .22rem; }
.task-list .check { font-size: .68rem; }
.task-list.big .check { font-size: .78rem; }

/* 이안이 요약 + D-day */
.pet-summary { display: flex; align-items: center; gap: .7rem; }
.pet-summary__art {
  position: relative; width: 78px; height: 78px; flex: none;
  display: grid; place-items: center;
  background: radial-gradient(ellipse at 50% 78%, #bfe08a 0 52%, transparent 54%);
  border-radius: 14px;
}
.pet-summary__art img { height: 62px; image-rendering: pixelated; }
.pet-summary__info { min-width: 0; flex: 1; }
.pet-summary__name { margin: 0; font-size: .95rem; font-weight: 900; }
.pet-summary__stage { margin: .1rem 0 .35rem; font-size: .66rem; font-weight: 800; color: var(--pink); }
.bar {
  height: 12px; border: 2px solid var(--navy); border-radius: 999px; overflow: hidden;
  background: repeating-linear-gradient(45deg, #fff 0 5px, #f3f6ee 5px 10px);
}
.bar > span { display: block; height: 100%; background: linear-gradient(90deg, #ffd76e, #ffb02e); border-radius: 999px 0 0 999px; }
.bar__label { margin: .25rem 0 0; font-size: .62rem; font-weight: 800; color: var(--navy-soft); }

.dday { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: .3rem; }
.dday li { display: flex; align-items: center; gap: .45rem; font-size: .7rem; font-weight: 800; }
.dday__badge {
  flex: none; min-width: 42px; text-align: center;
  padding: .08rem .3rem; border: 2px solid var(--navy); border-radius: 8px;
  background: var(--cream-2); font-size: .62rem; font-weight: 900;
}
.dday__badge.is-soon { background: var(--pink); color: #fff; border-color: #b02654; }
.dday__title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dday__date { font-size: .62rem; color: var(--navy-faint); flex: none; }

.award {
  margin-top: .45rem; padding: .45rem .55rem;
  border: 2px dashed var(--gold); border-radius: 12px;
  background: var(--gold-soft);
  display: flex; flex-wrap: wrap; align-items: center; gap: .45rem;
}
.award__text { margin: 0; font-size: .7rem; font-weight: 900; }
.award .btn { padding: .35rem .6rem; font-size: .7rem; }

/* ---------- 7. 스티커 보드 ---------- */
.board {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-rows: minmax(0, .9fr) minmax(0, 1.1fr);
  gap: clamp(10px, 1vw, 16px);
  height: 100%;
  align-content: stretch;
}
.card--pet { grid-row: 1 / 3; }
.card--dex, .card--stickers { min-height: 0; }
.pet { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 0 .2rem; height: 100%; gap: .1rem; }
.pet--empty { justify-content: center; gap: .4rem; text-align: center; }
.pet__empty-title { margin: 0; font-size: 1rem; font-weight: 900; }
.pet__empty-sub { margin: 0 0 .5rem; font-size: .74rem; font-weight: 700; color: var(--navy-soft); }

.pet__stage {
  position: relative; width: 100%;
  display: grid; place-items: center;
  padding: 1.2rem 0 .9rem;
}
.pet__stage::before {
  content: ''; position: absolute; bottom: .5rem; left: 50%; transform: translateX(-50%);
  width: min(380px, 80%); height: 48px; border-radius: 50%;
  background: radial-gradient(ellipse at center, #c3e58f 0 58%, #a6d46c 70%, rgba(166, 212, 108, 0) 74%);
}
.pet__sprite {
  position: relative; height: clamp(120px, 19vh, 250px);
  image-rendering: pixelated;
  filter: drop-shadow(0 5px 0 rgba(38, 50, 77, .13));
  animation: bob 1.6s ease-in-out infinite alternate;
}
.pet__sprite--egg { height: clamp(96px, 15vh, 190px); }
.egg-fallback {
  width: 88px; height: 108px; border-radius: 50% 50% 46% 46% / 62% 62% 40% 40%;
  background: #fff8e6; border: 3px solid var(--navy);
  box-shadow: inset -8px -10px 0 rgba(199, 214, 176, .6);
}
.sprite-fallback {
  display: inline-grid; place-items: center;
  color: var(--navy-faint); font-weight: 900;
}

.pet__name { margin: .2rem 0 0; font-size: clamp(1.3rem, 2vw, 1.7rem); font-weight: 900; letter-spacing: -.02em; }
.pet__level { margin: .1rem 0 .55rem; font-size: .78rem; font-weight: 900; color: var(--pink); }

.evo { display: flex; align-items: center; gap: .3rem; width: 100%; }
.evo__box {
  position: relative; flex: 1 1 0;
  aspect-ratio: 1 / 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  border: 2px solid var(--navy); border-radius: 14px;
  background: #fff; padding: .2rem;
  min-width: 0;
}
.evo__box.is-now { border-color: var(--pink); background: #fff6fa; box-shadow: 0 0 0 3px var(--pink-soft); }
.evo__box.is-done { background: #fbfff4; }
.evo__img { height: 58%; max-width: 90%; object-fit: contain; image-rendering: pixelated; }
.evo__box.is-now .evo__img { animation: bob .9s ease-in-out infinite alternate; }
.evo__img.is-silhouette { filter: brightness(0) opacity(.78); }
.evo__cap { font-size: .6rem; font-weight: 900; color: var(--navy-soft); }
.evo__badge {
  position: absolute; top: -9px; right: -7px;
  min-width: 22px; height: 22px; padding: 0 4px;
  display: grid; place-items: center;
  border: 2px solid var(--navy); border-radius: 999px;
  background: var(--gold); color: #3b2a00;
  font-size: .6rem; font-weight: 900;
}
.evo__badge--done { background: var(--green); color: #fff; }
.evo__badge--start { background: #fff; color: var(--navy-soft); }
.evo__arrow { color: var(--navy-faint); font-weight: 900; font-size: .8rem; flex: none; }
.evo__box.is-locked { background: #f6f8fb; border-style: dashed; border-color: rgba(38, 50, 77, .45); }
.evo__q { font-size: 1.5rem; font-weight: 900; color: var(--navy-faint); line-height: 1; }

.pet__msg {
  width: 100%; margin-top: .7rem;
  padding: .55rem .7rem;
  border: 2px solid var(--navy); border-radius: 12px;
  background: #fff;
  display: flex; flex-wrap: wrap; align-items: baseline; gap: .2rem .6rem;
}
.pet__msg-main { margin: 0; font-size: .8rem; font-weight: 900; }
.pet__msg-next { margin: 0 0 0 auto; font-size: .68rem; font-weight: 800; color: var(--navy-faint); }

.card--pet > .pet > .btn--wide { margin-top: auto; }

/* 도감 */
.dex {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(66px, 1fr));
  gap: .35rem; min-height: 150px; align-content: start; flex: 1 1 auto; overflow: auto;
}
.dex__empty { grid-column: 1 / -1; padding: .5rem 0; }
.dex__empty p { margin: 0; font-size: .74rem; font-weight: 800; }
.dex__empty-sub { margin-top: .15rem !important; font-size: .66rem !important; font-weight: 700 !important; color: var(--navy-faint); }
.dex__cell {
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: .3rem .15rem;
  border: 1.5px solid rgba(38, 50, 77, .16); border-radius: 12px; background: #fff;
}
.dex__img { height: 42px; image-rendering: pixelated; }
.dex__name { font-size: .58rem; font-weight: 900; color: var(--navy-soft); text-align: center; }

/* 최근 스티커 */
.stickers { margin: 0; padding: 0; list-style: none; overflow: auto; flex: 1; min-height: 0; }
.stickers__empty { padding: .5rem 0; }
.stickers__empty p { margin: 0; font-size: .74rem; font-weight: 800; }
.stickers__empty-sub { margin-top: .15rem !important; font-size: .66rem !important; font-weight: 700 !important; color: var(--navy-faint); }
.sticker-row {
  display: grid;
  grid-template-columns: 44px 22px 28px minmax(0, 1fr) auto;
  align-items: center; gap: .3rem;
  padding: .34rem .1rem;
  border-bottom: 1.5px dashed rgba(38, 50, 77, .12);
  font-size: .74rem; font-weight: 800;
}
.sticker-row:last-child { border-bottom: 0; }
.sticker-row__date { color: var(--navy-soft); font-size: .68rem; }
.sticker-row__emoji { font-size: .9rem; line-height: 1; }
.sticker-row__plus { color: var(--pink); font-weight: 900; }
.sticker-row__reason { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sticker-row__giver { font-size: .62rem; color: var(--navy-faint); }
.sticker-row.is-new { animation: flash 1.4s ease-out; }
.stickers__foot { margin: .35rem 0 0; font-size: .62rem; font-weight: 800; color: var(--navy-faint); text-align: center; }

/* ---------- 8. 이안 할 일 ---------- */
.routines {
  display: grid; grid-template-columns: 1fr 1fr; gap: clamp(10px, 1vw, 16px);
  height: 100%;
}
.routine {
  --accent: var(--gold);
  --accent-soft: var(--gold-soft);
  display: flex; flex-direction: column;
  min-height: 0;
}
.routine__head { display: flex; align-items: center; gap: .5rem; }
.routine__title { margin: 0; font-size: 1rem; font-weight: 900; }
.routine__title::before { background: var(--accent); }
.routine__count { margin-left: auto; font-size: 1.05rem; font-weight: 900; color: var(--accent); }
.routine__list { display: flex; flex-direction: column; gap: .55rem; margin-top: .7rem; flex: 1 1 auto; justify-content: space-evenly; padding: .2rem 0; }
.routine__item {
  display: flex; align-items: center; gap: .6rem;
  width: 100%; padding: .7rem .85rem;
  border: 2px solid var(--navy); border-radius: 14px;
  background: var(--cream);
  font-size: 1rem; font-weight: 900; text-align: left;
  box-shadow: 0 3px 0 rgba(38, 50, 77, .16);
  transition: transform .08s ease, background .15s ease;
}
.routine__item:active { transform: translateY(2px); box-shadow: none; }
.routine__item.is-done { background: var(--accent); color: #fff; border-color: #26324d; }
.routine__check {
  width: 26px; height: 26px; flex: none;
  border: 2px solid var(--navy); border-radius: 50%;
  background: #fff; color: var(--accent);
  display: grid; place-items: center; font-size: .8rem; font-weight: 900;
}
.routine__item.is-done .routine__check { border-color: #fff; }
.routine__foot {
  margin-top: auto; padding-top: .9rem;
  border-top: 2px dashed rgba(38, 50, 77, .16);
  display: flex; align-items: center; gap: .8rem;
  min-height: 96px;
}
.routine__pet { height: 66px; image-rendering: pixelated; flex: none; }
.routine__pet.is-dim { filter: grayscale(1) opacity(.35); }
.routine__foot-main { margin: 0; font-size: .98rem; font-weight: 900; color: var(--accent); line-height: 1.25; }
.routine__foot-sub { margin: .15rem 0 0; font-size: .7rem; font-weight: 800; color: var(--navy-soft); }
.routine__spark { margin-left: auto; font-size: 1.1rem; }

/* ---------- 9. 위키 ---------- */
.wiki {
  display: grid; grid-template-columns: 210px minmax(0, 1fr);
  gap: clamp(10px, 1vw, 16px);
  height: 100%;
  min-height: 0;
}
.wiki__side { display: flex; flex-direction: column; gap: .6rem; min-height: 0; }
.searchbar {
  display: flex; align-items: center; gap: .35rem;
  padding: .35rem .55rem;
  background: #fff; border: var(--line); border-radius: 999px;
  box-shadow: var(--pop-sm);
}
.searchbar__icon { font-size: .8rem; }
.searchbar input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent;
  font-size: .78rem; font-weight: 800;
}
.searchbar input::placeholder { color: var(--navy-faint); font-weight: 700; }
.searchbar__clear { border: 0; background: none; font-weight: 900; color: var(--navy-soft); padding: 0 .1rem; }

.doc-nav { display: flex; flex-direction: column; gap: .35rem; overflow: auto; min-height: 0; padding-right: 2px; }
.doc-chip {
  display: flex; align-items: center; gap: .45rem;
  padding: .5rem .6rem;
  border: var(--line); border-radius: 12px;
  background: var(--cream); color: var(--navy);
  font-size: .78rem; font-weight: 900; text-align: left;
  box-shadow: var(--pop-sm);
}
.doc-chip__icon { font-size: .9rem; }
.doc-chip.is-active { background: var(--green); color: #fff; box-shadow: 0 2px 0 #2b7328; }
.doc-chip:active { transform: translateY(2px); box-shadow: none; }

.wiki__body {
  background: var(--cream);
  border: var(--line); border-radius: var(--radius);
  box-shadow: var(--pop), var(--shadow);
  padding: 1rem 1.3rem 1.4rem;
  overflow: auto; min-height: 0;
}

.doc__head { border-bottom: 2px solid rgba(38, 50, 77, .12); padding-bottom: .6rem; margin-bottom: .8rem; }
.doc__title { margin: 0; font-size: 1.35rem; font-weight: 900; letter-spacing: -.02em; }
.doc__sub { margin: .15rem 0 0; font-size: .8rem; font-weight: 800; color: var(--navy-soft); }
.doc__meta { margin: .35rem 0 0; font-size: .66rem; font-weight: 800; color: var(--navy-faint); }
.doc__foot { margin-top: 1.4rem; padding-top: .5rem; border-top: 2px dashed rgba(38, 50, 77, .12); font-size: .6rem; font-weight: 700; color: var(--navy-faint); font-family: ui-monospace, monospace; }

.md { font-size: .84rem; line-height: 1.65; }
.md h1 { font-size: 1.2rem; margin: .2rem 0 .5rem; }
.md h2 {
  font-size: 1rem; margin: 1.3rem 0 .45rem; padding-bottom: .2rem;
  border-bottom: 2px solid var(--green-soft);
}
.md h3 { font-size: .9rem; margin: 1rem 0 .3rem; }
.md h4 { font-size: .84rem; margin: .8rem 0 .25rem; }
.md p { margin: .45rem 0; }
.md ul, .md ol { margin: .4rem 0; padding-left: 1.2rem; }
.md li { margin: .2rem 0; }
.md li > ul, .md li > ol { margin: .2rem 0; }
.md strong { background: linear-gradient(transparent 62%, #ffe9a8 62%); padding: 0 1px; }
.md em { font-style: normal; color: var(--pink); font-weight: 800; }
.md a { color: var(--blue); font-weight: 800; }
.md code {
  font-family: ui-monospace, monospace; font-size: .82em;
  background: #fff4d9; border: 1px solid rgba(38, 50, 77, .14);
  border-radius: 5px; padding: 0 .25rem;
}
.md pre {
  background: #253049; color: #f4f7ff; border-radius: 12px;
  padding: .7rem .8rem; overflow: auto;
}
.md pre code { background: none; border: 0; color: inherit; padding: 0; }
.md blockquote {
  margin: .6rem 0; padding: .5rem .7rem;
  background: var(--gold-soft); border-left: 5px solid var(--gold);
  border-radius: 0 10px 10px 0; font-size: .8rem;
}
.md hr { border: 0; border-top: 2px dashed rgba(38, 50, 77, .16); margin: 1rem 0; }
.md .table-wrap { overflow-x: auto; margin: .6rem 0; }
.md table { border-collapse: collapse; width: 100%; font-size: .76rem; }
.md th, .md td { border: 1.5px solid rgba(38, 50, 77, .18); padding: .35rem .5rem; vertical-align: top; }
.md th { background: var(--green-soft); font-weight: 900; }
.md tr:nth-child(even) td { background: rgba(255, 250, 235, .7); }
.md .ta-center { text-align: center; }
.md .ta-right { text-align: right; }

.md .wikilink {
  color: var(--pink); font-weight: 900; text-decoration: none;
  border-bottom: 2px dotted var(--pink);
}
.md .wikilink--missing { color: var(--navy-faint); border-bottom: 2px dotted var(--navy-faint); }

.md .task-list { list-style: none; padding-left: .1rem; }
.md .task { display: flex; align-items: flex-start; gap: .4rem; cursor: pointer; }
.md .task input { margin: .3rem 0 0; accent-color: var(--green); width: 17px; height: 17px; flex: none; }

/* 검색 결과 */
.results { margin: .2rem 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: .4rem; }
.results__btn {
  display: block; width: 100%; text-align: left;
  padding: .55rem .65rem;
  border: 1.5px solid rgba(38, 50, 77, .16); border-radius: 12px;
  background: #fff;
}
.results__btn:hover { border-color: var(--navy); }
.results__top { display: flex; align-items: baseline; gap: .4rem; }
.results__icon { font-size: .8rem; }
.results__doc { font-size: .76rem; font-weight: 900; }
.results__where { margin-left: auto; font-size: .6rem; font-weight: 800; color: var(--navy-faint); }
.results__snippet { display: block; margin-top: .15rem; font-size: .72rem; color: var(--navy-soft); line-height: 1.4; }
.results__snippet mark { background: #ffe9a8; padding: 0 1px; font-weight: 900; }

/* ---------- 10. 모달 ---------- */
.modal, .celebrate {
  position: fixed; inset: 0; z-index: 60;
  display: grid; place-items: center;
  padding: 1rem;
  background: rgba(24, 34, 54, .48);
  backdrop-filter: blur(3px);
}
.modal[hidden], .celebrate[hidden] { display: none; }
.modal__panel, .celebrate__panel {
  width: min(520px, 100%);
  max-height: 88dvh;
  overflow: auto;
  background: var(--cream);
  border: 3px solid var(--navy);
  border-radius: 22px;
  box-shadow: 0 6px 0 var(--navy), 0 22px 50px -18px rgba(0, 0, 0, .5);
  padding: 1rem 1.1rem 1.2rem;
  animation: popin .22s ease-out;
}
.modal__panel--wide { width: min(720px, 100%); }
.modal__head { display: flex; align-items: center; gap: .5rem; margin-bottom: .5rem; }
.modal__head h2 { margin: 0; font-size: 1.05rem; font-weight: 900; }
.modal__head .icon-btn { margin-left: auto; }
.modal__info { margin: 0 0 .6rem; font-size: .74rem; font-weight: 800; color: var(--navy-soft); }
.modal__label { margin: .7rem 0 .35rem; font-size: .7rem; font-weight: 900; color: var(--navy-soft); }
.modal__note { margin: .8rem 0 0; font-size: .66rem; font-weight: 700; color: var(--navy-faint); }

.chips { display: flex; flex-wrap: wrap; gap: .35rem; }
.chip-btn {
  padding: .45rem .7rem;
  border: 2px solid var(--navy); border-radius: 999px;
  background: #fff; font-size: .74rem; font-weight: 800;
  box-shadow: 0 2px 0 rgba(38, 50, 77, .18);
}
.chip-btn.is-picked { background: var(--pink); color: #fff; border-color: #b02654; box-shadow: 0 2px 0 #8f1b3f; }
.chip-btn--giver.is-picked { background: var(--blue); border-color: #1d5c9e; }
.chip-btn:active { transform: translateY(2px); box-shadow: none; }

.field { display: block; margin-top: .55rem; }
.field__label { display: block; font-size: .68rem; font-weight: 900; color: var(--navy-soft); margin-bottom: .25rem; }
.field input {
  width: 100%; padding: .5rem .6rem;
  border: 2px solid var(--navy); border-radius: 12px; background: #fff;
  font-size: .8rem; font-weight: 800; outline: none;
}
.field input:focus { box-shadow: 0 0 0 3px var(--pink-soft); }

/* 새 알 */
.egg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: .5rem; }
.egg-cell {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: .1rem;
  padding: .55rem .4rem;
  border: 2px solid var(--navy); border-radius: 14px; background: #fff;
  box-shadow: 0 2px 0 rgba(38, 50, 77, .18);
}
.egg-cell__img { height: 54px; image-rendering: pixelated; }
.egg-cell__q { height: 54px; display: grid; place-items: center; font-size: 1.7rem; font-weight: 900; color: var(--navy-faint); }
.egg-cell.is-unknown { background: #f6f8fb; border-style: dashed; border-color: rgba(38, 50, 77, .45); }
.egg-cell__name { font-size: .8rem; font-weight: 900; }
.egg-cell__line { font-size: .56rem; font-weight: 800; color: var(--navy-faint); }
.egg-cell.is-done { background: #f5fff0; }
.egg-cell.is-now { border-color: var(--pink); box-shadow: 0 0 0 3px var(--pink-soft); }
.egg-cell__tag {
  margin-top: .15rem; font-size: .56rem; font-weight: 900;
  background: var(--green-soft); border-radius: 999px; padding: .05rem .35rem;
}
.egg-cell__tag--now { background: var(--pink); color: #fff; }

/* 설정 */
.settings { display: flex; flex-direction: column; gap: .4rem; }
.setting {
  display: flex; align-items: center; gap: .6rem;
  padding: .55rem .6rem;
  border: 2px solid var(--navy); border-radius: 12px; background: #fff;
  text-align: left;
}
.setting__icon { font-size: 1.1rem; }
.setting__text { display: flex; flex-direction: column; }
.setting__text b { font-size: .8rem; font-weight: 900; }
.setting__text small { font-size: .64rem; font-weight: 700; color: var(--navy-faint); }
.setting--danger { border-color: #b8332f; }
.setting--danger .setting__text b { color: #b8332f; }

/* 축하 */
.celebrate__panel { position: relative; text-align: center; overflow: hidden; }
.celebrate__sprite-wrap { display: grid; place-items: center; height: 150px; }
.celebrate__sprite { height: 130px; image-rendering: pixelated; animation: popin .5s ease-out, bob 1s ease-in-out infinite alternate .5s; }
.celebrate__title { margin: .4rem 0 .2rem; font-size: 1.2rem; font-weight: 900; }
.celebrate__sub { margin: 0 0 .9rem; font-size: .8rem; font-weight: 800; color: var(--navy-soft); }
.confetti { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.confetti__bit {
  position: absolute; top: -10%;
  font-size: 1.1rem;
  animation-name: fall;
  animation-timing-function: linear;
  animation-iteration-count: 1;
  animation-fill-mode: forwards;
}

/* 토스트 */
.toast {
  position: fixed; left: 50%; bottom: 5vh; transform: translateX(-50%);
  z-index: 80;
  padding: .6rem .9rem;
  background: var(--navy); color: #fff;
  border-radius: 999px; font-size: .78rem; font-weight: 800;
  box-shadow: 0 10px 24px -10px rgba(0, 0, 0, .6);
  animation: popin .18s ease-out;
}
.toast[hidden] { display: none; }

.fatal { margin: 1rem; padding: .8rem; background: #fff0f0; border: 2px solid #b8332f; border-radius: 12px; font-weight: 800; }
.fatal[hidden] { display: none; }

/* ---------- 11. 애니메이션 ---------- */
@keyframes bob { from { transform: translateY(0); } to { transform: translateY(-5px); } }
@keyframes popin { from { transform: scale(.94); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes fall {
  from { transform: translateY(0) rotate(0deg); opacity: 1; }
  to { transform: translateY(110vh) rotate(320deg); opacity: .9; }
}
@keyframes flash { 0% { background: #fff3c4; } 100% { background: transparent; } }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; animation-iteration-count: 1 !important; }
}

/* ---------- 12. 화면 크기별 ---------- */
@media (max-width: 1180px) {
  .weather__next { display: none; }
  .tabs { gap: .3rem; }
  .tab { padding: .45rem .65rem; font-size: .72rem; }
}

@media (min-width: 1025px) and (max-height: 830px) {
  html { font-size: 14px; }
  .card { padding: .66rem .78rem; }
  .card__head { margin-bottom: .42rem; }
  .cal { grid-auto-rows: minmax(41px, 1fr); }
  .day-col__head { margin-bottom: .2rem; }
  .mini-events li { padding: .08rem 0; }
  .check { padding: .09rem 0; }
}

@media (max-width: 1024px) {
  body { overflow: auto; }
  .app { height: auto; min-height: 100dvh; }
  .views { min-height: 0; }
  .view { height: auto; overflow: visible; }
  .dash, .board, .routines, .wiki { grid-template-columns: 1fr; height: auto; }
  .board { grid-template-rows: repeat(3, auto); }
  .card--pet { grid-row: auto; }
  .dash { min-height: 0; }
  .card--cal, .card--summary { flex: 0 1 auto; }
  .dex { min-height: 120px; max-height: 40vh; }
  .wiki__side { flex-direction: row; flex-wrap: wrap; align-items: center; }
  .doc-nav { flex-direction: row; flex-wrap: wrap; }
  .topbar { flex-wrap: wrap; }
  .tabs { margin-left: 0; width: 100%; justify-content: flex-start; }
  .weather { flex: 1 1 auto; }
}

@media (max-width: 620px) {
  .cal__ev, .cal__more { display: none; }
  .cal__dots { display: flex; }
  .cal__cell { min-height: 40px; }
  .dash { min-height: 0; }
  .brand__stamp { display: none; }
  .clock__time { font-size: 1.5rem; }
  .days, .tasks { grid-template-columns: 1fr; }
  .sticker-row { grid-template-columns: 40px 20px 26px minmax(0, 1fr); }
  .sticker-row__giver { display: none; }
  .evo__cap { font-size: .52rem; }
  .weather__air { display: none; }
}

/* ---------- 12. 오늘 · 내일 저녁 메뉴 ---------- */
.card--menu { padding: .62rem .85rem; }
.card--menu .card__head { margin-bottom: .35rem; }
.menu-box { display: flex; flex-direction: column; gap: .3rem; }
.menu-row {
  display: flex; align-items: baseline; gap: .45rem; flex-wrap: wrap;
  padding: .3rem .55rem; border-radius: 10px; background: var(--cream-2);
  font-size: .8rem; line-height: 1.35;
}
.menu-row.is-today { background: var(--gold-soft); border: 1.5px solid var(--gold); }
.menu-row__tag {
  font-size: .7rem; font-weight: 900; padding: .1rem .4rem; border-radius: 999px;
  background: var(--white); color: var(--navy); border: 1px solid var(--navy-faint); flex: none;
}
.menu-row.is-today .menu-row__tag { background: var(--gold); color: var(--white); border-color: var(--gold); }
.menu-row__main { color: var(--navy); font-weight: 800; }
.menu-row__side { color: var(--navy-soft); font-size: .73rem; }
.menu-empty { margin: 0; font-size: .8rem; color: var(--navy-soft); }

.weather__outfit {
  font-size: .72rem; font-weight: 800; padding: .2rem .55rem; border-radius: 999px;
  background: var(--sky-3); color: var(--navy); border: 1.5px solid var(--sky-1);
  white-space: nowrap;
}

/* ---------- 13. 달력 날짜 클릭 팝업 ---------- */
.cal__cell[data-date] { cursor: pointer; transition: background .12s ease; }
.cal__cell[data-date]:hover { background: var(--sky-3); }
.modal__box--day { max-width: 420px; }
.day-modal__sec { margin-top: .75rem; }
.day-modal__sec h4 { margin: 0 0 .35rem; font-size: .82rem; color: var(--navy-soft); }
.day-modal__list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: .45rem; }
.day-modal__list li { display: flex; align-items: flex-start; gap: .5rem; font-size: .88rem; }
.day-modal__list .dot { width: 10px; height: 10px; border-radius: 50%; margin-top: .32rem; flex: none; }
.day-modal__list p { margin: .15rem 0 0; font-size: .78rem; color: var(--navy-soft); }
.day-modal__empty, .day-modal__menu { margin: 0; font-size: .88rem; color: var(--navy); }
.day-modal__menu span { color: var(--navy-soft); font-size: .8rem; }

/* ---------- 14. 야간 딤(Dim) 모드 ---------- */
.night-dim {
  position: fixed; inset: 0; z-index: 9999; pointer-events: none;
  background: rgba(0, 0, 0, 0.65); opacity: 0; transition: opacity .45s ease;
}
.night-dim.is-active { opacity: 1; }

/* ---------- 15. 할 일 잠금 & 토스트 실행 취소 & 진화 애니메이션 ---------- */
.routine__item.is-locked,
.routine__item:disabled { opacity: .82; cursor: default; }
.routine__item.is-locked .routine__check::after { content: ' 🔒'; font-size: .65rem; }
.toast { display: flex; align-items: center; gap: .6rem; }
.toast__undo {
  border: 1.5px solid #fff; background: rgba(255,255,255,.18); color: #fff;
  font: inherit; font-weight: 800; font-size: .78rem; padding: .2rem .55rem;
  border-radius: 999px; cursor: pointer;
}
.toast__undo:hover { background: rgba(255,255,255,.32); }

@keyframes evoSparkle {
  0%   { transform: scale(.75); filter: brightness(1) drop-shadow(0 0 0 rgba(255,220,90,0)); }
  35%  { transform: scale(1.22); filter: brightness(1.55) drop-shadow(0 0 22px rgba(255,220,90,.95)); }
  65%  { transform: scale(1.06); filter: brightness(1.2) drop-shadow(0 0 12px rgba(255,220,90,.7)); }
  100% { transform: scale(1); filter: brightness(1) drop-shadow(0 0 0 rgba(255,220,90,0)); }
}
.celebrate__sprite-wrap.is-evolving img {
  animation: evoSparkle 1.15s cubic-bezier(.22, 1.25, .36, 1) 1;
}




