/* ===== 취향 아카이브 ===== */
/* 기본은 라이트(차가운 순백). 다크는 data-theme="dark", 또는 "system"이면서 기기가 다크일 때 */
:root {
  --bg: #ffffff;
  --ink: #0a0b0d;
  --ink-2: rgba(10, 11, 13, .56);
  --ink-3: rgba(10, 11, 13, .32);
  --ink-4: rgba(10, 11, 13, .12);
  --hair: rgba(10, 11, 13, .1);
  --rule: #0a0b0d;
  --surface-2: #f1f3f5;
  --band: #f4f5f7;
  --press: rgba(10, 11, 13, .04);
  --bar: rgba(255, 255, 255, .9);
  --glass: rgba(236, 239, 243, .42);
  --danger: #e03131;
  --ph: #141518;
  --r: 4px;
  --font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  --serif: "Nanum Myeongjo", "AppleMyungjo", "Noto Serif KR", Georgia, "Times New Roman", serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0b0c0e; --ink: #f2f4f7; --ink-2: rgba(242,244,247,.58); --ink-3: rgba(242,244,247,.42); --ink-4: rgba(242,244,247,.14);
  --hair: rgba(242,244,247,.1); --rule: #f2f4f7; --surface-2: #1a1c20; --band: #141619; --press: rgba(242,244,247,.05);
  --bar: rgba(11,12,14,.9); --glass: rgba(60,64,72,.35); --danger: #ff6b6b; --ph: #23262c;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] {
    --bg: #0b0c0e; --ink: #f2f4f7; --ink-2: rgba(242,244,247,.58); --ink-3: rgba(242,244,247,.42); --ink-4: rgba(242,244,247,.14);
    --hair: rgba(242,244,247,.1); --rule: #f2f4f7; --surface-2: #1a1c20; --band: #141619; --press: rgba(242,244,247,.05);
    --bar: rgba(11,12,14,.9); --glass: rgba(60,64,72,.35); --danger: #ff6b6b; --ph: #23262c;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); height: 100%; overflow: hidden; overscroll-behavior: none; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.5; letter-spacing: -.02em;
  -webkit-font-smoothing: antialiased; height: 100dvh; overflow: hidden; overscroll-behavior: none; display: flex; flex-direction: column;
}
button, input, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
html, body, button, input, textarea, label, dialog { touch-action: manipulation; }
body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
textarea, input { -webkit-user-select: text; user-select: text; }
button { cursor: pointer; }
[hidden] { display: none !important; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.spacer { flex: 1; }
.textbtn { border: 0; background: none; height: 40px; padding: 0 8px; font-size: 15px; font-weight: 500; color: var(--ink-2); }
.textbtn.strong { color: var(--ink); font-weight: 700; }
.textbtn:disabled { opacity: .35; }
.icon-btn {
  width: 40px; height: 40px; border: 0; border-radius: var(--r); background: transparent; color: var(--ink);
  display: inline-grid; place-items: center; transition: background .15s;
}
.icon-btn:active { background: var(--press); }
.icon-btn:disabled { opacity: .25; }

/* ---- 넘기는 영역 ---- */
.view { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; scrollbar-width: none; }
.view::-webkit-scrollbar { display: none; }
.wrap { max-width: 720px; margin: 0 auto; padding: 0 20px; }

/* ---- 머리: 이름 + 분류 (위에 붙어 있어요) ---- */
.top { position: sticky; top: 0; z-index: 5; background: var(--bg); padding-top: env(safe-area-inset-top); }
.top-row { display: flex; align-items: center; height: 52px; margin-right: -10px; }
.brand { font-family: "Dela Gothic One", "Arial Black", var(--font); font-weight: 400; font-size: 20px; line-height: 1; letter-spacing: .04em; font-synthesis: none; }
/* 다크 모드에서만 라임 포인트: 타이틀 · 숫자 · 별 */
:root[data-theme="dark"] .brand,
:root[data-theme="dark"] .sec[aria-selected="true"] sup,
:root[data-theme="dark"] .coll-name em,
:root[data-theme="dark"] .row-rate svg,
:root[data-theme="dark"] .dt-rate .stars,
:root[data-theme="dark"] .rate { color: #c6f45f; }
@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] .brand,
  :root[data-theme="system"] .sec[aria-selected="true"] sup,
  :root[data-theme="system"] .coll-name em,
  :root[data-theme="system"] .row-rate svg,
  :root[data-theme="system"] .dt-rate .stars,
  :root[data-theme="system"] .rate { color: #c6f45f; }
}
.sections {
  display: flex; gap: 22px; margin: 0 -20px; padding: 0 20px; overflow-x: auto; scrollbar-width: none;
  border-bottom: 1px solid var(--hair);
}
.sections::-webkit-scrollbar { display: none; }
.sec {
  flex: none; position: relative; border: 0; background: none; padding: 9px 0 11px; font-size: 15px; font-weight: 600;
  color: var(--ink-3); transition: color .15s;
}
.sec sup { margin-left: 2px; font-size: 10px; font-weight: 600; vertical-align: 6px; line-height: 0; font-variant-numeric: tabular-nums; }
.sec[aria-selected="true"] { color: var(--ink); }
.sec[aria-selected="true"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--ink); }
.searchbar { display: flex; align-items: center; gap: 6px; padding: 8px 0 10px; border-bottom: 1px solid var(--hair); }
.searchbar input {
  flex: 1; min-width: 0; height: 38px; border: 0; border-radius: 0; background: transparent; padding: 0; font-size: 16px; outline: none;
}
.searchbar input::placeholder { color: var(--ink-3); }
.searchbar input::-webkit-search-cancel-button { -webkit-appearance: none; }
.content { padding: 20px 0 calc(56px + env(safe-area-inset-bottom)); }

/* 별 (글자색을 따라가요) */
.stars { --s: 12px; position: relative; display: inline-flex; flex: none; line-height: 0; }
.stars svg { width: var(--s); height: var(--s); stroke: none; flex: none; }
.s-bg, .s-fg { display: flex; gap: var(--g, 0px); }
.s-bg svg { fill: currentColor; opacity: .18; }
.s-fg { position: absolute; inset: 0 auto 0 0; overflow: hidden; }
.s-fg svg { fill: currentColor; }
.row-rate { flex: none; display: inline-flex; align-items: center; gap: 2px; font-size: 12px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.row-rate svg { width: 10px; height: 10px; fill: currentColor; stroke: none; }

/* ---- 표지: 사진, 없으면 제목만 조판한 회색 면 ---- */
.cover { position: relative; display: block; overflow: hidden; border-radius: 2px; background: var(--surface-2); container-type: inline-size; }
.cover::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 1px var(--hair); pointer-events: none; }
.cover > img { display: block; width: 100%; height: 100%; object-fit: cover; }
.ar-port { aspect-ratio: 4 / 5; }
.ar-tall, .ar-book { aspect-ratio: 2 / 3; }
.ar-sq { aspect-ratio: 1; }
.ar-wide { aspect-ratio: 3 / 2; }
.ph {
  position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-between; padding: 8cqw;
  background: linear-gradient(180deg, color-mix(in srgb, var(--ph) 88%, #fff) 0%, var(--ph) 55%); color: #f2f4f7;
  word-break: keep-all; overflow-wrap: anywhere; overflow: hidden;
}
.ph-top { display: flex; justify-content: space-between; gap: 6px; font-family: var(--mono); font-size: max(8px, 4.4cqw); letter-spacing: .06em; opacity: .5; white-space: nowrap; }
.ph-b { display: flex; flex-direction: column; gap: 1.6cqw; padding-top: 4.5cqw; border-top: 1px solid rgba(255,255,255,.16); }
.ph-t { font-size: max(11px, 8.2cqw); font-weight: 700; line-height: 1.24; letter-spacing: -.03em; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.ph-s { font-size: max(9px, 4.6cqw); opacity: .58; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ph-m { display: none; }
/* 아주 작은 표지에서는 첫 글자만 */
@container (max-width: 96px) {
  .ph { padding: 11cqw; align-items: flex-start; justify-content: flex-start; }
  .ph-top, .ph-b { display: none; }
  .ph-m { display: block; font-size: 36cqw; font-weight: 800; line-height: 1; letter-spacing: -.04em; opacity: .92; }
}
.thumb { position: relative; display: block; container-type: inline-size; width: 42px; aspect-ratio: 3 / 4; border-radius: 2px; overflow: hidden; background: var(--surface-2); flex: none; }
.thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.cover > img.ext, .thumb > img.ext { position: absolute; inset: 0; z-index: 1; background: var(--surface-2); }

/* ---- 맨 위 한 편 (가장 최근 기록) ---- */

.card:active .cover, .rail-card:active .cover { opacity: .82; }

/* ---- 홈: 컬렉션 인덱스 ---- */
.idx-h {
  display: flex; justify-content: space-between; align-items: baseline; padding-bottom: 9px; border-bottom: 1px solid var(--ink);
  font-family: var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink);
}
.idx-h span:last-child { color: var(--ink-2); text-transform: none; letter-spacing: 0; font-family: var(--font); font-size: 12px; }
.coll {
  width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 16px 0;
  border: 0; border-bottom: 1px solid var(--hair); background: none; color: var(--ink); text-align: left; transition: background .15s;
}
.coll:active { background: var(--press); }
.coll-name { display: flex; flex-wrap: wrap; align-items: flex-start; column-gap: 5px; min-width: 0; }
.coll-name b { font-size: 40px; font-weight: 800; line-height: .95; letter-spacing: -.055em; }
.coll-name em { font-style: normal; font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 1px; }
.coll-name small { flex-basis: 100%; margin-top: 8px; font-size: 12px; color: var(--ink-2); }
.coll-stack { position: relative; flex: none; width: 120px; height: 92px; }
.stk {
  position: absolute; transform: rotate(var(--r)); transform-origin: 50% 100%;
  box-shadow: 0 1px 2px rgba(0,0,0,.12), 0 10px 18px -9px rgba(0,0,0,.4); transition: transform .3s cubic-bezier(.2,.9,.3,1);
}
.coll:active .stk { transform: rotate(calc(var(--r) * 1.3)); }
/* ---- 빈 화면 ---- */
.ghost {
  position: absolute; display: flex; align-items: center; justify-content: center; border: 1px dashed var(--ink-3); border-radius: 2px;
  background: var(--bg); transform: rotate(var(--r)); transform-origin: 50% 100%;
}
.ghost + .ghost { opacity: .5; }
.ghost-plus { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.ghost .ghost-plus { color: var(--ink-2); }
.coll.is-empty .coll-name b { color: var(--ink-3); }
.coll.is-empty .coll-name em { color: var(--ink-3); }
.coll.is-empty .coll-name small { line-height: 1.5; word-break: keep-all; }
.welcome { margin-bottom: 44px; }
.welcome-h { margin: 30px 0 0; font-size: 34px; font-weight: 800; line-height: 1.14; letter-spacing: -.055em; word-break: keep-all; }
.welcome-p { margin: 14px 0 0; font-size: 14px; line-height: 1.6; color: var(--ink-2); }
.welcome-cta { display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; margin-top: 26px; }
.welcome-cta .ghost-plus { width: 16px; height: 16px; stroke-width: 2.2; }
.ghost-cover { border: 1px dashed var(--ink-4); background: none; display: flex; align-items: center; justify-content: center; }
.ghost-cover::after { display: none; }
.is-first .ghost-cover { border-color: var(--ink-3); color: var(--ink-2); transition: border-color .15s, color .15s; }
.is-first .ghost-plus { width: 24px; height: 24px; stroke-width: 1.4; }
.is-first:active .ghost-cover { border-color: var(--ink); color: var(--ink); }
.is-first .c-by { color: var(--ink-3); }
.ghost-line { display: block; height: 8px; margin-top: 8px; border-radius: 1px; background: var(--surface-2); }
.ghost-line + .ghost-line { margin-top: 7px; }
.ghost-line.short { width: 58%; }
.ghost-card:not(.is-first) { opacity: .75; }
.ghost-card:nth-child(3) { opacity: .45; }
.ghost-card:nth-child(4) { opacity: .25; }
/* 좁은 화면에서는 한 줄에 들어가는 만큼만 */
.ghost-grid:not(.g-book) > .ghost-card:nth-child(n+3) { display: none; }
.ghost-grid.g-book > .ghost-card:nth-child(n+4) { display: none; }
.ghost-grid.g-wide > .ghost-card:nth-child(n+2) { display: none; }
@media (min-width: 560px) {
  .ghost-grid > .ghost-card:nth-child(n+2) { display: flex; }
}
.ghost-msg { margin: 26px 0 0; padding-top: 14px; border-top: 1px solid var(--hair); font-size: 13px; line-height: 1.6; color: var(--ink-2); word-break: keep-all; }
.nores { padding: 36px 0 12px; border-top: 1px solid var(--ink); }
.nores b { display: block; font-size: 30px; font-weight: 800; line-height: 1.2; letter-spacing: -.05em; color: var(--ink-3); word-break: break-all; }
.nores p { margin: 10px 0 0; font-size: 14px; line-height: 1.6; color: var(--ink-2); }
.latest { margin-top: 44px; }
.rail { display: flex; gap: 12px; margin: 14px -20px 0; padding: 0 20px; overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding: 0 20px; scrollbar-width: none; }
.rail::-webkit-scrollbar { display: none; }
.rail-card { flex: none; width: 128px; scroll-snap-align: start; border: 0; background: none; padding: 0; color: var(--ink); text-align: left; display: flex; flex-direction: column; min-width: 0; }
.rail-card .cover { aspect-ratio: 4 / 5; margin-bottom: 9px; transition: opacity .15s; }
.rail-card b { font-size: 13.5px; font-weight: 700; line-height: 1.3; letter-spacing: -.03em; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: keep-all; overflow-wrap: anywhere; }
.rail-card small { margin-top: 3px; font-size: 11.5px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.recap-row {
  width: 100%; margin-top: 44px; padding: 15px 0; border: 0; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--hair);
  background: none; color: var(--ink); display: flex; align-items: center; gap: 10px; text-align: left;
}
.recap-row b { font-size: 15px; font-weight: 700; }
.recap-row span { flex: 1; text-align: right; font-size: 13px; color: var(--ink-2); }
.recap-row svg { width: 16px; height: 16px; color: var(--ink-2); }

/* ---- 목록 머리: 개수 + 정렬 ---- */
.lh { display: flex; align-items: center; justify-content: space-between; margin: 0 0 14px; font-size: 13px; font-weight: 500; color: var(--ink-2); }
.recap-row + .lh { margin-top: 34px; }
.sort { display: flex; align-items: center; margin-right: -4px; }
.sort button { border: 0; background: none; padding: 6px 4px; font-size: 13px; font-weight: 600; color: var(--ink-3); transition: color .15s; }
.sort button + button::before { content: "·"; margin-right: 8px; color: var(--ink-4); }
.sort button[aria-pressed="true"] { color: var(--ink); }

/* ---- 격자 ---- */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 30px 12px; }
.g-book { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 26px 10px; }
.g-wide { grid-template-columns: minmax(0, 1fr); gap: 36px; }
@media (min-width: 560px) {
  .g-port, .g-tall, .g-sq { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .g-book { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .g-wide { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.card { border: 0; background: none; padding: 0; color: var(--ink); text-align: left; display: flex; flex-direction: column; min-width: 0; }
.card .cover { margin-bottom: 10px; transition: opacity .15s; }
.c-kick { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: 11.5px; font-weight: 500; color: var(--ink-2); letter-spacing: 0; font-variant-numeric: tabular-nums; }
.c-kick > span:first-child { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c-title { margin-top: 4px; font-size: 15px; font-weight: 700; line-height: 1.3; letter-spacing: -.03em; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: keep-all; overflow-wrap: anywhere; }
.c-by { margin-top: 2px; font-size: 13px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c-note { margin-top: 8px; font-size: 14px; line-height: 1.6; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; word-break: keep-all; overflow-wrap: anywhere; }
.g-book .c-title { font-size: 13.5px; }
.g-book .c-kick, .g-book .c-by { font-size: 11px; }
.g-wide .c-title { font-size: 17px; }

/* ---- 전체 화면 페이지 (설정·결산은 오른쪽에서, 쓰기는 아래에서) ---- */
.page {
  position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 0; border: 0;
  background: var(--bg); color: var(--ink); overflow: hidden; touch-action: pan-y; box-shadow: -10px 0 30px rgba(0,0,0,.12);
}
.page[open] { animation: pageIn .34s cubic-bezier(.2,.9,.3,1); }
.page.leaving { animation: pageOut .22s cubic-bezier(.4,0,1,1) forwards; }
.page.up[open] { animation: upIn .34s cubic-bezier(.2,.9,.3,1); }
.page.up.leaving { animation: upOut .22s cubic-bezier(.4,0,1,1) forwards; }
@keyframes pageIn { from { transform: translateX(100%); } }
@keyframes pageOut { to { transform: translateX(100%); } }
@keyframes upIn { from { transform: translateY(100%); } }
@keyframes upOut { to { transform: translateY(100%); } }
.page::backdrop { background: rgba(0,0,0,.2); }
.page[open]::backdrop { animation: fadeIn .34s ease-out; }
.page.leaving::backdrop { animation: fadeOut .22s ease-in forwards; }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes fadeOut { to { opacity: 0; } }
.page-form { height: 100%; display: flex; flex-direction: column; }
.page-bar {
  flex: none; width: 100%; display: grid; grid-template-columns: 64px 1fr 64px; align-items: center;
  padding: calc(8px + env(safe-area-inset-top)) 12px 6px; border-bottom: 1px solid var(--hair);
}
.page-bar > :last-child { justify-self: end; }
/* 왼쪽 화살표와 오른쪽 글자 버튼이 본문과 같은 20px 선에 보이도록 */
.page-bar > .icon-btn:first-child { margin-left: -9px; }
.page-bar > .icon-btn:last-child { margin-right: -9px; }
.page-title { margin: 0; justify-self: center; padding: 6px 10px; font-size: 16px; font-weight: 700; line-height: 1.2; letter-spacing: -.02em; }
.page-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; }
.page-body::-webkit-scrollbar { display: none; }
.page-inner { max-width: 560px; margin: 0 auto; padding-bottom: calc(28px + env(safe-area-inset-bottom)); }

/* 설정 목록 */
.group { padding: 18px 0 10px; }
.group + .group { border-top: 8px solid var(--band); }
.group-label { margin: 0 20px 4px; font-size: 13px; font-weight: 600; color: var(--ink-2); letter-spacing: -.01em; }
.group-foot { margin: 6px 20px 4px; font-size: 12px; font-weight: 400; color: var(--ink-2); line-height: 1.6; }
.list-rows { display: flex; flex-direction: column; }
.srow {
  position: relative; width: 100%; min-height: 52px; display: flex; align-items: center; gap: 10px; padding: 0 20px; margin: 0;
  border: 0; background: transparent; color: var(--ink); text-align: left; font-size: 16px; transition: background .15s;
}
.srow + .srow::before { content: ""; position: absolute; top: 0; left: 20px; right: 0; height: 1px; background: var(--hair); }
button.srow:active { background: var(--press); }
.srow-label { flex: none; font-weight: 500; }
.srow-value { min-width: 0; font-size: 15px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: right; }
.srow .chev { flex: none; width: 16px; height: 16px; margin-right: -4px; color: var(--ink-3); }

/* 선으로 나눈 선택 버튼 */
.segmented { display: inline-flex; border: 1px solid var(--rule); border-radius: var(--r); overflow: hidden; }
.segmented button { border: 0; border-radius: 0; background: transparent; padding: 7px 13px; font-size: 13px; font-weight: 600; color: var(--ink); transition: background .15s, color .15s; }
.segmented button + button { border-left: 1px solid var(--rule); }
.segmented button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.segmented.wide { display: flex; width: 100%; }
.segmented.wide button { flex: 1; padding: 10px 0; font-size: 14px; }

/* ---- 상세 보기 ---- */
.page-bar.plain { border-bottom: 0; }
.dt { max-width: 640px; margin: 0 auto; padding-bottom: calc(48px + env(safe-area-inset-bottom)); }
.dt-photo { margin: 4px 0 0; }
.dt-photo:empty { display: none; }
.dt-photo img { display: block; width: 100%; height: auto; max-height: 72vh; object-fit: cover; }
.dt-main { padding: 0 20px; }
.dt-kick { margin: 24px 0 0; font-size: 12.5px; font-weight: 500; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.dt-title { margin: 8px 0 0; font-size: 30px; font-weight: 800; line-height: 1.2; letter-spacing: -.05em; word-break: keep-all; overflow-wrap: anywhere; }
.dt-by { margin: 8px 0 0; font-size: 16px; color: var(--ink-2); }
.dt-rate { display: flex; align-items: center; gap: 8px; margin-top: 18px; color: var(--ink); }
.dt-rate b { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.dt-rate .muted { font-size: 13px; color: var(--ink-3); }
.dt-note { margin: 28px 0 0; padding: 20px 0 0; border-top: 1px solid var(--ink); font-size: 18px; font-weight: 500; line-height: 1.7; letter-spacing: -.025em; word-break: keep-all; overflow-wrap: anywhere; white-space: pre-line; }
.dt-link {
  width: 100%; margin-top: 28px; padding: 14px 0; border: 0; border-top: 1px solid var(--hair); border-bottom: 1px solid var(--hair);
  background: none; color: var(--ink); display: flex; align-items: center; gap: 12px; text-align: left;
}
.dt-link span { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.dt-link b { font-size: 15px; font-weight: 700; }
.dt-link small { font-size: 12px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dt-link svg { flex: none; width: 18px; height: 18px; stroke-width: 2; }
.dt-link:active { opacity: .6; }
.dt-note + .dt-link { margin-top: 32px; }
.dt-foot { margin: 28px 0 0; font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }

/* ---- 쓰기 · 수정 ---- */
.ed { max-width: 560px; margin: 0 auto; padding: 0 20px calc(40px + env(safe-area-inset-bottom)); }
.ed-cats { display: flex; gap: 22px; margin: 0 -20px; padding: 0 20px; border-bottom: 1px solid var(--hair); overflow-x: auto; scrollbar-width: none; }
.ed-cats::-webkit-scrollbar { display: none; }
.ed-cats button { flex: none; position: relative; border: 0; background: none; padding: 12px 0 11px; font-size: 15px; font-weight: 600; color: var(--ink-3); transition: color .15s; }
.ed-cats button[aria-pressed="true"] { color: var(--ink); }
.ed-cats button[aria-pressed="true"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--ink); }
.ed-photo { position: relative; margin-top: 20px; }
.ed-cover { position: relative; display: block; width: 100%; height: 168px; border: 0; padding: 0; border-radius: 2px; overflow: hidden; background: var(--surface-2); color: var(--ink-2); }
.ed-cover.has { height: auto; background: none; }
.ed-cover img { display: block; width: 100%; height: auto; max-height: 56vh; object-fit: cover; }
.ed-cover-empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; font-size: 13px; font-weight: 600; }
.ed-cover-empty svg { width: 26px; height: 26px; stroke-width: 1.6; }
.ed-cover:active { opacity: .85; }
.ed-photo-x {
  position: absolute; right: 10px; bottom: 10px; border: 0; border-radius: 2px; padding: 7px 10px; background: rgba(10,11,13,.62); color: #fff;
  font-size: 12px; font-weight: 600; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.ed-photo-src { display: flex; justify-content: flex-end; margin-top: 4px; }
.ed-url { display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--hair); }
#edPhotoUrl { flex: 1; min-width: 0; min-height: 44px; border: 0; background: transparent; padding: 0; font-size: 15px; outline: none; }
#edPhotoUrl::placeholder { color: var(--ink-3); }
.linkish.strong { color: var(--ink); }
.linkish:disabled { opacity: .5; }
.ed-names { display: flex; flex-direction: column; padding: 22px 0 18px; border-bottom: 1px solid var(--hair); }
#edName {
  border: 0; outline: none; resize: none; background: transparent; padding: 0; font-size: 26px; font-weight: 800; line-height: 1.25;
  letter-spacing: -.045em; word-break: keep-all; overflow-wrap: anywhere;
}
#edBy { margin-top: 6px; border: 0; outline: none; background: transparent; padding: 0; font-size: 16px; color: var(--ink-2); }
#edName::placeholder, #edBy::placeholder, #edNote::placeholder, #edLink::placeholder { color: var(--ink-3); font-weight: inherit; }
.ed-rating { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 26px 0 22px; border-bottom: 1px solid var(--hair); }
.rate { touch-action: none; outline: none; padding: 2px 0; }
.rate-num { min-height: 18px; font-size: 13px; font-weight: 600; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.rate-num:empty::before { content: "별을 눌러 매겨 보세요"; color: var(--ink-3); }
.ed-note { display: flex; flex-direction: column; padding: 20px 0 12px; border-bottom: 1px solid var(--hair); }
#edNote { border: 0; outline: none; resize: none; background: transparent; padding: 0; font-size: 17px; line-height: 1.7; min-height: 88px; }
.ed-count { align-self: flex-end; font-size: 11.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.ed-rows { display: flex; flex-direction: column; }
.ed-row { display: flex; align-items: center; gap: 12px; min-height: 54px; border-bottom: 1px solid var(--hair); }
.ed-label { flex: none; width: 68px; font-size: 14px; font-weight: 600; color: var(--ink); }
#edDate { flex: 1; min-width: 0; min-height: 40px; border: 0; background: transparent; padding: 0; font-size: 16px; color: var(--ink); text-align: right; outline: none; }
#edDate::-webkit-date-and-time-value { text-align: right; }
#edLink { flex: 1; min-width: 0; min-height: 40px; border: 0; background: transparent; padding: 0; font-size: 15px; outline: none; }
.linkish { flex: none; border: 0; background: none; padding: 6px 0; font-size: 13px; font-weight: 600; color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px; }
.ed-hint { display: block; margin-top: 8px; font-size: 12px; color: var(--ink-3); }
.ed-delete { display: block; margin: 44px auto 0; border: 0; background: none; padding: 10px; font-size: 14px; font-weight: 600; color: var(--danger); }
.btn { border: 0; background: var(--surface-2); padding: 13px 18px; border-radius: var(--r); font-size: 15px; font-weight: 700; transition: transform .15s; }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--ink); color: var(--bg); }
.btn:disabled { opacity: .5; }
/* 계정 */
.acct-form { display: flex; flex-direction: column; gap: 8px; padding: 8px 20px 4px; }
.acct-form input, .mini input {
  width: 100%; min-height: 48px; padding: 0 14px; border: 1px solid var(--hair); border-radius: var(--r);
  background: var(--bg); font-size: 16px; outline: none;
}
.acct-form input:focus, .mini input:focus { border-color: var(--ink); }
.acct-form input::placeholder, .mini input::placeholder { color: var(--ink-3); }
.acct-row { display: flex; gap: 8px; margin-top: 4px; }
.acct-row .btn { flex: 1; }
.acct-foot { display: flex; align-items: flex-start; gap: 12px; margin-top: 2px; }
.acct-foot .group-foot { flex: 1; margin: 6px 0 0; }
.acct-note { margin: 10px 20px 0; padding: 10px 12px; border-radius: var(--r); background: var(--surface-2); font-size: 13px; line-height: 1.5; color: var(--ink); }
.srow-label.danger { color: var(--danger); }
.srow:disabled { opacity: .5; }
/* 새 비밀번호 */
dialog.mini {
  width: min(340px, calc(100% - 32px)); margin: auto; padding: 22px 20px 16px; border: 0; border-radius: var(--r);
  background: var(--bg); color: var(--ink); box-shadow: 0 20px 50px -20px rgba(0,0,0,.5);
}
dialog.mini::backdrop { background: rgba(0,0,0,.42); }
.mini h2 { margin: 0 0 14px; font-size: 17px; font-weight: 700; letter-spacing: -.02em; }
.mini-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }

/* ---- 결산 ---- */
.rc { max-width: 560px; margin: 0 auto; padding: 0 0 calc(32px + env(safe-area-inset-bottom)); }
.rc-year { display: flex; align-items: center; justify-content: space-between; padding: 10px 10px 0; }
.rc-year b { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.rc-year .icon-btn svg { width: 20px; height: 20px; }
.rc-hero { margin: 4px 20px 0; padding: 14px 0 22px; border-top: 2px solid var(--rule); }
.rc-hero .num { display: block; font-size: 96px; font-weight: 800; letter-spacing: -.06em; line-height: 1; font-variant-numeric: tabular-nums; }
.rc-hero p { margin: 10px 0 0; font-size: 15px; color: var(--ink-2); }
.bars { display: flex; flex-direction: column; gap: 12px; padding: 6px 20px 6px; }
.bar { display: grid; grid-template-columns: 44px 1fr 28px; align-items: center; gap: 10px; font-size: 14px; }
.bar span:first-child { font-weight: 600; }
.bar i { display: block; height: 4px; background: var(--ink-4); overflow: hidden; }
.bar i::after { content: ""; display: block; height: 100%; width: var(--w); background: var(--ink); }
.bar em { font-style: normal; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.months { display: grid; grid-template-columns: repeat(12, 1fr); gap: 6px; align-items: end; height: 96px; padding: 8px 20px 0; }
.months div { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; height: 100%; }
.months i { display: block; width: 8px; min-height: 2px; height: var(--h); background: var(--ink); border-radius: 1px; }
.months i.zero { background: var(--ink-4); }
.months small { font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.best { display: flex; flex-direction: column; }
.best .srow { min-height: 68px; gap: 12px; }
.best .thumb { width: 40px; flex: none; }
.best .bt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.best .bt b { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.best .bt small { font-size: 12px; color: var(--ink-2); }
.rc-actions { padding: 18px 20px 0; }
.rc-actions .btn { width: 100%; }
.rc-empty { margin: 4px 20px 0; padding: 48px 0; border-top: 2px solid var(--rule); color: var(--ink-2); font-size: 15px; }

/* ---- 알림 ---- */
.toast {
  position: fixed; left: 50%; bottom: calc(28px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 60;
  background: var(--ink); color: var(--bg); padding: 11px 16px; border-radius: var(--r); font-size: 14px; font-weight: 600;
  box-shadow: 0 8px 24px rgba(0,0,0,.18); display: flex; gap: 14px; align-items: center; max-width: calc(100vw - 32px); white-space: nowrap;
  animation: toastIn .28s cubic-bezier(.2,.9,.3,1);
}
@keyframes toastIn { from { transform: translate(-50%, 10px); opacity: 0; } }
.toast button { border: 0; background: none; color: inherit; text-decoration: underline; font-weight: 800; padding: 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
/* 마우스가 있는 기기에서만 hover (터치 기기에서는 눌러도 hover가 남지 않게) */
@media (hover: hover) and (pointer: fine) {
  button.srow:hover, .icon-btn:hover, .coll:hover { background: var(--press); }
  .sec:hover, .ed-cats button:hover, .sort button:hover, .textbtn:hover { color: var(--ink); }
  .card:hover .cover, .rail-card:hover .cover { opacity: .88; }
  .dt-link:hover, .recap-row:hover { opacity: .7; }
  .linkish:hover { color: var(--ink); }
}
dialog:focus { outline: none; }

