/* ============ 디자인 토큰 ============ */
:root {
  --bg: #fbf7f1; --surface: #ffffff; --surface-2: #f3ede4; --text: #2b2420; --muted: #8a7f76; --line: #eadfd2;
  --accent: #ff6b4a; --accent-2: #ffb347; --accent-ink: #fff; --gold: #d99a00; --heart: #ff3d6e; --ok: #2f9e6e;
  --radius: 16px; --tab-h: 62px; --shadow: 0 6px 20px rgba(60, 40, 20, .08);
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
  --font: 'Noto Sans KR', system-ui, -apple-system, 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15120f; --surface: #201b17; --surface-2: #2a241f; --text: #f3ece4; --muted: #a59a8f; --line: #3a3129;
    --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #15120f; --surface: #201b17; --surface-2: #2a241f; --text: #f3ece4; --muted: #a59a8f; --line: #3a3129;
  --shadow: none; color-scheme: dark;
}

/* ============ 기본 ============ */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 15px; line-height: 1.5;
  -webkit-tap-highlight-color: transparent; overscroll-behavior-y: contain;
}
body.noscroll { overflow: hidden; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2 { margin: 0; }
h2 { font-size: 16px; margin: 4px 0 10px; }
small { font-size: 12px; }
.muted { color: var(--muted); }
.empty { color: var(--muted); text-align: center; padding: 40px 0; grid-column: 1 / -1; list-style: none; }

#app {
  max-width: 480px; margin: 0 auto; min-height: 100dvh; padding: calc(var(--tab-h) + var(--safe-t)) 16px calc(var(--safe-b) + 24px);
  background: var(--bg);
}
@media (min-width: 520px) { #app { border-left: 1px solid var(--line); border-right: 1px solid var(--line); } }

/* ============ 상단바 ============ */
.topbar {
  position: sticky; top: calc(var(--tab-h) + var(--safe-t)); z-index: 10; display: flex; align-items: center; gap: 8px;
  margin: 0 -16px; padding: 10px 16px; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.topbar h1 { font-size: 19px; font-weight: 800; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logo { font-weight: 900; letter-spacing: -.5px; }
.logo b { color: var(--accent); }
.icon-btn { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; font-size: 26px; line-height: 1; background: var(--surface-2); }
.chip-points { background: var(--surface); border: 1px solid var(--line); border-radius: 99px; padding: 5px 12px; font-size: 13px; font-weight: 700; }

/* ============ 메뉴 바 (맨 위에 항상 떠 있음) ============ */
#tabbar {
  position: fixed; top: 0; left: 50%; transform: translateX(-50%); width: min(100%, 480px); z-index: 60;
  display: flex; justify-content: space-around; align-items: center;
  height: calc(var(--tab-h) + var(--safe-t)); padding-top: var(--safe-t);
  background: var(--surface); border-bottom: 1px solid var(--line); box-shadow: 0 2px 10px rgba(0, 0, 0, .05);
}
#tabbar[hidden], #tabbar a[hidden] { display: none; }
#tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 1px; font-size: 11px; color: var(--muted); padding: 6px 0; }
#tabbar a .ti { font-size: 20px; filter: grayscale(1); opacity: .7; }
#tabbar a.on { color: var(--text); font-weight: 700; }
#tabbar a.on .ti { filter: none; opacity: 1; }
#tabbar .ti-svg { display: block; height: 26px; line-height: 0; }
#tabbar .ti-svg svg { width: 26px; height: 26px; }
#tabbar .tab-create { flex: 0 0 auto; }
#tabbar .plus {
  width: 52px; height: 38px; border-radius: 12px; display: grid; place-items: center; font-size: 26px; font-weight: 700;
  color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 4px 14px rgba(255, 107, 74, .4);
}

/* ============ 공용 요소 ============ */
.seg { display: flex; gap: 4px; padding: 4px; background: var(--surface-2); border-radius: 12px; margin: 12px 0; }
.seg button { flex: 1; border: 0; background: transparent; padding: 9px 4px; border-radius: 9px; font-weight: 600; font-size: 14px; color: var(--muted); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 12px;
  padding: 13px 18px; font-weight: 700; font-size: 15px; background: var(--surface-2); text-align: center;
}
.btn.primary { background: var(--text); color: var(--bg); }
.btn.accent { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; }
.btn.ghost { background: transparent; border: 1.5px solid var(--line); }
.btn.sm { padding: 7px 12px; font-size: 13px; border-radius: 10px; }
.btn.wide { width: 100%; margin-top: 12px; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.link { border: 0; background: none; color: var(--accent); font-weight: 600; padding: 6px 0; font-size: 14px; }
.link.danger { color: var(--muted); display: block; margin: 24px auto 0; font-size: 13px; text-decoration: underline; }

.badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 6px; background: rgba(0, 0, 0, .55); color: #fff; }
.badge.gold { background: var(--gold); }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 12px 0; }
.panel.center { text-align: center; }
.info-box { background: var(--surface-2); border-radius: 14px; padding: 12px 14px; margin: 8px 0 4px; font-size: 14px; }
.note { background: color-mix(in srgb, var(--accent-2) 18%, var(--surface)); border-radius: 10px; padding: 10px 12px; font-size: 13px; margin: 10px 0; }
.fine { font-size: 12px; color: var(--muted); margin: 8px 0 0; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sec { margin: 24px 0 10px; }

.field-label { display: block; font-size: 13px; font-weight: 700; margin: 14px 0 6px; color: var(--muted); }
textarea, input:not([type="checkbox"]), select {
  width: 100%; border: 1.5px solid var(--line); background: var(--bg); border-radius: 12px; padding: 12px; font-size: 16px; /* 16px: iOS 확대 방지 */
}
textarea { resize: vertical; line-height: 1.6; }
/* 밀어서 고르는 막대(배경음악 크기 등): 입력칸 테두리·여백을 빼야 끝(100%)까지 감 */
input[type="range"] { padding: 0; border: 0; background: none; border-radius: 0; height: 24px; accent-color: var(--accent); }
textarea:focus, input:focus, select:focus { outline: none; border-color: var(--accent); }

.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; }
.check input { width: 20px; height: 20px; margin-top: 1px; accent-color: var(--accent); flex: none; }

.toggle { display: flex; align-items: center; gap: 10px; margin: 14px 0 0; font-size: 14px; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle span { width: 42px; height: 24px; border-radius: 99px; background: var(--line); position: relative; flex: none; transition: .2s; }
.toggle span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: .2s; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); }
.toggle input:checked + span { background: var(--accent); }
.toggle input:checked + span::after { left: 21px; }
.toggle input:disabled + span { opacity: .4; }

.actions { position: sticky; bottom: 0; display: flex; gap: 8px; margin: 16px -16px 0; padding: 12px 16px calc(12px + var(--safe-b)); background: linear-gradient(transparent, var(--bg) 30%); }
.actions .btn { flex: 1; }
.actions.two .btn:first-child { flex: 0 0 30%; }

.spin { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; display: inline-block; animation: spin .7s linear infinite; vertical-align: -3px; }
@keyframes spin { to { transform: rotate(360deg); } }

#toast {
  position: fixed; left: 50%; bottom: calc(var(--safe-b) + 24px); transform: translate(-50%, 20px);
  background: #222; color: #fff; padding: 10px 16px; border-radius: 99px; font-size: 14px; z-index: 100;
  opacity: 0; pointer-events: none; transition: .25s; max-width: calc(100% - 32px); text-align: center;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ============ 피드 ============ */
.hero {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 0 0;
  padding: 16px; border-radius: var(--radius); color: #fff;
  background: linear-gradient(135deg, #ff8a65, #f6a6b2 50%, #9b8ce0);
}
.hero b { font-size: 17px; line-height: 1.35; display: block; }
.hero small { opacity: .9; }
.hero-cta { background: rgba(255, 255, 255, .25); padding: 8px 12px; border-radius: 99px; font-weight: 700; font-size: 13px; white-space: nowrap; }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 10px; }
.card { display: block; min-width: 0; }
.card-cover {
  position: relative; aspect-ratio: 9 / 16; border-radius: 14px; overflow: hidden; padding: 10px;
  display: flex; flex-direction: column; justify-content: flex-end; color: #fff;
}
.card-cover::after { content: ''; position: absolute; inset: 0; background: linear-gradient(transparent 45%, rgba(0, 0, 0, .45)); }
.cover-photo { position: absolute; inset: -10px; background-size: cover; background-position: center; filter: blur(8px) brightness(.75); }
.card-cover > *:not(.cover-photo) { position: relative; z-index: 1; }
.badges { position: absolute !important; top: 8px; left: 8px; display: flex; gap: 4px; flex-wrap: wrap; }
.card-text { word-break: keep-all; font-size: 15px; font-weight: 700; line-height: 1.35; text-shadow: 0 1px 4px rgba(0, 0, 0, .35); display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.s-emo .card-text { font-family: 'Gaegu', var(--font); font-size: 19px; }
.s-fun .card-text { font-family: 'Black Han Sans', var(--font); font-weight: 400; color: #2b2420; text-shadow: none; }
.s-fun.card-cover::after { background: none; }
.s-fun .card-meta { color: #2b2420; }
.s-retro .card-text { font-family: 'Nanum Gothic Coding', monospace; font-size: 13px; }
.card-meta { display: flex; justify-content: space-between; margin-top: 8px; font-size: 12px; font-weight: 700; }
.card-title { font-weight: 700; font-size: 14px; margin-top: 7px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-author { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.ad-cover { background: repeating-linear-gradient(45deg, var(--surface-2), var(--surface-2) 10px, var(--surface) 10px, var(--surface) 20px); color: var(--text); justify-content: center; text-align: center; border: 1px dashed var(--line); }
.ad-cover::after { display: none; }
.ad-cover .card-text { text-shadow: none; }
.ad-tag { position: absolute; top: 8px; right: 8px; font-size: 10px; font-weight: 800; background: var(--gold); color: #fff; padding: 1px 6px; border-radius: 4px; }
.ad-icon { font-size: 40px; margin-bottom: 6px; }
.ad-icon.sm { font-size: 26px; margin: 0; }
.ad-banner { position: relative; display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin: 16px 0; border: 1px dashed var(--line); border-radius: 14px; background: var(--surface); text-align: left; color: var(--text); }
.ad-banner b { display: block; font-size: 14px; }
.ad-banner small { color: var(--muted); }

/* ============ 시청(전체화면) ============ */
#overlay { display: none; }
#overlay.open { display: block; position: fixed; inset: calc(var(--tab-h) + env(safe-area-inset-top, 0px)) 0 0 0; z-index: 50; background: #000; } /* 메뉴 바 아래부터 */
#overlay { --safe-t: 0px; } /* 노치 여백은 메뉴 바가 이미 차지 */
.watch { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; }
/* 휴대폰: 화면 꽉 채움 / 태블릿·PC: 9:16 프레임 */
.stage { position: relative; width: 100vw; height: 100dvh; overflow: hidden; background: #111; }
@media (min-width: 520px) { .stage { border-radius: 18px; height: min(94dvh, calc(100vw * 16 / 9)); width: min(100vw, calc(94dvh * 9 / 16)); } }
.stage.small { width: 220px; height: 391px; border-radius: 16px; margin: 0 auto; box-shadow: var(--shadow); }
.w-close { position: absolute; top: calc(12px + var(--safe-t)); left: 12px; z-index: 5; width: 40px; height: 40px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .35); color: #fff; font-size: 18px; }
.w-rail { position: absolute; right: 10px; bottom: calc(120px + var(--safe-b)); z-index: 5; display: flex; flex-direction: column; gap: 14px; }
@media (min-width: 520px) { .w-rail { right: calc(50% - min(50vw, 47dvh * 9 / 16) - 70px); } }
.rail-btn { border: 0; background: none; color: #fff; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; text-shadow: 0 1px 3px rgba(0, 0, 0, .5); }
.rail-btn b { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 50%; background: rgba(0, 0, 0, .35); font-size: 22px; }
.rail-btn.on b { color: var(--heart); }
#w-voice.on b { color: #ffe259; }
.rail-btn.pop b { animation: pop .45s ease; }
@keyframes pop { 40% { transform: scale(1.35); } }
.w-info { position: absolute; left: 0; right: 70px; bottom: 0; z-index: 4; padding: 40px 16px calc(20px + var(--safe-b)); pointer-events: none; background: linear-gradient(transparent, rgba(0, 0, 0, .5)); max-width: 480px; }
@media (min-width: 520px) { .w-info { left: 50%; transform: translateX(-50%); width: min(100vw, calc(94dvh * 9 / 16)); right: auto; bottom: 3dvh; } }
.w-info a { pointer-events: auto; }
.w-author { font-weight: 700; font-size: 14px; }
.w-title { font-size: 15px; margin: 2px 0 6px; }
.w-series { display: inline-block; font-size: 13px; background: rgba(255, 255, 255, .2); padding: 4px 10px; border-radius: 99px; }
.w-end { position: absolute; inset: 0; z-index: 6; display: grid; place-items: center; background: rgba(0, 0, 0, .6); padding: 24px; }
.end-card { position: relative; width: min(320px, 100%); background: var(--surface); color: var(--text); border-radius: 20px; padding: 20px; display: flex; flex-direction: column; gap: 10px; text-align: center; }
.end-card .lock { font-size: 36px; }
.end-card p { margin: 0; color: var(--muted); font-size: 14px; }
.end-card .ad-banner { margin: 4px 0 0; }

/* ============ 재생기 ============ */
.player { position: absolute; inset: 0; overflow: hidden; color: #fff; user-select: none; }
.pl-bg { position: absolute; inset: -6%; background-size: cover; background-position: center; }
.pl-bg.is-photo { filter: blur(10px) brightness(.6); }
@keyframes kenburns { from { transform: scale(1) translate(0, 0); } to { transform: scale(1.15) translate(-2%, -3%); } }
.pl-shade { position: absolute; inset: 0; background: radial-gradient(transparent 40%, rgba(0, 0, 0, .25)); }
.pl-bars { position: absolute; top: calc(10px + var(--safe-t)); left: 10px; right: 10px; display: flex; gap: 4px; z-index: 3; }
.stage.small .pl-bars { top: 10px; }
.pl-bars span { flex: 1; height: 3px; border-radius: 3px; background: rgba(255, 255, 255, .35); overflow: hidden; }
.pl-bars i { display: block; height: 100%; width: 0; background: #fff; }
.pl-date { position: absolute; top: calc(28px + var(--safe-t)); right: 14px; font-size: 12px; opacity: .85; z-index: 3; }
.stage.small .pl-date { top: 24px; }
.pl-caption { position: absolute; inset: 0; display: grid; place-items: center; padding: 18% 10%; z-index: 2; }
.pl-caption p { margin: 0; text-align: center; white-space: pre-line; word-break: keep-all; overflow-wrap: anywhere; font-size: clamp(18px, 6.5cqw, 34px); line-height: 1.4; opacity: 0; }
.stage { container-type: size; }
.pl-caption p.in { animation: capIn .6s ease forwards; }
@keyframes capIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.pl-mark { position: absolute; bottom: 10px; right: 12px; font-size: 11px; font-weight: 800; opacity: .6; z-index: 3; }
.pl-paused { position: absolute; inset: 0; display: grid; place-items: center; font-size: 54px; z-index: 4; background: rgba(0, 0, 0, .2); }
.player.is-paused * { animation-play-state: paused !important; }

/* 감성: 손글씨 + 종이 */
.s-emo .pl-caption p { font-family: 'Gaegu', var(--font); font-weight: 700; font-size: clamp(22px, 8cqw, 40px); text-shadow: 0 2px 10px rgba(80, 40, 60, .4); }
.s-emo .pl-caption p[data-kind="body"] { background: rgba(255, 253, 247, .92); color: #3b2f2a; text-shadow: none; padding: .5em .8em; border-radius: 6px; box-shadow: 0 6px 24px rgba(0, 0, 0, .15); transform: rotate(-1deg);
  background-image: repeating-linear-gradient(transparent, transparent 1.38em, rgba(120, 150, 200, .25) 1.38em, rgba(120, 150, 200, .25) 1.42em); }
.s-emo .pl-caption p.in[data-kind="body"] { animation: capInTilt .7s ease forwards; }
@keyframes capInTilt { from { opacity: 0; transform: translateY(14px) rotate(-3deg); } to { opacity: 1; transform: rotate(-1deg); } }

/* 유머: 예능 자막 */
.s-fun .pl-caption p { font-family: 'Black Han Sans', var(--font); color: #fff; -webkit-text-stroke: 1.5px #2b2420; paint-order: stroke fill; text-shadow: 3px 3px 0 #2b2420; font-size: clamp(22px, 8.5cqw, 42px); }
.s-fun .pl-caption p[data-kind="body"] { color: #ffe259; }
.s-fun .pl-caption p.in { animation: popIn .45s cubic-bezier(.2, 1.6, .4, 1) forwards; }
@keyframes popIn { from { opacity: 0; transform: scale(.4) rotate(-6deg); } to { opacity: 1; transform: none; } }
.s-fun .pl-date, .s-fun .pl-mark { color: #2b2420; }

/* 레트로: VHS */
.s-retro .pl-caption p { font-family: 'Nanum Gothic Coding', monospace; font-size: clamp(16px, 6cqw, 28px); color: #e8f7ff; text-shadow: 2px 0 rgba(255, 0, 80, .7), -2px 0 rgba(0, 220, 255, .7); }
.s-retro .pl-caption p.in { animation: glitch .5s steps(4) forwards; }
@keyframes glitch { 0% { opacity: 0; transform: translateX(-6px); } 50% { opacity: .6; transform: translateX(4px); } 100% { opacity: 1; transform: none; } }
.pl-scan { position: absolute; inset: 0; z-index: 3; pointer-events: none; background: repeating-linear-gradient(transparent 0 2px, rgba(0, 0, 0, .18) 2px 4px); }
.pl-rec { position: absolute; top: calc(26px + var(--safe-t)); left: 14px; z-index: 3; font-family: 'Nanum Gothic Coding', monospace; font-size: 13px; color: #e8f7ff; }
.stage.small .pl-rec { top: 22px; }
.pl-rec b { margin-left: 6px; }
.s-retro .pl-date { font-family: 'Nanum Gothic Coding', monospace; color: #ffb347; }

/* ============ 만들기 ============ */
.stepper { display: flex; list-style: none; padding: 0; margin: 4px 0 0; gap: 4px; }
.stepper li { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); position: relative; }
.stepper li span { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); font-weight: 700; font-size: 13px; }
.stepper li.on { color: var(--text); font-weight: 700; }
.stepper li.on span { background: var(--accent); color: #fff; }
.stepper li.done span { background: var(--text); color: var(--bg); }

.uploader { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 20px 14px; border: 2px dashed var(--line); border-radius: 14px; background: var(--bg); text-align: center; transition: .15s; }
.uploader.has { padding: 10px; }
.uploader.over { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--bg)); }
.uploader small { color: var(--muted); }
.up-btns { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; justify-content: center; }
.up-btns .btn { cursor: pointer; background: var(--surface); border: 1.5px solid var(--line); }
.pc-only { display: none; }
@media (hover: hover) and (pointer: fine) { .pc-only { display: block; } }
.pages { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; width: 100%; }
.page { position: relative; aspect-ratio: 3 / 4; border-radius: 10px; overflow: hidden; background: var(--surface-2); }
.page img { width: 100%; height: 100%; object-fit: cover; display: block; }
.page-no { position: absolute; top: 5px; left: 5px; background: rgba(0, 0, 0, .6); color: #fff; font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 5px; }
.page-tools { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: flex-end; gap: 4px; padding: 5px; background: linear-gradient(transparent, rgba(0, 0, 0, .5)); }
.page-tools button { width: 28px; height: 28px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .9); color: #222; font-size: 14px; font-weight: 700; display: grid; place-items: center; padding: 0; }
.page.add { display: flex; flex-direction: column; align-items: center; justify-content: center; border: 2px dashed var(--line); background: transparent; cursor: pointer; color: var(--muted); }
.page.add span { font-size: 28px; line-height: 1; }
.ocr-sub { margin-top: 4px; }
.ocr-choice { display: flex; gap: 8px; }
.ocr-choice .btn { flex: 1; padding: 12px 8px; font-size: 14px; }
.ref-photos { display: flex; flex-direction: column; gap: 8px; margin: 14px 0 4px; }
.ref-photos img { width: 100%; border-radius: 10px; border: 1px solid var(--line); cursor: zoom-in; }
.zoom-view { position: fixed; inset: 0; z-index: 130; background: rgba(0, 0, 0, .92); overflow: auto; display: grid; place-items: center; }
.zoom-view img { width: 100%; max-width: 900px; }
.drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 180px; border: 2px dashed var(--line); border-radius: 14px; background: var(--bg); text-align: center; padding: 16px; cursor: pointer; }
.drop.has { padding: 6px; min-height: 0; }
.drop img { max-width: 100%; max-height: 320px; border-radius: 10px; display: block; }
.drop-ic { font-size: 40px; }
.drop small { color: var(--muted); }
.ocr-status { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 14px; color: var(--accent); font-weight: 600; font-size: 14px; }
.consent { background: var(--surface-2); border-color: transparent; }

.pii-list { display: flex; flex-wrap: wrap; gap: 6px; }
.pii { border: 1.5px solid var(--line); background: var(--bg); border-radius: 10px; padding: 6px 10px; font-size: 13px; text-align: left; text-decoration: line-through; color: var(--muted); }
.pii small { display: block; font-size: 10px; font-weight: 700; text-decoration: none; }
.pii i { font-style: normal; opacity: .5; }
.pii.on { border-color: var(--ok); color: var(--text); text-decoration: none; background: color-mix(in srgb, var(--ok) 10%, var(--surface)); }
.pii.on small { color: var(--ok); }
.add-row { display: flex; gap: 6px; margin-top: 12px; }
.add-row input { flex: 1; }
.masked { font-size: 15px; line-height: 1.8; white-space: normal; word-break: keep-all; }
.masked mark { background: color-mix(in srgb, var(--ok) 25%, transparent); color: inherit; border-radius: 4px; padding: 0 3px; font-weight: 700; }

.style-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 8px; }
.style-card { border: 2px solid var(--line); background: var(--bg); border-radius: 14px; padding: 10px 6px; display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; }
.style-card small { font-size: 11px; color: var(--muted); line-height: 1.3; }
.sc-swatch { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-size: 22px; background: var(--g); margin-bottom: 4px; }
.style-card.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }

.scenes { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.scenes li { display: flex; gap: 8px; align-items: flex-start; }
.sc-no { flex: 0 0 42px; text-align: center; font-weight: 800; padding-top: 8px; }
.sc-no small { display: block; font-weight: 400; color: var(--muted); font-size: 11px; }
.scenes textarea { padding: 8px 10px; font-size: 15px; }

.preview-wrap { padding: 6px 0; }
.price-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.price-row input { width: 120px; flex: none; }
.price-row small { flex-basis: 100%; }

/* ============ 마켓 / 연재 ============ */
.mlist, .slist { list-style: none; padding: 0; margin: 12px 0; display: flex; flex-direction: column; gap: 8px; }
.mrow { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 10px; }
.mthumb { flex: 0 0 48px; height: 64px; border-radius: 10px; display: grid; place-items: center; font-size: 20px; font-weight: 800; color: #fff; text-shadow: 0 1px 3px rgba(0, 0, 0, .4); }
.minfo { flex: 1; min-width: 0; }
.minfo b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.minfo small { color: var(--muted); }
.play-ic { color: var(--muted); padding: 0 6px; }
.srow { display: flex; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 10px; }
.srow b { display: block; }
.srow small { color: var(--muted); }
.srow p { margin: 4px 0 0; font-size: 13px; }
.scover { flex: 0 0 72px; height: 96px; border-radius: 10px; position: relative; }
.scover span { position: absolute; bottom: 6px; right: 6px; background: rgba(0, 0, 0, .55); color: #fff; font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 5px; }

/* ============ 내 정보 ============ */
.profile { display: flex; align-items: center; gap: 14px; margin: 8px 0 14px; }
.profile b { display: block; font-size: 18px; }
.profile small { color: var(--muted); }
.avatar { width: 60px; height: 60px; border-radius: 50%; display: grid; place-items: center; font-size: 30px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 0; text-align: center; }
.stats b { display: block; font-size: 18px; }
.stats small { color: var(--muted); }
.stats div + div { border-left: 1px solid var(--line); }
.policy { padding-left: 18px; color: var(--muted); font-size: 13px; margin: 0; }
.policy li { margin-bottom: 6px; }

/* ============ 웹툰 쇼츠 ============ */
.comic-player { position: absolute; inset: 0; display: grid; place-items: center; overflow: hidden; }
.comic-player canvas { width: 100%; height: 100%; object-fit: contain; display: block; }
.cover-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.card-cover.is-comic::after { display: none; }
.card-cover.is-comic .card-text { display: none; }
.card-cover.is-comic .card-meta { position: absolute !important; left: 8px; right: 8px; bottom: 8px; background: rgba(0, 0, 0, .5); color: #fff; padding: 2px 8px; border-radius: 8px; }
.badge.comic { background: var(--accent); }
.mthumb { position: relative; overflow: hidden; }
.mthumb .mlabel { position: absolute; bottom: 3px; right: 3px; font-size: 11px; background: rgba(0, 0, 0, .6); padding: 0 4px; border-radius: 4px; }

.fmt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 16px; }
.fmt-card { border: 2px solid var(--line); background: var(--bg); border-radius: 14px; padding: 12px 8px; display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; }
.fmt-card span { font-size: 30px; }
.fmt-card small { color: var(--muted); font-size: 12px; }
.fmt-card.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }

.char-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 8px; }
.char-card { border: 2px solid var(--line); background: var(--bg); border-radius: 14px; padding: 6px 4px 8px; display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; cursor: pointer; font-size: 13px; min-width: 0; }
.char-card canvas { width: 100%; max-width: 70px; aspect-ratio: 1; }
.char-card small { font-size: 10px; color: var(--muted); line-height: 1.2; }
.char-card.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--surface)); }
.char-card.locked { opacity: .55; cursor: default; border-style: dashed; }
.lock-ic { font-size: 30px; height: 56px; display: grid; place-items: center; }

.pcards { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.pcard { display: flex; gap: 10px; background: var(--bg); border: 1.5px solid var(--line); border-radius: 14px; padding: 8px; }
.pthumb { flex: 0 0 96px; width: 96px; height: 171px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-2); }
.pfields { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.pfields input, .pfields select { padding: 7px 9px; font-size: 16px; border-radius: 9px; }
.prow { display: flex; gap: 6px; align-items: center; }
.prow > * { min-width: 0; flex: 1; }
.prow .pno { flex: 0 0 auto; font-size: 14px; }
.prow select.sm { flex: 0 0 76px; }
.cchips { display: flex; flex-wrap: wrap; gap: 4px; }
.cchip { border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: 2px 9px; font-size: 12px; color: var(--muted); }
.cchip.on { background: var(--text); color: var(--bg); border-color: var(--text); }

.voice-box, .translate-box { display: flex; flex-direction: column; gap: 6px; background: color-mix(in srgb, var(--accent-2) 14%, var(--surface)); border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; }
.translate-box { margin: 12px 0 0; }
.voice-box select, .translate-box select { padding: 7px 9px; font-size: 16px; border-radius: 9px; }
.voice-box .btn, .translate-box .btn { flex: 0 0 auto; white-space: nowrap; }
.vrow { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; font-size: 12px; }
.vspace { flex: 1; }
.vbtn { border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: 4px 10px; font-size: 12px; font-weight: 600; }
.vbtn.on { background: color-mix(in srgb, var(--ok) 15%, var(--surface)); border-color: var(--ok); }
.vbtn.rec.recording { background: #e8453c; color: #fff; border-color: #e8453c; animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .6; } }
.warn { color: #d9480f; font-size: 11px; }
.export-modal { position: fixed; inset: 0; z-index: 120; display: grid; place-items: center; background: rgba(0, 0, 0, .6); padding: 24px; }
.xbar { height: 10px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.xbar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .2s; }

@media (prefers-reduced-motion: reduce) {
  .pl-bg, .pl-caption p.in { animation: none !important; opacity: 1; }
}

/* 작성 중인 영상 목록 */
.draft-row { gap: 8px; padding: 8px 0; border-bottom: 1px solid color-mix(in srgb, var(--ink, #2b2420) 10%, transparent); }
.draft-row:last-child { border-bottom: 0; }
.draft-row > span:first-child { min-width: 0; overflow-wrap: anywhere; }
.draft-row .btn { white-space: nowrap; }

/* 배경 사진 고르기 */
.bg-picks { display: flex; gap: 8px; overflow-x: auto; padding: 6px 4px 2px 0; }
.bg-pick { position: relative; flex: 0 0 64px; height: 84px; border-radius: 10px; overflow: hidden; border: 2px solid transparent; background: var(--surface-2, #eee); padding: 0; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.bg-pick img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.bg-pick small { position: relative; margin-top: auto; width: 100%; font-size: 11px; background: rgba(0,0,0,.45); color: #fff; text-align: center; }
.bg-pick.on { border-color: var(--accent, #ff7a59); }
.bg-pick.add span { font-size: 22px; line-height: 1; }
.bg-pick.add small { background: none; color: inherit; margin-top: 4px; }

/* 로그인 화면: 메뉴 바가 없으니 위 여백 없앰 */
body.no-tabs #app { padding-top: 0; }
body.no-tabs .topbar { top: 0; padding-top: calc(10px + var(--safe-t)); }

/* 개인정보로 보이는 부분 (그대로 두기일 때) */
.pii-red { color: #e03131; font-weight: 700; }
@media (prefers-color-scheme: dark) { .pii-red { color: #ff6b6b; } }

/* 영상 끝 카드 닫기 */
.end-x { position: absolute; top: 8px; right: 8px; width: 32px; height: 32px; border: 0; border-radius: 50%; background: var(--surface-2); color: var(--text); font-size: 15px; line-height: 1; cursor: pointer; display: grid; place-items: center; }
.end-x:hover { filter: brightness(.95); }
.end-card > b { padding: 0 30px; }

/* 내 아이콘 · 닉네임 바꾸기 */
.avatar-btn { position: relative; border: 0; padding: 0; cursor: pointer; flex: 0 0 auto; overflow: visible; }
.avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.avatar-edit { position: absolute; right: -2px; bottom: -2px; width: 22px; height: 22px; border-radius: 50%; background: var(--surface); border: 1px solid var(--line); font-size: 11px; display: grid; place-items: center; }
.avatar.big { width: 84px; height: 84px; font-size: 42px; margin: 4px auto; }
.profile-edit { text-align: left; max-height: 90dvh; overflow-y: auto; }
.profile-edit > b { text-align: center; }
.avatar-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.avatar-grid button { aspect-ratio: 1; border: 2px solid transparent; border-radius: 12px; background: var(--surface-2); font-size: 24px; cursor: pointer; }
.avatar-grid button.on { border-color: var(--accent); background: var(--surface); }

/* 사진 보관함 */
.bg-pick-wrap { position: relative; flex: 0 0 64px; }
.bg-pick-wrap .bg-pick { width: 64px; }
.bg-pick small { font-size: 10px; line-height: 1.3; }
.bg-del { position: absolute; top: -4px; right: -4px; width: 20px; height: 20px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; font-size: 10px; line-height: 1; cursor: pointer; display: grid; place-items: center; z-index: 1; }

/* 위쪽 막대 오른쪽 버튼 사이 간격 (💾 저장 · 새로) */
.topbar-right { display: flex; align-items: center; gap: 14px; }
/* 글로 쓰기: 일기 이미지 붙이기 */
.attach-box { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; padding: 10px 12px; border: 1px dashed var(--line); border-radius: 12px; }
.attach-box .bg-pick img { cursor: zoom-in; }

/* 내 영상 삭제 버튼 */
.card-wrap { position: relative; min-width: 0; }
.card-del { position: absolute; top: 6px; right: 6px; z-index: 3; width: 30px; height: 30px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .55); color: #fff; font-size: 14px; line-height: 1; cursor: pointer; display: grid; place-items: center; }
.card-del:hover { background: #e03131; }

/* 영상 상태 (공개 · 마켓판매 · 개인소장) */
.status-row { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.status-badge { font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 99px; white-space: nowrap; }
.status-badge.s-public { background: #e7f5ff; color: #1971c2; }
.status-badge.s-sale { background: #fff4e6; color: #d9480f; }
.status-badge.s-private { background: #f1f3f5; color: #495057; }
.status-row select { font-size: 12px; padding: 3px 6px; border-radius: 8px; max-width: 100%; }
.card-del.locked { background: rgba(0, 0, 0, .4); font-size: 12px; }
.card-del.locked:hover { background: rgba(0, 0, 0, .6); }
@media (prefers-color-scheme: dark) { .status-badge.s-public { background: #1c3a57; color: #a5d8ff; } .status-badge.s-sale { background: #4a2a12; color: #ffc078; } .status-badge.s-private { background: #2b2f33; color: #ced4da; } }

/* 연재 만들기: 영상 고르기 목록 */
.series-edit { text-align: left; max-height: 90dvh; overflow-y: auto; }
.series-edit > b { text-align: center; display: block; }
.pick-list { display: flex; flex-direction: column; gap: 4px; max-height: 42vh; overflow-y: auto; border: 1px solid var(--line); border-radius: 12px; padding: 6px; }
.pick-row { display: flex; align-items: center; gap: 8px; padding: 8px; border-radius: 10px; cursor: pointer; }
.pick-row.on { background: color-mix(in srgb, var(--accent) 12%, var(--surface)); }
.pick-row input { flex: 0 0 auto; width: 18px; height: 18px; }
.pick-row b { flex: 1; min-width: 0; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-row small { flex: 0 0 auto; }
.pick-no { flex: 0 0 auto; font-size: 12px; font-weight: 700; color: var(--accent); min-width: 28px; }

/* 연재 묶음 카드 (여러 장 겹친 느낌) */
.badge.series { background: #7048e8; color: #fff; }
.series-card .card-cover { position: relative; }
.series-stack { position: absolute; right: 6px; top: 34px; width: 24px; height: 34px; z-index: 2; }
.series-stack::before, .series-stack::after { content: ""; position: absolute; right: 0; width: 18px; height: 26px; border-radius: 4px; background: rgba(255,255,255,.55); border: 1px solid rgba(0,0,0,.12); }
.series-stack::before { top: 0; right: 7px; }
.series-stack::after { top: 4px; }

/* 번역본 보관 · 언어 선택 */
.trans-item { margin-top: 8px; display: flex; flex-direction: column; gap: 4px; }
.trans-item textarea { width: 100%; border-radius: 10px; }
.lang-seg { flex-wrap: wrap; }
.lang-seg button { flex: 0 1 auto; padding: 7px 12px; }

/* 서버에 구운 영상(MP4) 재생 */
.w-video { width: 100%; height: 100%; object-fit: contain; background: #000; display: block; }
.w-nosound { position: absolute; left: 12px; right: 12px; top: calc(12px + var(--safe-t, 0px)); z-index: 3; padding: 10px 14px; border-radius: 12px; background: rgba(232, 69, 60, .92); color: #fff; font: 700 14px/1.45 'Noto Sans KR', sans-serif; text-align: center; pointer-events: none; }
.w-unmute { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 3; padding: 14px 22px; border: 0; border-radius: 99px; background: rgba(0, 0, 0, .72); color: #fff; font: 700 17px 'Noto Sans KR', sans-serif; box-shadow: 0 4px 16px rgba(0, 0, 0, .35); cursor: pointer; }

/* ============ 홈(첫 화면) 배경 ============ */
body.home-bg { background: var(--home-base, var(--bg)) var(--home-img, none) repeat; background-attachment: fixed; }
body.home-bg.home-photo { background: var(--home-base) var(--home-img) center / cover no-repeat fixed; }
body.home-bg #app { background: color-mix(in srgb, var(--bg) var(--home-veil, 80%), transparent); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) body.home-bg #app { background: color-mix(in srgb, var(--bg) 92%, transparent); } }
:root[data-theme="dark"] body.home-bg #app { background: color-mix(in srgb, var(--bg) 92%, transparent); }
.hb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.hb-item { display: flex; flex-direction: column; gap: 4px; padding: 8px; border: 2px solid var(--line); border-radius: 14px; background: var(--surface); font-size: 13px; }
.hb-item.on { border-color: var(--accent); }
.hb-item small { font-size: 11px; line-height: 1.35; }
.hb-item input { width: 100%; padding: 5px 7px; font-size: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.hb-thumb { display: block; width: 100%; height: 120px; border: 1px solid var(--line); border-radius: 10px; padding: 0; }
.trans-picks { display: flex; flex-wrap: wrap; gap: 6px; }
.trans-picks .cchip { font-size: 13px; padding: 5px 11px; cursor: pointer; }
/* 배경 사진 가운데 체크 */
.bg-check { position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 17px; font-weight: 800; line-height: 1; color: #fff; background: rgba(255,255,255,.55); border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.35); }
.bg-pick.on .bg-check { background: var(--accent, #ff7a59); }
.bg-pick:not(.on) img { filter: brightness(.82) saturate(.8); }
.cover-pv { flex: 0 0 90px !important; width: 90px; height: 160px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); }
