/* 왜저장 — 디지털 기억 서랍 */
@font-face{
  font-family:'Pretendard';
  src:url('fonts/PretendardVariable.woff2') format('woff2-variations');
  font-weight:45 920;font-style:normal;font-display:swap;
}

:root{
  --bg:#F4F0E8;
  --bg-top:#EDF3EE;
  --surface:#FFFDF8;
  --surface-2:#FBF7EE;
  --ink:#2B2823;
  --ink2:#5A544B;
  --muted:#968D80;
  --line:#E5DCCB;
  --line-soft:#EFE8DA;
  --brand:#2C6E63;
  --brand-dark:#245A51;
  --brand-soft:#E3F0EC;
  --hi:#FFF0B8;
  --hi-line:#F2DE95;
  --coral:#E2795E;
  --shadow:0 8px 22px -14px rgba(63,52,35,.45);
  --radius:18px;
  --sheet-radius:26px;
}

*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{margin:0;padding:0}
html{background:var(--bg)}
body{
  min-height:100dvh;
  background:
    radial-gradient(120% 42% at 50% -6%, var(--bg-top) 0%, rgba(237,243,238,0) 70%),
    var(--bg);
  color:var(--ink);
  font-family:'Pretendard',-apple-system,BlinkMacSystemFont,'Apple SD Gothic Neo','Noto Sans KR',system-ui,sans-serif;
  font-size:15px;line-height:1.5;letter-spacing:-.01em;
  word-break:keep-all;
  -webkit-font-smoothing:antialiased;
}
button{font-family:inherit;font-size:inherit;color:inherit;border:0;background:none;cursor:pointer}
input,textarea{font-family:inherit;font-size:inherit;color:inherit}
h1,h2,h3,p{margin:0}
[hidden]{display:none !important}

.app{
  max-width:520px;margin:0 auto;
  padding:calc(env(safe-area-inset-top,0px) + 14px) 16px calc(env(safe-area-inset-bottom,0px) + 28px);
}

/* ── 상단 바 ───────────────────────────── */
.topbar{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:4px 2px 2px}
.brand{display:flex;align-items:center;gap:9px;min-width:0}
.brand-mark{
  width:38px;height:38px;flex:none;border-radius:12px;
  background:var(--brand);color:#FFF8E7;
  display:grid;place-items:center;
  box-shadow:0 6px 14px -9px rgba(44,110,99,.9);
}
.brand-mark svg{width:24px;height:24px}
.brand-text{display:flex;flex-direction:column;line-height:1.16;min-width:0}
.brand-text strong{font-size:21px;font-weight:800;letter-spacing:-.035em}
.brand-text em{font-style:normal;font-size:11.5px;color:var(--muted);font-weight:600;letter-spacing:.01em}
.topbar-actions{display:flex;align-items:center;gap:7px;flex:none}
.icon-btn{
  width:36px;height:36px;border-radius:11px;display:grid;place-items:center;
  color:var(--ink2);background:rgba(255,253,248,.7);border:1px solid var(--line);
}
.icon-btn svg{width:20px;height:20px}
.icon-btn:active{transform:scale(.96)}

.btn-primary{
  display:inline-flex;align-items:center;justify-content:center;gap:5px;
  background:var(--brand);color:#FFFDF6;font-weight:700;
  padding:10px 13px;border-radius:12px;font-size:14px;
  box-shadow:0 8px 16px -12px rgba(44,110,99,.9);
  white-space:nowrap;
}
.btn-primary svg{width:17px;height:17px}
.btn-primary:active{background:var(--brand-dark);transform:translateY(1px)}
.btn-add span{letter-spacing:-.02em}
.btn-ghost{
  display:inline-flex;align-items:center;justify-content:center;
  background:var(--surface);border:1px solid var(--line);color:var(--ink2);
  font-weight:600;padding:10px 14px;border-radius:12px;font-size:14px;
}
.btn-ghost:active{background:var(--surface-2)}
.btn-wide{width:100%;margin-top:14px;padding:13px}

/* ── 검색 · 토글 ───────────────────────── */
.toolbar{display:flex;align-items:center;gap:8px;margin-top:14px}
.search{
  position:relative;flex:1;min-width:0;display:flex;align-items:center;
  background:var(--surface);border:1px solid var(--line);border-radius:14px;
  padding:0 10px 0 33px;height:42px;
  box-shadow:0 3px 10px -9px rgba(63,52,35,.5);
}
.search .search-ic{position:absolute;left:10px;width:18px;height:18px;color:var(--muted)}
.search input{
  width:100%;border:0;background:none;outline:none;font-size:14.5px;
  padding:0;height:100%;letter-spacing:-.02em;
}
.search input::placeholder{color:#A9A092}
.search input::-webkit-search-cancel-button{display:none}
.search:focus-within{border-color:#BBD3CB;box-shadow:0 0 0 3px rgba(44,110,99,.09)}
.search-clear{
  width:22px;height:22px;border-radius:50%;background:var(--line-soft);color:var(--ink2);
  font-size:15px;line-height:1;display:grid;place-items:center;flex:none;margin-left:4px;
}
.toggle{
  display:flex;align-items:center;gap:6px;flex:none;
  background:var(--surface);border:1px solid var(--line);border-radius:14px;
  height:42px;padding:0 10px;color:var(--ink2);font-size:12px;font-weight:600;letter-spacing:-.03em;
}
.toggle-track{
  width:30px;height:18px;border-radius:999px;background:#DCD3C2;position:relative;flex:none;
  transition:background .18s ease;
}
.toggle-knob{
  position:absolute;top:2px;left:2px;width:14px;height:14px;border-radius:50%;
  background:#FFFDF8;box-shadow:0 1px 3px rgba(0,0,0,.18);transition:transform .18s ease;
}
.toggle[aria-checked="true"]{border-color:#BBD3CB;color:var(--brand)}
.toggle[aria-checked="true"] .toggle-track{background:var(--brand)}
.toggle[aria-checked="true"] .toggle-knob{transform:translateX(12px)}

/* ── 용도 탭 ───────────────────────────── */
.chips{
  display:flex;gap:7px;overflow-x:auto;padding:12px 2px 4px;
  scrollbar-width:none;-webkit-overflow-scrolling:touch;
}
.chips::-webkit-scrollbar{display:none}
.chip{
  flex:none;display:inline-flex;align-items:center;gap:5px;
  padding:7px 12px;border-radius:999px;border:1px solid var(--line);
  background:rgba(255,253,248,.78);color:var(--ink2);
  font-size:13px;font-weight:600;letter-spacing:-.02em;white-space:nowrap;
}
.chip .chip-n{font-size:11px;font-weight:700;color:var(--muted)}
.chip.is-on{background:var(--brand);border-color:var(--brand);color:#FFFDF6}
.chip.is-on .chip-n{color:rgba(255,253,246,.75)}
.chip-add{border-style:dashed;color:var(--muted)}

/* ── 카드 그리드 ───────────────────────── */
.grid{
  display:grid;grid-template-columns:repeat(2,minmax(0,1fr));
  gap:11px;margin-top:11px;
}
.card{
  position:relative;display:flex;flex-direction:column;
  background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);
  overflow:hidden;box-shadow:var(--shadow);
}
.card.done{opacity:.62}
.card.done .card-title{text-decoration:line-through;text-decoration-color:#B9AF9E;text-decoration-thickness:1.4px}
.thumb{
  position:relative;aspect-ratio:4/3;background:var(--surface-2);
  display:grid;place-items:center;overflow:hidden;
}
/* 링크만 담은 카드는 플랫폼 뱃지 카드로: 사진 자리를 조금 낮춰 서랍이 덜 길어지게 */
.card.noimg .thumb{aspect-ratio:16/10}
.thumb img{width:100%;height:100%;object-fit:cover;display:block}
.thumb-badge{
  position:absolute;left:7px;bottom:7px;display:inline-flex;align-items:center;gap:4px;
  padding:3.5px 7px;border-radius:8px;font-size:10.5px;font-weight:800;letter-spacing:-.01em;
  background:rgba(43,40,35,.72);color:#FFFDF6;backdrop-filter:blur(3px);
}
.thumb-badge svg{width:11px;height:11px}
.thumb-empty{
  display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;
  width:100%;height:100%;padding:10px;text-align:center;
}
.thumb-empty .pe-icon{
  width:38px;height:38px;border-radius:11px;display:grid;place-items:center;
  background:var(--brand-soft);color:var(--brand);
}
.thumb-empty .pe-icon svg{width:20px;height:20px}
.thumb-empty .pe-host{
  font-size:10.5px;color:var(--muted);font-weight:700;max-width:100%;
  overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
}
.check{
  position:absolute;right:7px;top:7px;width:27px;height:27px;border-radius:9px;
  background:rgba(255,253,248,.92);border:1px solid #D9D0BF;color:#B4AA99;
  display:grid;place-items:center;box-shadow:0 2px 6px -4px rgba(0,0,0,.5);
}
.check svg{width:15px;height:15px}
.check[aria-pressed="true"]{background:var(--brand);border-color:var(--brand);color:#FFFDF6}
.card-body{padding:9px 10px 10px;display:flex;flex-direction:column;gap:6px;flex:1}
.use-tag{
  align-self:flex-start;font-size:10.5px;font-weight:800;letter-spacing:-.01em;
  padding:3px 7px;border-radius:7px;background:var(--brand-soft);color:var(--brand-dark);
}
.use-tag[data-tone="1"]{background:#FCE7DA;color:#A75B3A}
.use-tag[data-tone="2"]{background:#E7E1F6;color:#5F4C8C}
.use-tag[data-tone="3"]{background:#DEEFE4;color:#2C6B4A}
.use-tag[data-tone="4"]{background:#DDE9F6;color:#3B6288}
.use-tag[data-tone="5"]{background:#F8DEE5;color:#9C4C63}
.card-title{
  font-size:13.5px;font-weight:700;line-height:1.32;letter-spacing:-.03em;
  display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;
}
.why{
  background:var(--hi);border:1px solid var(--hi-line);border-radius:9px;
  padding:6px 7px;font-size:11.5px;line-height:1.34;color:#5A4B1E;font-weight:600;
  letter-spacing:-.02em;word-break:break-all;
  display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden;
}
.why .why-label{display:block;font-size:9.5px;font-weight:800;color:#A08A32;letter-spacing:.02em;margin-bottom:1px}
.card-acts{display:flex;gap:5px;margin-top:auto;padding-top:2px}
.card-acts button{
  flex:1;min-width:0;border-radius:9px;border:1px solid var(--line);
  background:var(--surface-2);color:var(--ink2);font-size:11px;font-weight:700;
  padding:6px 3px;letter-spacing:-.04em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
}
.card-acts button.solo{flex:1}
.card-acts button.primary{
  background:var(--brand-soft);border-color:#C6DFD7;color:var(--brand-dark);
}
.card-acts button:active{filter:brightness(.97)}

/* ── 빈 상태 ───────────────────────────── */
.empty{
  margin:26px 6px 0;text-align:center;
  background:rgba(255,253,248,.6);border:1px dashed #DCD2C0;border-radius:22px;
  padding:20px 18px 18px;
}
.empty-art svg{width:172px;height:auto;display:block;margin:0 auto 6px}
.empty h2{font-size:17px;font-weight:800;letter-spacing:-.03em}
.empty p{font-size:12.5px;color:var(--muted);line-height:1.62;margin-top:6px}
.empty-steps{
  margin-top:14px;text-align:left;font-size:12px;color:var(--ink2);
  display:flex;flex-direction:column;gap:7px;
}
.empty-steps div{background:var(--surface);border:1px solid var(--line-soft);border-radius:11px;padding:8px 10px}
.empty-steps b{color:var(--brand);font-weight:800}
.foot-note{text-align:center;font-size:11px;color:#AFA595;margin-top:18px;letter-spacing:-.01em}

/* ── 시트 · 스크림 ─────────────────────── */
.scrim{
  position:fixed;inset:0;z-index:60;display:flex;align-items:flex-end;justify-content:center;
  background:rgba(38,33,26,.42);backdrop-filter:blur(2px);
  animation:fade .18s ease;
}
@keyframes fade{from{opacity:0}to{opacity:1}}
@keyframes rise{from{transform:translateY(18px);opacity:.6}to{transform:translateY(0);opacity:1}}
.sheet{
  width:100%;max-width:520px;max-height:92dvh;overflow-y:auto;
  background:var(--bg);
  border-radius:var(--sheet-radius) var(--sheet-radius) 0 0;
  padding:8px 18px calc(env(safe-area-inset-bottom,0px) + 20px);
  box-shadow:0 -18px 40px -24px rgba(0,0,0,.6);
  animation:rise .2s ease;
}
.sheet-grip{width:38px;height:4px;border-radius:999px;background:#D9CFBD;margin:4px auto 10px}
.sheet-head{display:flex;align-items:center;justify-content:space-between;gap:10px}
.sheet-head h2{font-size:18px;font-weight:800;letter-spacing:-.03em}
.sheet-close{width:32px;height:32px;border-radius:50%;background:var(--surface);border:1px solid var(--line);color:var(--ink2);font-size:18px;display:grid;place-items:center;flex:none}
.sheet-sub{font-size:12px;color:var(--muted);margin-top:5px;line-height:1.55}

.fld{margin-top:12px;display:flex;flex-direction:column;gap:7px}
.fld-label{font-size:12.5px;font-weight:800;color:var(--ink2);letter-spacing:-.02em}
.fld-label em{font-style:normal;font-weight:700;color:var(--muted);font-size:11.5px}
.fld-label small{font-weight:600;color:var(--muted);font-size:11px}
.fld-label .req{
  font-size:10.5px;font-weight:800;color:#8C6B12;background:var(--hi);
  border:1px solid var(--hi-line);padding:1px 6px;border-radius:6px;margin-left:4px;
}
.fld input[type=text],.fld input[type=url]{
  width:100%;background:var(--surface);border:1px solid var(--line);border-radius:11px;
  padding:11px 12px;outline:none;font-size:14px;letter-spacing:-.02em;
}
.fld input::placeholder{color:#ADA496}
.fld input:focus{border-color:#B9D2CA;box-shadow:0 0 0 3px rgba(44,110,99,.09)}
.url-row{display:flex;gap:6px}
.url-row input{flex:1;min-width:0}
.mini-btn{
  flex:none;background:var(--surface);border:1px solid var(--line);border-radius:10px;
  padding:0 11px;font-size:12px;font-weight:700;color:var(--ink2);
}
.mini-btn:active{background:var(--surface-2)}
.mini-btn.ghost{background:none;border-color:transparent;color:var(--muted)}

.img-row{display:flex;gap:7px;flex-wrap:wrap}
.img-thumb{position:relative;width:62px;height:62px;border-radius:11px;overflow:hidden;border:1px solid var(--line);background:#EFE7D8}
.img-thumb img{width:100%;height:100%;object-fit:cover;display:block}
.img-thumb button{
  position:absolute;right:2px;top:2px;width:18px;height:18px;border-radius:50%;
  background:rgba(38,33,26,.68);color:#fff;font-size:12px;line-height:1;display:grid;place-items:center;
}
.file-btn{
  align-self:flex-start;display:inline-flex;align-items:center;gap:6px;
  border:1px dashed #CFC3AE;border-radius:11px;padding:9px 12px;
  font-size:12.5px;font-weight:700;color:var(--ink2);background:rgba(255,253,248,.6);
}
.file-btn svg{width:17px;height:17px;color:var(--brand)}

.pick-row{display:flex;flex-wrap:wrap;gap:6px}
.pick{
  padding:7px 11px;border-radius:10px;border:1px solid var(--line);
  background:var(--surface);font-size:12.5px;font-weight:700;color:var(--ink2);
  letter-spacing:-.02em;
}
.pick.is-on{background:var(--brand);border-color:var(--brand);color:#FFFDF6}
.pick.is-on[data-emotion]{background:#F7E2D9;border-color:#E9C2B1;color:#8E4B33}
.link-btn{align-self:flex-start;font-size:12px;font-weight:700;color:var(--brand);padding:2px 0}
.newtag-row{display:flex;gap:6px}
.newtag-row input{flex:1;min-width:0;background:var(--surface);border:1px solid var(--line);border-radius:10px;padding:9px 10px;outline:none;font-size:13px}

.sheet-actions{
  position:sticky;bottom:0;z-index:2;
  display:flex;gap:8px;margin-top:18px;
  padding:10px 0 calc(env(safe-area-inset-bottom,0px) * 0 + 4px);
  background:linear-gradient(to bottom, rgba(244,240,232,0) 0%, var(--bg) 22%);
}
.sheet-actions .btn-ghost{flex:0 0 96px}
.sheet-actions .btn-primary{flex:1;padding:13px}

/* ── 자세히 ───────────────────────────── */
.sheet-detail .dt-images{display:flex;gap:7px;overflow-x:auto;margin-top:12px;padding-bottom:2px}
.sheet-detail .dt-images img{height:150px;border-radius:12px;border:1px solid var(--line);flex:none}
.dt-use{margin-top:10px}
.dt-title{font-size:17px;font-weight:800;letter-spacing:-.03em;margin-top:8px;line-height:1.35}
.dt-why{
  background:var(--hi);border:1px solid var(--hi-line);border-radius:12px;
  padding:11px 12px;margin-top:10px;font-size:13.5px;font-weight:600;color:#5A4B1E;line-height:1.5;
}
.dt-why span{display:block;font-size:10.5px;font-weight:800;color:#A08A32;margin-bottom:3px}
.dt-meta{margin-top:10px;font-size:11.5px;color:var(--muted);display:flex;flex-wrap:wrap;gap:8px}
.dt-meta .pill{background:var(--surface);border:1px solid var(--line);border-radius:999px;padding:2px 8px;font-weight:700}
.dt-url{margin-top:9px;font-size:11.5px;color:#7C8F89;word-break:break-all;line-height:1.4}
.dt-acts{display:grid;grid-template-columns:1fr 1fr;gap:7px;margin-top:16px}
.dt-acts button{padding:11px;font-size:13px}
.dt-acts .danger{color:#A9503C;border-color:#EED4CB;background:#FDF3EF}
.dt-acts .full{grid-column:1 / -1}

/* ── 도움말 ───────────────────────────── */
.help-body h3{font-size:13.5px;font-weight:800;color:var(--ink);margin:18px 0 7px;letter-spacing:-.02em}
.help-body h3:first-child{margin-top:14px}
.help-list{margin:0;padding-left:18px;font-size:12.5px;color:var(--ink2);line-height:1.7}
.help-list li{margin-bottom:4px}
.help-list b{color:var(--ink)}
.help-list code{background:var(--surface);border:1px solid var(--line);border-radius:5px;padding:0 4px;font-size:11.5px}
.help-tip{
  margin-top:10px;font-size:11.5px;color:#6D6353;line-height:1.6;
  background:var(--hi);border:1px solid var(--hi-line);border-radius:11px;padding:9px 11px;
}
.help-p{font-size:12px;color:var(--muted);line-height:1.6}
.backup-row{display:flex;flex-wrap:wrap;gap:7px;margin-top:9px}
.backup-row .btn-ghost{padding:9px 12px;font-size:12.5px}
.help-count{font-size:11.5px;color:var(--muted);margin-top:8px}
.tag-manage{display:flex;flex-wrap:wrap;gap:6px}
.tag-manage .tm{
  display:inline-flex;align-items:center;gap:5px;background:var(--surface);
  border:1px solid var(--line);border-radius:999px;padding:5px 6px 5px 10px;font-size:12px;font-weight:700;color:var(--ink2);
}
.tag-manage .tm button{width:18px;height:18px;border-radius:50%;background:var(--line-soft);color:var(--ink2);font-size:12px;display:grid;place-items:center}
.help-version{margin-top:16px;font-size:11px;color:#ADA496;text-align:center}

/* ── 라이트박스 ────────────────────────── */
.lightbox{
  position:fixed;inset:0;z-index:80;background:rgba(24,21,17,.94);
  display:flex;align-items:center;justify-content:center;
}
.lb-close{position:absolute;top:calc(env(safe-area-inset-top,0px) + 12px);right:14px;width:36px;height:36px;border-radius:50%;background:rgba(255,255,255,.14);color:#fff;font-size:20px;display:grid;place-items:center;z-index:2}
.lb-track{display:flex;overflow-x:auto;scroll-snap-type:x mandatory;width:100%;height:100%;align-items:center}
.lb-track img{flex:0 0 100%;width:100%;max-height:88dvh;object-fit:contain;scroll-snap-align:center}
.lb-count{position:absolute;bottom:calc(env(safe-area-inset-bottom,0px) + 16px);left:0;right:0;text-align:center;color:rgba(255,255,255,.72);font-size:12px;font-weight:700}

/* ── 토스트 ───────────────────────────── */
.toast{
  position:fixed;left:50%;bottom:calc(env(safe-area-inset-bottom,0px) + 22px);
  transform:translateX(-50%) translateY(0);z-index:90;
  background:rgba(38,33,26,.92);color:#FFFDF6;font-size:12.5px;font-weight:600;
  padding:10px 16px;border-radius:999px;max-width:88vw;text-align:center;
  box-shadow:0 10px 24px -16px #000;
}
@media (min-width:460px){
  .grid{gap:13px}
  .card-title{font-size:14px}
  .why{font-size:12px}
}
