:root {
  --bg: #fffaf4; --card: #ffffff; --ink: #2b2118; --muted: #8a7a6b; --line: #eee3d6;
  --accent: #f08a24; --accent-ink: #ffffff; --soft: #fff1e2;
  --ok: #2f9e5b; --warn: #c98a00; --bad: #d64545; --info: #3a7bd5;
  --radius: 14px; --shadow: 0 1px 3px rgba(60, 40, 20, .08), 0 4px 16px rgba(60, 40, 20, .05);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17130f; --card: #221c16; --ink: #f3ebe2; --muted: #a8998a; --line: #3a3027;
    --soft: #33261a; --shadow: none;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body {
  font: 15px/1.55 -apple-system, "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  padding-bottom: calc(64px + env(safe-area-inset-bottom));
}
a { color: inherit; }
h2 { font-size: 20px; margin: 0 0 4px; }
h3 { font-size: 16px; margin: 0 0 10px; }
.muted { color: var(--muted); font-size: 13px; }
.small { font-size: 12px; }

.top {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top));
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; text-decoration: none; }
.brand img { width: 28px; height: 28px; }
main { max-width: 1100px; margin: 0 auto; padding: 16px; }

.tabs {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 10; display: flex; justify-content: center; gap: 4px;
  background: var(--card); border-top: 1px solid var(--line); padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
}
.tabs a {
  flex: 1; max-width: 200px; text-align: center; padding: 10px 0; border-radius: 10px; text-decoration: none;
  color: var(--muted); font-weight: 600;
}
.tabs a.on { color: var(--accent); background: var(--soft); }
.tabs b { display: inline-block; min-width: 18px; margin-left: 4px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: #fff; font-size: 12px; }
.tabs b:empty { display: none; }

.btn {
  appearance: none; border: 1px solid var(--line); background: var(--card); color: var(--ink);
  padding: 9px 14px; border-radius: 10px; font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: var(--accent); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.danger { color: var(--bad); }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.grow { flex: 1; }

input, textarea, select {
  width: 100%; font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line);
  border-radius: 10px; padding: 9px 11px;
}
textarea { resize: vertical; }
input:focus, textarea:focus, select:focus { outline: 2px solid color-mix(in srgb, var(--accent) 40%, transparent); border-color: var(--accent); }
label.f { display: block; margin: 10px 0 4px; font-size: 13px; font-weight: 600; color: var(--muted); }
input[type=checkbox] { width: auto; }
.check { display: flex; gap: 8px; align-items: center; margin: 6px 0; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); margin-bottom: 14px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.ep-card { text-decoration: none; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.ep-card .thumb { aspect-ratio: 9/16; background: var(--soft) center/cover no-repeat; display: grid; place-items: center; color: var(--muted); font-size: 13px; position: relative; }
.ep-card .meta { padding: 8px 10px 10px; }
.ep-card .t { font-weight: 600; font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ep-card .badge { position: absolute; top: 8px; left: 8px; }

.badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--soft); color: var(--accent); }
.badge.review { background: var(--accent); color: #fff; }
.badge.approved { background: color-mix(in srgb, var(--info) 18%, transparent); color: var(--info); }
.badge.published { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.badge.failed { background: color-mix(in srgb, var(--bad) 16%, transparent); color: var(--bad); }
.badge.rejected { background: var(--line); color: var(--muted); }

.spin { display: inline-block; width: 12px; height: 12px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: s .8s linear infinite; vertical-align: -1px; }
@keyframes s { to { transform: rotate(360deg); } }

.detail > * { min-width: 0; }
.detail { display: grid; grid-template-columns: minmax(260px, 360px) 1fr; gap: 18px; align-items: start; }
.player { position: sticky; top: 70px; }
.player video, .player .ph { width: 100%; aspect-ratio: 9/16; border-radius: var(--radius); background: #000; display: block; }
.player .ph { background: var(--soft); display: grid; place-items: center; color: var(--muted); text-align: center; padding: 20px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.chip { font-size: 12px; padding: 4px 10px; border-radius: 999px; background: var(--soft); border: 0; color: var(--ink); cursor: pointer; font: inherit; font-size: 12px; }
.shots { display: grid; gap: 10px; }
.shot { display: grid; grid-template-columns: 84px 1fr; gap: 12px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; }
.shot .img { width: 84px; aspect-ratio: 9/16; border-radius: 8px; background: var(--soft) center/cover; cursor: pointer; }
.shot details summary { cursor: pointer; color: var(--muted); font-size: 13px; }
.log { max-height: 240px; overflow: auto; font-size: 12px; color: var(--muted); }
.log div { padding: 2px 0; border-bottom: 1px dashed var(--line); }
.hist .h { font-size: 13px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.hist .h b { font-weight: 600; margin-right: 6px; }
.pubs { display: grid; gap: 6px; }
.pub { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; }
.photos { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.photos .p { width: 72px; height: 72px; border-radius: 10px; background: var(--soft) center/cover; position: relative; }
.photos .p button { position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: var(--bad); color: #fff; cursor: pointer; font-size: 12px; }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--bad); margin-right: 6px; }
.status-dot.on { background: var(--ok); }
.warn { background: color-mix(in srgb, var(--warn) 14%, var(--card)); border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent); border-radius: 12px; padding: 10px 14px; margin: 12px 16px 0; font-size: 14px; }
.empty { text-align: center; color: var(--muted); padding: 60px 10px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

dialog { border: 0; border-radius: 18px; padding: 0; width: min(520px, calc(100vw - 32px)); background: var(--card); color: var(--ink); box-shadow: 0 20px 60px rgba(0,0,0,.3); }
dialog::backdrop { background: rgba(0,0,0,.4); }
.dlg { padding: 20px; display: grid; gap: 10px; }
#toast { position: fixed; left: 50%; bottom: calc(80px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 14px; opacity: 0; transition: .2s; pointer-events: none; z-index: 50; max-width: calc(100vw - 32px); }
#toast.on { opacity: 1; }

@media (max-width: 760px) {
  .detail { grid-template-columns: 1fr; }
  .player { position: static; max-width: min(300px, 100%); margin: 0 auto; width: 100%; }
  .two { grid-template-columns: 1fr; }
  .brand span { font-size: 15px; }
  .grid { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- 편집기 ---------- */
.ed-grid { display: grid; grid-template-columns: minmax(220px, 300px) 1fr; gap: 16px; margin-top: 12px; }
.ed-grid > * { min-width: 0; }
.ed-stage { position: relative; aspect-ratio: 9/16; background: #000; border-radius: 12px; overflow: hidden; touch-action: none; }
.ed-stage video { width: 100%; height: 100%; object-fit: cover; display: block; }
.ed-caps { position: absolute; inset: 0; pointer-events: none; }
.ed-cap { position: absolute; left: 50%; transform: translate(-50%, -50%); max-width: 90%; text-align: center; font-weight: 800;
  line-height: 1.3; pointer-events: auto; cursor: grab; touch-action: none; user-select: none; padding: 2px 4px; border-radius: 6px;
  text-shadow: -2px -2px 0 #000, 2px -2px 0 #000, -2px 2px 0 #000, 2px 2px 0 #000, 0 2px 0 #000, 0 -2px 0 #000, 2px 0 0 #000, -2px 0 0 #000; }
.ed-cap.sel { outline: 2px dashed var(--accent); }
.ed-ctrl { margin-top: 8px; }
.ed-strip { position: relative; display: flex; gap: 2px; height: 56px; margin-top: 8px; border-radius: 8px; overflow: hidden; cursor: pointer; background: var(--soft); }
.ed-shot { border: 0; padding: 0; background: var(--soft) center/cover; position: relative; cursor: pointer; min-width: 0; }
.ed-shot span { position: absolute; left: 4px; bottom: 3px; font-size: 11px; color: #fff; text-shadow: 0 1px 2px #000; }
.ed-head { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--accent); pointer-events: none; }
.ed-tabs { display: flex; gap: 4px; background: var(--soft); padding: 4px; border-radius: 10px; }
.ed-tab { flex: 1; border: 0; background: transparent; padding: 8px; border-radius: 8px; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; }
.ed-tab.on { background: var(--card); color: var(--accent); box-shadow: var(--shadow); }
.cap-list { display: grid; gap: 8px; max-height: 520px; overflow: auto; padding-right: 2px; }
.cap-item { border: 1px solid var(--line); border-radius: 10px; padding: 10px; cursor: pointer; }
.cap-item.live { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }
.cap-item.sel { border-color: var(--accent); background: var(--soft); }
.cap-time input { width: 64px; padding: 6px; }
.cap-time { flex-wrap: wrap; margin-top: 6px; gap: 6px; }
.chip.on { background: var(--accent); color: #fff; }
.swatch { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--line); cursor: pointer; padding: 0; }
.swatch.on { border-color: var(--ink); box-shadow: 0 0 0 2px var(--accent); }
input[type=range] { padding: 0; accent-color: var(--accent); }
@media (max-width: 760px) {
  .ed-grid { grid-template-columns: 1fr; }
  .ed-stage { max-width: 300px; margin: 0 auto; width: 100%; }
  .cap-list { max-height: none; }
}

/* ---------- 트렌드 ---------- */
.soft-box { background: var(--soft); border-radius: 10px; padding: 10px 12px; font-size: 14px; }
.tr-ex { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-top: 10px; }
.tr-vid { display: grid; gap: 4px; text-decoration: none; }
.tr-thumb { display: block; aspect-ratio: 16/9; border-radius: 8px; background: var(--soft) center/cover; }
.tr-scen { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; margin-top: 12px; }
.tr-sc { border: 1px solid var(--line); border-radius: 10px; padding: 10px; display: grid; gap: 6px; }
.tr-sc textarea { font-size: 13px; }
.tabs a { font-size: 14px; }

/* 틱톡 1분 모음 */
.comp-list { display:flex; flex-direction:column; gap:8px; }
.comp-item { display:flex; align-items:center; gap:10px; padding:8px; border:1px solid var(--line); border-radius:12px; cursor:pointer; }
.comp-item input { width:20px; height:20px; flex:none; }
.comp-thumb { width:48px; height:84px; flex:none; border-radius:8px; background:#eee center/cover; }

/* 성과 */
.st-sum { display:grid; grid-template-columns:repeat(auto-fit,minmax(180px,1fr)); gap:12px; margin-bottom:12px; }
.st-sum .card { margin:0; }
.st-big { font-size:30px; font-weight:800; line-height:1.2; margin-top:4px; }
.st-list { display:flex; flex-direction:column; gap:8px; }
.st-row { display:flex; align-items:center; gap:10px; color:inherit; text-decoration:none; padding:6px; border-radius:10px; }
.st-row:hover { background:var(--line); }
.st-cover { width:40px; height:70px; flex:none; border-radius:6px; background:#eee center/cover; }
.st-nums { white-space:nowrap; }
@media (max-width:520px) { .st-row { flex-wrap:wrap; } .st-nums { width:100%; padding-left:50px; } }
