/* 영상 만들기 폰 화면. 노트북 대화창과 같은 동화책 느낌 (크림 바탕, 굵은 테두리, 딱 떨어지는 그림자). */

@font-face {
  font-family: "Pretendard";
  src: url("fonts/PretendardVariable.woff2") format("woff2");
  font-weight: 45 920;
  font-display: swap;
}

:root {
  --ink: #3B2F2A;
  --cream: #FBF4E6;
  --paper: #FFFDF8;
  --white: #FFFFFF;
  --line: #D9CBB2;
  --muted: #6B5A4C;
  --body2: #4A3D33;
  --primary: #C24E30;
  --primary-ink: #A9401F;
  --sun: #FFE7A8;
  --chip: #FFF4DC;
  --pick: #FFF8EA;
  --soft: #F3E7D0;
  --run: #FFF0D6;
  --leaf: #3D6631;
  --leaf-soft: #E6F3E3;
  --leaf-dot: #BFF0A8;
  --amber: #B07A00;
  --amber-soft: #FFF0C2;
  --gray-soft: #EDE6DA;
  --err: #9A3420;
  --err-line: #B3402A;
  --err-soft: #FDE4DA;
  --bw: 2.5px;
  --shadow: 4px 4px 0 var(--ink);
  --shadow-s: 2px 2px 0 var(--ink);
  --font: "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--cream); color: var(--ink); font-family: var(--font); -webkit-text-size-adjust: 100%; }
body { min-height: 100vh; }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--ink); text-decoration: none; }
a:hover { color: var(--primary); }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }

.shell { max-width: 520px; margin: 0 auto; min-height: 100vh; position: relative; }
.view { padding: 0 20px calc(110px + env(safe-area-inset-bottom)); }
.view.no-tabs { padding-bottom: calc(150px + env(safe-area-inset-bottom)); }
.view > section, .view > figure, .view > .player, .view > .page-text, .view > .page-nums, .view > .btns,
.view > .note, .view > .kinds, .view > .seg { margin-bottom: 14px; }

/* 머리 */
.top { display: flex; align-items: center; justify-content: space-between; padding: 20px 0 6px; gap: 10px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 17px; }
.logo { width: 32px; height: 32px; border-radius: 10px; background: var(--primary); border: var(--bw) solid var(--ink); display: flex; align-items: center; justify-content: center; flex: none; }
.me { width: 44px; height: 44px; border-radius: 50%; background: var(--sun); border: var(--bw) solid var(--ink); font-weight: 800; font-size: 16px; display: flex; align-items: center; justify-content: center; padding: 0; cursor: pointer; }
.back { width: 44px; height: 44px; border-radius: 14px; border: var(--bw) solid var(--ink); background: var(--paper); box-shadow: var(--shadow-s); display: flex; align-items: center; justify-content: center; flex: none; }
.headline { display: flex; align-items: center; gap: 12px; padding: 20px 0 4px; }
.headline h1 { margin: 0; font-size: 22px; font-weight: 800; letter-spacing: -.02em; line-height: 1.3; }
h1.big { margin: 6px 0 16px; font-size: 26px; font-weight: 800; letter-spacing: -.02em; line-height: 1.3; }
.lead { margin: 8px 0 16px; font-size: 15px; line-height: 1.55; color: var(--muted); }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; padding: 8px 0 14px; font-size: 13.5px; color: var(--muted); font-weight: 600; }

/* 자동 제작 띠 */
.strip { display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 999px; border: 2px solid var(--ink); background: var(--leaf); color: var(--white); font-size: 14px; font-weight: 800; box-shadow: var(--shadow-s); margin-top: 6px; }
.strip.off { background: var(--gray-soft); color: var(--ink); }
.strip.wait { background: var(--amber-soft); color: var(--ink); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--leaf-dot); flex: none; }
.dot.blink { animation: pulse 1.4s ease-in-out infinite; }
.strip.off .dot { background: var(--muted); }
.strip.wait .dot { background: var(--amber); }
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .35; transform: scale(.7); } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* 카드 */
.stack { display: flex; flex-direction: column; gap: 14px; }
.card { background: var(--paper); border: var(--bw) solid var(--ink); border-radius: 22px; box-shadow: var(--shadow); padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; }
.card.flat { box-shadow: none; }
.card h2 { margin: 0; font-size: 18px; font-weight: 800; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.row.top-align { align-items: flex-start; }
.small { font-size: 13.5px; color: var(--muted); }
.note { margin: 0; padding: 10px 12px; border-radius: 12px; border: 2px dashed var(--ink); background: var(--run); font-size: 14px; font-weight: 600; line-height: 1.5; }
.note.err { background: var(--err-soft); border-color: var(--err-line); color: var(--err); }
.empty { color: var(--muted); font-size: 14.5px; line-height: 1.6; text-align: center; padding: 18px 8px; }

.pill { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; border: 2px solid var(--ink); font-weight: 800; font-size: 15px; }
.pill .dot { width: 10px; height: 10px; }
.pill.making { background: #FFE0D6; } .pill.making .dot { background: var(--primary); }
.pill.resting { background: var(--leaf-soft); } .pill.resting .dot { background: #4F7F40; }
.pill.waiting { background: var(--amber-soft); } .pill.waiting .dot { background: var(--amber); }
.pill.offline, .pill.idle { background: var(--gray-soft); } .pill.offline .dot, .pill.idle .dot { background: var(--muted); }
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 800; padding: 3px 10px; border-radius: 999px; background: var(--leaf-soft); border: 2px solid #4F7F40; color: var(--leaf); white-space: nowrap; }
.badge.live { background: var(--leaf); color: var(--white); border-color: var(--ink); }
.badge.live .dot { width: 8px; height: 8px; }
.badge.gray { background: var(--chip); border-color: var(--line); color: var(--body2); }
.badge.err { background: var(--err-soft); border-color: var(--err-line); color: var(--err); }

.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.metric { background: var(--chip); border-radius: 14px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.metric span { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.metric b { font-size: 20px; font-weight: 800; }
.metric small { font-size: 12px; color: var(--muted); }

.job-head { display: flex; gap: 14px; align-items: center; }
.kind-art { width: 88px; height: 112px; border-radius: 12px; border: var(--bw) solid var(--ink); flex: none; object-fit: cover; background: var(--sun); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.kind-art img { width: 100%; height: 100%; object-fit: cover; }
.job-head b { font-size: 17px; font-weight: 800; line-height: 1.35; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.steps li { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 4px; border-radius: 12px; background: var(--soft); font-size: 13px; font-weight: 700; color: var(--muted); text-align: center; word-break: keep-all; }
.steps li.done { background: var(--leaf-soft); color: var(--leaf); }
.steps li.now { background: var(--sun); border: 2px solid var(--ink); color: var(--ink); font-weight: 800; }
.bar { height: 14px; border-radius: 999px; border: 2px solid var(--ink); background: var(--paper); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--primary); transition: width .4s; }

.queue-item { display: flex; gap: 12px; align-items: center; }
.queue-item.mine { padding: 10px; margin: 0 -10px; border-radius: 14px; background: var(--sun); }
.num { width: 30px; height: 30px; border-radius: 50%; background: var(--chip); border: 2px solid var(--ink); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 14px; flex: none; }
.queue-item.mine .num { background: var(--paper); }
.grow { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.grow b { font-size: 15.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.when { font-size: 13px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.queue-item.mine .when { color: var(--ink); font-weight: 800; }

.covers { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.covers.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cover { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.cover .pic { position: relative; width: 100%; aspect-ratio: 3 / 4; border-radius: 12px; border: var(--bw) solid var(--ink); background: var(--sun); overflow: hidden; display: flex; align-items: center; justify-content: center; }
.cover .pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover .pic .len { position: absolute; right: 6px; bottom: 6px; padding: 2px 7px; border-radius: 8px; background: #2A211D; color: var(--white); font-size: 12px; font-weight: 700; }
.cover .pic .state { position: absolute; left: 6px; top: 6px; }
.cover b { font-size: 13.5px; font-weight: 700; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cover small { font-size: 12.5px; color: var(--muted); }

/* 버튼 */
.btn { min-height: 46px; padding: 0 14px; border-radius: 14px; border: var(--bw) solid var(--ink); background: var(--paper); color: var(--ink); font-size: 14.5px; font-weight: 800; box-shadow: var(--shadow-s); display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; word-break: keep-all; line-height: 1.3; text-align: center; }
.btn:active { transform: translate(1px, 1px); box-shadow: 1px 1px 0 var(--ink); }
.btn.primary { background: var(--primary); color: var(--white); font-size: 17px; min-height: 54px; border-radius: 16px; box-shadow: 3px 3px 0 var(--ink); }
.btn.primary:hover { background: var(--primary-ink); color: var(--white); }
.btn.dark { background: var(--ink); color: var(--white); box-shadow: none; }
.btn.sun { background: var(--sun); }
.btn.danger { border-color: var(--err-line); background: var(--err-soft); color: var(--err); box-shadow: none; }
.btn.small { min-height: 40px; font-size: 13.5px; padding: 0 12px; border-radius: 12px; }
.btn[disabled] { opacity: .5; cursor: default; }
.btns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.btns.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.btns .btn { min-height: 52px; padding: 6px; }
.link { background: none; border: 0; padding: 0; font-size: 14px; font-weight: 700; text-decoration: underline; cursor: pointer; color: var(--ink); }

/* 고르기 */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 8px; }
.seg button, .chips button { border: var(--bw) solid var(--line); background: var(--pick); color: var(--ink); font-weight: 700; cursor: pointer; }
.seg button { min-height: 48px; border-radius: 14px; font-size: 15.5px; font-weight: 800; word-break: keep-all; padding: 4px; }
.seg button[aria-pressed="true"], .chips button[aria-pressed="true"], .tiles button[aria-pressed="true"] { background: var(--sun); border-color: var(--ink); box-shadow: var(--shadow-s); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips button { min-height: 40px; padding: 0 13px; border-radius: 999px; font-size: 14px; border-width: 2px; }
.chips button.more { border-style: dashed; border-color: var(--ink); background: transparent; }
.tiles { display: flex; gap: 10px; overflow-x: auto; padding: 2px 2px 8px; margin: 0 -18px 0 0; padding-right: 18px; scroll-snap-type: x proximity; }
.tiles button { flex: none; width: 104px; padding: 6px; border-radius: 16px; border: var(--bw) solid var(--line); background: var(--pick); font-size: 13.5px; font-weight: 800; display: flex; flex-direction: column; gap: 6px; cursor: pointer; scroll-snap-align: start; }
.tiles img { width: 100%; height: 78px; object-fit: cover; border-radius: 10px; display: block; background: var(--sun); }
.tiles.animals img { object-fit: contain; }
.kinds { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.kinds button { min-height: 56px; border-radius: 16px; border: var(--bw) solid var(--line); background: var(--pick); font-weight: 800; font-size: 14.5px; cursor: pointer; word-break: keep-all; line-height: 1.3; padding: 4px; }
.kinds button[aria-pressed="true"] { background: var(--sun); border-color: var(--ink); box-shadow: var(--shadow-s); }
.stepper { display: flex; align-items: center; gap: 10px; }
.stepper button { width: 44px; height: 44px; border-radius: 14px; border: var(--bw) solid var(--ink); background: var(--paper); font-size: 22px; font-weight: 800; padding: 0; cursor: pointer; }
.stepper b { min-width: 52px; text-align: center; font-size: 20px; font-weight: 800; }
label.title, .label { font-size: 17px; font-weight: 800; }
textarea, input[type=email], input[type=password], input[type=text] { width: 100%; border-radius: 14px; border: var(--bw) solid var(--line); background: var(--white); padding: 12px 14px; font-size: 16px; line-height: 1.5; color: var(--ink); }
textarea { resize: none; }
input[type=email], input[type=password] { height: 50px; padding: 0 14px; }
textarea:focus, input:focus { border-color: var(--ink); outline: none; }
.check { display: flex; align-items: center; gap: 10px; font-size: 14.5px; font-weight: 600; min-height: 44px; }
.check input { width: 22px; height: 22px; accent-color: var(--primary); margin: 0; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 14.5px; font-weight: 800; }

/* 아래 고정 칸 */
.dock { position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; width: 100%; max-width: 520px; background: var(--paper); border-top: var(--bw) solid var(--ink); padding: 12px 20px calc(18px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 10px; z-index: 5; }
.dock p { margin: 0; font-size: 13.5px; font-weight: 600; color: var(--muted); text-align: center; }
.tabs { position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; width: 100%; max-width: 520px; height: calc(84px + env(safe-area-inset-bottom)); background: var(--paper); border-top: var(--bw) solid var(--ink); display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); padding: 8px 8px calc(14px + env(safe-area-inset-bottom)); z-index: 5; }
.tabs a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border-radius: 14px; font-size: 12.5px; font-weight: 700; }
.tabs a[aria-current="page"] { background: var(--sun); font-weight: 800; color: var(--ink); }

/* 책 읽기·영상 */
.page-pic { margin: 0; background: var(--paper); border: var(--bw) solid var(--ink); border-radius: 22px; box-shadow: var(--shadow); padding: 10px; display: flex; flex-direction: column; gap: 10px; }
.page-pic img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 14px; display: block; background: var(--sun); }
.page-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.round { width: 48px; height: 48px; border-radius: 50%; border: var(--bw) solid var(--ink); background: var(--sun); padding: 0; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.page-text { margin: 0; min-height: 96px; padding: 16px 18px; border-radius: 18px; background: var(--paper); border: var(--bw) solid var(--line); font-size: 19px; line-height: 1.7; font-weight: 600; white-space: pre-line; }
.page-nums { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.page-nums button { height: 44px; border-radius: 12px; border: 2px solid var(--line); background: var(--paper); font-weight: 800; font-size: 15px; cursor: pointer; }
.page-nums button[aria-pressed="true"] { background: var(--sun); border-color: var(--ink); }
.player { background: #2A211D; border: var(--bw) solid var(--ink); border-radius: 22px; box-shadow: var(--shadow); padding: 12px; }
.player video { display: block; width: 100%; max-height: 70vh; border-radius: 14px; background: #000; }

/* 관리 */
.switch { width: 64px; height: 38px; border-radius: 999px; border: var(--bw) solid var(--ink); background: var(--line); padding: 0 4px; display: flex; align-items: center; justify-content: flex-start; cursor: pointer; flex: none; }
.switch[aria-checked="true"] { background: #4F7F40; justify-content: flex-end; }
.switch span { width: 26px; height: 26px; border-radius: 50%; background: var(--white); border: var(--bw) solid var(--ink); }
.list { display: flex; flex-direction: column; }
.list > * { display: flex; align-items: center; gap: 12px; min-height: 52px; border-top: 2px dashed var(--line); padding: 6px 0; }
.list > *:first-child { border-top: 0; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--sun); border: 2px solid var(--ink); display: flex; align-items: center; justify-content: center; font-weight: 800; flex: none; }
.log { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.log li { display: grid; grid-template-columns: 74px 1fr; gap: 10px; font-size: 14px; line-height: 1.45; }
.log li span:first-child { color: var(--muted); font-weight: 700; }

/* 로그인 */
.login { min-height: 100vh; display: flex; flex-direction: column; gap: 18px; padding: 28px 4px 40px; }
.hero { width: 168px; height: 168px; border-radius: 50%; background: var(--sun); border: var(--bw) solid var(--ink); box-shadow: var(--shadow); display: flex; align-items: flex-end; justify-content: center; overflow: hidden; margin: 6px auto 0; }
.hero img { width: 150px; height: 150px; object-fit: contain; }
.center { text-align: center; }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(100px + env(safe-area-inset-bottom)); max-width: min(440px, calc(100% - 40px)); padding: 12px 16px; border-radius: 14px; border: var(--bw) solid var(--ink); background: var(--ink); color: var(--white); font-size: 14.5px; font-weight: 700; z-index: 20; box-shadow: var(--shadow-s); line-height: 1.45; }
.toast.err { background: var(--err-soft); color: var(--err); border-color: var(--err-line); }
.spin { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--primary); animation: spin 1s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
