@import url('base.css');

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Outfit', system-ui, sans-serif;
  background: linear-gradient(135deg, var(--page) 0%, var(--bg-light) 100%);
  color: var(--ink);
  line-height: 1.6;
  min-height: 100vh;
}

/* Main wrapper: left hero, right carousel */
.wrapper {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  min-height: 100vh;
  gap: 0;
}

/* Left section: Hero */
.hero {
  position: relative;
  background: linear-gradient(180deg, rgba(107, 143, 35, 0.08) 0%, rgba(107, 143, 35, 0.04) 100%);
  padding: 40px 60px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  border-right: 1px solid var(--border);
}

.hero h1 {
  font-family: 'Crimson Text', serif;
  font-size: 52px;
  color: var(--ink);
  margin-bottom: 8px;
  font-weight: 400;
  letter-spacing: -0.5px;
  line-height: 1.1;
}

.hero .subtitle {
  color: var(--accent);
  font-size: 16px;
  font-weight: 300;
  letter-spacing: 0.4px;
  margin-bottom: 16px;
}

.hero-content {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.feature {
  animation: slideInLeft 0.6s ease-out backwards;
}

.feature:nth-child(1) { animation-delay: 0.05s; }
.feature:nth-child(2) { animation-delay: 0.1s; }
.feature:nth-child(3) { animation-delay: 0.15s; }

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.feature h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 4px;
  letter-spacing: 0.2px;
}

.feature p {
  font-size: 12px;
  color: var(--ink);
  opacity: 0.75;
  line-height: 1.5;
}

/* Pricing Section */
.pricing-section {
  margin-top: 20px;
}

.pricing-section-title {
  font-family: 'Crimson Text', serif;
  font-size: 18px;
  color: var(--ink);
  margin-bottom: 12px;
  font-weight: 400;
}

.pricing-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pricing-card {
  position: relative;
  padding: 12px 14px;
  background: white;
  border: 1px solid var(--border);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.pricing-card.active {
  border-left: 3px solid var(--accent);
  background: rgba(107, 143, 35, 0.04);
}

.pricing-card.active .pricing-card-name {
  color: var(--accent);
}

.pricing-card.disabled {
  opacity: 0.55;
  cursor: not-allowed;
  background: #f9f8f6;
}

.pricing-card-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pricing-card-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: 0.2px;
}

.pricing-card-desc {
  font-size: 11px;
  color: var(--ink);
  opacity: 0.7;
}

.pricing-card-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pricing-card-price {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.pricing-card.active .pricing-card-price {
  color: var(--accent);
}

.pricing-card-savings {
  font-size: 10px;
  color: #4a7d52;
  font-weight: 600;
  background: rgba(100, 170, 110, 0.12);
  padding: 2px 6px;
  letter-spacing: 0.2px;
}

.coming-soon-badge {
  font-size: 9px;
  font-weight: 700;
  color: white;
  background: linear-gradient(135deg, #888 0%, #666 100%);
  padding: 3px 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.current-badge {
  font-size: 9px;
  font-weight: 700;
  color: white;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
  padding: 3px 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Rate limit pricing section */
.rate-limit-pricing {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.rate-limit-pricing .pricing-section-title {
  font-size: 22px;
  margin-bottom: 16px;
}

.rate-limit-pricing .pricing-cards {
  gap: 10px;
  max-width: 360px;
  margin: 0 auto;
}

.rate-limit-pricing .pricing-card {
  padding: 14px 16px;
}

.rate-limit-pricing .pricing-card-name {
  font-size: 14px;
}

.rate-limit-pricing .pricing-card-desc {
  font-size: 12px;
}

.rate-limit-pricing .pricing-card-price {
  font-size: 16px;
}

/* Right section: Carousel */
.carousel-container {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.carousel-track {
  display: flex;
  width: 400%;
  height: 100%;
  transition: transform 0.5s ease-out;
  will-change: transform;
}

.carousel-track[data-screen="form"] {
  transform: translateX(0%);
}

.carousel-track[data-screen="style"] {
  transform: translateX(-25%);
}

.carousel-track[data-screen="processing"] {
  transform: translateX(-50%);
}

.carousel-track[data-screen="download"] {
  transform: translateX(-75%);
}

.carousel-screen {
  width: calc(100% / 4);
  flex: 0 0 calc(100% / 4);
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 40px;
  overflow: hidden;
  visibility: hidden;
}

.carousel-track[data-screen="form"] .form-screen,
.carousel-track[data-screen="style"] .style-screen,
.carousel-track[data-screen="processing"] .processing-screen,
.carousel-track[data-screen="download"] .download-screen {
  visibility: visible;
  overflow-y: auto;
}

/* Form screen */
.carousel-screen.form-screen {
  justify-content: flex-start;
  background: white;
}

.carousel-screen.form-screen h2 {
  font-family: 'Crimson Text', serif;
  font-size: 32px;
  color: var(--ink);
  margin-bottom: 20px;
  font-weight: 400;
  letter-spacing: -0.5px;
}

/* Processing & Download screens - centered */
.carousel-screen.processing-screen,
.carousel-screen.download-screen {
  justify-content: center;
  align-items: center;
  background: white;
}

/* Style screen - side by side layout */
.carousel-screen.style-screen {
  background: white;
  display: flex;
  flex-direction: column;
}

.carousel-screen.style-screen h2 {
  font-family: 'Crimson Text', serif;
  font-size: 32px;
  color: var(--ink);
  margin-bottom: 20px;
  font-weight: 400;
  letter-spacing: -0.5px;
}

.style-content {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.style-controls {
  display: flex;
  flex-direction: column;
}

.style-preview-panel {
  position: absolute;
  top: 110px;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  padding-top: 12px;
  overflow-y: auto;
  background: linear-gradient(180deg, rgba(244, 236, 228, 0.97) 0%, rgba(248, 241, 234, 0.97) 100%);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  transform: translateX(-30px);
  transition: opacity 0.4s ease, transform 0.4s ease;
  pointer-events: none;
  z-index: 10;
}

.style-preview-panel.preview-visible {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

.preview-caption {
  width: min(400px, calc(100% - 32px));
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 2px;
  color: #766d62;
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.preview-caption-title {
  color: var(--accent-dark);
  font-weight: 700;
  letter-spacing: 0.1em;
}

.book-preview {
  width: 100%;
  max-width: 400px;
  aspect-ratio: 3 / 4;
  background: linear-gradient(180deg, #fdfcfa 0%, #f8f5f0 100%);
  box-shadow:
    4px 4px 20px rgba(0, 0, 0, 0.15),
    0 0 1px rgba(0, 0, 0, 0.1),
    inset -2px 0 4px rgba(0, 0, 0, 0.02);
  border: 1px solid rgba(0, 0, 0, 0.08);
  padding: 24px 20px;
  overflow: hidden;
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  font-family: 'Crimson Text', serif;
  position: relative;
}

.book-preview::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, rgba(0,0,0,0.08) 0%, rgba(0,0,0,0.04) 100%);
}

.book-preview-chapter-number {
  font-size: 11px;
  margin-bottom: 4px;
  opacity: 0.9;
}

.book-preview-chapter {
  font-size: 16px;
  margin-bottom: 16px;
  padding-bottom: 4px;
  text-align: center;
}

.book-preview-body {
  font-size: 12px;
  line-height: 1.7;
  color: #1a1a1a;
  flex: 1;
  overflow: hidden;
  padding-bottom: 24px;
}

.book-preview-body p {
  margin-bottom: 10px;
  text-indent: 1.5em;
}

.book-preview-body p:first-child {
  text-indent: 0;
}

.book-preview-scene-break {
  text-align: center;
  margin: 16px 0;
  letter-spacing: 4px;
  color: var(--preview-accent, #c0734c);
  opacity: 0.8;
}

/* Preview navigation */
.preview-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 12px;
}
.preview-nav-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px 12px;
  font-size: 12px;
  cursor: pointer;
  color: var(--ink);
  width: auto;
  box-shadow: none;
  text-transform: none;
  letter-spacing: 0;
  margin-top: 0;
}
.preview-nav-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}
.preview-nav-btn:hover:not(:disabled) {
  background: var(--bg-light);
}
.preview-nav-counter {
  font-size: 11px;
  color: var(--ink);
  opacity: 0.6;
}

/* Theme-specific preview styles */
.book-preview[data-theme="default"] {
  background: #ffffff;
  color: #1a1a1a;
}

.book-preview[data-theme="default"] .book-preview-chapter {
  font-family: 'Crimson Text', serif;
  font-weight: 400;
}

.book-preview[data-theme="default"] .book-preview-body {
  font-family: 'Crimson Text', serif;
}

.book-preview[data-theme="serif"] {
  background: #ffffff;
  color: #1a1a1a;
}

.book-preview[data-theme="serif"] .book-preview-chapter {
  font-family: 'Crimson Text', serif;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 14px;
  font-style: normal;
  letter-spacing: 0.5px;
}

.book-preview[data-theme="serif"] .book-preview-body {
  font-family: 'Crimson Text', serif;
}

.book-preview[data-theme="sans-serif"] {
  background: #ffffff;
  color: #1a1a1a;
}

.book-preview[data-theme="sans-serif"] .book-preview-chapter {
  font-family: 'Outfit', system-ui, sans-serif;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  font-size: 13px;
  font-style: normal;
}

.book-preview[data-theme="sans-serif"] .book-preview-body {
  font-family: 'Outfit', system-ui, sans-serif;
  font-weight: 300;
}

.book-preview[data-theme="modern"] {
  background: #ffffff;
  color: #1a1a1a;
}

.book-preview[data-theme="modern"] .book-preview-chapter {
  font-family: 'Outfit', system-ui, sans-serif;
  font-weight: 600;
  color: #b8860b;
  letter-spacing: 0.2px;
  font-style: normal;
  border-bottom-color: rgba(0, 0, 0, 0.08);
}

.book-preview[data-theme="modern"] .book-preview-body {
  font-family: 'Outfit', system-ui, sans-serif;
  font-weight: 300;
  color: #333;
}

/* Form groups */
.form-group {
  margin-bottom: 18px;
  animation: fadeIn 0.6s ease-out forwards;
  opacity: 0;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-row .form-group {
  margin-bottom: 0;
}

.form-group:nth-child(1) { animation-delay: 0.15s; }
.form-group:nth-child(2) { animation-delay: 0.25s; }
.form-group:nth-child(3) { animation-delay: 0.35s; }
.form-group:nth-child(4) { animation-delay: 0.45s; }
.form-group:nth-child(5) { animation-delay: 0.55s; }
.form-group:nth-child(6) { animation-delay: 0.65s; }

@keyframes fadeIn {
  to {
    opacity: 1;
  }
}

label {
  display: block;
  color: var(--ink);
  font-weight: 600;
  margin-bottom: 10px;
  font-size: 13px;
  letter-spacing: 0.3px;
}

span[style*="color: red"] {
  color: var(--accent) !important;
  font-weight: 700;
}

input[type='text'],
input[type='email'],
input[type='file'],
select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 0;
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 14px;
  background: white;
  color: var(--ink);
  transition: all 0.2s ease;
}

input[type='text']:focus,
input[type='email']:focus,
input[type='file']:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(107, 143, 35, 0.1);
}

.file-input-wrapper {
  position: relative;
  overflow: hidden;
  display: block;
}

.file-input-label {
  display: block;
  padding: 16px 14px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 0;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 500;
  font-size: 14px;
  color: var(--ink);
}

.file-input-label:hover {
  border-color: var(--accent);
  background: rgba(107, 143, 35, 0.02);
}

.file-input-label.dragging {
  background: rgba(107, 143, 35, 0.05);
  border-color: var(--accent);
  box-shadow: inset 0 0 0 2px rgba(107, 143, 35, 0.2);
}

input[type='file'] {
  display: none;
}

.file-name {
  display: block;
  color: var(--accent);
  font-weight: 600;
  margin-top: 6px;
  font-size: 13px;
  word-break: break-word;
}

.field-hint {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--muted, #666);
  font-weight: 400;
  line-height: 1.4;
}

.field-hint code {
  font-size: 12px;
  background: rgba(0, 0, 0, 0.04);
  padding: 1px 5px;
  border-radius: 2px;
}

button {
  width: 100%;
  padding: 12px 16px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
  color: white;
  border: none;
  border-radius: 0;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  letter-spacing: 0.2px;
  text-transform: uppercase;
  font-size: 12px;
  box-shadow: 0 4px 12px rgba(107, 143, 35, 0.2);
  margin-top: 6px;
}

button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(107, 143, 35, 0.3);
}

button:active:not(:disabled) {
  transform: translateY(0);
}

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

/* Theme preview section */
.theme-preview-section {
  margin-top: 16px;
  position: relative;
}

.theme-preview-section::after {
  content: '';
  position: absolute;
  bottom: 0;
  right: 0;
  width: 50px;
  height: calc(100% - 30px);
  background: linear-gradient(to right, transparent, white);
  pointer-events: none;
  z-index: 5;
}

.theme-preview-label {
  display: block;
  color: var(--ink);
  font-weight: 600;
  margin-bottom: 10px;
  font-size: 13px;
  letter-spacing: 0.3px;
}

.theme-previews {
  display: flex;
  flex-wrap: nowrap;
  gap: 12px;
  overflow-x: auto;
  overflow-y: visible;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 4px 40px 4px 0;
}

.theme-previews::-webkit-scrollbar {
  display: none;
}

.theme-preview-item {
  position: relative;
  cursor: pointer;
  border: 2px solid var(--border);
  border-radius: 0;
  overflow: hidden;
  transition: all 0.2s ease;
  background: white;
  flex: 0 0 180px;
  scroll-snap-align: start;
}

.theme-preview-item:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(107, 143, 35, 0.15);
}

.theme-preview-item input[type="radio"] {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  z-index: 10;
  margin: 0;
}

.theme-preview-item input[type="radio"]:checked + .preview-thumbnail {
  box-shadow: inset 0 0 0 2px var(--accent);
}

.theme-preview-item input[type="radio"]:checked ~ .preview-label {
  color: var(--accent);
  font-weight: 700;
}

.print-pdf-option {
  margin-top: 20px;
  padding: 16px;
  border: 1px solid var(--border);
  background: #fdfcfa;
}

.print-pdf-title {
  margin-bottom: 10px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.print-pdf-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 8px;
  cursor: pointer;
  font-weight: 500;
  line-height: 1.4;
}

.print-pdf-checkbox input {
  width: 16px;
  height: 16px;
  margin: 2px 0 0;
  accent-color: var(--accent);
  flex: 0 0 auto;
}

.print-pdf-option .field-hint {
  margin-bottom: 0;
  padding-left: 26px;
}

.trim-size-control {
  margin-top: 14px;
  padding-left: 26px;
}

.trim-size-control[hidden] {
  display: none;
}

.trim-size-control label {
  margin-bottom: 6px;
}

.trim-size-control select {
  max-width: 220px;
}

.preview-thumbnail {
  height: 170px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: stretch;
  padding: 14px 12px;
  text-align: left;
  transition: all 0.2s ease;
  font-family: 'Crimson Text', serif;
  box-shadow:
    2px 2px 8px rgba(0, 0, 0, 0.08),
    0 1px 3px rgba(0, 0, 0, 0.06);
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.preview-chapter {
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.preview-chapter-number {
  font-size: 8px;
  line-height: 1.3;
  margin-bottom: 2px;
  opacity: 0.7;
}

.preview-chapter-title {
  font-size: 12px;
  line-height: 1.3;
  margin-bottom: 2px;
}

.preview-body {
  font-size: 8px;
  line-height: 1.5;
  opacity: 0.85;
}

.preview-body p {
  margin-bottom: 4px;
}

.preview-label {
  padding: 8px 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: 0.2px;
  transition: all 0.2s ease;
}

/* Default Serif Theme */
.theme-preview-item[data-theme="default"] .preview-thumbnail {
  background: #ffffff;
  color: #1a1a1a;
}

.theme-preview-item[data-theme="default"] .preview-chapter-title {
  font-family: 'Crimson Text', serif;
  font-style: italic;
  font-weight: 400;
  text-align: center;
}

.theme-preview-item[data-theme="default"] .preview-body {
  font-family: 'Crimson Text', serif;
  text-align: justify;
}

.theme-preview-item[data-theme="default"] .preview-chapter {
  border-bottom-color: rgba(0, 0, 0, 0.1);
}

/* Classic Serif Theme */
.theme-preview-item[data-theme="serif"] .preview-thumbnail {
  background: #ffffff;
  color: #1a1a1a;
}

.theme-preview-item[data-theme="serif"] .preview-chapter-number {
  text-align: center;
  text-transform: uppercase;
  font-family: 'Crimson Text', serif;
  letter-spacing: 0.5px;
}

.theme-preview-item[data-theme="serif"] .preview-chapter-title {
  font-family: 'Crimson Text', serif;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.5px;
  text-align: center;
}

.theme-preview-item[data-theme="serif"] .preview-body {
  font-family: 'Crimson Text', serif;
  font-weight: 400;
  text-align: justify;
}

.theme-preview-item[data-theme="serif"] .preview-chapter {
  border-bottom-color: rgba(0, 0, 0, 0.12);
}

/* Modern Sans Theme */
.theme-preview-item[data-theme="sans-serif"] .preview-thumbnail {
  background: #ffffff;
  color: #1a1a1a;
}

.theme-preview-item[data-theme="sans-serif"] .preview-chapter-number {
  text-align: left;
  font-family: 'Outfit', system-ui, sans-serif;
  font-weight: 600;
}

.theme-preview-item[data-theme="sans-serif"] .preview-chapter-title {
  font-family: 'Outfit', system-ui, sans-serif;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  font-size: 10px;
  text-align: left;
}

.theme-preview-item[data-theme="sans-serif"] .preview-body {
  font-family: 'Outfit', system-ui, sans-serif;
  font-weight: 300;
}

.theme-preview-item[data-theme="sans-serif"] .preview-chapter {
  border-bottom-color: rgba(0, 0, 0, 0.08);
}

/* Contemporary (Dark) Theme */
.theme-preview-item[data-theme="modern"] .preview-thumbnail {
  background: #ffffff;
  color: #1a1a1a;
}

.theme-preview-item[data-theme="modern"] .preview-chapter-number {
  text-align: center;
  font-family: 'Outfit', system-ui, sans-serif;
  color: #b8860b;
}

.theme-preview-item[data-theme="modern"] .preview-chapter-title {
  font-family: 'Outfit', system-ui, sans-serif;
  font-weight: 600;
  color: #b8860b;
  letter-spacing: 0.2px;
  text-align: center;
}

.theme-preview-item[data-theme="modern"] .preview-body {
  font-family: 'Outfit', system-ui, sans-serif;
  font-weight: 300;
  color: #333;
}

.theme-preview-item[data-theme="modern"] .preview-chapter {
  border-bottom-color: rgba(0, 0, 0, 0.08);
}

/* Advanced Formatting Section */
.advanced-formatting {
  margin-top: 20px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fdfcfa;
  transition: opacity 0.2s ease;
}

.advanced-formatting.locked {
  opacity: 0.6;
  cursor: not-allowed;
}

.advanced-formatting.locked .advanced-formatting-content {
  pointer-events: none;
}

.advanced-formatting-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  user-select: none;
  list-style: none;
}

.advanced-formatting-summary::-webkit-details-marker {
  display: none;
}

.advanced-formatting-summary::marker {
  display: none;
  content: '';
}

.advanced-formatting-arrow {
  font-size: 10px;
  transition: transform 0.2s ease;
  display: inline-block;
}

.advanced-formatting[open] .advanced-formatting-arrow {
  transform: rotate(90deg);
}

.pro-badge {
  font-size: 11px;
  font-weight: 600;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
  color: white;
  padding: 2px 8px;
  border-radius: 10px;
  margin-left: auto;
}

.advanced-formatting:not(.locked) .pro-badge {
  background: linear-gradient(135deg, #4a9d4a 0%, #357535 100%);
}

.advanced-formatting:not(.locked) .pro-badge::before {
  content: '✓ ';
}

.advanced-formatting.locked .pro-badge::before {
  content: '';
}

.advanced-formatting-content {
  padding: 16px;
  border-top: 1px solid var(--border);
}

.format-group {
  margin-bottom: 16px;
}

.format-group:last-child {
  margin-bottom: 0;
}

.format-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 10px;
  letter-spacing: 0.2px;
}

.format-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.format-row:last-child {
  margin-bottom: 0;
}

.format-sublabel {
  font-size: 12px;
  color: #666;
  min-width: 100px;
  flex-shrink: 0;
}

/* Segmented Buttons */
.segmented-buttons {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.seg-btn {
  flex: 1;
  width: auto;
  padding: 6px 12px;
  font-size: 12px;
  font-family: inherit;
  background: white;
  border: none;
  border-right: 1px solid var(--border);
  cursor: pointer;
  color: var(--ink);
  transition: all 0.15s ease;
  white-space: nowrap;
  box-shadow: none;
  margin-top: 0;
}

.seg-btn:last-child {
  border-right: none;
}

.seg-btn:hover {
  background: var(--bg-light);
}

.seg-btn.active {
  background: #6b8f23;
  color: white;
}

/* Toggle Buttons (multi-select) */
.toggle-buttons {
  display: flex;
  gap: 4px;
}

.toggle-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-family: inherit;
  font-weight: 600;
  background: white;
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  color: var(--ink);
  transition: all 0.15s ease;
}

.toggle-btn:hover {
  border-color: var(--accent);
}

.toggle-btn.active {
  background: #6b8f23;
  color: white;
  border-color: #6b8f23;
}

/* Color Swatches */
.color-swatches {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

button.color-swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  padding: 0;
  background: none;
  box-shadow: none;
  min-width: 0;
  text-transform: none;
  letter-spacing: 0;
}

.color-swatch:hover {
  transform: scale(1.1);
}

.color-swatch.active {
  border-color: var(--ink);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.1);
}

/* Locked overlay for non-admin */
.advanced-formatting.locked::after {
  content: 'Available with paid plans';
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  background: var(--ink);
  color: white;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 11px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 10;
}

.advanced-formatting.locked:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.advanced-formatting {
  position: relative;
}

/* Responsive adjustments for advanced formatting */
@media (max-width: 640px) {
  .format-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .format-sublabel {
    min-width: auto;
  }

  .segmented-buttons {
    width: 100%;
  }

  .seg-btn {
    flex: 1;
    text-align: center;
    padding: 8px 6px;
    font-size: 11px;
  }
}

/* Status message */
.status {
  margin-top: 24px;
  padding: 16px 18px;
  border-radius: 0;
  display: none;
  font-size: 14px;
  border-left: 3px solid;
  animation: slideIn 0.3s ease-out;
  word-break: break-word;
  white-space: pre-wrap;
  overflow-x: auto;
}

.status small {
  opacity: 0.85;
  font-size: 12px;
  display: block;
  margin-top: 8px;
}

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

.status.show {
  display: block;
}

.status.loading {
  background: rgba(107, 143, 35, 0.08);
  border-color: var(--accent);
  color: var(--accent-dark);
}

.status.success {
  background: rgba(100, 170, 110, 0.08);
  border-color: #64aa6e;
  color: #4a7d52;
}

.status.error {
  background: rgba(220, 100, 90, 0.08);
  border-color: #dc645a;
  color: #a84740;
}

/* Progress spinner */
.spinner {
  width: 60px;
  height: 60px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1.2s linear infinite;
  margin-bottom: 24px;
}

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

.progress-text {
  font-family: 'Crimson Text', serif;
  font-size: 24px;
  color: var(--ink);
  margin-bottom: 8px;
  font-weight: 400;
  letter-spacing: -0.5px;
}

.progress-subtext {
  font-size: 14px;
  color: var(--ink);
  opacity: 0.6;
  margin-bottom: 12px;
}

.progress-dots {
  display: flex;
  gap: 6px;
  justify-content: center;
}

.progress-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
  animation: pulse 1.4s ease-in-out infinite;
}

.progress-dot:nth-child(1) { animation-delay: 0s; }
.progress-dot:nth-child(2) { animation-delay: 0.2s; }
.progress-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes pulse {
  0%, 100% { opacity: 0.4; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.2); }
}

/* Download card */
.download-card {
  background: linear-gradient(135deg, rgba(100, 170, 110, 0.05) 0%, rgba(100, 170, 110, 0.02) 100%);
  border: 2px solid #64aa6e;
  padding: 32px;
  text-align: center;
}

.download-icon {
  font-size: 40px;
  margin-bottom: 16px;
  display: block;
}

.download-title {
  font-family: 'Crimson Text', serif;
  font-size: 28px;
  color: #4a7d52;
  margin-bottom: 8px;
  font-weight: 400;
  letter-spacing: -0.5px;
}

.download-description {
  font-size: 14px;
  color: var(--ink);
  opacity: 0.7;
  margin-bottom: 24px;
}

.download-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.download-button {
  background: linear-gradient(135deg, #64aa6e 0%, #4a7d52 100%);
  color: white;
  padding: 14px 28px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  font-size: 13px;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  width: auto;
  display: inline-block;
  box-shadow: 0 4px 12px rgba(100, 170, 110, 0.2);
}

.download-button[hidden] {
  display: none;
}

.download-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(100, 170, 110, 0.3);
}

.reset-button {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--border);
  padding: 12px 20px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  font-size: 12px;
  margin-top: 16px;
  width: auto;
  display: inline-block;
  box-shadow: none;
  transition: all 0.2s ease;
}

.reset-button:hover {
  background: rgba(107, 143, 35, 0.05);
  border-color: var(--accent);
  transform: none;
}

/* Select styling */
select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%231a1a1a' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
}

/* Rate limit message */
.rate-limit-message {
  display: none;
  text-align: center;
  padding: 40px;
  animation: fadeIn 0.6s ease-out forwards;
}

.rate-limit-message.show {
  display: block;
}

.rate-limit-message h2 {
  font-family: 'Crimson Text', serif;
  font-size: 28px;
  color: var(--ink);
  margin-bottom: 12px;
  font-weight: 400;
  letter-spacing: -0.5px;
}

.rate-limit-message p {
  font-size: 15px;
  color: var(--ink);
  opacity: 0.75;
  line-height: 1.6;
  margin-bottom: 8px;
}

.rate-limit-message .reset-date {
  display: inline-block;
  margin-top: 16px;
  padding: 12px 18px;
  background: rgba(107, 143, 35, 0.08);
  border-left: 3px solid var(--accent);
  font-size: 14px;
  color: var(--accent-dark);
}

.rate-limit-message .upgrade-link {
  display: inline-block;
  margin-top: 20px;
  padding: 12px 24px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
  color: white;
  text-decoration: none;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.3px;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(107, 143, 35, 0.2);
}

.rate-limit-message .upgrade-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(107, 143, 35, 0.3);
}

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

  .hero {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .carousel-screen.form-screen h2 {
    font-size: 28px;
    margin-bottom: 18px;
  }

  .carousel-screen.style-screen h2 {
    font-size: 28px;
    margin-bottom: 18px;
  }

  .style-preview-panel {
    display: none;
  }
}

@media (max-width: 640px) {
  .hero {
    padding: 32px 24px;
  }

  .hero h1 {
    font-size: 32px;
  }

  .hero .subtitle {
    font-size: 15px;
  }

  .carousel-screen {
    padding: 24px;
  }

  .carousel-screen.form-screen h2,
  .carousel-screen.style-screen h2 {
    font-size: 24px;
    margin-bottom: 16px;
  }

  .book-preview {
    max-width: 180px;
    padding: 16px 14px;
  }

  .book-preview-chapter {
    font-size: 14px;
    margin-bottom: 12px;
    padding-bottom: 8px;
  }

  .book-preview-body {
    font-size: 10px;
  }

  .form-group {
    margin-bottom: 14px;
  }

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

  .form-row .form-group {
    margin-bottom: 14px;
  }

  label {
    font-size: 12px;
  }

  input, select, .file-input-label {
    font-size: 13px;
  }

  .theme-previews {
    gap: 10px;
  }

  .theme-preview-item {
    flex: 0 0 160px;
  }

  .preview-thumbnail {
    height: 140px;
    padding: 10px 8px;
  }

  .preview-chapter-title {
    font-size: 10px;
  }

  .preview-body {
    font-size: 7px;
  }

  .preview-chapter {
    margin-bottom: 6px;
    padding-bottom: 4px;
  }

  .download-card {
    padding: 24px;
  }

  .download-title {
    font-size: 24px;
  }

  .progress-text {
    font-size: 18px;
  }

  .pricing-card {
    padding: 10px 12px;
  }

  .pricing-card-right {
    gap: 6px;
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .pricing-card-name {
    font-size: 12px;
  }

  .pricing-card-desc {
    font-size: 10px;
  }

  .pricing-card-price {
    font-size: 13px;
  }

  .pricing-card-savings {
    font-size: 9px;
    padding: 2px 4px;
  }

  .coming-soon-badge,
  .current-badge {
    font-size: 8px;
    padding: 2px 6px;
  }

  .rate-limit-pricing .pricing-cards {
    max-width: 100%;
  }
}
