/* ============================================================
   TTUNJINO LOG — 디자인 토큰
   색을 바꾸고 싶으면 여기 :root 값만 바꾸면 전체에 반영돼요.
   ============================================================ */
:root {
  --bg: #F6F5F0;
  --card: #FFFFFF;
  --ink: #161616;
  --muted: #66655F;
  --line: #E2E0D8;
  --line-strong: #161616;
  --soft: #F0EEE7;       /* 중립 칩 */
  --soft-2: #EDEBE4;     /* 중립 카드 */
  --dash: #A9A79F;

  --ttun: #C94272;       /* 뜐 */
  --ttun-soft: #FBE3EA;
  --ttun-on: #FFFFFF;    /* 뜐 색 위 글씨 */
  --jino: #161616;       /* 지노 */
  --jino-soft: #F0EEE7;
  --jino-on: #FFFFFF;
  --us: #F4E07E;         /* 우리(공통) */
  --us-on: #161616;

  --font-display: 'Bricolage Grotesque', 'IBM Plex Sans KR', sans-serif;
  --font-body: 'IBM Plex Sans KR', system-ui, sans-serif;
  --font-mono: 'DM Mono', ui-monospace, monospace;

  --radius-lg: 28px;
  --radius: 20px;
  --radius-sm: 14px;
  --page: 560px;
  --gutter: 20px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 var(--font-body);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.mono { font-family: var(--font-mono); letter-spacing: .04em; }
.display { font-family: var(--font-display); font-weight: 700; letter-spacing: -.03em; }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- layout ---------- */
#app { max-width: var(--page); margin: 0 auto; min-height: 100dvh; padding-bottom: 110px; position: relative; }
.page-pad { padding: 0 var(--gutter); }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px var(--gutter) 12px; }
.page-title { margin: 0; font-size: 40px; line-height: 1.05; }
.page-title .sub { color: var(--muted); font-weight: 500; }
.section { margin-top: 24px; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; padding: 0 var(--gutter); }
.section-head h2 { margin: 0; font-size: 26px; }
.row { display: flex; align-items: center; gap: 8px; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 8px; }

.logo { display: flex; align-items: baseline; gap: 6px; }
.logo b { font-size: 26px; }
.logo span { font-size: 20px; color: var(--muted); font-weight: 500; }

/* ---------- buttons & chips ---------- */
.icon-btn { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--ink); background: var(--card); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.icon-btn.dark { background: var(--ink); color: #fff; }
.icon-btn.ghost { border-color: transparent; background: transparent; }
.btn { min-height: 44px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--ink); background: var(--ink); color: #fff; font-weight: 500; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.btn.light { background: var(--card); color: var(--ink); }
.btn.block { width: 100%; border-radius: 16px; min-height: 52px; }
.btn.dashed { background: transparent; color: var(--muted); border: 1px dashed var(--dash); border-radius: 18px; width: 100%; }
.btn.danger { background: transparent; color: #B3261E; border-color: #E8C4C1; }
.btn:disabled { opacity: .5; cursor: default; }

.pill { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 7px 14px; font-size: 12px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; flex: none; white-space: nowrap; }
.pill[aria-pressed="true"], .pill.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.pills { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 0 var(--gutter); }
.pills::-webkit-scrollbar { display: none; }

.tag { border-radius: 6px; padding: 2px 8px; font-size: 11px; font-weight: 600; background: var(--soft); white-space: nowrap; }
.tag.movie { background: var(--ink); color: #fff; }
.tag.festival { background: var(--us); }

.who { border-radius: 999px; padding: 4px 10px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.who.ttun { background: var(--ttun); color: var(--ttun-on); }
.who.jino { background: var(--jino); color: var(--jino-on); }
.who.us { background: var(--us); color: var(--us-on); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.dot.ttun { background: var(--ttun); }
.dot.jino { background: var(--jino); }
.dot.us { background: var(--us); box-shadow: inset 0 0 0 1px var(--ink); }
.avatar { width: 44px; height: 44px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: 14px; border: 2px solid var(--card); flex: none; }
.avatar.ttun { background: var(--ttun); color: var(--ttun-on); }
.avatar.jino { background: var(--jino); color: var(--jino-on); font-size: 12px; }
.avatar.sm { width: 32px; height: 32px; font-size: 12px; border: 0; }
.avatar.sm.jino { font-size: 10px; }

/* 뜐/지노 토글 */
.me-toggle { display: flex; padding: 3px; border: 1px solid var(--ink); border-radius: 999px; background: var(--card); }
.me-toggle button { border: 0; border-radius: 999px; padding: 6px 12px; background: transparent; font-size: 12px; font-weight: 500; min-height: 32px; }
.me-toggle button[aria-pressed="true"].ttun { background: var(--ttun); color: var(--ttun-on); }
.me-toggle button[aria-pressed="true"].jino { background: var(--jino); color: var(--jino-on); }

/* ---------- cards ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.card.strong { border-color: var(--line-strong); }
.card.neutral { background: var(--soft-2); border-color: transparent; }

.hero { margin: 4px var(--gutter) 0; padding: 22px; background: var(--card); border: 1px solid var(--ink); border-radius: var(--radius-lg); position: relative; }
.hero .dday { font-size: clamp(64px, 20vw, 84px); line-height: .95; }
.hero .sparkle { position: absolute; top: -11px; right: 34px; }
.sticker { background: var(--us); border-radius: 999px; padding: 6px 12px; font-size: 12px; font-weight: 500; }
.sticker.outline { background: transparent; border: 1px solid var(--line); color: var(--muted); }

/* week strip */
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; text-align: center; padding: 12px var(--gutter) 0; }
.week button { border: 0; background: transparent; padding: 8px 0; border-radius: 14px; }
.week .on { background: var(--ink); color: #fff; }
.week .on .mono { color: #CFCFCF; }
.week .num { font-size: 15px; margin-top: 4px; }
.week .dots { display: flex; justify-content: center; gap: 3px; height: 6px; margin-top: 4px; }
.week .dots .dot { width: 6px; height: 6px; }

.event { display: flex; align-items: center; gap: 14px; background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 12px 14px; text-align: left; width: 100%; }
.event.us { border-color: var(--ink); }
.event .day { width: 46px; text-align: center; flex: none; }
.event .day b { display: block; font-size: 26px; line-height: 1; }

/* polaroid */
.polaroids { display: flex; gap: 12px; padding: 12px var(--gutter) 8px; overflow-x: auto; scrollbar-width: none; }
.polaroids::-webkit-scrollbar { display: none; }
.polaroid { flex: 0 0 132px; background: var(--card); padding: 8px 8px 12px; border: 1px solid var(--line); }
.polaroid:nth-child(3n+1) { transform: rotate(-2deg); }
.polaroid:nth-child(3n+2) { transform: rotate(1.5deg); }
.polaroid:nth-child(3n) { transform: rotate(-1deg); }
.polaroid .ph { height: 120px; }
.polaroid .cap { font-size: 10px; margin-top: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.ph { background: var(--soft-2); overflow: hidden; position: relative; }
.ph img { width: 100%; height: 100%; object-fit: cover; }
.ph.empty::after { content: ''; position: absolute; inset: 0; background: repeating-linear-gradient(45deg, transparent 0 8px, rgba(0,0,0,.03) 8px 16px); }

.ring-card { margin: 20px var(--gutter) 0; display: flex; align-items: center; gap: 16px; background: var(--soft-2); border-radius: 22px; padding: 16px 18px; }
.ring { width: 52px; height: 52px; flex: none; }

/* ---------- timeline ---------- */
.month-nav { display: flex; align-items: center; justify-content: space-between; margin: 14px var(--gutter) 0; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink); padding: 4px 0; }
.month-nav button { width: 44px; height: 44px; border: 0; background: transparent; font-size: 18px; }
.tl { padding: 20px var(--gutter) 0; display: flex; flex-direction: column; gap: 22px; }
.tl-day { display: flex; gap: 14px; }
.tl-date { flex: 0 0 52px; text-align: center; }
.tl-date b { display: block; font-size: 44px; line-height: .9; }
.tl-date .line { width: 1px; min-height: 40px; height: calc(100% - 70px); margin: 10px auto 0; border-left: 1px dashed var(--dash); }
.tl-cards { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.tl-card { display: block; background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 14px; }
.tl-card:first-child { border-color: var(--ink); }
.tl-card h3 { margin: 6px 0 0; font-size: 16px; font-weight: 600; }
.thumbs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; margin-top: 10px; border-radius: 10px; overflow: hidden; }
.thumbs .ph { aspect-ratio: 1; }
.thumbs .more { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(22,22,22,.45); color: #fff; font-family: var(--font-mono); font-size: 13px; }
.item-line { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-top: 6px; min-width: 0; }
.item-line .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pair { display: flex; }
.pair .dot { width: 18px; height: 18px; border: 2px solid var(--card); }
.pair .dot + .dot { margin-left: -6px; }

.empty-state { text-align: center; padding: 48px 24px; color: var(--muted); }
.empty-state b { display: block; font-size: 28px; color: var(--ink); margin-bottom: 6px; }

/* ---------- detail ---------- */
.carousel { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 8px; border-radius: 26px; scrollbar-width: none; }
.carousel::-webkit-scrollbar { display: none; }
.carousel .ph { flex: 0 0 100%; aspect-ratio: 4 / 5; max-height: 70vh; scroll-snap-align: center; border-radius: 26px; }
.carousel .ph img { cursor: zoom-in; }
.tape { position: absolute; top: -10px; left: 24px; width: 70px; height: 20px; background: var(--us); opacity: .9; transform: rotate(-6deg); z-index: 1; }
.dots-nav { display: flex; justify-content: center; gap: 5px; margin-top: 10px; }
.dots-nav span { width: 6px; height: 6px; border-radius: 3px; background: #C9C7BF; transition: width .2s; }
.dots-nav span.on { width: 16px; background: var(--ink); }
.diary { margin: 10px 0 0; font-size: 15px; line-height: 1.85; white-space: pre-wrap; word-break: keep-all; overflow-wrap: anywhere; }
.poster { flex: 0 0 64px; height: 92px; border-radius: 8px; }
.bubble { border-radius: 4px 18px 18px 18px; padding: 10px 14px; font-size: 14px; line-height: 1.6; background: var(--ttun-soft); white-space: pre-wrap; overflow-wrap: anywhere; }
.note.jino { flex-direction: row-reverse; }
.note.jino .bubble { background: var(--card); border: 1px solid var(--ink); border-radius: 18px 4px 18px 18px; }
.note { display: flex; gap: 10px; align-items: flex-start; }
.note .when { font-size: 10px; margin-top: 4px; }
.note-del { border: 0; background: none; color: var(--muted); font-size: 11px; padding: 4px; }

/* ---------- gallery ---------- */
.highlights { display: flex; gap: 14px; padding: 16px var(--gutter) 0; overflow-x: auto; scrollbar-width: none; }
.highlights::-webkit-scrollbar { display: none; }
.hl { flex: none; width: 68px; text-align: center; font-size: 11px; background: none; border: 0; padding: 0; }
.hl .circle { width: 64px; height: 64px; margin: 0 auto; border-radius: 50%; padding: 3px; border: 1.5px solid var(--ink); }
.hl .circle .ph { width: 100%; height: 100%; border-radius: 50%; }
.hl .circle.add { border: 1px dashed var(--dash); display: flex; align-items: center; justify-content: center; font-size: 22px; color: var(--muted); }
.hl .name { margin-top: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 18px; border-top: 1px solid var(--line); }
.tabs button { height: 44px; border: 0; background: transparent; color: var(--muted); font-size: 13px; }
.tabs button[aria-selected="true"] { border-top: 2px solid var(--ink); margin-top: -1px; color: var(--ink); font-weight: 600; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2px; }
.grid3 .ph { aspect-ratio: 1; display: block; }
.grid3 .ph.sel::before { content: '✓'; position: absolute; z-index: 1; top: 6px; right: 6px; width: 22px; height: 22px; border-radius: 50%; background: var(--ink); color: #fff; font-size: 12px; display: flex; align-items: center; justify-content: center; }
.grid3 .ph.sel img { opacity: .6; }
.group-card { display: block; margin: 0 var(--gutter) 16px; }
.group-card .meta { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.group-card .grid4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; border-radius: 14px; overflow: hidden; }
.group-card .grid4 .ph { aspect-ratio: 1; }

/* ---------- album ---------- */
.album-cover { position: relative; height: 330px; background: var(--soft-2); border-radius: 0 0 140px 140px / 0 0 48px 48px; overflow: hidden; }
.album-cover .back { position: absolute; top: 12px; left: 12px; z-index: 1; }
.album-cover .count { position: absolute; top: 26px; right: 20px; font-size: 10px; background: rgba(255,255,255,.85); padding: 3px 8px; border-radius: 999px; z-index: 1; }
.album-title { text-align: center; margin-top: -34px; position: relative; padding: 0 var(--gutter); }
.album-title .badge { display: inline-block; background: var(--bg); border-radius: 999px; padding: 10px 26px 4px; }
.album-title h1 { margin: 0; font-size: 36px; line-height: 1.05; overflow-wrap: anywhere; }
.collage { position: relative; height: 250px; margin: 26px var(--gutter) 0; }
.collage .polaroid { position: absolute; width: 46%; }
.collage .polaroid .ph { height: 150px; }
.collage .polaroid:first-child { left: 0; top: 10px; transform: rotate(-4deg); }
.collage .polaroid:nth-child(2) { right: 6px; top: 0; transform: rotate(3deg); }
.quote { margin: 10px 28px 0; display: flex; gap: 10px; }
.quote .mark { font-size: 54px; line-height: .8; }
.quote p { margin: 6px 0 0; font-size: 14px; line-height: 1.7; white-space: pre-wrap; }
.album-grid { margin: 22px var(--gutter) 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.album-grid .ph { aspect-ratio: 1; border-radius: 14px; }

/* ---------- archive ---------- */
.ul-tabs { display: flex; gap: 18px; margin: 10px var(--gutter) 0; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.ul-tabs button { height: 44px; border: 0; background: transparent; padding: 0; color: var(--muted); white-space: nowrap; }
.ul-tabs button[aria-selected="true"] { border-bottom: 2px solid var(--ink); margin-bottom: -1px; color: var(--ink); font-weight: 600; }
.big-stat { font-size: 72px; line-height: .9; }
.posters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 10px; padding: 16px var(--gutter) 0; }
.posters .ph { aspect-ratio: 2 / 3; border-radius: 10px; }
.posters .where { position: absolute; left: 6px; bottom: 6px; font-size: 9px; background: #fff; border-radius: 4px; padding: 2px 5px; z-index: 1; }
.posters .name { font-size: 12px; font-weight: 500; margin-top: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.songs { list-style: none; margin: 10px var(--gutter) 0; padding: 0; border-top: 1px solid var(--ink); }
.songs li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.songs .cover { width: 44px; height: 44px; border-radius: 8px; flex: none; }

/* ---------- bucket ---------- */
.progress-card { margin: 18px var(--gutter) 0; background: var(--ink); color: #fff; border-radius: 24px; padding: 18px 20px; }
.progress-bar { height: 8px; background: #3A3A3A; border-radius: 4px; margin-top: 12px; overflow: hidden; }
.progress-bar div { height: 100%; background: var(--us); }
.check-row { display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 10px 14px; }
.check-row.done { background: var(--soft-2); border-color: transparent; }
.check-row.done .t { text-decoration: line-through; color: var(--muted); }
.check-row input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--ink); margin: 0; flex: none; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 12px; color: var(--muted); }
.input, .textarea, .select { width: 100%; min-height: 48px; border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; background: var(--card); font-size: 16px; }
.input:focus, .textarea:focus, .select:focus { border-color: var(--ink); outline: none; }
.textarea { min-height: 160px; resize: vertical; line-height: 1.7; }
.input.strong { border-color: var(--ink); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.stars { display: flex; gap: 2px; }
.stars button { border: 0; background: none; font-size: 22px; padding: 0 2px; color: #D5D3CB; min-width: 28px; min-height: 36px; }
.stars button.on { color: var(--ink); }
.item-editor { border: 1px solid var(--line); border-radius: 18px; padding: 14px; background: var(--card); display: flex; flex-direction: column; gap: 10px; }
.photo-picker { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.photo-picker .ph { aspect-ratio: 1; border-radius: 12px; }
.photo-picker .x { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: rgba(22,22,22,.7); color: #fff; font-size: 14px; z-index: 1; }
.photo-picker .mv { position: absolute; bottom: 4px; left: 4px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: rgba(255,255,255,.85); font-size: 12px; z-index: 1; }
.photo-picker .add { aspect-ratio: 1; border-radius: 12px; border: 1px dashed var(--dash); display: flex; align-items: center; justify-content: center; font-size: 26px; color: var(--muted); cursor: pointer; }
.photo-picker .uploading::after { content: attr(data-progress); position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(255,255,255,.6); font-family: var(--font-mono); font-size: 12px; }

/* ---------- nav ---------- */
.tabbar { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(14px + env(safe-area-inset-bottom)); width: min(calc(100% - 32px), calc(var(--page) - 32px)); display: flex; justify-content: space-around; background: var(--card); border: 1px solid var(--ink); border-radius: 999px; padding: 6px; z-index: 20; }
.tabbar a { min-width: 56px; min-height: 44px; display: flex; align-items: center; justify-content: center; font-size: 12px; border-radius: 999px; padding: 0 6px; }
.tabbar a[aria-current="page"] { background: var(--ink); color: #fff; font-weight: 500; }

/* ---------- overlays ---------- */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(22,22,22,.35); z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: var(--page); max-height: 90dvh; overflow-y: auto; background: var(--bg); border-radius: 28px 28px 0 0; padding: 20px var(--gutter) calc(24px + env(safe-area-inset-bottom)); }
.sheet h2 { margin: 0 0 14px; font-size: 26px; }
.lightbox { position: fixed; inset: 0; background: rgba(10,10,10,.94); z-index: 50; display: flex; align-items: center; justify-content: center; }
.lightbox img { max-width: 100vw; max-height: 100dvh; object-fit: contain; }
.lightbox .close, .lightbox .prev, .lightbox .next { position: absolute; border: 0; background: rgba(255,255,255,.12); color: #fff; width: 44px; height: 44px; border-radius: 50%; font-size: 18px; }
.lightbox .close { top: 16px; right: 16px; }
.lightbox .prev { left: 12px; top: 50%; }
.lightbox .next { right: 12px; top: 50%; }
.lightbox .go { position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%); color: #fff; font-size: 12px; border: 1px solid rgba(255,255,255,.4); border-radius: 999px; padding: 8px 14px; }
.toast { position: fixed; left: 50%; top: 16px; transform: translateX(-50%); background: var(--ink); color: #fff; border-radius: 999px; padding: 10px 18px; font-size: 13px; z-index: 60; }
.loading { padding: 80px 0; text-align: center; color: var(--muted); font-family: var(--font-mono); font-size: 12px; }

/* ---------- lock ---------- */
.lock { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 0 32px; position: relative; overflow: hidden; }
.lock .deco { position: absolute; border-radius: 50%; pointer-events: none; }
.lock h1 { margin: 10px 0 0; font-size: 52px; line-height: 1; }
.lock form { margin-top: 44px; width: 100%; max-width: 340px; display: flex; flex-direction: column; gap: 10px; }

@media (min-width: 720px) {
  body { background: var(--soft-2); }
  #app { background: var(--bg); box-shadow: 0 0 0 1px var(--line); }
}
.songs .cover .ph { width: 100%; height: 100%; }
