:root {
  --cream: #F6F0E4;
  --cream-2: #EFE6D4;
  --paper: #FFFBF3;
  --ink: #1F3A33;
  --ink-2: #4A5F57;
  --line: #DDD1BB;
  --accent: #B8442C;
  --accent-2: #9C3823;
  --leaf: #3E8A5F;
  --leaf-d: #285E45;
  --leaf-l: #DDEBD0;
  --sun: #E3A72F;
  --sun-l: #FBEFD2;
  --water: #2C5F80;
  --water-l: #DCEBF3;
  --soil: #8A5A3B;
  --soil-l: #F0E2D3;
  --outside: #E6DCC8;
  --radius: 18px;
  --sans: "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  --serif: "Noto Serif KR", "AppleMyungjo", "Batang", serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
h1[tabindex]:focus { outline: none; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--outside);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  word-break: keep-all;
  overflow-wrap: anywhere;
  -webkit-tap-highlight-color: transparent;
}

.app {
  position: relative;
  max-width: 430px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--cream);
  display: flex;
  flex-direction: column;
}
@media (min-width: 520px) {
  body { padding: 24px 0; }
  .app {
    min-height: calc(100vh - 48px);
    border-radius: 28px;
    box-shadow: 0 20px 60px rgba(31, 58, 51, .16);
    overflow: hidden;
  }
}

.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0 20px calc(16px + env(safe-area-inset-bottom));
  animation: fade .28s ease;
}
/* 글자가 흐려진 채 멈추는 일이 없도록 투명도는 바꾸지 않고 살짝 올라오기만 해요 */
@keyframes fade { from { transform: translateY(6px); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) { .screen, .grow { animation: none !important; } }

.pad { padding: 20px; }

/* 위쪽 머리 */
.top {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: calc(12px + env(safe-area-inset-top)) 0 8px;
  min-height: 64px;
}
.top .grow-1 { flex: 1; min-width: 0; }
.brand {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -.01em;
  margin: 0;
  line-height: 1.3;
}
.brand-sub { margin: 0; font-size: 13px; color: var(--ink-2); }

.icon-btn {
  min-width: 44px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.icon-btn svg { width: 18px; height: 18px; flex: none; }
.icon-btn.on { background: var(--ink); color: var(--cream); border-color: var(--ink); }
.back { border: 0; background: transparent; padding-left: 4px; font-size: 15px; }

h1, h2 { font-family: var(--serif); font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: 26px; line-height: 1.35; margin: 8px 0 6px; }
h2 { font-size: 20px; line-height: 1.4; margin: 20px 0 8px; }
.lead { font-size: 15px; color: var(--ink-2); margin: 0 0 12px; }
.small { font-size: 13px; color: var(--ink-2); }
.center { text-align: center; }
.mt-auto { margin-top: auto; }

/* 버튼 */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 54px;
  padding: 12px 18px;
  border: 0;
  border-radius: 16px;
  background: var(--ink);
  color: var(--cream);
  font: inherit;
  font-size: 17px;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: transform .08s ease, opacity .15s ease;
}
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .45; cursor: default; transform: none; }
.btn.accent { background: var(--accent); color: #fff; }
.btn.ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--ink); }
.btn.soft { background: var(--cream-2); color: var(--ink); }
.btn.big { min-height: 64px; font-size: 19px; }
.btn + .btn { margin-top: 10px; }
.btns { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.btns .btn + .btn { margin-top: 0; }
.btns.sticky {
  position: sticky;
  bottom: 0;
  z-index: 5;
  margin: 8px -20px 0;
  padding: 18px 20px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(rgba(246, 240, 228, 0), var(--cream) 22px);
}

.link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 8px;
  background: none;
  border: 0;
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.link.small { font-size: 13px; color: var(--ink-2); }

:focus-visible { outline: 3px solid var(--sun); outline-offset: 2px; }

/* 숲 첫 화면 */
.forest-art { margin: 4px -20px 0; }
.forest-art svg { display: block; width: 100%; height: auto; }
.example-note { margin: 2px 0 0; text-align: right; font-size: 12px; color: var(--ink-2); }
.motto {
  font-family: var(--serif);
  font-size: 21px;
  line-height: 1.55;
  text-align: center;
  margin: 18px 0 20px;
}

/* 내 나무 */
.tree-head { text-align: center; margin-top: 4px; }
.tree-name { font-family: var(--serif); font-size: 26px; font-weight: 700; margin: 0; line-height: 1.3; }
.tree-meta { display: flex; justify-content: center; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 6px; font-size: 15px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 30px; padding: 2px 12px;
  border-radius: 999px; font-size: 14px; font-weight: 500;
  background: var(--leaf-l); color: var(--leaf-d);
}
.pill.spring { background: #E7F1DC; color: #2F5A2A; }
.pill.summer { background: #D7E8DC; color: #1E4A36; }
.pill.autumn { background: #F6E3C8; color: #7A4313; }
.pill.winter { background: #E6E9EC; color: #33434F; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }

.tree-art { margin: 6px auto 0; width: 100%; max-width: min(300px, 31vh); }
.tree-art svg { display: block; width: 100%; height: auto; }
.grow { animation: grow .6s ease; transform-origin: 50% 90%; }
@keyframes grow { 0% { transform: scale(.96); } 60% { transform: scale(1.03); } 100% { transform: none; } }

.season-line { text-align: center; font-size: 14px; color: var(--ink-2); margin: 0; }
.tree-motto { font-family: var(--serif); text-align: center; font-size: 18px; margin: 10px 0 4px; }
.progress { text-align: center; font-size: 13px; color: var(--ink-2); margin: 0 0 14px; }

.bloom-note {
  background: #FBE7EA; color: #7A2E3B; border-radius: 14px;
  padding: 10px 14px; text-align: center; font-size: 14px; margin: 8px 0 0;
}

.actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.act {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px;
  min-height: 108px;
  padding: 12px 4px;
  border-radius: var(--radius);
  border: 0;
  font: inherit;
  color: var(--ink);
  cursor: pointer;
  transition: transform .08s ease;
}
.act:active { transform: scale(.97); }
.act svg { width: 30px; height: 30px; margin-bottom: 4px; }
.act b { font-size: 16px; }
.act span { font-size: 12px; color: var(--ink-2); line-height: 1.35; }
.act.f { background: var(--soil-l); }
.act.s { background: var(--sun-l); }
.act.w { background: var(--water-l); }

.inbox {
  display: flex; align-items: center; gap: 10px; width: 100%;
  margin: 0 0 12px; padding: 12px 14px; min-height: 56px;
  background: var(--paper); border: 1.5px dashed var(--accent);
  border-radius: 16px; font: inherit; color: var(--ink); text-align: left; cursor: pointer;
}
.inbox b { color: var(--accent); }

.under { display: flex; flex-direction: column; align-items: center; gap: 2px; margin-top: 14px; }
.notify { display: flex; flex-direction: column; align-items: center; margin-top: 8px; }
.notify .small { margin-top: -6px; font-size: 12px; }

/* 문구 고르기 */
.choices { display: flex; flex-direction: column; gap: 8px; margin: 4px 0 0; padding: 0; list-style: none; }
.choice {
  width: 100%; min-height: 52px; padding: 12px 16px;
  border-radius: 14px; border: 1.5px solid var(--line);
  background: var(--paper); color: var(--ink);
  font: inherit; font-size: 15px; text-align: left; cursor: pointer;
  display: flex; align-items: center; gap: 10px;
}
.choice::before {
  content: ""; flex: none; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--line); background: var(--paper);
}
.choice[aria-pressed="true"] { border-color: var(--ink); background: #F1F4EC; }
.choice[aria-pressed="true"]::before { border-color: var(--ink); background: radial-gradient(circle, var(--ink) 45%, transparent 50%); }

.field { margin-top: 14px; }
.field label { display: block; font-weight: 500; margin-bottom: 6px; }
textarea, input[type="date"], input[type="text"] {
  width: 100%;
  min-height: 52px;
  padding: 12px 14px;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 16px;
}
textarea { min-height: 96px; resize: vertical; }
textarea:focus, input:focus { border-color: var(--ink); outline: none; box-shadow: 0 0 0 3px rgba(227, 167, 47, .45); }
.count { text-align: right; font-size: 12px; color: var(--ink-2); margin-top: 4px; }

.box {
  background: var(--paper);
  border-radius: var(--radius);
  padding: 16px;
  border: 1px solid var(--line);
}
.box + .box { margin-top: 12px; }
.name-box { text-align: center; }
.name-box .tree-name { font-size: 28px; margin: 4px 0 8px; }

.hint { background: var(--cream-2); border-radius: 14px; padding: 12px 14px; font-size: 14px; margin: 12px 0 0; }
.hint b { font-weight: 700; }

/* 물 주기 */
.stage-tag { display: inline-block; font-size: 13px; font-weight: 500; color: var(--water); background: var(--water-l); border-radius: 999px; padding: 4px 12px; }
.mission {
  background: var(--paper); border-radius: 22px; padding: 24px 20px; margin-top: 12px;
  border: 1px solid var(--line); text-align: center;
  box-shadow: 0 6px 20px rgba(31, 58, 51, .07);
}
.mission .date { font-size: 13px; color: var(--ink-2); }
.mission p.m { font-family: var(--serif); font-size: 22px; line-height: 1.5; margin: 10px 0 4px; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 16px; }
.pair button {
  min-height: 64px; border-radius: 16px; border: 1.5px solid var(--water);
  background: var(--paper); color: var(--ink); font: inherit; font-size: 15px; cursor: pointer;
}
.pair button[aria-pressed="true"] { background: var(--water); color: #fff; }

/* 기다리는 마음 */
.wait-list { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.wait-btn {
  display: flex; align-items: center; gap: 14px;
  width: 100%; min-height: 76px; padding: 14px 18px;
  border: 0; border-radius: var(--radius);
  font: inherit; color: var(--ink); text-align: left; cursor: pointer;
  transition: transform .08s ease;
}
.wait-btn:active { transform: scale(.98); }
.wait-btn svg { width: 34px; height: 34px; flex: none; }
.wait-btn b { display: block; font-size: 19px; line-height: 1.3; }
.wait-btn span span { display: block; font-size: 14px; color: var(--ink-2); }
.wait-btn.f { background: var(--soil-l); }
.wait-btn.s { background: var(--sun-l); }
.wait-btn.w { background: var(--water-l); }
.box a { color: var(--ink); font-weight: 700; }

/* 받는 사람 */
.gift { text-align: center; padding-top: 8px; }
.gift .from { font-size: 15px; color: var(--ink-2); margin: 0; }
.gift .from b { color: var(--ink); }
.gift h1 { margin-top: 2px; }
.quote {
  position: relative;
  background: var(--paper);
  border-radius: 22px;
  padding: 26px 22px;
  margin: 14px 0 6px;
  font-family: var(--serif);
  font-size: 21px;
  line-height: 1.6;
  text-align: center;
  white-space: pre-wrap;
  border: 1px solid var(--line);
}
.quote.s { border-top: 5px solid var(--sun); }
.quote.f { border-top: 5px solid var(--soil); }
.quote.w { border-top: 5px solid var(--water); }
.gift-ico svg { width: 64px; height: 64px; }

/* 공유 카드 */
.card-wrap { margin: 8px auto 0; width: 100%; max-width: 340px; }
.card-wrap img { display: block; width: 100%; height: auto; border-radius: 18px; box-shadow: 0 10px 30px rgba(31, 58, 51, .16); background: var(--paper); -webkit-touch-callout: default; }
.card-loading { aspect-ratio: 4 / 5; border-radius: 18px; background: var(--cream-2); display: flex; align-items: center; justify-content: center; color: var(--ink-2); }

/* 링크 상자 */
.linkbox { display: flex; gap: 8px; margin-top: 10px; }
.linkbox input { flex: 1; min-width: 0; font-size: 14px; }
.linkbox .btn { width: auto; min-height: 52px; font-size: 15px; padding: 0 16px; }

/* 메신저 안내 */
.inapp {
  margin: 0;
  padding: calc(12px + env(safe-area-inset-top)) 20px 12px;
  background: #FFF4D6;
  border-bottom: 1px solid #EAD9A6;
  font-size: 14px;
}
.inapp b { font-weight: 700; }
.inapp ul { margin: 6px 0 8px; padding-left: 18px; }
.inapp li { margin: 2px 0; }
.inapp .row { display: flex; gap: 8px; }
.inapp .row .btn { min-height: 46px; font-size: 15px; }
.inapp .row .btn.soft { background: #F3E6BF; }
.inapp + .top { padding-top: 8px; }
.inapp details summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; }
.steps { margin: 4px 0 8px; padding-left: 20px; }

/* 아래 출처 */
.foot {
  margin-top: 24px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--ink-2);
  text-align: center;
}
.foot a { color: inherit; display: inline-block; padding: 13px 2px; margin: -13px 0; }   /* 누르는 칸 44px 이상, 줄 간격은 그대로 */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translate(-50%, 20px);
  max-width: min(390px, calc(100vw - 32px));
  background: var(--ink);
  color: var(--cream);
  padding: 12px 18px;
  border-radius: 14px;
  font-size: 15px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  z-index: 20;
  text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
