/* 디자인 값은 여기 :root 에 모여 있습니다. 디자인 가이드를 받으면 이 부분부터 바꿉니다. */
:root {
  --bg: #F2F4EF;
  --surface: #FFFFFF;
  --sunken: #E8ECE5;
  --line: #DCE1D8;
  --ink: #1C2320;
  --muted: #66706A;
  --accent: #FFCE3A;
  --accent-ink: #2A2100;
  --green: #2C7A57;
  --green-soft: #E1EFE7;
  --heart: #E5484D;
  --danger: #C8332F;
  --sun: #D9534F;
  --sat: #3B6FB6;
  --radius: 14px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Pretendard Variable", Pretendard, -apple-system, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  overscroll-behavior-y: none;
  word-break: keep-all;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
a { color: var(--green); }
:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }

#app { max-width: 560px; margin: 0 auto; min-height: 100dvh; }
.screen { padding: calc(var(--safe-t) + 12px) 16px calc(var(--safe-b) + 88px); }

/* 버튼·입력 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 48px; padding: 0 18px; border-radius: 12px;
  background: var(--accent); color: var(--accent-ink); font-weight: 700; text-decoration: none;
}
.btn:disabled { opacity: .55; cursor: default; }
.btn.ghost { background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); font-weight: 600; }
.btn.danger { background: var(--surface); color: var(--danger); box-shadow: inset 0 0 0 1px currentColor; font-weight: 600; }
.btn.small { min-height: 38px; padding: 0 12px; font-size: 14px; border-radius: 10px; }
.btn.full { width: 100%; }
.btn-row { display: flex; gap: 8px; }
.btn-row .btn { flex: 1; }
.link { color: var(--muted); font-size: 14px; text-decoration: underline; text-underline-offset: 3px; min-height: 32px; }

.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 14px; color: var(--muted); margin-bottom: 6px; }
.field input, .field textarea, .field select, .search-input {
  width: 100%; min-height: 48px; padding: 11px 13px; font-size: 16px;
  border-radius: 12px; border: 1px solid var(--line); background: var(--surface);
}
.field textarea { min-height: 76px; resize: vertical; }
.field .hint { font-size: 13px; color: var(--muted); margin-top: 4px; }
.error { color: var(--danger); font-size: 14px; margin-bottom: 12px; }

.choice { display: flex; flex-wrap: wrap; gap: 6px; }
.choice button {
  min-height: 36px; padding: 0 12px; border-radius: 18px; font-size: 14px;
  background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); color: var(--muted);
}
.choice button[aria-pressed="true"] { background: var(--ink); color: var(--surface); box-shadow: none; }

details.more { margin: 4px 0 16px; border-top: 1px solid var(--line); }
details.more > summary { list-style: none; cursor: pointer; padding: 14px 0; font-weight: 600; color: var(--green); }
details.more > summary::-webkit-details-marker { display: none; }
details.more[open] > summary { color: var(--muted); }

/* 로그인 */
.auth { padding: calc(var(--safe-t) + 64px) 24px 32px; }
.wordmark { font-size: 44px; font-weight: 800; letter-spacing: -.04em; line-height: 1.1; }
.wordmark i { font-style: normal; color: var(--green); }
.auth > p { color: var(--muted); margin: 8px 0 32px; }
.auth .link { display: block; margin: 14px auto 0; }

/* 상단 */
.top { display: flex; align-items: center; gap: 2px; position: relative; min-height: 48px; }
.top .grow { flex: 1; }
.month-btn {
  font-size: 24px; font-weight: 800; letter-spacing: -.03em; line-height: 1.2;
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px;
}
.month-btn svg { width: 14px; height: 14px; transition: transform .15s; }
.month-btn[aria-expanded="true"] svg { transform: rotate(180deg); }
.icon-btn { width: 40px; height: 44px; display: grid; place-items: center; color: var(--ink); border-radius: 10px; }
.icon-btn svg { width: 21px; height: 21px; }
.page-title { font-size: 24px; font-weight: 800; letter-spacing: -.03em; }

.picker {
  position: absolute; top: 50px; left: 0; z-index: 20; width: 248px; padding: 12px;
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 12px 28px rgba(28, 35, 32, .14);
}
.picker select { min-height: 46px; width: 100%; padding: 0 8px; font-size: 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); }
.summary { font-size: 14px; color: var(--muted); margin: 0 2px 12px; }
.summary b { color: var(--ink); font-variant-numeric: tabular-nums; }

/* 홈 카드: 1년 전 오늘, 추천 */
.cards { display: grid; gap: 8px; margin-bottom: 14px; }
.card-row {
  display: flex; gap: 12px; align-items: center; width: 100%; text-align: left;
  padding: 10px; border-radius: var(--radius); background: var(--surface);
}
.card-row .pic { flex: none; width: 60px; height: 60px; border-radius: 10px; object-fit: cover; background: var(--sunken); }
.card-row .pic.blank { display: grid; place-items: center; font-size: 22px; font-weight: 800; color: var(--green); }
.card-row .body { flex: 1; min-width: 0; }
.card-row .eyebrow { font-size: 13px; color: var(--green); font-weight: 600; }
.card-row .title { font-size: 17px; font-weight: 700; line-height: 1.35; overflow-wrap: anywhere; }
.card-row .sub { font-size: 13px; color: var(--muted); }
.card-row .actions { display: flex; gap: 14px; margin-top: 2px; }
.card-row .actions button { font-size: 14px; font-weight: 600; min-height: 30px; color: var(--green); }
.card-row .actions button + button { color: var(--muted); }

/* 달력 */
.weekdays, .days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.weekdays { font-size: 12px; color: var(--muted); text-align: center; margin-bottom: 4px; }
.weekdays :first-child { color: var(--sun); }
.weekdays :last-child { color: var(--sat); }
.cal-frame { overflow: hidden; touch-action: pan-y; background: var(--surface); border-radius: var(--radius); padding: 8px 4px; }
.days { gap: 3px; will-change: transform; }
.day {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  min-height: 76px; padding: 3px 2px 4px; border-radius: 9px;
  font-size: 13px; font-variant-numeric: tabular-nums;
}
.day.sun .num { color: var(--sun); }
.day.sat .num { color: var(--sat); }
.day.blank { pointer-events: none; }
.num { width: 24px; height: 22px; line-height: 22px; text-align: center; border-radius: 7px; }
.day.today .num { background: var(--ink); color: var(--surface); font-weight: 700; }
.thumb-wrap { position: relative; width: 100%; }
.thumb { width: 100%; aspect-ratio: 1; border-radius: 7px; object-fit: cover; display: block; background: var(--sunken); }
.thumb.text {
  display: grid; place-items: center; padding: 2px; overflow: hidden; background: var(--green-soft); color: var(--green);
  font-size: 11px; font-weight: 600; line-height: 1.2; text-align: center; overflow-wrap: anywhere;
}
.more-badge {
  position: absolute; right: 2px; bottom: 2px; padding: 0 4px; border-radius: 5px;
  font-size: 10px; font-weight: 700; background: rgba(28, 35, 32, .78); color: #fff;
}

/* 하단 탭 */
.tabs {
  position: fixed; left: 50%; bottom: 0; transform: translateX(-50%); z-index: 10;
  width: 100%; max-width: 560px; display: flex;
  padding-bottom: var(--safe-b); background: var(--surface); border-top: 1px solid var(--line);
}
.tab { flex: 1; height: 58px; color: var(--muted); font-size: 15px; font-weight: 600; }
.tab[aria-current="page"] { color: var(--ink); font-weight: 800; }
.tab[aria-current="page"]::after { content: ""; display: block; width: 18px; height: 3px; border-radius: 2px; background: var(--green); margin: 3px auto 0; }

/* 시트 */
#sheet {
  width: 100%; max-width: 560px; max-height: 90dvh; margin: auto auto 0; padding: 0;
  border: 0; border-radius: 22px 22px 0 0; background: var(--bg); color: var(--ink); overflow-y: auto;
}
#sheet::backdrop { background: rgba(28, 35, 32, .45); }
#sheet[open] { animation: rise .22s ease-out; }
@keyframes rise { from { transform: translateY(28px); opacity: .4; } }
.sheet-body { padding: 18px 16px calc(var(--safe-b) + 18px); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.sheet-head h2 { font-size: 20px; font-weight: 800; letter-spacing: -.02em; overflow-wrap: anywhere; }
.sheet-sub { color: var(--muted); margin: -8px 0 14px; font-size: 15px; }

/* 기록 상세 */
.entry { background: var(--surface); border-radius: var(--radius); margin-bottom: 12px; overflow: hidden; }
.strip { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.strip::-webkit-scrollbar { display: none; }
.strip button { flex: none; width: 100%; scroll-snap-align: start; position: relative; }
.strip img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; background: var(--sunken); }
.strip-count {
  position: absolute; right: 10px; top: 10px; padding: 2px 8px; border-radius: 10px;
  background: rgba(28, 35, 32, .7); color: #fff; font-size: 12px; font-weight: 600;
}
.entry-body { padding: 14px; }
.entry-title { font-size: 19px; font-weight: 800; letter-spacing: -.02em; overflow-wrap: anywhere; }
.entry-place { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; margin-top: 2px; color: var(--muted); }
.entry-place b { color: var(--ink); font-weight: 600; overflow-wrap: anywhere; }
.place-link {
  display: inline-flex; align-items: center; min-height: 28px; padding: 0 10px; border-radius: 14px;
  background: var(--green-soft); color: var(--green); font-size: 13px; font-weight: 700; text-decoration: none;
}
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.tag { padding: 3px 9px; border-radius: 8px; background: var(--sunken); font-size: 13px; color: var(--ink); }
.entry-note { margin-top: 10px; white-space: pre-wrap; overflow-wrap: anywhere; }
.entry-addr { margin-top: 6px; font-size: 14px; color: var(--muted); }

.react { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.heart-btn { display: inline-flex; align-items: center; gap: 5px; min-height: 36px; padding: 0 12px; border-radius: 18px; box-shadow: inset 0 0 0 1px var(--line); font-size: 14px; font-weight: 600; }
.heart-btn svg { width: 18px; height: 18px; }
.heart-btn[aria-pressed="true"] { color: var(--heart); box-shadow: inset 0 0 0 1px currentColor; }
.heart-btn[aria-pressed="true"] svg path { fill: currentColor; }
.revisit { display: inline-flex; border-radius: 18px; box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; }
.revisit button { min-height: 36px; padding: 0 12px; font-size: 14px; color: var(--muted); }
.revisit button[aria-pressed="true"] { background: var(--green); color: #fff; font-weight: 600; }
.react-note { width: 100%; font-size: 13px; color: var(--muted); }

.comments { margin-top: 12px; }
.comment { display: flex; gap: 8px; align-items: baseline; padding: 4px 0; font-size: 15px; }
.comment b { flex: none; font-weight: 700; }
.comment span { flex: 1; overflow-wrap: anywhere; }
.comment button { flex: none; font-size: 12px; color: var(--muted); min-height: 28px; }
.comment-form { display: flex; gap: 6px; margin-top: 6px; }
.comment-form input { flex: 1; min-width: 0; min-height: 42px; padding: 8px 12px; border-radius: 21px; border: 1px solid var(--line); background: var(--bg); font-size: 16px; }
.comment-form .btn { min-height: 42px; border-radius: 21px; }

.entry-foot { display: flex; align-items: center; gap: 14px; margin-top: 10px; font-size: 13px; color: var(--muted); }
.entry-foot .grow { flex: 1; }
.entry-foot button { min-height: 34px; font-size: 14px; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.entry-foot button.del { color: var(--danger); }

/* 사진 입력 */
.photo-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-bottom: 16px; }
.photo-cell { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--sunken); }
.photo-cell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-cell .x {
  position: absolute; top: 3px; right: 3px; width: 26px; height: 26px; border-radius: 13px;
  background: rgba(28, 35, 32, .75); color: #fff; font-size: 16px; line-height: 26px; text-align: center;
}
.photo-cell .cover { position: absolute; left: 4px; bottom: 4px; padding: 0 5px; border-radius: 5px; background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 700; }
.photo-add {
  display: grid; place-items: center; aspect-ratio: 1; border-radius: 10px; cursor: pointer;
  border: 1.5px dashed var(--line); background: var(--surface); color: var(--muted); font-size: 13px; text-align: center; line-height: 1.3;
}
.photo-add:focus-within { outline: 2px solid var(--green); outline-offset: 2px; }
.photo-add input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.loc-box { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }
.loc-box span { flex: 1; font-size: 15px; color: var(--muted); overflow-wrap: anywhere; }
.loc-box span.set { color: var(--ink); }

/* 사진 뷰어 */
#viewer {
  position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 0; border: 0;
  background: #0E1210; color: #fff; flex-direction: column; overflow: hidden;
}
#viewer[open] { display: flex; }
#viewer::backdrop { background: #0E1210; }
.viewer-top { display: flex; align-items: center; justify-content: space-between; padding: calc(var(--safe-t) + 8px) 8px 8px 16px; }
.viewer-top button { width: 44px; height: 44px; display: grid; place-items: center; color: #fff; font-size: 26px; }
.viewer-strip { flex: 1; display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.viewer-strip::-webkit-scrollbar { display: none; }
.viewer-strip figure { flex: none; width: 100%; height: 100%; margin: 0; scroll-snap-align: center; display: flex; flex-direction: column; justify-content: center; }
.viewer-strip img { width: 100%; max-height: calc(100dvh - 150px); object-fit: contain; }
.viewer-strip figcaption { padding: 12px 16px calc(var(--safe-b) + 16px); font-size: 14px; color: #C9D1CC; }
.viewer-strip figcaption button { color: #fff; text-decoration: underline; text-underline-offset: 3px; margin-left: 6px; font-size: 14px; }

/* 앨범 */
.album-month { font-size: 15px; font-weight: 700; margin: 18px 2px 8px; }
.album-month:first-of-type { margin-top: 8px; }
.album-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 3px; }
.album-grid button img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; background: var(--sunken); }

/* 맛집 */
.seg { display: flex; padding: 3px; border-radius: 12px; background: var(--sunken); margin: 8px 0 14px; }
.seg button { flex: 1; min-height: 40px; border-radius: 9px; font-size: 15px; font-weight: 600; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(28, 35, 32, .12); }
.roulette-btn { width: 100%; margin-bottom: 14px; }
.place {
  display: flex; gap: 12px; align-items: center; width: 100%; text-align: left;
  padding: 10px; margin-bottom: 8px; border-radius: var(--radius); background: var(--surface);
}
.place .pic { flex: none; width: 64px; height: 64px; border-radius: 10px; object-fit: cover; background: var(--sunken); }
.place .pic.blank { display: grid; place-items: center; font-size: 22px; font-weight: 800; color: var(--green); background: var(--green-soft); }
.place .body { flex: 1; min-width: 0; }
.place h3 { font-size: 17px; font-weight: 700; overflow-wrap: anywhere; }
.place p { font-size: 14px; color: var(--muted); overflow-wrap: anywhere; }
.place .again { color: var(--green); font-weight: 600; }
.wish.done { opacity: .6; }
.wish .side { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.section-label { font-size: 14px; color: var(--muted); font-weight: 600; margin: 18px 2px 8px; }
.empty { color: var(--muted); padding: 34px 8px; text-align: center; }
.visit { display: flex; gap: 10px; align-items: center; width: 100%; text-align: left; padding: 8px 0; border-bottom: 1px solid var(--line); }
.visit img, .visit .pic { flex: none; width: 48px; height: 48px; border-radius: 8px; object-fit: cover; background: var(--sunken); }
.visit .body { flex: 1; min-width: 0; font-size: 15px; }
.visit .body small { display: block; color: var(--muted); font-size: 13px; }

.map { height: calc(100dvh - 260px); min-height: 320px; border-radius: var(--radius); overflow: hidden; background: var(--sunken); }
.map.small { height: 300px; min-height: 0; }
.map-legend { display: flex; gap: 14px; font-size: 13px; color: var(--muted); margin-top: 8px; }
.map-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 5px; margin-right: 5px; vertical-align: 0; }
.leaflet-popup-content { font-family: inherit; font-size: 14px; margin: 10px 12px; }
.leaflet-popup-content b { display: block; font-size: 15px; }
.geo-results { list-style: none; margin: 0 0 10px; padding: 0; }
.geo-results button { width: 100%; text-align: left; padding: 9px 4px; border-bottom: 1px solid var(--line); font-size: 14px; }

/* 룰렛 */
.slot {
  display: grid; place-items: center; min-height: 128px; margin: 6px 0 16px; padding: 16px;
  border-radius: var(--radius); background: var(--surface); text-align: center;
  font-size: 26px; font-weight: 800; letter-spacing: -.02em; overflow-wrap: anywhere;
}
.slot.spinning { color: var(--muted); }
.slot small { display: block; font-size: 14px; font-weight: 500; color: var(--muted); letter-spacing: 0; }

/* 검색 */
.search-input { margin-bottom: 10px; }

/* 통계 */
.stats-head { display: flex; align-items: center; justify-content: space-between; min-height: 48px; }
.stats-head select { min-height: 42px; padding: 0 8px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); }
.recap { padding: 18px; margin: 10px 0 22px; border-radius: var(--radius); background: var(--ink); color: #fff; }
.recap .big { font-size: 24px; font-weight: 800; letter-spacing: -.03em; line-height: 1.35; }
.recap .big b { color: var(--accent); }
.recap ul { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 6px; font-size: 15px; color: #D5DCD7; }
.recap ul b { color: #fff; }
.section { margin-bottom: 28px; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin: 0 2px 10px; }
.section h2 { font-size: 16px; font-weight: 700; }
.mini-seg { display: flex; border-radius: 9px; background: var(--sunken); padding: 2px; }
.mini-seg button { min-height: 32px; padding: 0 10px; border-radius: 7px; font-size: 13px; color: var(--muted); }
.mini-seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); font-weight: 600; }
.readout { min-height: 22px; font-size: 14px; margin: 0 2px 6px; font-variant-numeric: tabular-nums; color: var(--muted); }
.readout b { color: var(--ink); }
.chart { background: var(--surface); border-radius: var(--radius); padding: 14px 8px 8px; }
.bars { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); height: 150px; align-items: end; border-bottom: 1px solid var(--line); }
.bar-hit { height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; }
.bar { width: 62%; max-width: 20px; background: #A9BFB2; border-radius: 4px 4px 0 0; }
.bar-hit.peak .bar { background: var(--green); }
.bar-hit.active .bar { box-shadow: 0 0 0 2px var(--ink); }
.bar-val { font-size: 11px; font-weight: 700; margin-bottom: 2px; white-space: nowrap; }
.axis { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); text-align: center; font-size: 11px; color: var(--muted); margin-top: 4px; }
.rank { list-style: none; margin: 0; padding: 4px 12px; background: var(--surface); border-radius: var(--radius); }
.rank li { display: grid; grid-template-columns: 22px 1fr auto; gap: 2px 8px; align-items: baseline; padding: 8px 0; }
.rank .pos { color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; }
.rank .name { overflow-wrap: anywhere; font-weight: 600; }
.rank .cnt { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 14px; }
.rank .meter { grid-column: 2 / 4; height: 6px; border-radius: 3px; background: var(--sunken); overflow: hidden; }
.rank .meter i { display: block; height: 100%; border-radius: 3px; background: #A9BFB2; }
.rank li:first-child .meter i { background: var(--green); }

#toast {
  position: fixed; left: 50%; bottom: calc(var(--safe-b) + 76px); transform: translateX(-50%); z-index: 300;
  max-width: 88vw; padding: 10px 15px; border-radius: 11px; background: var(--ink); color: #fff;
  font-size: 15px; font-weight: 600; opacity: 0; pointer-events: none; transition: opacity .2s;
}
#toast.show { opacity: 1; }
.loading { padding-top: 40dvh; text-align: center; color: var(--muted); }

@media (min-width: 480px) { .day { min-height: 90px; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
