/*
 * 공통 디자인 토큰과 컴포넌트 — "말랑" (2026-09-23 사용자 선택).
 *
 * 크림색 바탕 · 둥근 흰 카드 · 파스텔 · 제목은 Jua, 본문은 Gowun Dodum.
 * 폰에서 쓰는 것이 기본이다 — 720px 아래에서는 상단 메뉴가 하단 탭바로 내려간다.
 *
 * 규칙
 *   1. 클래스 이름은 옛것을 그대로 쓴다. 화면 16개가 이 파일 하나로 같이 바뀐다.
 *   2. 읽는 화면(.doc — 초안·자막·프롬프트 원문)은 조용히. 뒤에서 아무것도 안 움직인다.
 *   3. prefers-reduced-motion이면 움직임을 전부 끈다(맨 아래).
 *   4. 밝은 테마 하나뿐이다. 크림색이 이 방향의 전부라 어두운 판을 따로 두지 않는다.
 */
@import url("https://fonts.googleapis.com/css2?family=Jua&family=Gowun+Dodum&display=swap");

:root {
  color-scheme: light;

  --bg:        #fff7ef;
  --surface:   #ffffff;
  --surface-2: #fff3ea;
  --ink:       #2d2a32;
  --ink-2:     #57525c;
  --slate:     #9a939e;
  --hair:      #f1e3d6;

  --accent:    #ff7a59;
  --accent-ink:#e0603c;
  --accent-bg: #ffe9df;
  --ok:        #2f9e5b;
  --ok-bg:     #dff3e6;
  --warn:      #c9861a;
  --warn-bg:   #fff1d6;
  --danger:    #e5484d;
  --danger-bg: #ffe4e4;

  /* 타일·배지에 돌려 쓰는 파스텔 */
  --peach:  #ffe1d4;
  --mint:   #dff3e6;
  --lilac:  #e3e8ff;
  --butter: #fff1c9;
  --cloud:  #eef0f3;

  --shadow-sm: 0 2px 0 var(--hair);
  --shadow:    0 2px 0 var(--hair), 0 10px 28px rgba(160,110,70,.10);
  --radius:    22px;
  --radius-sm: 14px;

  --font-title: "Jua", "Gowun Dodum", sans-serif;
  --font-body:  "Gowun Dodum", -apple-system, "Apple SD Gothic Neo", sans-serif;
  --font-mono:  ui-monospace, SFMono-Regular, Menlo, monospace;

  --tabbar-h: 68px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
/* 크림 바탕에 아주 옅은 점무늬 — 종이 같은 결 */
body::before {
  content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image: radial-gradient(rgba(224,96,60,.07) 1px, transparent 1.2px);
  background-size: 22px 22px;
}

a { color: inherit; }
b, strong { font-weight: 700; }

/* ─────────── 상단 바 ─────────── */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.topbar-inner {
  max-width: 1080px; margin: 0 auto; padding: 0 20px;
  height: 64px; display: flex; align-items: center; gap: 10px;
}
.brand {
  font-family: var(--font-title); font-size: 22px; letter-spacing: -.01em;
  text-decoration: none; margin-right: 12px; white-space: nowrap; color: var(--ink);
}
.brand span { color: var(--accent); }
.nav { display: flex; gap: 4px; flex: 1; position: relative; }
.nav a {
  position: relative; z-index: 1;
  display: inline-flex; align-items: center; gap: 6px;
  text-decoration: none; color: var(--ink-2); font-size: 15px;
  padding: 8px 14px; border-radius: 999px; white-space: nowrap;
  transition: background .15s ease, color .15s ease;
}
.nav a i { font-style: normal; font-size: 15px; line-height: 1; }
.nav a:hover { background: var(--surface); color: var(--ink); }
.nav a.on { background: var(--surface); color: var(--accent-ink); box-shadow: var(--shadow-sm); }
.nav .indicator { display: none; } /* app.js가 넣는 움직이는 배경 — 이 디자인에서는 알약이 대신한다 */
.logout { margin: 0; flex: none; }

.page { max-width: 1080px; margin: 0 auto; padding: 26px 20px 90px; }

/* 폰: 메뉴는 하단 탭바로 */
@media (max-width: 720px) {
  /* ⚠️ backdrop-filter가 있으면 그 안의 position:fixed가 화면이 아니라 상단 바에 붙는다 —
     탭바가 아래로 안 내려가고 위에 붙어 있었다. 폰에서는 흐림 대신 단색 바탕 */
  .topbar { backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--bg); }
  .topbar-inner { height: 56px; padding: 0 16px; }
  .brand { font-size: 20px; margin-right: auto; }
  .nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
    padding: 8px 6px env(safe-area-inset-bottom);
    background: var(--surface);
    border-radius: 26px 26px 0 0;
    box-shadow: 0 -4px 24px rgba(120,80,50,.10);
    justify-content: space-around; gap: 0;
  }
  .nav a {
    flex: 1; flex-direction: column; gap: 3px; justify-content: center;
    padding: 6px 0; font-size: 11.5px; border-radius: 16px; color: var(--slate);
  }
  .nav a i { font-size: 21px; filter: grayscale(.9); opacity: .7; transition: transform .2s ease; }
  .nav a:hover { background: transparent; }
  .nav a.on { background: transparent; box-shadow: none; color: var(--accent-ink); }
  .nav a.on i { filter: none; opacity: 1; transform: translateY(-2px) scale(1.08); }
  .page { padding: 18px 16px calc(var(--tabbar-h) + 40px + env(safe-area-inset-bottom)); }
  .logout .btn { padding: 6px 12px; font-size: 13px; }
}

/* ─────────── 타이포 ─────────── */
h1, h2, h3 { font-family: var(--font-title); font-weight: 400; letter-spacing: -.01em; }
h1 { font-size: 28px; line-height: 1.3; margin: 0 0 6px; }
h2 { font-size: 19px; line-height: 1.35; margin: 0 0 12px; }
h3 { font-size: 16px; margin: 0 0 8px; }
.lede { color: var(--ink-2); margin: 0 0 22px; font-size: 15px; }
.muted { color: var(--slate); }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: .92em; }
@media (max-width: 720px) { h1 { font-size: 25px; } }

/* ─────────── 카드 ─────────── */
.card {
  background: var(--surface); border: none;
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card-pad { padding: 20px 22px; }
@media (max-width: 720px) { .card-pad { padding: 18px 16px; } }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px,1fr)); gap: 14px; }

/* 할 일 타일 — 파스텔 알약, 숫자가 크게 */
.todo-tile {
  display: block; text-decoration: none; position: relative;
  border-radius: var(--radius); padding: 18px 18px 16px;
  background: var(--cloud);
  transition: transform .15s ease, box-shadow .15s ease;
}
.todo-tile:nth-child(4n+1) { background: var(--peach); }
.todo-tile:nth-child(4n+2) { background: var(--lilac); }
.todo-tile:nth-child(4n+3) { background: var(--mint); }
.todo-tile:nth-child(4n+4) { background: var(--butter); }
.todo-tile.zero { background: var(--cloud); }
.todo-tile:hover { transform: translateY(-3px); box-shadow: 0 10px 22px rgba(160,110,70,.14); }
.todo-tile .n { font-family: var(--font-title); font-size: 40px; line-height: 1; }
.todo-tile .label { font-size: 14.5px; color: var(--ink); margin-top: 6px; font-weight: 700; }
.todo-tile .hint { font-size: 13px; color: var(--ink-2); margin-top: 6px; }
.todo-tile.zero .n, .todo-tile.zero .label { color: var(--slate); }
.todo-tile.has::after {
  content: ''; position: absolute; top: 16px; right: 16px;
  width: 10px; height: 10px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent);
}
/* 폰: 두 줄씩, 설명은 숨긴다 — 네 칸이 한 화면에 들어오게 */
@media (max-width: 560px) {
  .grid-3:has(.todo-tile) { grid-template-columns: 1fr 1fr; gap: 10px; }
  .todo-tile { padding: 15px 15px 14px; }
  .todo-tile .n { font-size: 34px; }
  .todo-tile .hint { display: none; }
}

/* ─────────── 배지 ─────────── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; padding: 3px 10px; border-radius: 999px;
  background: var(--cloud); color: var(--ink-2); white-space: nowrap;
}
.badge.ok     { background: var(--ok-bg);     color: var(--ok); }
.badge.warn   { background: var(--warn-bg);   color: var(--warn); }
.badge.danger { background: var(--danger-bg); color: var(--danger); }
.badge.accent { background: var(--accent-bg); color: var(--accent-ink); }

/* ─────────── 버튼 — 누르면 쏙 들어간다 ─────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-family: var(--font-title); font-size: 15px; line-height: 1.2;
  padding: 11px 18px; border-radius: 999px;
  border: none; background: var(--surface); color: var(--ink);
  box-shadow: 0 3px 0 var(--hair), inset 0 0 0 1.5px var(--hair);
  text-decoration: none; cursor: pointer; position: relative; overflow: hidden;
  transition: transform .08s ease, box-shadow .08s ease, background .15s ease;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(3px); box-shadow: 0 0 0 var(--hair), inset 0 0 0 1.5px var(--hair); }
.btn.primary { background: var(--accent); color: #fff; box-shadow: 0 3px 0 var(--accent-ink); }
.btn.primary:hover { background: #ff8a6c; }
.btn.primary:active { box-shadow: 0 0 0 var(--accent-ink); }
.btn.danger { color: var(--danger); background: var(--surface); box-shadow: 0 3px 0 #f7c9ca, inset 0 0 0 1.5px #f7c9ca; }
.btn.danger:hover { background: var(--danger-bg); }
.btn.sm { font-size: 13.5px; padding: 7px 14px; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.ripple {
  position: absolute; border-radius: 50%; transform: scale(0); pointer-events: none;
  background: currentColor; opacity: .18; animation: ripple .55s ease-out forwards;
}
@keyframes ripple { to { transform: scale(2.6); opacity: 0; } }

/* ─────────── 목록 ─────────── */
.list { display: flex; flex-direction: column; }
.card.list { padding: 6px; }
.list-item {
  display: flex; gap: 12px; align-items: center;
  padding: 11px 12px; border-radius: 16px;
  text-decoration: none; color: inherit;
  transition: background .15s ease;
}
.list-item + .list-item { margin-top: 2px; }
.list-item:hover { background: var(--surface-2); }
.list-item .thumb {
  width: 84px; height: 52px; border-radius: 12px; object-fit: cover;
  background: linear-gradient(135deg, var(--peach), #ffc2a8); flex: none;
}
.list-item .body { flex: 1; min-width: 0; }
.list-item .t { font-weight: 700; font-size: 15px; margin-bottom: 2px; line-height: 1.4;
                overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item .s { font-size: 13px; color: var(--slate); }
/* 폰: 제목은 두 줄까지, 배지는 제목 아래로 */
@media (max-width: 560px) {
  .list-item { flex-wrap: wrap; row-gap: 6px; align-items: flex-start; }
  .list-item .thumb { width: 64px; height: 64px; border-radius: 14px; }
  .list-item .body { flex-basis: calc(100% - 76px); }
  .list-item .t { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; font-size: 14.5px; }
  .list-item .s { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; }
  .list-item > .badge { margin-left: 76px; }
  .list-item > .badge + .badge { margin-left: 0; }
}

/* ─────────── 빈 상태 ─────────── */
.empty {
  text-align: center; padding: 48px 24px; color: var(--ink-2);
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
}
.empty .big { font-size: 40px; margin-bottom: 10px; animation: float 3.4s ease-in-out infinite; }
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }

/* ─────────── 단계 진행 ─────────── */
.steps { display: flex; flex-direction: column; gap: 0; }
.step { display: flex; gap: 14px; padding: 12px 0; position: relative; }
.step:not(:last-child)::before {
  /* 점과 점을 잇는 점선 */
  content: ''; position: absolute; left: 14px; top: 44px; bottom: -4px;
  border-left: 2px dashed var(--hair);
}
.step .dot {
  width: 30px; height: 30px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-family: var(--font-title); font-size: 14px;
  background: var(--cloud); color: var(--slate); position: relative; z-index: 1;
}
.step.done .dot { background: var(--mint); color: var(--ok); }
.step.now  .dot { background: var(--accent); color: #fff; animation: pulse 2s ease-out infinite; }
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 45%, transparent); }
  70%  { box-shadow: 0 0 0 10px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
.step .c { flex: 1; min-width: 0; padding-top: 3px; }
.step .c b { display: block; font-family: var(--font-title); font-weight: 400; font-size: 16px; }
.step .c small { color: var(--ink-2); font-size: 13px; }

.scroller { overflow-x: auto; }

/* ─────────── 뒤로가기 ─────────── */
.back {
  display: inline-flex; align-items: center; gap: 4px; text-decoration: none; color: var(--ink-2);
  font-size: 14px; margin-bottom: 14px; padding: 5px 12px 5px 8px; border-radius: 999px; background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.back:hover { color: var(--accent-ink); }

/* ─────────── 알림 상자 ─────────── */
.note {
  border-radius: var(--radius-sm); padding: 13px 16px; font-size: 14px;
  background: var(--surface-2); color: var(--ink-2); border: none;
}
.note b { color: var(--ink); }
.note.warn   { background: var(--warn-bg);   color: #8a5a0c; }
.note.danger { background: var(--danger-bg); color: #b4262b; }
.note.accent { background: var(--accent-bg); color: var(--accent-ink); }
.note.warn b, .note.danger b, .note.accent b { color: inherit; }

/* ─────────── 읽기용 본문 상자 — 조용히 ─────────── */
.doc {
  background: var(--surface-2); border-radius: var(--radius-sm); padding: 18px 20px;
  white-space: pre-wrap; word-break: break-word;
  font-size: 15px; line-height: 1.85; max-height: 60vh; overflow: auto;
}
.doc.short { max-height: 220px; color: var(--ink-2); line-height: 1.75; font-size: 14px; }

/* ─────────── 입력 ─────────── */
label.field { display: block; font-size: 13.5px; font-weight: 700; color: var(--ink-2); margin-bottom: 6px; }
input[type=text], input[type=url], input[type=number], input[type=password], textarea, select {
  width: 100%; font: inherit; font-size: 16px; /* 16px 아래면 iOS가 확대한다 */
  padding: 12px 15px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--hair); background: var(--surface); color: var(--ink);
  transition: border-color .15s ease, box-shadow .15s ease;
}
textarea { resize: vertical; line-height: 1.7; }
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-bg);
}
input[type=checkbox] { accent-color: var(--accent); width: 18px; height: 18px; }
.hint { font-size: 13px; color: var(--slate); margin: 6px 0 0; }

/* ─────────── 표 ─────────── */
table.kv { width: 100%; border-collapse: collapse; font-size: 14px; }
table.kv th, table.kv td { padding: 11px 12px; border-bottom: 1.5px dashed var(--hair); text-align: left; vertical-align: top; }
table.kv th { color: var(--slate); font-weight: 700; font-size: 13px; white-space: nowrap; }
table.kv tr:last-child th, table.kv tr:last-child td { border-bottom: none; }
table.kv a { color: var(--accent-ink); font-weight: 700; text-decoration: none; }
table.kv a:hover { text-decoration: underline; }

/* ─────────── 사진 격자 ─────────── */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px,1fr)); gap: 12px; }
@media (max-width: 560px) { .tiles { grid-template-columns: 1fr 1fr; gap: 10px; } }
.tile {
  background: var(--surface); border-radius: 18px; overflow: hidden; box-shadow: var(--shadow);
}
.tile img { display: block; width: 100%; height: 130px; object-fit: cover; background: var(--peach); }
.tile .meta { padding: 8px 12px; font-size: 12px; color: var(--slate); }
.tile .acts { display: flex; gap: 6px; padding: 0 10px 10px; }

/* ─────────── 여백 유틸 ─────────── */
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mt-16 { margin-top: 16px; }

/* ─────────── 상품별 후기 막대 (영상 상세) ─────────── */
.groups { display: flex; flex-direction: column; gap: 12px; }
.group { border-radius: var(--radius-sm); padding: 12px 14px; background: var(--surface-2); }
.group-name { font-family: var(--font-title); font-size: 15px; color: var(--ink); margin-bottom: 10px; }
.bars { display: flex; flex-direction: column; gap: 9px; }
.bar-row { display: grid; grid-template-columns: minmax(0,1fr) 140px 46px; gap: 10px; align-items: center; }
@media (max-width: 640px) { .bar-row { grid-template-columns: minmax(0,1fr) 80px 40px; } }
.bar-name { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar { height: 10px; border-radius: 999px; background: var(--surface); overflow: hidden; position: relative; }
.bar .fill {
  display: block; height: 100%; width: 0; border-radius: 999px; background: var(--accent);
  transition: width .8s cubic-bezier(.22,1,.36,1);
}
.bars.filled .fill { width: min(var(--pct), 100%); }
.bar-n { font-family: var(--font-title); font-size: 14px; color: var(--ink-2); text-align: right; }
.bar-row.dropped { opacity: .45; }
.bar-row.dropped .fill { background: var(--slate); }

/* ─────────── 토스트 ─────────── */
.toasts { position: fixed; top: 74px; right: 16px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-radius: 999px; font-size: 14px;
  background: var(--surface); box-shadow: var(--shadow);
  animation: toast-in .32s cubic-bezier(.22,1,.36,1) both;
  max-width: min(88vw, 380px);
}
.toast.gone { animation: toast-out .28s ease forwards; }
.toast.accent { background: var(--accent-bg); color: var(--accent-ink); }
.toast.danger { background: var(--danger-bg); color: var(--danger); }
.toast button { background: none; border: none; color: inherit; cursor: pointer; font-size: 16px; opacity: .6; }
.toast button:hover { opacity: 1; }
@keyframes toast-in  { from { opacity: 0; transform: translateY(-10px) scale(.96); } }
@keyframes toast-out { to   { opacity: 0; transform: translateY(-10px) scale(.96); } }

/* ─────────── 대시보드 카드 ─────────── */
.glass { background: var(--surface); }
a.card { text-decoration: none; transition: transform .15s ease, box-shadow .15s ease; }
a.card:hover, .card.hoverable:hover { transform: translateY(-2px); box-shadow: 0 2px 0 var(--hair), 0 14px 30px rgba(160,110,70,.14); }

/* ─────────── 진입 애니메이션 — 통통 ─────────── */
@keyframes rise { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: none; } }
.page > *, .stagger > * { animation: rise .45s cubic-bezier(.34,1.4,.64,1) both; }
.stagger > * { animation-delay: calc(var(--i, 0) * 50ms); }
.doc { animation: none; }

/* ─────────── 움직임 줄이기 ─────────── */
@media (prefers-reduced-motion: reduce) {
  .page > *, .stagger > *, .empty .big, .step.now .dot, .toast { animation: none !important; }
  .bar .fill { transition: none; }
  .todo-tile, .list-item, .btn, a.card, .nav a i { transition: none !important; }
  .todo-tile:hover, a.card:hover, .btn:active { transform: none; }
  .ripple { display: none; }
}
