/* srai-gallery — base styles */
:root {
  --bg: #FFFFFF;
  --bg-sub: #F7F8FB;
  --dark: #0F172A;
  --text: #1E293B;
  --sub: #64748B;
  --muted: #94A3B8;
  --line: #E2E8F0;
  --blue: #2563EB;
  --blue-bg: #EFF6FF;
  --blue-border: #BFDBFE;
  --green: #059669;
  --green-bg: #ECFDF5;
  --orange: #EA580C;
  --orange-bg: #FFF7ED;
  --red: #DC2626;
  --red-bg: #FEF2F2;
  --shadow-sm: 0 1px 2px rgba(15,23,42,0.04), 0 1px 3px rgba(15,23,42,0.06);
  --shadow-md: 0 4px 12px rgba(15,23,42,0.08);
  --shadow-lg: 0 12px 32px rgba(15,23,42,0.12);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
[hidden] { display: none !important; }

/* topbar */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  height: 60px;
  display: flex; align-items: center;
}
.topbar-inner {
  max-width: 1100px; width: 100%; margin: 0 auto; padding: 0 24px;
  display: flex; align-items: center; justify-content: space-between;
}
.logo {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 800; font-size: 22px;
  color: var(--dark);
  letter-spacing: -0.02em;
}
.logo em { color: var(--blue); font-style: italic; }
/* #14 — 로고 자리에 URL 텍스트. 두 줄: URL + 부연 카피.
   박예준님 정리 (#1): monospace → 페이지 본문 sans-serif 로 통일. 차분한 단색 + 자간 정돈. */
.logo-url {
  display: inline-flex; flex-direction: column; align-items: flex-start;
  line-height: 1.18;
  white-space: nowrap;
  text-decoration: none;
}
.logo-url .logo-text {
  font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 600; font-size: 15.5px;
  color: var(--dark);
  letter-spacing: -0.01em;
  transition: color 0.18s ease;
}
.logo-url .logo-tagline {
  font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 11.5px; font-weight: 500;
  color: var(--muted);
  letter-spacing: -0.005em;
  margin-top: 3px;
}
.logo-url:hover .logo-text { color: var(--blue); }

/* topbar 두 줄 — stories/cardnews 페이지에서만 적용. 다른 페이지는 60px 유지. */
.topbar.topbar-twoline { height: 74px; }

/* 헤더 버튼 통일 (#2) — 공유 / 마이페이지 / 로그아웃 셋 다 동일. */
.topnav-uniform { gap: 8px; }
.btn-nav {
  display: inline-flex; align-items: center; justify-content: center;
  height: 36px; padding: 0 14px;
  font-size: 13.5px; font-weight: 600;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 9px;
  letter-spacing: -0.01em;
  text-decoration: none;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.btn-nav:hover {
  background: var(--bg-sub);
  border-color: #CBD5E1;
  color: var(--dark);
}
.btn-nav:active { transform: translateY(1px); }

/* 자동저장 라벨 — 박예준님 명시 #3: 헤더에서 완전히 숨김 */
.autosave-hidden { display: none !important; }

@media (max-width: 720px) {
  .logo-url .logo-text { font-size: 13px; }
  .logo-url .logo-tagline { font-size: 11px; }
  .topbar.topbar-twoline { height: 66px; }
  .btn-nav { height: 32px; padding: 0 11px; font-size: 12.5px; }
}
.topnav { display: flex; align-items: center; gap: 12px; }
.topnav-link {
  font-size: 14px; font-weight: 600; color: var(--sub);
  padding: 8px 14px; border-radius: 8px;
}
.topnav-link:hover { background: var(--bg-sub); color: var(--dark); }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px;
  font-size: 14px; font-weight: 600;
  padding: 9px 18px; border-radius: 10px;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn-primary {
  background: var(--blue); color: #fff;
}
.btn-primary:hover { background: #1D4ED8; box-shadow: var(--shadow-md); }
.btn-ghost {
  background: var(--bg-sub); color: var(--dark);
  border: 1px solid var(--line);
}
.btn-ghost:hover { background: #EEF2F7; }

/* container */
.container {
  max-width: 1100px; margin: 0 auto;
  padding: 64px 24px 96px;
}

/* hero */
.hero { text-align: center; margin-bottom: 72px; }
.hero-title {
  font-size: clamp(36px, 6vw, 56px);
  font-weight: 800;
  color: var(--dark);
  letter-spacing: -0.03em;
  margin-bottom: 18px;
}
.hero-sub {
  font-size: 17px;
  color: var(--sub);
  line-height: 1.7;
  max-width: 600px;
  margin: 0 auto 32px;
}
.hero-sub strong { color: var(--blue); font-weight: 700; }
.hero-stats {
  display: flex; justify-content: center; gap: 12px; flex-wrap: wrap;
  margin-top: 28px;
}
.stat {
  background: var(--bg-sub);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 22px;
  text-align: left;
  min-width: 150px;
}
.stat-label { display: block; font-size: 12px; color: var(--sub); margin-bottom: 4px; }
.stat-val { display: block; font-size: 18px; font-weight: 700; color: var(--dark); }

/* section title */
.section-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--dark);
  margin-bottom: 20px;
  letter-spacing: -0.02em;
}

/* gallery grid */
.gallery { margin-bottom: 80px; }
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}
.loading {
  grid-column: 1 / -1;
  text-align: center; color: var(--muted);
  padding: 60px 0;
}
.tool-card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 24px;
  cursor: pointer;
  transition: all 0.18s;
  display: flex; flex-direction: column;
  min-height: 200px;
}
.tool-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--blue-border);
}
.tool-icon {
  width: 44px; height: 44px;
  background: var(--blue-bg);
  color: var(--blue);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 700;
  margin-bottom: 14px;
}
.tool-name { font-size: 17px; font-weight: 700; color: var(--dark); margin-bottom: 6px; }
.tool-desc { font-size: 14px; color: var(--sub); line-height: 1.5; flex: 1; margin-bottom: 14px; }
.tool-price {
  font-size: 13px;
  color: var(--blue);
  font-weight: 600;
  background: var(--blue-bg);
  display: inline-block;
  padding: 4px 10px;
  border-radius: 6px;
}
.tool-tag {
  font-size: 12px;
  color: var(--sub);
  font-weight: 500;
  background: var(--bg-sub);
  display: inline-block;
  padding: 4px 10px;
  border-radius: 6px;
}

.disclaimer-note {
  font-size: 13px; color: var(--sub);
  margin-top: 16px;
  padding: 10px 14px;
  background: var(--bg-sub);
  border-left: 3px solid var(--orange);
  border-radius: 4px;
}

/* jobs list */
.jobs-list { display: flex; flex-direction: column; gap: 8px; }
.job-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px;
  background: var(--bg-sub);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.job-meta { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font-size: 13px; }
.job-tool { font-weight: 700; color: var(--dark); }
.job-status {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  padding: 3px 8px; border-radius: 4px;
}
.job-status-queued    { color: var(--sub);    background: #E2E8F0; }
.job-status-running   { color: var(--blue);   background: var(--blue-bg); }
.job-status-completed { color: var(--green);  background: var(--green-bg); }
.job-status-failed    { color: var(--red);    background: var(--red-bg); }
.job-status-canceled  { color: var(--muted);  background: #F1F5F9; }
.job-time { color: var(--sub); font-size: 12px; }
.job-cost { color: var(--orange); font-size: 12px; font-weight: 600; }
.job-actions { display: flex; gap: 6px; }
.job-actions .btn { padding: 6px 10px; font-size: 12px; }

/* how */
.how { background: var(--bg-sub); border-radius: 16px; padding: 36px 32px; }
.howlist { list-style: none; counter-reset: step; }
.howlist li {
  position: relative; padding: 14px 14px 14px 56px;
  font-size: 15px; color: var(--text); line-height: 1.6;
  counter-increment: step;
}
.howlist li::before {
  content: counter(step);
  position: absolute; left: 14px; top: 14px;
  width: 28px; height: 28px;
  background: var(--blue); color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
}
.howlist li strong { color: var(--dark); font-weight: 700; }

/* footer */
.foot {
  background: var(--bg-sub);
  border-top: 1px solid var(--line);
  padding: 28px 0;
}
.foot-inner {
  max-width: 1100px; margin: 0 auto; padding: 0 24px;
  display: flex; gap: 18px; align-items: center; flex-wrap: wrap;
  font-size: 13px; color: var(--sub);
}
.foot-inner a:hover { color: var(--dark); }

/* modal */
.modal {
  position: fixed; inset: 0;
  background: rgba(15,23,42,0.4);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
}
.modal-box {
  background: #fff;
  border-radius: 16px;
  padding: 32px;
  width: 90%; max-width: 420px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}
.modal-box h3 { font-size: 22px; font-weight: 800; color: var(--dark); margin-bottom: 12px; }
.modal-box p { font-size: 15px; color: var(--sub); line-height: 1.6; margin-bottom: 24px; }
.modal-actions { display: flex; gap: 10px; justify-content: center; }

/* mypage */
.mypage-section {
  background: var(--bg-sub);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 24px;
  margin-bottom: 18px;
}
.mypage-section h3 {
  font-size: 16px; font-weight: 700; color: var(--dark);
  margin-bottom: 14px;
}
.kvrow { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.kvrow:last-child { border-bottom: none; }
.kvrow .k { color: var(--sub); font-size: 14px; }
.kvrow .v { color: var(--dark); font-size: 14px; font-weight: 600; }

input[type=number] {
  font-family: inherit;
  font-size: 14px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  width: 140px;
}
input[type=number]:focus {
  outline: none; border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-bg);
}

/* tool runner page */
.runner {
  max-width: 720px; margin: 40px auto;
  background: var(--bg-sub);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 32px;
}
.runner textarea {
  width: 100%;
  min-height: 120px;
  font-family: inherit;
  font-size: 15px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  resize: vertical;
}
.runner textarea:focus {
  outline: none; border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-bg);
}
.runner pre {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  font-size: 13px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--dark);
  white-space: pre-wrap; word-break: break-word;
  max-height: 400px; overflow: auto;
}
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%);
  background: var(--dark); color: #fff;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 14px;
  box-shadow: var(--shadow-lg);
  z-index: 200;
  opacity: 0; transition: opacity 0.2s;
  pointer-events: none;
}
.toast.show { opacity: 1; }

/* ═══════════════════════════════════════════════════════
   Phase 3 — stories illustrator
   ═══════════════════════════════════════════════════════ */

.container-wide { max-width: 1280px; padding: 36px 24px 96px; }

.stories-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; margin-bottom: 14px; flex-wrap: wrap;
}
.stories-title {
  font-size: 28px; font-weight: 800; color: var(--dark); letter-spacing: -0.02em;
}
.stories-sub { font-size: 14px; color: var(--sub); margin-top: 4px; }
.stories-status { display: flex; align-items: center; gap: 10px; }
.autosave-label {
  font-size: 12px; color: var(--muted); padding: 4px 10px;
  border-radius: 6px; background: var(--bg-sub); border: 1px solid var(--line);
  transition: all 0.18s;
}
.autosave-label.show { color: var(--green); background: var(--green-bg); border-color: #A7F3D0; }

/* 탭 바 */
.story-tabs {
  display: flex; align-items: center; gap: 6px;
  margin: 12px 0 14px;
  background: var(--bg-sub); border: 1px solid var(--line); border-radius: 12px;
  padding: 6px;
}
.tabs-scroll {
  flex: 1; overflow-x: auto; scrollbar-width: none;
}
.tabs-scroll::-webkit-scrollbar { display: none; }
.story-tabs-row {
  display: flex; gap: 4px; flex-wrap: nowrap;
}
.story-tab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px;
  background: #fff; border: 1px solid var(--line); border-radius: 8px;
  font-size: 13px; color: var(--sub); cursor: pointer; white-space: nowrap;
  transition: all 0.15s;
}
.story-tab:hover { background: #F8FAFC; color: var(--dark); }
.story-tab.active {
  background: var(--blue); color: #fff; border-color: var(--blue);
  box-shadow: var(--shadow-sm);
}
.story-tab.active .story-tab-close { color: #fff; }
.story-tab-label {
  max-width: 180px; overflow: hidden; text-overflow: ellipsis;
  font-weight: 600;
}
.story-tab-close {
  background: transparent; color: var(--muted);
  width: 18px; height: 18px; line-height: 16px; text-align: center;
  font-size: 14px; border-radius: 4px;
}
.story-tab-close:hover { background: rgba(0,0,0,0.12); }
.tab-add, .tab-arrow {
  width: 32px; height: 32px;
  background: #fff; border: 1px solid var(--line); border-radius: 8px;
  font-size: 14px; color: var(--sub); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.tab-add:hover, .tab-arrow:hover { background: var(--blue-bg); color: var(--blue); border-color: var(--blue-border); }

/* 탭 본문 */
.story-content { /* placeholder */ }
.story-tab-body {
  background: #fff; border: 1px solid var(--line); border-radius: 16px;
  padding: 28px; box-shadow: var(--shadow-sm);
}
.story-row { margin-bottom: 22px; }
.story-row-inline { display: flex; align-items: center; gap: 12px; }
.story-label {
  display: block; font-size: 13px; font-weight: 700; color: var(--sub);
  text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 6px;
}
.story-row-inline .story-label { margin-bottom: 0; }
/* #6 — 전체개요 라벨을 카드 헤더 라벨과 동일 스타일로 통일 */
.story-row > .story-label {
  font-size: 13px; font-weight: 700; color: var(--dark);
  text-transform: none; letter-spacing: -0.01em;
  margin-bottom: 8px;
}
.story-row textarea, .story-row select {
  width: 100%; font-family: inherit; font-size: 14px;
  padding: 11px 12px;
  border: 1px solid var(--line); border-radius: 10px;
  background: #fff;
}
.story-row-inline select { width: auto; min-width: 120px; }
.story-row textarea:focus, .story-row select:focus {
  outline: none; border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-bg);
}
.aspect-hint { font-size: 12px; color: var(--muted); }

/* 카드 */
.story-cards-head {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px;
}
.story-cards-head h3 { font-size: 14px; font-weight: 700; color: var(--dark); }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 7px; }

.story-cards { display: flex; flex-direction: column; gap: 14px; }
.story-card {
  background: var(--bg-sub); border: 1px solid var(--line); border-radius: 12px;
  padding: 18px;
}
.story-card-head {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px;
}
.story-card-idx { font-size: 13px; font-weight: 800; color: var(--blue); }
/* #8 — 모든 카드 헤더에 동일 라벨 ("카드(30장까지 한번에 그릴 수 있습니다.)") */
.story-card-label {
  font-size: 13px; font-weight: 700; color: var(--dark);
  letter-spacing: -0.01em;
}
.story-card-tools { display: flex; gap: 4px; }
.story-card-text {
  width: 100%; font-family: inherit; font-size: 14px;
  padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 8px;
  background: #fff; resize: vertical; min-height: 70px;
  margin-bottom: 12px;
}
.story-card-text:focus {
  outline: none; border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-bg);
}

.upload-section { margin-top: 10px; }
.upload-section-head {
  display: flex; align-items: center; gap: 10px; margin-bottom: 8px;
  flex-wrap: wrap;
}
.upload-section-head strong { font-size: 13px; color: var(--dark); font-weight: 700; }
.upload-hint { font-size: 11px; color: var(--muted); flex: 1; }
.upload-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px; min-height: 4px;
}
.upload-item {
  background: #fff; border: 1px solid var(--line); border-radius: 8px;
  padding: 6px; display: flex; flex-direction: column; gap: 6px;
  position: relative;
}
.upload-thumb {
  width: 100%; aspect-ratio: 1 / 1; object-fit: cover;
  background: #F1F5F9; border-radius: 6px;
}
.upload-meta { font-size: 11px; color: var(--sub); padding: 0 2px; }
.upload-name {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-weight: 600; color: var(--dark);
}
.upload-size { color: var(--muted); }
.upload-actions {
  position: absolute; top: 4px; right: 4px;
  display: flex; gap: 2px;
  background: rgba(255,255,255,0.92); border-radius: 6px; padding: 2px;
  opacity: 0; transition: opacity 0.15s;
}
.upload-item:hover .upload-actions { opacity: 1; }
.upload-btn {
  background: transparent; border: none; cursor: pointer;
  width: 22px; height: 22px; border-radius: 4px;
  font-size: 12px; line-height: 20px; text-align: center;
  color: var(--sub);
}
.upload-btn:hover { background: var(--bg-sub); color: var(--dark); }

.story-card-foot {
  margin-top: 12px; display: flex; justify-content: space-between; align-items: center;
}
.card-status {
  font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 4px;
  text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--sub); background: #E2E8F0;
}
.card-status[data-status="running"]   { color: var(--blue);   background: var(--blue-bg); }
.card-status[data-status="completed"] { color: var(--green);  background: var(--green-bg); }
.card-status[data-status="failed"]    { color: var(--red);    background: var(--red-bg); }
.card-status[data-status="queued"],
.card-status[data-status="pending"]   { color: var(--orange); background: var(--orange-bg); }
.card-bytes { font-size: 11px; color: var(--muted); }

/* 실행 */
.story-actions {
  margin-top: 22px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.run-meta { font-size: 13px; color: var(--sub); }

/* #9, #11 — 카드뉴스 제작 버튼: 카드 영역 아래 가운데 + 비주얼 강조 */
.story-actions-center {
  flex-direction: column; align-items: center;
  margin-top: 32px; gap: 10px;
}
.story-actions-center .run-meta {
  text-align: center; max-width: 520px;
}
.btn-cardnews-run {
  font-size: 16px; font-weight: 700;
  padding: 14px 38px;
  border-radius: 12px;
  letter-spacing: -0.01em;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.22);
  transition: all 0.18s ease;
}
.btn-cardnews-run:hover {
  background: #1D4ED8;
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.30);
}
.btn-cardnews-run:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.20);
}
@media (max-width: 720px) {
  .btn-cardnews-run { font-size: 15px; padding: 13px 30px; }
}

/* ═══════════════════════════════════════════════════════
   진행 카운터 헤드라인 + 막대 (박예준님 #1, #3)
   ═══════════════════════════════════════════════════════ */
.run-counter {
  display: flex; flex-direction: column; align-items: center;
  width: 100%; gap: 10px; margin-top: 18px;
}
.run-counter-line {
  display: flex; align-items: baseline; gap: 8px;
  font-family: 'Plus Jakarta Sans', 'Noto Sans KR', sans-serif;
  letter-spacing: -0.02em;
}
.run-counter-num {
  font-size: 32px; font-weight: 800; color: var(--blue);
  transition: color 0.25s ease;
}
.run-counter-sep {
  font-size: 26px; font-weight: 500; color: var(--muted);
}
.run-counter-total {
  font-size: 26px; font-weight: 700; color: var(--dark);
}
.run-counter-state {
  margin-left: 10px;
  font-family: 'Noto Sans KR', sans-serif;
  font-size: 14px; font-weight: 500; color: var(--sub);
  letter-spacing: -0.01em;
}
.run-counter.queued .run-counter-state { color: var(--orange); }
.run-counter.complete .run-counter-num { color: var(--green); }
.run-counter.complete .run-counter-state { color: var(--green); font-weight: 600; }
.run-counter.has-fail .run-counter-state { color: var(--orange); }
.run-counter.failed .run-counter-num { color: var(--red); }
.run-counter.failed .run-counter-state { color: var(--red); font-weight: 600; }

.run-progressbar {
  position: relative;
  width: 78%; max-width: 600px;
  height: 10px;
  background: var(--bg-sub);
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
}
.run-progress-fill {
  position: absolute; top: 0; left: 0;
  height: 100%; background: var(--blue);
  border-radius: 999px;
  transition: width 0.35s ease, background 0.3s ease;
}
.run-counter.complete .run-progress-fill { background: var(--green); }
.run-counter.failed .run-progress-fill { background: var(--red); }
.run-progress-fail {
  position: absolute; top: 0; right: 0;
  height: 100%; background: #FCA5A5;
  border-radius: 0 999px 999px 0;
  transition: width 0.35s ease;
}

/* runMeta — 헤드라인 아래 보조 정보 (jobId 등). 한 단계 작게. */
.run-meta {
  font-size: 12px; color: var(--muted);
  text-align: center; max-width: 600px;
  margin-top: 4px;
}

@media (max-width: 720px) {
  .run-counter-num { font-size: 26px; }
  .run-counter-sep, .run-counter-total { font-size: 22px; }
  .run-counter-state { font-size: 13px; }
  .run-progressbar { width: 92%; }
}

/* ═══════════════════════════════════════════════════════
   카드별 진행 시각 피드백 (박예준님 #2)
   ═══════════════════════════════════════════════════════ */
.card-progress {
  position: absolute;
  top: 14px; right: 14px;
  width: 22px; height: 22px;
  pointer-events: none;
}
.card-progress > * { display: none; }

.card-spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(37, 99, 235, 0.18);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: card-spin 1s linear infinite;
}
.card-mark {
  width: 22px; height: 22px;
  font-size: 13px; font-weight: 800;
  text-align: center; line-height: 22px;
  border-radius: 50%;
}
.card-mark.mark-ok { background: var(--green-bg); color: var(--green); border: 1px solid #A7F3D0; }
.card-mark.mark-fail { background: var(--red-bg); color: var(--red); border: 1px solid #FCA5A5; }

.story-card[data-card-status="running"] .card-spinner { display: block; }
.story-card[data-card-status="completed"] .card-mark.mark-ok { display: flex; align-items: center; justify-content: center; }
.story-card[data-card-status="failed"]    .card-mark.mark-fail { display: flex; align-items: center; justify-content: center; }

@keyframes card-spin { to { transform: rotate(360deg); } }

/* ═══════════════════════════════════════════════════════
   새 결과 도착 펄스 + 다운로드 버튼 강조 (박예준님 #4)
   ═══════════════════════════════════════════════════════ */
@keyframes pulse-new-result {
  0%   { transform: scale(0.94); box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.50); }
  35%  { transform: scale(1.05); box-shadow: 0 0 0 10px rgba(37, 99, 235, 0); }
  100% { transform: scale(1.00); box-shadow: 0 0 0 0 rgba(37, 99, 235, 0); }
}
.result-card.pulse-new { animation: pulse-new-result 1.2s ease-out 1; }

@keyframes btn-flash-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.55); }
  60%  { box-shadow: 0 0 0 14px rgba(37, 99, 235, 0); }
  100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0); }
}
.btn-flash { animation: btn-flash-pulse 1.4s ease-out 1; }

/* toast — 기존 .toast 의 transition 보완 */
.toast.show { opacity: 1; pointer-events: none; }

/* 결과 */
.results-box {
  margin-top: 28px; padding: 22px;
  background: var(--blue-bg); border: 1px solid var(--blue-border); border-radius: 12px;
}
.results-box h3 { font-size: 15px; font-weight: 700; color: var(--dark); margin-bottom: 14px; }
.results-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
}
.result-card {
  background: #fff; border: 1px solid var(--blue-border); border-radius: 8px;
  padding: 6px; position: relative;
}
.result-thumb {
  width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: 6px;
  background: #F1F5F9;
}
.result-meta {
  display: flex; justify-content: space-between; padding: 4px 4px 0;
  font-size: 11px; color: var(--sub);
}
.result-idx { font-weight: 700; color: var(--blue); }
.result-actions {
  position: absolute; top: 8px; right: 8px;
  display: flex; gap: 2px;
  background: rgba(255,255,255,0.92); border-radius: 6px; padding: 2px;
  opacity: 0; transition: opacity 0.15s;
}
.result-card:hover .result-actions { opacity: 1; }
.results-actions { margin-top: 14px; display: flex; gap: 10px; }

/* 미리보기 모달 */
.modal-preview {
  max-width: 90vw; max-height: 90vh; padding: 12px;
}
.modal-close {
  position: absolute; top: 8px; right: 12px;
  font-size: 24px; color: var(--sub); background: transparent; border: none;
  cursor: pointer; width: 32px; height: 32px; border-radius: 6px;
}
.modal-close:hover { background: var(--bg-sub); color: var(--dark); }
.modal-preview img {
  max-width: 100%; max-height: 80vh; border-radius: 8px; display: block;
}
.preview-meta {
  font-size: 12px; color: var(--sub); margin-top: 8px; text-align: center;
}

@media (max-width: 720px) {
  .stories-title { font-size: 22px; }
  .story-tab-body { padding: 18px; }
  .story-card { padding: 12px; }
  .upload-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
  .results-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
}

/* ───────────────────────────────────────────────────────
   Phase 3 추가 — 박예준님 17개 수정사항 반영 (2026-05-01 야간)
   ─────────────────────────────────────────────────────── */

/* #1, #2, #3 — 이미지 사용방법 섹션 (좌 텍스트 / 우 이미지) */
.usage-section {
  margin: 4px 0 28px;
  padding: 24px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
}
.usage-grid {
  display: grid;
  grid-template-columns: 1fr minmax(240px, 360px);
  gap: 28px; align-items: start;
}
.usage-text { padding-top: 4px; }
.usage-title {
  font-size: 18px; font-weight: 800; color: var(--dark);
  letter-spacing: -0.02em; margin-bottom: 12px;
}
.usage-body {
  font-size: 14px; color: var(--text); line-height: 1.7;
  margin-bottom: 14px;
}
.usage-body strong { color: var(--blue); font-weight: 700; }
.usage-example {
  font-size: 13px; color: var(--sub); line-height: 1.6;
  background: var(--bg-sub); padding: 12px 14px; border-radius: 10px;
  border-left: 3px solid var(--blue-border);
}
.usage-example-tag {
  display: inline-block; margin-right: 8px;
  font-size: 11px; font-weight: 700;
  background: var(--blue); color: #fff;
  padding: 2px 8px; border-radius: 4px;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.usage-image {
  display: flex; align-items: center; justify-content: center;
  min-height: 200px;
}
.usage-image svg { width: 100%; max-width: 360px; height: auto; }
.usage-hero {
  width: 100%; max-width: 360px; height: auto;
  border-radius: 12px;
  display: block;
  box-shadow: var(--shadow-sm);
  background: var(--bg-sub);
}
/* onerror fallback — 이미지 미업로드 시 빈 박스 + 안내 텍스트 */
.usage-hero.usage-hero-fallback {
  width: 100%; max-width: 360px; aspect-ratio: 4 / 5;
  background: repeating-linear-gradient(45deg, #F1F5F9, #F1F5F9 8px, #E2E8F0 8px, #E2E8F0 16px);
  border: 1px dashed #CBD5E1;
  box-shadow: none;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: var(--sub);
  position: relative;
}
.usage-hero.usage-hero-fallback::after {
  content: "이미지 자리\A(업로드 대기)";
  white-space: pre;
  text-align: center;
  font-size: 12px; line-height: 1.6;
  color: var(--sub);
  background: rgba(255,255,255,0.85);
  padding: 8px 14px;
  border-radius: 8px;
}

/* 사용 흐름 리스트 (1·2·3·4) */
.usage-flow {
  margin-top: 16px;
  list-style: none; counter-reset: usage-step;
  padding: 0;
}
.usage-flow li {
  position: relative;
  padding: 8px 0 8px 36px;
  font-size: 13px; color: var(--text); line-height: 1.55;
  counter-increment: usage-step;
}
.usage-flow li::before {
  content: counter(usage-step);
  position: absolute; left: 0; top: 8px;
  width: 22px; height: 22px;
  background: var(--blue); color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 11px;
}
.usage-flow li strong { color: var(--dark); font-weight: 700; }

/* #3 — 저작권 / 법적 책임 안내 (usage-section 안 하단) */
.legal-notice {
  margin-top: 22px;
  padding: 14px 18px;
  background: var(--bg-sub);
  border: 1px solid var(--line); border-radius: 10px;
  font-size: 12px; color: var(--sub); line-height: 1.65;
}

/* #7 — 카드 사이 옅은 실선 (1px) */
.story-cards { gap: 18px; }
.story-cards > .story-card { position: relative; }
.story-cards > .story-card + .story-card::before {
  content: ''; position: absolute;
  left: 8%; right: 8%; top: -10px;
  height: 1px; background: var(--line);
}

/* #11 — ▲▼ 클릭 시 카드 깜빡임 */
.story-card { transition: filter 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease; }
.story-card.card-flash {
  filter: brightness(0.85);
  transform: scale(0.998);
  box-shadow: 0 0 0 2px var(--blue-border) inset;
}
/* 박예준님 결정 (2026-05-02): 카드 자체에 드래그앤드롭 — 첨부 영역 외에서도 가능하게 */
.story-card.card-drag-over {
  box-shadow: 0 0 0 3px var(--blue-border) inset;
  background: var(--blue-bg);
}

/* #12 — 카드 추가 버튼: 카드 영역의 오른쪽 아래 */
.story-cards-foot {
  display: flex; justify-content: flex-end;
  margin-top: 14px;
}
.btn-add-card {
  font-size: 13px; padding: 9px 16px;
  border-style: dashed; border-color: var(--blue-border);
  color: var(--blue); background: var(--blue-bg);
}
.btn-add-card:hover {
  background: #DBEAFE; border-color: var(--blue);
}

/* 카드 헤더 — 새 라벨 표시 + 도구 정렬 (.story-card-label 사용) */
.story-card-head { gap: 10px; }
.story-card-label { flex: 1; }

/* 업로드 섹션 헤더의 액션 그룹 (파일 선택 + 화면캡쳐첨부) */
.upload-section-actions {
  display: inline-flex; gap: 6px; flex-shrink: 0;
}

/* #9 — 참고이미지 영역 위 안내문 */
.upload-usage-note {
  margin: 6px 0 10px;
  font-size: 12px; color: var(--sub); line-height: 1.6;
  padding: 10px 12px;
  background: #fff;
  border: 1px dashed var(--line); border-radius: 8px;
}
.upload-usage-note strong { color: var(--blue); font-weight: 700; }

/* #13 — 처리 중 오버레이 (반투명, z-index 최상단). 기본 hidden, 필요시 stories.js 가 활성화 */
.busy-overlay {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(15,23,42,0.32);
  display: flex; align-items: center; justify-content: center;
  pointer-events: all;   /* 클릭 차단 */
  backdrop-filter: blur(2px);
}
.busy-spinner {
  width: 40px; height: 40px;
  border: 3px solid rgba(255,255,255,0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: busy-spin 0.7s linear infinite;
}
@keyframes busy-spin { to { transform: rotate(360deg); } }

/* 카드 status (data attribute 기반) — 처리 중에 카드 시각 강조 */
.story-card[data-card-status="running"] {
  border-color: var(--blue);
  box-shadow: 0 0 0 1px var(--blue) inset;
}
.story-card[data-card-status="completed"] {
  border-color: #A7F3D0;
}
.story-card[data-card-status="failed"] {
  border-color: var(--red);
  box-shadow: 0 0 0 1px var(--red-bg) inset;
}
/* 박예준님 결정 — 시작·끝 빈 카드는 자동 trim, "생성 안 함" 표식 */
.story-card[data-card-status="skipped"] {
  opacity: 0.55;
  background: repeating-linear-gradient(
    45deg, var(--bg-sub), var(--bg-sub) 8px, #F1F5F9 8px, #F1F5F9 16px
  );
}
.story-card[data-card-status="skipped"]::after {
  content: "생략됨 (빈 카드)";
  position: absolute;
  top: 14px; left: 50%;
  transform: translateX(-50%);
  font-size: 11px; font-weight: 600;
  color: var(--sub);
  background: rgba(255,255,255,0.92);
  padding: 4px 10px; border-radius: 999px;
  border: 1px solid var(--line);
  pointer-events: none;
}

/* 반응형 — 좁은 화면에서 usage-grid 1열 */
@media (max-width: 720px) {
  .usage-grid { grid-template-columns: 1fr; gap: 16px; }
  .usage-image { order: 2; }
}

/* ───────────────────────────────────────────────────────
   마이페이지 모달 — 박예준님 명시: 페이지 전환 X, 모달 다이얼로그
   ─────────────────────────────────────────────────────── */
body.modal-open { overflow: hidden; }

.mypage-modal { animation: mypage-fade 0.18s ease-out; }
@keyframes mypage-fade { from { opacity: 0; } to { opacity: 1; } }

.mypage-modal-box {
  width: min(680px, 94vw);
  max-width: 680px;
  max-height: 88vh;
  padding: 28px 28px 22px;
  text-align: left;
  overflow: hidden;
  position: relative;
  display: flex; flex-direction: column;
  animation: mypage-slide 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes mypage-slide {
  from { transform: translateY(12px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
.mypage-modal .modal-close {
  position: absolute; top: 12px; right: 14px;
  width: 32px; height: 32px;
  font-size: 22px; line-height: 28px; color: var(--sub);
  border-radius: 8px;
  background: transparent;
}
.mypage-modal .modal-close:hover { background: var(--bg-sub); color: var(--dark); }

.mypage-title {
  font-size: 20px; font-weight: 800; color: var(--dark);
  letter-spacing: -0.02em;
  margin-bottom: 16px; padding-right: 32px;
}
.mypage-status {
  padding: 30px 0; text-align: center; color: var(--muted);
  font-size: 14px;
}
.mypage-body {
  overflow-y: auto;
  margin-right: -12px; padding-right: 12px;   /* 스크롤바 여유 */
}
.mypage-modal .mypage-section {
  background: var(--bg-sub);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 12px;
}
.mypage-modal .mypage-section h4 {
  font-size: 13px; font-weight: 700; color: var(--dark);
  margin-bottom: 10px; letter-spacing: -0.01em;
}
.mypage-help {
  font-size: 12px; color: var(--sub); line-height: 1.55;
  margin-bottom: 10px;
}
.mypage-modal .kvrow { padding: 8px 0; border-bottom: 1px dashed var(--line); }
.mypage-modal .kvrow:last-child { border-bottom: none; }
.mypage-modal .kvrow .k { font-size: 13px; }
.mypage-modal .kvrow .v { font-size: 13px; font-weight: 700; }
/* 결제 카드 (박예준님 결정 — bogose 스타일 차용 + cardnews 톤). 미결제 + 예치금 가로 배치. */
.mp-pay-card {
  background: var(--dark);
  color: #fff;
  border: none;
}
.mp-pay-card h4 { display: none; }
.mp-pay-row-amount {
  display: flex; gap: 28px; align-items: flex-start;
  padding: 4px 0 14px;
  flex-wrap: wrap;
}
.mp-pay-block { flex: 1; min-width: 130px; }
.mp-pay-label {
  font-size: 11px; color: rgba(255,255,255,0.55);
  margin-bottom: 4px;
  letter-spacing: 0.02em;
}
.mp-pay-num {
  font-family: 'Plus Jakarta Sans', 'Noto Sans KR', sans-serif;
  font-size: 28px; font-weight: 800;
  letter-spacing: -0.02em;
  color: #fff;
}
.mp-pay-num-deposit { color: #93C5FD; }   /* 예치금은 살짝 다른 톤 */
.mp-pay-unit {
  font-size: 14px; font-weight: 400;
  color: rgba(255,255,255,0.55);
  margin-left: 2px;
}
.mp-pay-card .mypage-help {
  color: rgba(255,255,255,0.6);
  margin: 12px 0 14px;
}
.mp-pay-card .mypage-pay-row .btn-primary {
  background: #fff; color: var(--dark);
  border: none;
}
.mp-pay-card .mypage-pay-row .btn-primary:hover {
  background: #F1F5F9;
}
.mypage-pay-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.mypage-pay-info { font-size: 12px; color: var(--sub); flex: 1; min-width: 200px; }
.mypage-pay-note {
  font-size: 11.5px; color: rgba(255,255,255,0.5);
  letter-spacing: -0.005em;
}

/* 월 한도 row (bogose 패턴 복원) */
.mypage-limit-row {
  display: flex; align-items: center; gap: 8px;
}
.mypage-limit-row input {
  width: 130px; padding: 7px 10px; font-size: 13px;
  border: 1px solid var(--line); border-radius: 8px;
  font-family: inherit;
}
.mypage-limit-row input:focus {
  outline: none; border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-bg);
}
.mypage-unit { font-size: 13px; color: var(--sub); }

/* 사용 내역 / 결제 내역 테이블 (bogose 스타일 차용) */
.mypage-table-wrap {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 4px 12px;
  max-height: 240px;
  overflow-y: auto;
  overflow-x: auto;   /* 7컬럼 결제 내역 — 좁은 화면에서 가로 스크롤 */
}
.mypage-table-wrap .tbl {
  min-width: 560px;   /* 결제 내역 7컬럼 최소 보장 */
}
.mypage-table-wrap .tbl {
  width: 100%; border-collapse: collapse;
}
.mypage-table-wrap .tbl th {
  font-size: 10.5px; font-weight: 700; color: var(--muted);
  text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line);
  letter-spacing: 0.04em; text-transform: uppercase;
  position: sticky; top: 0; background: #fff; z-index: 1;
}
.mypage-table-wrap .tbl td {
  font-size: 12px; padding: 9px 6px;
  border-bottom: 1px solid var(--line); vertical-align: middle;
  color: var(--text);
}
.mypage-table-wrap .tbl tr:last-child td { border-bottom: none; }
.mypage-table-wrap .tbl .r { text-align: right; }
.mypage-table-wrap .tbl .amt {
  font-weight: 700;
  font-family: 'Plus Jakarta Sans', 'Noto Sans KR', sans-serif;
}
.mypage-table-wrap .tbl .amt-minus { color: var(--green); }   /* 미결제 정산 — 초록 */
.mypage-table-wrap .tbl .amt-plus  { color: var(--blue); }    /* 예치금 추가 — 파랑 */
.mypage-table-wrap .tbl .tbl-total td {
  font-weight: 800;
  background: var(--bg-sub);
  border-top: 2px solid var(--line);
}
.tbl-empty {
  padding: 22px 8px; text-align: center;
  color: var(--muted); font-size: 12px;
}

/* 약관 · 개인정보 섹션 — 스크롤 영역 */
.mypage-policy-section .mypage-policy {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  max-height: 280px;
  overflow-y: auto;
  font-size: 12px; line-height: 1.75; color: #475569;
  letter-spacing: -0.005em;
}
.mypage-policy h5 {
  font-size: 13px; font-weight: 800; color: var(--dark);
  margin: 14px 0 8px;
  letter-spacing: -0.01em;
}
.mypage-policy p.tt {
  font-weight: 700; color: var(--dark); font-size: 12.5px;
  margin: 12px 0 6px;
}
.mypage-policy p { margin-bottom: 6px; }
.mypage-policy strong { color: var(--dark); }
.mypage-policy-divider {
  border: 0; border-top: 1px solid var(--line); margin: 14px 0;
}

/* 문의하기 섹션 */
.mypage-contact-row {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.mypage-contact-row .btn {
  font-family: 'Noto Sans KR', sans-serif;
  letter-spacing: -0.01em;
}
.mypage-contact-note {
  font-size: 11.5px; color: var(--sub);
}

@media (max-width: 720px) {
  .mypage-modal-box { padding: 22px 18px 16px; max-height: 92vh; }
  .mypage-title { font-size: 18px; }
}

/* ═══════════════════════════════════════════════════════
   Footer — bogose-ai 거의 그대로 차용 (박예준님 명시)
   원본: bogose-ai/frontend/public/index.html
   추가: 7일 자동 삭제 안내 + 약관/문의 링크 (마이페이지 모달 트리거)
   ═══════════════════════════════════════════════════════ */
.footer {
  background: #1a1a2e; color: #888; padding: 36px 24px;
  text-align: center; font-size: 0.78rem; line-height: 2;
  margin-top: 56px;
}
.footer a { color: #aaa; text-decoration: none; }
.footer a:hover { color: #fff; text-decoration: underline; }
.footer strong { color: #ccc; }
.footer .biz-info { max-width: 600px; margin: 0 auto; }

/* 7일 자동 삭제 안내 — 푸터 상단 박스 */
.footer-retention {
  font-size: 0.78rem; line-height: 1.7;
  color: #999;
  margin-bottom: 20px;
  padding-bottom: 18px;
  border-bottom: 1px solid #2c2c44;
  text-align: center;
}
.footer-retention strong { color: #d4a86a; }   /* 옅은 주황·강조 톤 */

/* 약관·문의 링크 (button 인데 a 처럼 보이게) */
.footer .footer-link {
  background: transparent; border: none; cursor: pointer;
  color: #aaa; padding: 0; font: inherit;
  letter-spacing: inherit; text-decoration: none;
}
.footer .footer-link:hover { color: #fff; text-decoration: underline; }
.footer .footer-sep { color: #555; margin: 0 6px; }

@media (max-width: 640px) {
  .footer { padding: 28px 18px; }
  .footer-retention { padding-bottom: 14px; margin-bottom: 16px; }
  .footer .footer-sep { margin: 0 4px; }
}

/* 박예준 결정 (2026-05-05 fix 129): legal-notice 입력 / 본문 history */
.ln-input-history, .ln-draft-history {
  margin: 14px 0; padding: 12px 14px;
  background: #F8FAFC; border: 1px solid #E2E8F0; border-radius: 10px;
}
.ln-input-history-h, .ln-draft-history-h {
  font-size: 12.5px; font-weight: 700; color: #475569;
  margin-bottom: 8px; letter-spacing: 0.2px;
}
.ln-input-history-list, .ln-draft-history-list {
  display: flex; flex-direction: column; gap: 6px;
}
.ln-input-history-item, .ln-draft-history-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; background: #fff; border: 1px solid #E2E8F0;
  border-radius: 8px; font-size: 12.5px; cursor: pointer;
  transition: border-color 0.15s;
}
.ln-input-history-item:hover, .ln-draft-history-item:hover { border-color: #94A3B8; }
.ln-h-time { color: #64748B; font-size: 11px; flex-shrink: 0; min-width: 110px; }
.ln-h-preview { flex: 1; color: #1F2937; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ln-h-del {
  background: transparent; border: none; cursor: pointer;
  color: #EF4444; font-size: 16px; padding: 0 4px; line-height: 1;
  flex-shrink: 0;
}
.ln-h-del:hover { color: #DC2626; }

/* video-bgm — 볼륨 3단계 라디오 (2026-05-06) */
.radio-pill { display:inline-flex; flex-direction:column; align-items:flex-start; gap:2px;
  padding:10px 14px; border:2px solid #e0e0e0; border-radius:12px; cursor:pointer;
  background:#fafafa; transition:all 0.15s; min-width:140px; }
.radio-pill input { display:none; }
.radio-pill span { font-weight:600; font-size:14px; }
.radio-pill small { font-size:11px; color:#888; }
.radio-pill:hover { border-color:#999; background:#fff; }
.radio-pill.checked { border-color:#3f51b5; background:#e8eaf6; }
.radio-pill.checked span { color:#3f51b5; }
