/* ============================================================
   THE SLEEP CODE HISTORIAN — PRODUCTION PACK GENERATOR
   Dark Academic Blue/Amber Palette
   ============================================================ */

:root {
  --bg-deepest: #080c14;
  --bg-deep: #0d1420;
  --bg-card: #111827;
  --bg-card-hover: #152033;
  --bg-input: #0c1420;
  --bg-input-focus: #0f1c30;
  
  --border-subtle: rgba(92, 124, 175, 0.18);
  --border-active: rgba(139, 180, 240, 0.45);
  --border-gold: rgba(196, 155, 78, 0.35);

  --blue-light: #93b9e8;
  --blue-mid: #6a9fd4;
  --blue-dark: #3a6fa5;
  --blue-glow: rgba(100, 160, 220, 0.15);

  --amber-light: #e8c97a;
  --amber-mid: #c4923c;
  --amber-dark: #8b5e1a;
  --amber-glow: rgba(210, 155, 50, 0.15);

  --text-primary: #d6e4f7;
  --text-secondary: #8dabc8;
  --text-muted: #5a7a9a;
  --text-amber: #d4a84a;
  --text-white: #f0f4fc;

  --success: #4caf84;
  --warning: #e8a742;
  --danger: #e05c5c;

  --font-display: 'Cinzel', serif;
  --font-body: 'EB Garamond', serif;
  --font-ui: 'Inter', sans-serif;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --shadow-card: 0 4px 32px rgba(0, 0, 0, 0.6), 0 1px 4px rgba(0, 0, 0, 0.4);
  --shadow-btn: 0 4px 20px rgba(100, 160, 220, 0.3);
  --shadow-glow-amber: 0 0 24px rgba(210, 155, 50, 0.25);
}

/* ============================================================
   PASSWORD GATE
   ============================================================ */

body.locked {
  overflow: hidden;
}

#password-gate {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bg-deepest);
  background-image:
    radial-gradient(ellipse at 20% 10%, rgba(30, 60, 110, 0.35) 0%, transparent 55%),
    radial-gradient(ellipse at 80% 90%, rgba(100, 60, 10, 0.2) 0%, transparent 55%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.gate-card {
  background: var(--bg-card);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-xl);
  box-shadow: 0 8px 60px rgba(0,0,0,0.7), 0 0 80px rgba(196,155,78,0.06);
  padding: 3rem 2.5rem 2.5rem;
  max-width: 420px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  text-align: center;
  animation: gateIn 0.4s ease;
}

@keyframes gateIn {
  from { opacity: 0; transform: translateY(24px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.gate-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1a3058 0%, #0d1e3a 100%);
  border: 1px solid var(--border-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--amber-light);
  font-size: 26px;
  box-shadow: var(--shadow-glow-amber);
  margin-bottom: 1.25rem;
}

.gate-title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-white);
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}

.gate-sub {
  font-family: var(--font-ui);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 1.25rem;
}

.gate-desc {
  font-family: var(--font-ui);
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-bottom: 1.75rem;
  line-height: 1.5;
}

#gate-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

.gate-input-wrap {
  position: relative;
  width: 100%;
  margin-bottom: 8px;
}

.gate-lock-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 13px;
  pointer-events: none;
}

.gate-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 1rem;
  padding: 13px 16px 13px 40px;
  outline: none;
  transition: all 0.2s;
  text-align: left;
  letter-spacing: 0.08em;
}

.gate-input:focus {
  border-color: var(--border-active);
  background: var(--bg-input-focus);
  box-shadow: 0 0 0 3px var(--blue-glow);
}

.gate-input.gate-shake {
  animation: shake 0.4s ease;
  border-color: rgba(224, 92, 92, 0.5);
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-8px); }
  40%       { transform: translateX(8px); }
  60%       { transform: translateX(-5px); }
  80%       { transform: translateX(5px); }
}

.gate-error {
  display: none;
  font-family: var(--font-ui);
  font-size: 0.8rem;
  color: var(--danger);
  margin-bottom: 12px;
  align-self: flex-start;
  padding-left: 4px;
}

.gate-error.visible {
  display: block;
}

.gate-submit-btn {
  width: 100%;
  background: linear-gradient(135deg, #1e4a8a 0%, #163970 50%, #0f2e5a 100%);
  border: 1px solid rgba(100, 160, 220, 0.5);
  border-radius: var(--radius-md);
  color: var(--text-white);
  cursor: pointer;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  padding: 14px 24px;
  margin-top: 4px;
  transition: all 0.25s;
  box-shadow: var(--shadow-btn);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.gate-submit-btn:hover {
  background: linear-gradient(135deg, #265aa0 0%, #1e4a88 50%, #163870 100%);
  box-shadow: 0 6px 28px rgba(100, 160, 220, 0.4);
  transform: translateY(-1px);
}

.gate-submit-btn:active {
  transform: translateY(0);
}

.gate-footer {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2rem;
  letter-spacing: 0.04em;
}

/* ============================================================
   RESET & BASE
   ============================================================ */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg-deepest);
  background-image: 
    radial-gradient(ellipse at 20% 0%, rgba(30, 60, 110, 0.25) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 100%, rgba(100, 60, 10, 0.15) 0%, transparent 60%);
  color: var(--text-primary);
  font-family: var(--font-ui);
  line-height: 1.6;
  min-height: 100vh;
}

/* ============================================================
   HEADER
   ============================================================ */

.site-header {
  background: linear-gradient(135deg, rgba(8, 14, 28, 0.98) 0%, rgba(12, 20, 40, 0.98) 100%);
  border-bottom: 1px solid var(--border-gold);
  padding: 0 2rem;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 70px;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-icon {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1a3058 0%, #0d1e3a 100%);
  border: 1px solid var(--border-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--amber-light);
  font-size: 18px;
  box-shadow: var(--shadow-glow-amber);
}

.logo-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.channel-name {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  color: var(--text-white);
  letter-spacing: 0.08em;
}

.channel-sub {
  font-family: var(--font-ui);
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.header-badge {
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 600;
  color: var(--amber-light);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-sm);
  padding: 4px 12px;
  letter-spacing: 0.05em;
  background: rgba(196, 146, 60, 0.08);
}

/* ============================================================
   MAIN CONTAINER
   ============================================================ */

.main-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
}

/* ============================================================
   SECTION CARDS
   ============================================================ */

.section-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 2.5rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-card);
}

.active-section {
  display: block;
}

.hidden-section {
  display: none;
}

.section-header {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
}

.step-badge {
  display: inline-block;
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  background: rgba(100, 160, 220, 0.12);
  color: var(--blue-light);
  border: 1px solid rgba(100, 160, 220, 0.3);
  border-radius: var(--radius-sm);
  padding: 3px 10px;
  margin-bottom: 10px;
}

.step-badge-success {
  background: rgba(76, 175, 132, 0.12);
  color: var(--success);
  border-color: rgba(76, 175, 132, 0.3);
}

.section-header h2 {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--text-white);
  margin: 8px 0 6px;
  letter-spacing: 0.04em;
}

.section-desc {
  font-family: var(--font-ui);
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ============================================================
   FORM
   ============================================================ */

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-ui);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}

.form-group label i {
  color: var(--blue-mid);
  font-size: 12px;
}

.required-badge {
  font-size: 10px;
  font-weight: 700;
  background: rgba(224, 92, 92, 0.15);
  color: var(--danger);
  border: 1px solid rgba(224, 92, 92, 0.3);
  border-radius: 4px;
  padding: 1px 7px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.required-group label {
  color: var(--text-primary);
}

textarea,
select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 0.95rem;
  padding: 12px 16px;
  transition: all 0.2s;
  resize: vertical;
  outline: none;
}

textarea::placeholder {
  color: var(--text-muted);
  font-style: italic;
}

textarea:focus,
select:focus {
  border-color: var(--border-active);
  background: var(--bg-input-focus);
  box-shadow: 0 0 0 3px var(--blue-glow);
}

.input-large {
  font-size: 1rem;
  min-height: 80px;
}

.input-large:focus {
  min-height: 100px;
}

select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%235a7a9a' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px;
  padding-right: 36px;
}

select option {
  background: var(--bg-card);
  color: var(--text-primary);
}

.field-hint {
  display: block;
  font-family: var(--font-ui);
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 6px;
  line-height: 1.4;
}

.error-msg {
  display: none;
  font-family: var(--font-ui);
  font-size: 0.82rem;
  color: var(--danger);
  margin-top: 6px;
}

.show-error .error-msg {
  display: block;
}

.show-error textarea {
  border-color: rgba(224, 92, 92, 0.5);
  box-shadow: 0 0 0 3px rgba(224, 92, 92, 0.1);
}

/* FORM GRID */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.form-grid-three {
  grid-template-columns: 1fr 1fr 1fr;
}

/* OPTIONAL TOGGLE */
.optional-toggle {
  margin: 0 0 0;
}

.toggle-btn {
  background: none;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-ui);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 10px 18px;
  transition: all 0.2s;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 1.5rem;
}

.toggle-btn:hover {
  background: var(--blue-glow);
  border-color: var(--border-active);
  color: var(--blue-light);
}

.toggle-arrow {
  margin-left: auto;
  transition: transform 0.25s;
  font-size: 10px;
}

.toggle-arrow.rotated {
  transform: rotate(180deg);
}

.optional-fields {
  display: none;
  animation: slideDown 0.25s ease;
  border-top: 1px solid var(--border-subtle);
  padding-top: 1.5rem;
}

.optional-fields.open {
  display: block;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* SUBMIT */
.form-submit-area {
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.generate-btn {
  background: linear-gradient(135deg, #1e4a8a 0%, #163970 50%, #0f2e5a 100%);
  border: 1px solid rgba(100, 160, 220, 0.5);
  border-radius: var(--radius-lg);
  color: var(--text-white);
  cursor: pointer;
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  padding: 18px 52px;
  transition: all 0.25s;
  box-shadow: var(--shadow-btn);
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  overflow: hidden;
}

.generate-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(196, 155, 78, 0.08) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.3s;
}

.generate-btn:hover {
  background: linear-gradient(135deg, #265aa0 0%, #1e4a88 50%, #163870 100%);
  box-shadow: 0 6px 30px rgba(100, 160, 220, 0.45);
  transform: translateY(-2px);
}

.generate-btn:hover::before {
  opacity: 1;
}

.generate-btn:active {
  transform: translateY(0);
}

.generate-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.submit-note {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
  max-width: 600px;
  line-height: 1.5;
}

.submit-note i {
  color: var(--blue-mid);
  margin-right: 4px;
}

/* ============================================================
   PROGRESS SECTION
   ============================================================ */

.progress-area {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.topic-display {
  background: rgba(100, 160, 220, 0.08);
  border: 1px solid var(--border-active);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--text-primary);
}

.topic-display i {
  color: var(--blue-light);
  font-size: 14px;
}

.progress-stages {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.progress-stage {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: all 0.3s;
}

.progress-stage.stage-active {
  border-color: var(--border-active);
  background: var(--bg-input-focus);
  box-shadow: 0 0 16px var(--blue-glow);
}

.progress-stage.stage-done {
  border-color: rgba(76, 175, 132, 0.3);
  background: rgba(76, 175, 132, 0.05);
}

.stage-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(100, 160, 220, 0.1);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 13px;
  flex-shrink: 0;
  transition: all 0.3s;
}

.stage-active .stage-icon {
  background: rgba(100, 160, 220, 0.2);
  border-color: var(--border-active);
  color: var(--blue-light);
}

.stage-done .stage-icon {
  background: rgba(76, 175, 132, 0.15);
  border-color: rgba(76, 175, 132, 0.4);
  color: var(--success);
}

.stage-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stage-label {
  font-family: var(--font-ui);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
}

.stage-desc {
  font-family: var(--font-ui);
  font-size: 0.78rem;
  color: var(--text-muted);
}

.stage-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-ui);
  font-size: 0.78rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.pending-dot {
  background: var(--text-muted);
}

.active-dot {
  background: var(--blue-light);
  box-shadow: 0 0 6px var(--blue-light);
  animation: pulse-dot 1.2s infinite;
}

.done-dot {
  background: var(--success);
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(0.85); }
}

/* PROGRESS BAR */
.progress-bar-container {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 6px;
}

.progress-bar-track {
  flex: 1;
  height: 6px;
  background: rgba(100, 160, 220, 0.1);
  border-radius: 100px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--blue-dark), var(--blue-light));
  border-radius: 100px;
  transition: width 0.6s ease;
}

.progress-percent {
  font-family: var(--font-ui);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--blue-light);
  min-width: 36px;
  text-align: right;
}

/* IMAGE PROGRESS */
.image-progress-area {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
}

.image-progress-label {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.image-thumb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 6px;
}

.thumb-placeholder {
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  background: rgba(100, 160, 220, 0.06);
  border: 1px solid var(--border-subtle);
}

.thumb-done {
  background: none;
  border-color: rgba(76, 175, 132, 0.3);
  overflow: hidden;
}

.thumb-done img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ============================================================
   RESULTS SECTION
   ============================================================ */

/* DOWNLOAD BAR */
.download-bar {
  background: linear-gradient(135deg, rgba(30, 74, 138, 0.15) 0%, rgba(196, 146, 60, 0.08) 100%);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
}

.download-bar-title {
  font-family: var(--font-ui);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--amber-light);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 8px;
}

.download-buttons {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.dl-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  border: 1px solid;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-family: var(--font-ui);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 9px 18px;
  transition: all 0.2s;
  text-decoration: none;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.dl-docx {
  background: rgba(40, 110, 190, 0.15);
  border-color: rgba(100, 160, 220, 0.4);
  color: var(--blue-light);
}

.dl-docx:hover {
  background: rgba(40, 110, 190, 0.28);
  border-color: var(--blue-light);
}

.dl-zip {
  background: rgba(196, 146, 60, 0.12);
  border-color: rgba(196, 146, 60, 0.4);
  color: var(--amber-light);
}

.dl-zip:hover {
  background: rgba(196, 146, 60, 0.22);
  border-color: var(--amber-light);
}

.dl-new {
  background: rgba(100, 100, 120, 0.12);
  border-color: rgba(100, 100, 120, 0.3);
  color: var(--text-secondary);
}

.dl-new:hover {
  background: rgba(100, 100, 120, 0.22);
  color: var(--text-primary);
}

.sm-btn {
  font-size: 0.78rem;
  padding: 7px 14px;
}

/* RESULT TABS */
.result-tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 1.5rem;
  padding-bottom: 0;
}

.tab-btn {
  background: none;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-ui);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 9px 16px;
  transition: all 0.2s;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  position: relative;
  bottom: -1px;
}

.tab-btn:hover {
  color: var(--text-secondary);
  background: rgba(100, 160, 220, 0.05);
}

.active-tab {
  background: var(--bg-card);
  border-color: var(--border-subtle);
  border-bottom-color: var(--bg-card);
  color: var(--blue-light);
}

/* TAB PANELS */
.tab-panels {
  min-height: 300px;
}

.tab-panel {
  display: block;
}

.hidden-panel {
  display: none;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-subtle);
  flex-wrap: wrap;
  gap: 10px;
}

.panel-header h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--text-white);
  font-weight: 600;
  letter-spacing: 0.04em;
}

.panel-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.word-count-badge {
  font-family: var(--font-ui);
  font-size: 0.78rem;
  font-weight: 700;
  background: rgba(76, 175, 132, 0.12);
  color: var(--success);
  border: 1px solid rgba(76, 175, 132, 0.3);
  border-radius: 4px;
  padding: 2px 10px;
}

.small-note {
  font-family: var(--font-ui);
  font-size: 0.78rem;
  color: var(--text-muted);
}

.copy-btn {
  background: rgba(100, 160, 220, 0.08);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  font-family: var(--font-ui);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 6px 14px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.copy-btn:hover {
  background: rgba(100, 160, 220, 0.15);
  border-color: var(--border-active);
  color: var(--blue-light);
}

/* SCRIPT CONTENT */
.script-content {
  font-family: var(--font-body);
  font-size: 1.05rem;
  line-height: 1.9;
  color: var(--text-primary);
  max-height: 600px;
  overflow-y: auto;
  padding-right: 8px;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.script-content::-webkit-scrollbar {
  width: 5px;
}

.script-content::-webkit-scrollbar-track {
  background: transparent;
}

.script-content::-webkit-scrollbar-thumb {
  background: var(--border-subtle);
  border-radius: 100px;
}

/* RESEARCH CONTENT */
.research-content {
  max-height: 600px;
  overflow-y: auto;
  padding-right: 8px;
}

.source-item {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 10px;
  transition: border-color 0.2s;
}

.source-item:hover {
  border-color: var(--border-active);
}

.source-num {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 4px;
}

.source-title {
  font-family: var(--font-ui);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.source-url {
  font-family: var(--font-ui);
  font-size: 0.78rem;
  color: var(--blue-mid);
  word-break: break-all;
  text-decoration: none;
}

.source-url:hover {
  color: var(--blue-light);
  text-decoration: underline;
}

.source-trust {
  display: inline-block;
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: 4px;
  padding: 1px 8px;
  margin-top: 6px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.trust-high {
  background: rgba(76, 175, 132, 0.12);
  color: var(--success);
  border: 1px solid rgba(76, 175, 132, 0.3);
}

.trust-mid {
  background: rgba(232, 167, 66, 0.12);
  color: var(--warning);
  border: 1px solid rgba(232, 167, 66, 0.3);
}

.source-note {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 6px;
  line-height: 1.4;
}

/* IMAGES GRID */
.images-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.image-card {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: all 0.25s;
  cursor: pointer;
}

.image-card:hover {
  border-color: var(--border-active);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.image-card img {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  display: block;
}

.image-card-info {
  padding: 8px 10px;
}

.image-num {
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.image-scene {
  font-family: var(--font-ui);
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 2px;
  line-height: 1.3;
}

/* THUMBNAILS */
.thumbnails-content {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.thumb-concept {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 18px;
}

.thumb-concept-header {
  font-family: var(--font-ui);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--amber-light);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.thumb-concept-title {
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--text-white);
  margin-bottom: 8px;
  font-weight: 600;
}

.thumb-concept-body {
  font-family: var(--font-ui);
  font-size: 0.86rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.thumb-concept-body strong {
  color: var(--text-primary);
}

/* TITLES */
.titles-content {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.title-category {
  font-family: var(--font-ui);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-top: 1rem;
  margin-bottom: 4px;
  padding-left: 4px;
  border-left: 2px solid var(--blue-dark);
  padding-left: 8px;
}

.title-option {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.title-option:hover {
  border-color: var(--border-active);
  background: var(--bg-input-focus);
}

.title-copy-icon {
  color: var(--text-muted);
  font-size: 12px;
  flex-shrink: 0;
  transition: color 0.2s;
}

.title-option:hover .title-copy-icon {
  color: var(--blue-light);
}

/* DESCRIPTION */
.description-content {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px;
  font-family: var(--font-body);
  font-size: 0.98rem;
  line-height: 1.85;
  color: var(--text-primary);
  white-space: pre-wrap;
  word-wrap: break-word;
  max-height: 500px;
  overflow-y: auto;
}

/* CHAPTERS */
.chapters-content {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px;
  font-family: 'Courier New', monospace;
  font-size: 0.9rem;
  line-height: 1.9;
  color: var(--text-primary);
  white-space: pre-wrap;
}

/* CHECKLIST */
.checklist-content {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.check-item {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.check-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  flex-shrink: 0;
  margin-top: 1px;
}

.check-pass {
  background: rgba(76, 175, 132, 0.15);
  color: var(--success);
  border: 1px solid rgba(76, 175, 132, 0.3);
}

.check-warn {
  background: rgba(232, 167, 66, 0.15);
  color: var(--warning);
  border: 1px solid rgba(232, 167, 66, 0.3);
}

.check-info {
  background: rgba(100, 160, 220, 0.15);
  color: var(--blue-light);
  border: 1px solid rgba(100, 160, 220, 0.3);
}

.check-body {}
.check-body strong {
  font-family: var(--font-ui);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-primary);
  display: block;
  margin-bottom: 2px;
}

.check-body span {
  font-family: var(--font-ui);
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* ============================================================
   API KEY BANNER
   ============================================================ */

.api-key-banner {
  background: linear-gradient(135deg, rgba(30, 74, 138, 0.2) 0%, rgba(10, 20, 50, 0.3) 100%);
  border: 1px solid var(--border-active);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.5rem;
  margin-bottom: 1.5rem;
}

.api-key-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.api-key-left {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--blue-light);
  font-size: 18px;
}

.api-key-left div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.api-key-left strong {
  font-family: var(--font-ui);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-white);
}

.api-key-left span {
  font-family: var(--font-ui);
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.api-key-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.api-key-input {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 0.9rem;
  padding: 8px 14px;
  width: 250px;
  outline: none;
  transition: all 0.2s;
}

.api-key-input:focus {
  border-color: var(--border-active);
  box-shadow: 0 0 0 3px var(--blue-glow);
}

.api-key-save-btn {
  background: rgba(100, 160, 220, 0.15);
  border: 1px solid var(--border-active);
  border-radius: var(--radius-md);
  color: var(--blue-light);
  cursor: pointer;
  font-family: var(--font-ui);
  font-size: 0.82rem;
  font-weight: 700;
  padding: 9px 18px;
  transition: all 0.2s;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}

.api-key-save-btn:hover {
  background: rgba(100, 160, 220, 0.28);
  color: var(--text-white);
}

/* ============================================================
   FOOTER
   ============================================================ */

.site-footer {
  border-top: 1px solid var(--border-subtle);
  padding: 1.5rem;
  text-align: center;
  font-family: var(--font-ui);
  font-size: 0.78rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

/* ============================================================
   SCROLLBARS
   ============================================================ */

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-deepest);
}

::-webkit-scrollbar-thumb {
  background: var(--border-subtle);
  border-radius: 100px;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 768px) {
  .main-container {
    padding: 1.5rem 1rem 3rem;
  }

  .section-card {
    padding: 1.5rem;
    border-radius: var(--radius-lg);
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .form-grid-three {
    grid-template-columns: 1fr;
  }

  .download-bar {
    flex-direction: column;
    align-items: flex-start;
  }

  .result-tabs {
    gap: 2px;
  }

  .tab-btn {
    font-size: 0.72rem;
    padding: 8px 10px;
  }

  .images-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }

  .generate-btn {
    font-size: 0.95rem;
    padding: 16px 36px;
  }
}

@media (max-width: 480px) {
  .channel-name {
    font-size: 12px;
  }
  .section-header h2 {
    font-size: 1.3rem;
  }
}

/* ============================================================
   UTILITIES
   ============================================================ */

.text-amber { color: var(--amber-light); }
.text-blue  { color: var(--blue-light); }
.text-muted { color: var(--text-muted); }

/* Toast notifications */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--bg-card);
  border: 1px solid var(--border-active);
  border-radius: var(--radius-md);
  padding: 12px 20px;
  font-family: var(--font-ui);
  font-size: 0.85rem;
  color: var(--text-primary);
  box-shadow: var(--shadow-card);
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideUp 0.3s ease;
  max-width: 320px;
}

.toast i { color: var(--success); }

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

.toast-fade {
  animation: fadeOut 0.4s ease forwards;
}

@keyframes fadeOut {
  from { opacity: 1; }
  to   { opacity: 0; }
}
