* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: #0a0c10;
  color: #e8eaed;
  min-height: 100vh;
}

.wrap {
  max-width: 1000px;
  margin: 0 auto;
  padding: 24px 20px 48px;
}

/* Header + stepper */
.site-header {
  margin-bottom: 8px;
}

.brand h1 {
  margin: 0 0 6px;
  font-size: 1.75rem;
  background: linear-gradient(135deg, #e8eaed 0%, #8ab4f8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  margin: 0 0 20px;
  color: #7a8494;
  font-size: 0.92rem;
}

.stage-nav {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 14px 16px;
  border: 1px solid #2a2f38;
  border-radius: 12px;
  background: #12151c;
}

.stage-step {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  opacity: 0.45;
  transition: opacity 0.25s;
}

.stage-step.active {
  opacity: 1;
}

.stage-step.done {
  opacity: 0.85;
}

.stage-step.done .step-num {
  background: #1f4d2a;
  border-color: #3d8f5a;
  color: #7dcea0;
}

.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  background: #1a2230;
  border: 1px solid #3d6a9e;
  color: #8ab4f8;
  font-size: 0.9rem;
  font-weight: 700;
  flex-shrink: 0;
}

.stage-step.active .step-num {
  background: #1a3a6e;
  border-color: #5a9cf5;
  box-shadow: 0 0 12px rgba(90, 156, 245, 0.35);
}

.step-label {
  font-size: 0.88rem;
  font-weight: 500;
  color: #b0b6be;
}

.stage-connector {
  width: 32px;
  height: 2px;
  background: #2a3545;
  flex-shrink: 0;
  margin: 0 6px;
}

.stage-section {
  margin-top: 4px;
}

h2 {
  margin: 0 0 10px;
  font-size: 1.05rem;
}

.stage-card h2 {
  display: flex;
  align-items: center;
  gap: 10px;
}

.stage-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.65rem;
  height: 1.65rem;
  border-radius: 999px;
  background: #1a2230;
  border: 1px solid #3d6a9e;
  color: #8ab4f8;
  font-size: 0.82rem;
  font-weight: 600;
}

.card {
  margin-top: 16px;
  padding: 18px;
  border: 1px solid #232830;
  border-radius: 12px;
  background: #141820;
}

.viewer-card {
  border-color: #2d4a6e;
  background: linear-gradient(180deg, #141c2a 0%, #12151c 100%);
}

.hidden {
  display: none !important;
}

.resume-banner {
  border-color: #3d6a9e;
  background: linear-gradient(135deg, #1a2740 0%, #141820 100%);
}

.resume-banner h2 {
  margin: 0 0 8px;
  color: #8ab4f8;
  font-size: 1.05rem;
}

.stage-card.collapsed {
  padding: 12px 18px;
}

.stage-card.collapsed h2 {
  margin: 0;
  font-size: 0.95rem;
  opacity: 0.65;
}

.stage-card.collapsed > :not(h2) {
  display: none;
}

.stage-card.collapsed h2::after {
  content: ' (tamamlandı)';
  font-size: 0.8rem;
  font-weight: 400;
  color: #6a9e6a;
}

button.primary {
  background: #1a5fb4;
  border-color: #3584e4;
}

button.viewer-btn {
  background: #1f4d2a;
  border-color: #3d8f5a;
  font-weight: 600;
}

button.viewer-btn:not(:disabled) {
  animation: pulse-viewer 2s ease-in-out infinite;
}

@keyframes pulse-viewer {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(61, 143, 90, 0.4);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(61, 143, 90, 0);
  }
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
  font-size: 0.9rem;
  color: #b0b6be;
}

input[type='file'],
textarea {
  padding: 10px;
  border: 1px solid #3c4048;
  border-radius: 8px;
  background: #0d1016;
  color: inherit;
  font-family: inherit;
  resize: vertical;
}

#kling-prompt {
  font-size: 0.95rem;
  line-height: 1.5;
  color: #d4e4ff;
}

button {
  padding: 10px 16px;
  border: 1px solid #3d6a9e;
  border-radius: 8px;
  background: #1a2a3d;
  color: inherit;
  cursor: pointer;
  font-size: 0.9rem;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.enhance-status {
  margin: 0 0 12px;
  color: #9aa0a6;
  font-size: 0.9rem;
}

#magnific-prompt {
  font-size: 0.85rem;
  line-height: 1.45;
  color: #c8d4e8;
}

.enhance-timer {
  margin: 0 0 12px;
  color: #8ec5ff;
  font-size: 0.9rem;
}

.enhance-status.warn {
  color: #f0b060;
}

.error {
  color: #ff8a80;
  margin: 0;
  line-height: 1.5;
}

#error-card {
  border-color: #6b3030;
  background: #221518;
}

.result-grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 20px;
}

figure {
  margin: 0;
}

figcaption {
  margin-bottom: 8px;
  color: #9aa0a6;
  font-size: 0.85rem;
}

img {
  width: 100%;
  border-radius: 8px;
  border: 1px solid #2a2f38;
  background: #000;
  min-height: 180px;
  object-fit: contain;
}

.prompt-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.meta-row {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 10px;
  font-size: 0.9rem;
}

.label {
  color: #9aa0a6;
}

.value {
  color: #e8eaed;
}

.prompt-field {
  margin-bottom: 0;
}

.hint {
  font-size: 0.82rem;
  color: #6a7585;
  margin: 0 0 10px;
}

.btn-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

#kling-btn {
  border-color: #5a8f4a;
  background: #1f3320;
}

.video-status {
  margin: 0 0 6px;
  color: #b0b6be;
  font-size: 0.9rem;
}

.video-timer {
  margin: 0 0 12px;
  color: #8ab4f8;
  font-size: 0.85rem;
}

#video-preview {
  width: 100%;
  margin-top: 12px;
  border-radius: 8px;
  border: 1px solid #2a2f38;
  background: #000;
  max-height: 400px;
}

#video-preview.video-empty {
  min-height: 100px;
  background: #0d1016;
}

.import-panel {
  margin: 0 0 16px;
  padding: 14px;
  border: 1px dashed #3d4a5e;
  border-radius: 10px;
  background: #10141b;
}

.import-panel h3 {
  margin: 0 0 8px;
  font-size: 0.95rem;
  color: #b0b6be;
}

.import-preview {
  width: 100%;
  margin-top: 10px;
  border-radius: 8px;
  border: 1px solid #2a2f38;
  background: #000;
  max-height: 220px;
}

.import-preview.video-empty {
  min-height: 80px;
  background: #0d1016;
}

.volume-picker {
  margin: 0 0 14px;
  padding: 12px;
  border: 1px solid #3d6a9e;
  border-radius: 10px;
  background: #0f1520;
  max-height: 280px;
  overflow: auto;
}

.volume-picker-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.picker-close {
  padding: 4px 10px;
  font-size: 0.82rem;
}

.volume-video-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.volume-video-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid #2a3545;
  border-radius: 8px;
  margin-bottom: 8px;
  cursor: pointer;
  background: #141820;
}

.volume-video-item:hover,
.volume-video-item.selected {
  border-color: #5a9cf5;
  background: #1a2740;
}

.volume-video-item .meta {
  font-size: 0.78rem;
  color: #7a8494;
}

.extra-details {
  margin-top: 4px;
  font-size: 0.85rem;
  color: #9aa0a6;
}

.extra-details summary {
  cursor: pointer;
  color: #b0b6be;
  margin-bottom: 8px;
}

/* Flipbook progress */
.progress-bar {
  height: 6px;
  border-radius: 999px;
  background: #1a2230;
  margin: 12px 0 14px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #3584e4, #5a9cf5);
  transition: width 0.4s ease;
}

/* Viewer embed */
.viewer-frame-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  min-height: 420px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid #2d4a6e;
  background: #000;
  margin-bottom: 12px;
}

#viewer-frame {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

@media (max-width: 720px) {
  .result-grid {
    grid-template-columns: 1fr;
  }

  .stage-nav {
    flex-wrap: wrap;
    gap: 8px;
  }

  .stage-connector {
    display: none;
  }

  .stage-step {
    flex: 1 1 100%;
  }

  .viewer-frame-wrap {
    min-height: 280px;
    aspect-ratio: 4 / 3;
  }
}
