/* 전체 기본 스타일 */
* {
    box-sizing: border-box;
}

html, body { height: 100%; }
a{ color:inherit; text-decoration:none; }

.user-name {
    opacity: 0.85;
}

/* Subtle gradient + noise background */
body {
    background: linear-gradient(135deg, #f9fbff 0%, #f5f7fb 45%, #f3f6ff 100%);
    background-attachment: fixed;
    position: relative;
}
body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        radial-gradient(circle at 10% 20%, rgba(79,70,229,0.03), transparent 35%),
        radial-gradient(circle at 80% 0%, rgba(14,165,233,0.025), transparent 30%),
        radial-gradient(circle at 50% 80%, rgba(79,70,229,0.02), transparent 35%),
        repeating-linear-gradient(
            45deg,
            rgba(0,0,0,0.012),
            rgba(0,0,0,0.012) 1px,
            transparent 1px,
            transparent 2px
        );
    z-index: -1;
}

/* 공통 section 박스 */
.section {
    background: rgba(255, 255, 255, 0.85);
    border-radius: 12px;
    padding: 16px 18px;
    margin-bottom: 16px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08), 0 1px 0 rgba(255,255,255,0.7);
    backdrop-filter: blur(4px);
}

.section h1,
.section h2,
.section h3 {
    margin-top: 0;
}

.script-sidebar {
    max-height: 70vh;
    overflow-y: auto;
    padding-right: 4px;
}

.script-block {
    margin-bottom: 12px;
}

.script-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
}

.chapter-header,
.scene-header {
    font-size: 13px;
    font-weight: 600;
    margin-top: 6px;
}

.line-list {
    list-style: none;
    padding-left: 12px;
    margin: 4px 0;
}

.line-item {
    display: block;
    width: 100%;
    text-align: left;
    border: none;
    background: transparent;
    padding: 2px 0;
    cursor: pointer;
    font-size: 13px;
}

.line-item.active {
    background: #e5e7eb;
}

/* 선택된 대사 텍스트 박스 */
.selected-text-box {
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 12px;
    min-height: 60px;
    margin-bottom: 10px;
    background: #f9fafb;
}

.selected-text {
    margin: 0 0 8px 0;
    font-size: 14px;
    color: #111827;
}

.selected-participants {
    margin: 0 0 10px 0;
    font-size: 12px;
    color: #4b5563;
    display: none;
}

/* 버튼 기본 스타일 가볍게 */
button {
    font-family: inherit;
    font-size: 14px;
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    background: #f3f4f6;
    cursor: pointer;
    transition: all 0.16s ease;
}

button:hover {
    background: #e5e7eb;
}
/* 기본 버튼 스타일 */
.btn-primary {
    background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
    color: #fff;
    border-color: #4f46e5;
    box-shadow: 0 8px 18px rgba(79,70,229,0.25);
    transition: all 0.18s ease;
}
.btn-primary:hover {
    background: linear-gradient(135deg, #5b52f2 0%, #4f46e5 100%);
    transform: translateY(-1px);
    box-shadow: 0 10px 22px rgba(79,70,229,0.32), 0 0 0 3px rgba(99,102,241,0.08);
}

/* 모달 공통 */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);  /* 더 진하게 */
    display: none;                    /* JS에서 flex로 변경 */
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.modal {
    background: #ffffff;
    border-radius: 10px;
    padding: 22px 24px;
    max-width: 440px;
    width: 92%;
    box-shadow:
        0 10px 15px -3px rgba(15, 23, 42, 0.3),
        0 4px 6px -2px rgba(15, 23, 42, 0.25);
}

.modal-title {
    margin-top: 0;
    margin-bottom: 12px;
    font-size: 16px;
    font-weight: 600;
}

.modal-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.page-header h1 {
    font-size: 24px;
    font-weight: 700;
    margin: 0;
}
.app-main {
    background: linear-gradient(180deg, rgba(255,255,255,0.7) 0%, rgba(244,246,252,0.8) 100%);
}

.btn-primary-sm,
.btn-outline-sm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 13px;
    border: 1px solid #111827;
    text-decoration: none;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.btn-primary-sm {
    background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
    color: #ffffff;
    border: 1px solid #4f46e5;
    box-shadow: 0 6px 14px rgba(79,70,229,0.22);
    transition: all 0.18s ease;
}

.btn-primary-sm:hover {
    background: linear-gradient(135deg, #5b52f2 0%, #4f46e5 100%);
    border-color: #4f46e5;
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(79,70,229,0.28), 0 0 0 3px rgba(99,102,241,0.08);
}

.btn-primary-block,
.cta-gradient {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 12px 14px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #4f46e5 0%, #6366f1 50%, #7c3aed 100%);
    color: #ffffff;
    font-size: 15px;
    font-weight: 700;
    overflow: hidden;
    box-shadow: 0 10px 24px rgba(79,70,229,0.28), 0 0 0 1px rgba(255,255,255,0.2);
    transition: transform 0.16s ease, box-shadow 0.16s ease, filter 0.16s ease;
}
.btn-primary-block:hover,
.cta-gradient:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 28px rgba(79,70,229,0.32), 0 0 0 1px rgba(255,255,255,0.22);
    filter: saturate(1.02);
}
.cta-gradient .cta-glow {
    position: absolute;
    inset: -20%;
    background: radial-gradient(circle, rgba(255,255,255,0.35) 0%, rgba(255,255,255,0) 45%);
    opacity: 0;
    transition: opacity 0.18s ease;
}
.cta-gradient:hover .cta-glow {
    opacity: 1;
}
.cta-gradient .cta-label {
    position: relative;
    z-index: 1;
}

.upload-card {
  gap: 10px;
}
.upload-label {
  font-weight: 600;
  font-size: 14px;
  color: #111827;
}
.upload-dropzone {
  position: relative;
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
  padding: 14px 14px;
  background: rgba(249, 250, 251, 0.8);
  transition: all 0.16s ease;
}
.upload-dropzone input[type="file"] {
  width: 100%;
  opacity: 0;
  position: absolute;
  inset: 0;
  cursor: pointer;
}
.file-input-wrap {
  display: block;
  cursor: pointer;
}
.file-input-display {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  color: #374151;
  font-size: 13px;
}
.upload-dropzone:hover {
  border-color: #4f46e5;
  background: rgba(238, 242, 255, 0.6);
  box-shadow: 0 8px 18px rgba(79,70,229,0.12);
}

/* 대본 직접 입력 폼 개선 */
#script-path-b .form-card {
  max-width: 820px;
}
#script-path-b .scene-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
#script-path-b .scene-block {
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 14px;
  background: #fff;
  box-shadow: 0 8px 18px rgba(15,23,42,0.06);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
#script-path-b .scene-block > div:first-child {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
#script-path-b .scene-title-input {
  flex: 1;
}
#script-path-b .scene-title-input,
#script-path-b .line-speaker-input,
#script-path-b .line-content-input {
  background: #f9fafb;
  border-radius: 10px;
  border: 1px solid #d1d5db;
  padding: 10px;
}
#script-path-b .line-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
#script-path-b .line-row {
  display: grid !important;
  grid-template-columns: 120px 1fr auto;
  gap: 8px;
  align-items: center;
}
#script-path-b .add-line-btn,
#script-path-b .remove-scene-btn {
  align-self: flex-start;
}
#script-path-b .add-line-btn {
  width: 100%;
  justify-content: center;
}
#script-path-b .remove-scene-btn {
  padding: 6px 12px;
  margin-left: auto;
}
#script-path-b .btn-primary-sm,
#script-path-b .btn-outline-sm {
  white-space: nowrap;
}

@media (max-width: 640px) {
  #script-path-b .form-card {
    padding: 14px;
  }
  #script-path-b .scene-block {
    padding: 12px;
  }
  #script-path-b .line-row {
    grid-template-columns: 1fr;
  }
  #script-path-b .add-line-btn,
  #script-path-b .remove-scene-btn {
    width: auto;
    justify-content: center;
  }
  #script-path-b .remove-scene-btn {
    margin-left: auto;
  }
}

.btn-outline-sm {
    background: #ffffff;
    color: #111827;
}

.btn-outline-sm:hover {
    background: #f3f4f6;
    border-color: #1f2937;
}

.btn-outline-sm.btn-danger-outline,
button.btn-outline-sm.btn-danger-outline {
    border-color: #ef4444 !important;
    color: #111827 !important;
    background: #ffffff !important;
}

.btn-outline-sm.btn-danger-outline:hover,
button.btn-outline-sm.btn-danger-outline:hover {
    background: #fff5f5 !important;
    border-color: #ef4444 !important;
    color: #111827 !important;
}

/* 기능 버튼(예: 업로드, 알림 등)용 그라데이션 hover */
.btn-feature,
.notif-btn,
#btn-script-register {
  background: linear-gradient(90deg, #111827, #1f2937);
  color: #fff;
  border-color: transparent;
}
.btn-feature:hover,
.notif-btn:hover,
#btn-script-register:hover {
  background: linear-gradient(90deg, #1f2937, #374151);
  color: #fff;
  border-color: transparent;
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    border: none;
    background: none;
    cursor: pointer;
    transition: transform 0.16s ease, background 0.2s ease, box-shadow 0.16s ease;
    border-radius: 50%;
}
.icon-btn:hover {
    background: rgba(79,70,229,0.08);
    transform: translateY(-1px);
    box-shadow: 0 0 0 8px rgba(79,70,229,0.06);
}

.btn-danger-outline {
    border-color: #ef4444 !important;
    color: #ef4444 !important;
    background: #ffffff !important;
    padding: 6px 12px !important;
    border-radius: 999px !important;
}

.btn-outline-sm.btn-danger-outline {
    border-color: #ef4444 !important;
    color: #ef4444 !important;
    background: #ffffff !important;
}

button.btn-outline-sm.btn-danger-outline {
    border-color: #ef4444 !important;
    color: #ef4444 !important;
    background: #ffffff !important;
}

.btn-danger-outline:hover {
    background: #fff5f5 !important;
    border-color: #ef4444 !important;
}

.btn-danger-sm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 13px;
    border: 1px solid #ef4444;
    background: #ffffff;
    color: #ef4444;
    text-decoration: none;
    min-height: 32px;
}

button.btn-danger-sm,
.btn-danger-sm {
    background: #ffffff !important;
    border-color: #ef4444 !important;
    color: #ef4444 !important;
}

button.btn-danger-sm:hover,
.btn-danger-sm:hover {
    background: #fff5f5 !important;
    border-color: #ef4444 !important;
}

.project-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 16px;
}

.project-card {
    background: rgba(255, 255, 255, 0.92);
    border-radius: 14px;
    padding: 14px 16px;
    box-shadow: 0 12px 30px rgba(15,23,42,0.08);
    border: 1px solid rgba(229, 231, 235, 0.8);
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: transform 0.16s ease, box-shadow 0.16s ease;
}
.project-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 40px rgba(15,23,42,0.12);
}

.project-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.project-title {
    font-size: 18px;
    font-weight: 700;
    margin: 0;
}

.project-sub {
    margin: 2px 0 0;
    font-size: 12px;
    color: #6b7280;
}

.project-desc {
    font-size: 14px;
    color: #4b5563;
    margin: 4px 0;
}

.project-meta-row {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #6b7280;
}

.meta-label {
    font-weight: 500;
    color: #4b5563;
}

.meta-value {
    text-align: right;
}

.project-card-footer {
    margin-top: 8px;
    display: flex;
    justify-content: flex-end;
}

.project-actions {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    border: none;
    background: none;
    cursor: pointer;
}

.icon-24 {
    width: 24px;
    height: 24px;
    display: block;
}

/* ====== 프로젝트 상세 헤더/본문 타이포 통일 ====== */
.project-title,
.script-structure-title,
.section-title-sm {
    font-size: 18px !important;
    font-weight: 700 !important;
    margin: 0;
}

.project-desc,
.script-structure-empty,
.selected-text,
#selected-info p {
    font-size: 14px !important;
    color: #111827;
}

/* 홈 배경 히어로 */
.hero-cover {
  position: relative;
  min-height: 70vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 16px;
  overflow: hidden;
  background: #0b0f19;
}

.hero-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  filter: blur(0.3px);
  background: #0b0f19;
}

.hero-overlay {
  position: relative;
  z-index: 1;
  background: rgba(17, 24, 39, 0.70);
  color: #fff;
  padding: 32px 28px;
  border-radius: 14px;
  text-align: center;
  max-width: 720px;
  width: 100%;
  box-shadow: 0 12px 28px rgba(0,0,0,0.25);
  backdrop-filter: blur(3px);
}

.hero-logo {
  height: 96px;
  margin-bottom: 12px;
}

.hero-title {
  margin: 0 0 8px;
  font-size: 28px;
  font-weight: 800;
}

.hero-subtitle {
  margin: 0 0 16px;
  font-size: 16px;
  color: #e5e7eb;
}

.hero-ctas {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* ====== 모바일 대응 ====== */
@media (max-width: 640px) {
  .section {
    padding: 14px;
  }

  .page-header,
  .page-hero {
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 10px;
  }
  .page-header h1 {
    font-size: 16px !important;
    margin: 0;
    white-space: nowrap;
  }
  .page-header .btn-primary-sm,
  .page-header .btn-outline-sm {
    padding: 6px 8px;
    font-size: 12px;
    white-space: nowrap;
  }

  h1.section-title,
  .page-title-lg,
  .project-title,
  .script-structure-title,
  .section-title-sm {
    font-size: 16px !important;
  }

  .project-list {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .project-card {
    padding: 12px 14px;
  }

  .project-card-footer {
    justify-content: flex-start;
    gap: 8px;
  }

  .script-layout-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .script-detail-card,
  .script-structure-card {
    padding: 12px;
  }

  .selected-text-box {
    padding: 10px;
  }

  .btn-primary-sm,
  .btn-outline-sm {
    width: auto;
  }

  .hero-ctas {
    flex-direction: column;
  }
  .hero-ctas a {
    width: 100%;
  }

  .hero-cover {
    min-height: 75vh;
    padding: 20px 12px 32px;
    background: #0b0f19;
  }
  .hero-bg {
    transform: none;
    filter: blur(0.3px);
    object-fit: cover;
    object-position: center;
  }
  .hero-overlay {
    padding: 24px 20px;
    max-width: 96%;
    margin: 0 auto;
  }
  .hero-title {
    font-size: 24px;
  }
  .hero-subtitle {
    font-size: 14px;
  }
}

/* ====== 로그인 랜딩 전용 ====== */
.landing-viewport {
  position: relative;
  min-height: 75vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 12px;
  background: #0b0f19;
  box-shadow: 0 6px 18px rgba(0,0,0,0.12);
}

.landing-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.landing-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0.35), rgba(0,0,0,0.6));
}

.landing-content {
  position: relative;
  z-index: 1;
  text-align: center;
  color: #fff;
  padding: 32px 24px;
  width: 100%;
  max-width: 520px;
}

.landing-header h1 {
  margin: 0 0 8px;
  font-size: 28px;
  font-weight: 800;
}

.landing-header p {
  margin: 0 0 16px;
  font-size: 15px;
  color: #e5e7eb;
}

.landing-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}

.landing-actions.show {
  opacity: 1;
  pointer-events: all;
}

.landing-btn {
  width: 100%;
  max-width: 260px;
}

.social-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 6px;
}

.social-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid #e5e7eb;
  width: 120px;
}

.social-btn img {
  height: 24px;
  display: block;
}

.auth-message {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #fef3c7;
  color: #92400e;
  font-size: 13px;
}

.auth-layer {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 12px;
}

.auth-card {
  background: #ffffff;
  border-radius: 14px;
  padding: 16px 18px;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 12px 30px rgba(0,0,0,0.18);
  position: relative;
}

.auth-close {
  position: absolute;
  top: 10px;
  right: 10px;
  border: none;
  background: none;
  font-size: 20px;
  cursor: pointer;
}

.auth-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.auth-tab {
  flex: 1;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #d1d5db;
  background: #f8fafc;
  cursor: pointer;
  font-weight: 600;
}

.auth-tab.active {
  background: #111827;
  color: #fff;
  border-color: #111827;
}

.auth-forms {
  display: block;
}

.auth-form {
  display: none;
  flex-direction: column;
  gap: 10px;
}

.auth-form.active {
  display: flex;
}

.auth-form label {
  font-weight: 600;
  font-size: 13px;
  color: #1f2937;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.auth-form input,
.auth-form textarea {
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
}

.auth-form textarea {
  resize: vertical;
}

@media (max-width: 640px) {
  .landing-viewport {
    min-height: 80vh;
    border-radius: 10px;
  }
  .landing-header h1 {
    font-size: 24px;
  }
  .landing-header p {
    font-size: 14px;
  }
}

/* 뱃지 */
.badge {
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    border: 1px solid transparent;
    white-space: nowrap;
}

.badge-green {
    background: #ecfdf3;
    color: #15803d;
    border-color: #bbf7d0;
}

.badge-gray {
    background: #f3f4f6;
    color: #4b5563;
    border-color: #e5e7eb;
}

/* 빈 상태 */
.empty-state {
    margin-top: 40px;
    text-align: center;
    color: #6b7280;
}

.empty-state p {
    margin-bottom: 12px;
    font-size: 14px;
}
.form-card {
    background: rgba(255, 255, 255, 0.92);
    border-radius: 16px;
    padding: 20px 22px;
    box-shadow: 0 12px 30px rgba(15,23,42,0.08);
    border: 1px solid rgba(229, 231, 235, 0.8);
    max-width: 900px;
    transition: transform 0.16s ease, box-shadow 0.16s ease;
}
.form-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 38px rgba(15,23,42,0.12);
}

.form-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
    gap: 24px;
}

@media (max-width: 900px) {
    .form-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

.form-section {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.form-section-title {
    font-size: 15px;
    font-weight: 600;
    margin: 0 0 4px;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 13px;
}

.form-field label {
    font-weight: 500;
    color: #374151;
}

.form-field input[type="text"],
.form-field input[type="password"],
.form-field select,
.form-field textarea {
    border-radius: 8px;
    border: 1px solid #d1d5db;
    padding: 8px 10px;
    font-size: 13px;
    font-family: inherit;
    outline: none;
}

.form-field input[type="text"]:focus,
.form-field input[type="password"]:focus,
.form-field select:focus,
.form-field textarea:focus {
    border-color: #111827;
    box-shadow: 0 0 0 1px #1118270f;
}

.field-help {
    font-size: 11px;
    color: #6b7280;
}

.field-warning {
    font-size: 11px;
    color: #b91c1c;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 20px;
}

.alert-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 12px;
}
.table-basic {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.table-basic thead {
    background: #f9fafb;
}

.table-basic th,
.table-basic td {
    padding: 8px 10px;
    border-bottom: 1px solid #e5e7eb;
    text-align: left;
    white-space: nowrap;
}

.table-basic th {
    font-weight: 600;
    color: #374151;
}

.table-basic tbody tr:hover {
    background: #f3f4f6;
}
/* 모달 공통 */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.35);
    display: none; /* JS에서 flex로 전환 */
    align-items: center;
    justify-content: center;
    z-index: 50;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.modal-header h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
}

.modal-close {
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 14px;      /* 기존보다 작게 */
    line-height: 1;
    padding: 2px 4px;     /* 여백 최소화 */
    width: 20px;          /* 버튼 영역 작게 */
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;       /* 연한 회색 */
}
.modal-close:hover {
    color: #111827;       /* 호버 시만 진하게 */
}

.modal-body {
    margin-top: 4px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#line-insert-text {
    font-size: 0.9rem;
}
/* 기본 레이아웃 */
body {
    margin: 0;
    background: #f6f7fb;
    color: #14171f;
    font-family: system-ui, -apple-system, Segoe UI, Roboto, "Noto Sans KR", sans-serif;
}

.app-shell {
    min-height: 100vh;
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: #ffffff;
    border-bottom: 1px solid #e8eaf0;
    backdrop-filter: blur(10px);
}

.logo {
    font-size: 18px;
    font-weight: 800;
    display: flex;
    gap: 10px;
    align-items: baseline;
}

.logo a {
    color: #111827;
    text-decoration: none;
}

.header-sep {
    margin: 0 6px;
    color: rgba(20, 23, 31, 0.6);
    font-weight: 700;
}

.header-section {
    opacity: 0.9;
    font-weight: 800;
}

.user-area {
    display: flex;
    gap: 12px;
    align-items: center;
    font-size: 13px;
    color: #14171f;
}

.user-area a {
    padding: 6px 10px;
    border-radius: 10px;
    text-decoration: none;
    color: inherit;
}

.user-area a:hover {
    background: #f1f3f8;
}

.app-main {
    padding: 16px;
    padding-bottom: 86px; /* 하단바가 있으면 유지 */
    min-height: calc(100vh - 56px);
}

/* 하단 고정 탭/링크 바 */
.bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: 64px;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    background: rgba(10, 12, 16, 0.96);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(12px);
    z-index: 30;
    padding-bottom: env(safe-area-inset-bottom);
}

.bottom-tab {
    appearance: none;
    border: 0;
    background: transparent;
    color: rgba(255, 255, 255, 0.78);
    font-size: 13px;
    font-weight: 800;
    padding: 14px 10px;
    cursor: pointer;
}

.bottom-tab.active {
    color: #fff;
}

.bottom-link {
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.78);
    text-decoration: none;
    font-size: 13px;
    font-weight: 800;
    padding: 14px 10px;
    text-align: center;
    opacity: 0.85;
}

.bottom-link.active {
    color: #fff;
    border-top: 2px solid rgba(255, 255, 255, 0.75);
    opacity: 1;
}

/* 바텀 시트(세부 메뉴) */
.bottom-sheet {
    position: fixed;
    inset: 0;
    display: none;
    background: rgba(0, 0, 0, 0.35);
    z-index: 40;
}

.bottom-sheet.open {
    display: block;
}

.sheet-card {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 64px;
    margin: 10px 12px;
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: #f6f7fb;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.sheet-title {
    font-weight: 900;
    font-size: 14px;
}

.sheet-close {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    border: 1px solid rgba(0, 0, 0, 0.10);
    background: #fff;
    font-size: 20px;
    line-height: 28px;
    cursor: pointer;
}

.sheet-body {
    padding: 6px;
}

.sheet-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 12px;
    margin: 6px;
    border-radius: 12px;
    text-decoration: none;
    color: #111;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.sheet-item:hover {
    background: #f6f7fb;
}

.sheet-item-label {
    font-weight: 800;
    font-size: 14px;
}

.sheet-item-arrow {
    color: rgba(0, 0, 0, 0.45);
    font-size: 18px;
}

/* 알림 아이콘 */
.notif-btn {
    position: relative;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e8eaf0;
    background: #fff;
    border-radius: 12px;
}

.notif-icon {
    width: 18px;
    height: 18px;
    fill: #2b2f3a;
}

.notif-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #ff3b30;
    color: #fff;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    border: 2px solid #fff;
}

/* 프로필 아이콘 버튼: 알림 버튼과 통일된 사이즈/테두리 */
.profile-btn {
    position: relative;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e8eaf0;
    background: #fff;
    border-radius: 12px;
    padding: 0;
}

.profile-icon {
    width: 24px;
    height: 24px;
    object-fit: cover;
    border-radius: 50%;
}

/* 팀 페이지 모바일 폰트 정리 */
@media (max-width: 640px) {
  .team-page {
    font-size: 14px;
  }
  .team-page h1,
  .team-page .section-title-sm {
    font-size: 16px;
  }
  .team-page .form-field label {
    font-size: 13px;
  }
  .team-page .btn-primary-sm,
  .team-page .btn-outline-sm {
    font-size: 14px;
  }
  .team-page .table-basic th,
  .team-page .table-basic td {
    font-size: 13px;
  }
}

/* 모드 전환 작은 버튼 */
.mode-switch-container {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 4px;
  font-size: 12px;
  color: #6b7280;
  white-space: nowrap;
  vertical-align: middle;
}
.mode-switch-btn {
  padding: 3px 10px;
  font-size: 12px;
  line-height: 1.2;
  border-radius: 999px;
  border: 1px solid #d1d5db;
  background: #fff;
}
.mode-switch-btn:hover {
  background: #f3f4f6;
}
@media (max-width: 640px) {
  .mode-switch-container {
    gap: 4px;
    font-size: 11px;
  }
  .mode-switch-btn {
    padding: 2px 8px;
    font-size: 11px;
    line-height: 1.15;
  }
}

/* 팀 전환 모달 부드러운 등장/퇴장 */
#team-modal-backdrop {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
#team-modal-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}
#team-modal-backdrop .modal {
  transform: translateY(12px);
  transition: transform 0.25s ease;
}
#team-modal-backdrop.show .modal {
  transform: translateY(0);
}

.team-option-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 200px;
  overflow-y: auto;
  padding: 6px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
}
.team-option-btn {
  width: 100%;
  text-align: left;
  border: 1px solid #e5e7eb;
  background: #fff;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 14px;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
}
.team-option-btn:hover {
  background: #f3f4f6;
}
.team-option-btn.active {
  border-color: #4b6bff;
  background: #eef2ff;
  transform: translateY(-1px);
}

/* 팀 전환 버튼 그룹: 텍스트 줄바꿈 방지 및 균일한 높이 */
.team-switch {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.team-switch .btn-primary-sm,
.team-switch .btn-outline-sm {
  min-width: 108px;
  padding: 9px 14px;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

/* 알림 카드 */
.card-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.card {
    padding: 12px;
    border-radius: 14px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

.card-top {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
}

.upload-progress {
  margin: 8px 0 12px;
  padding: 8px 10px;
  border-radius: 6px;
  background: #f0f4ff;
  border: 1px solid #c5d4ff;
  font-size: 13px;
  color: #1f2b4d;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.upload-progress-bar {
  position: relative;
  overflow: hidden;
  height: 6px;
  border-radius: 999px;
  background: #d8e1ff;
  margin-bottom: 6px;
  width: 100%;
}

.upload-mode-tabs {
  display: flex;
  gap: 8px;
  margin: 6px 0 12px;
}
.upload-mode-tabs .btn-secondary-block.active {
  background: #111827;
  color: #fff;
}

#hwp-progress-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 9999;
  align-items: center;
  justify-content: center;
}

/* ====== 대본 구조 카드 (모바일 우선) ====== */

.script-structure-section {
  margin-top: 16px;
}

.script-structure-card {
  background: #ffffff;
  border-radius: 14px;
  padding: 12px 12px 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
  border: 1px solid rgba(0,0,0,0.06);
  height: 100%;
}

.script-structure-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.script-structure-title {
  font-size: 18px;
  font-weight: 700;
  margin: 0;
}

/* "대본을 업로드해주세요" 문구 */
.script-structure-empty {
  font-size: 14px;
  color: #666;
  margin-bottom: 8px;
}

/* 씬 칩 영역: 가로 스크롤 가능 */
.scene-chips-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 6px;
}

.scene-chips {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* 씬 버튼 (세로 카드형) */
.scene-title-btn {
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #e0e0e0;
  background: #f7f7f9;
  font-size: 13px;
  line-height: 1.4;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease,
              transform 0.05s ease;
}

.scene-title-btn:hover {
  background: #ededf4;
  border-color: #d1d1e0;
}

.scene-title-btn:active {
  transform: scale(0.98);
}

.scene-title-btn.active {
  background: #111827;
  color: #ffffff;
  border-color: #111827;
}

.structured-scene-detail {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #f9fafb;
}

.structured-scene-title {
  margin: 0 0 6px 0;
  font-size: 15px;
  font-weight: 700;
}

.structured-scene-summary {
  margin: 0 0 10px 0;
  font-size: 13px;
  color: #4b5563;
  line-height: 1.5;
  white-space: pre-wrap;
}

.structured-scene-blocks {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 8px;
}

.structured-block {
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid #d5dae3;
  background: #ffffff;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08);
  margin: 0;
}

.structured-block:hover {
  background: #f3f4f6;
}

.structured-block.active {
  border-color: #111827;
  box-shadow: 0 0 0 1px #1118271a, 0 4px 10px rgba(15, 23, 42, 0.15);
}

.structured-block-meta {
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 4px;
}

.structured-block-content {
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.structured-block-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  align-items: center;
}

.structured-block-action {
  border: 1px solid #e5e7eb;
  background: #fff;
  border-radius: 8px;
  padding: 4px;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.16s ease;
}

.structured-block-action:hover {
  background: rgba(79,70,229,0.08);
  border-color: rgba(79,70,229,0.3);
  box-shadow: 0 0 0 6px rgba(79,70,229,0.06);
}
.structured-block-action.delete:hover,
.structured-block-action.rec-delete:hover {
  background: rgba(239,68,68,0.12);
  border-color: rgba(239,68,68,0.35);
  box-shadow: 0 0 0 6px rgba(239,68,68,0.08);
}
.structured-block-action:focus-visible {
  outline: 2px solid #4a6bff;
  outline-offset: 2px;
}

/* 업로드 진행 중에는 블록 액션을 숨겨서 충돌을 방지 */
/* 업로드 진행 중에도 녹음 버튼이 보이도록 숨김 처리 제거 */

/* 블록 추가/수정 패널 가독성 향상 */
.block-edit-panel {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.block-edit-panel .section-title-xs {
  font-size: 14px;
  margin: 0;
  color: #111827;
}

.block-edit-panel .form-row-inline {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.block-edit-panel label {
  font-size: 13px;
  font-weight: 600;
  color: #374151;
}

.block-edit-panel .input {
  font-size: 13px;
  line-height: 1.45;
  padding: 10px 12px;
}

.block-edit-panel textarea {
  min-height: 96px;
}

.block-edit-panel .form-actions {
  margin-top: 4px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.structured-block-action .block-action-icon {
  width: 16px !important;
  height: 16px !important;
  display: block;
  max-width: 16px;
  max-height: 16px;
  object-fit: contain;
  transform: scale(1);
}

.script-layout-grid {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(280px, 1.1fr);
  gap: 16px;
  align-items: stretch;
}

.script-detail-card {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(229, 231, 235, 0.8);
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
  height: 100%;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.7), 0 12px 30px rgba(15,23,42,0.08);
}

.script-structure-card {
  height: 100%;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(229, 231, 235, 0.8);
  border-radius: 14px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
  transition: transform 0.16s ease, box-shadow 0.16s ease;
  padding: 12px;
}
.script-structure-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 38px rgba(15, 23, 42, 0.12);
}

@media (max-width: 900px) {
  .script-layout-grid {
    grid-template-columns: 1fr;
  }
}

.logout-link img.logout-icon {
  width: 18px;
  height: 18px;
  display: block;
}

.record-modal .record-mode-buttons {
  display: flex;
  gap: 8px;
  margin: 12px 0;
}

.record-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.recording-status {
  margin: 8px 0 0;
  font-size: 12px;
  color: #4b5563;
}

.record-target-label {
  margin: 0 0 6px 0;
  font-size: 13px;
  color: #111827;
}

/* 페이지네이션 (JS가 #structured-scenes-pager를 동적으로 생성함) */
.structured-scenes-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 8px;
  font-size: 12px;
}

.structured-scenes-pagination .pager-btn {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid #d4d4d8;
  background: #f9fafb;
  font-size: 12px;
  cursor: pointer;
}

.structured-scenes-pagination .pager-info {
  color: #6b7280;
}

/* ====== 태블릿 / 데스크톱에서 살짝 넓게 보이도록 ====== */
@media (min-width: 768px) {
  .script-structure-card {
    padding: 14px 16px 10px;
  }

  .script-structure-title {
    font-size: 18px;
  }

  .scene-chips {
    flex-wrap: wrap;      /* 큰 화면에서는 여러 줄로 감싸기 */
  }

  .scene-title-btn {
    font-size: 14px;
  }
}
.section-title-sm {
    font-size: 17px;
    font-weight: 700;
    margin: 0 0 10px;
}
