/* ========== FONTS ========== */
@font-face {
  font-family: 'GenSenRounded';
  src: url('https://lab.helloruru.com/fonts/GenSenRounded-Regular.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'GenSenRounded';
  src: url('https://lab.helloruru.com/fonts/GenSenRounded-Medium.woff2') format('woff2');
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'GenSenRounded';
  src: url('https://lab.helloruru.com/fonts/GenSenRounded-Bold.woff2') format('woff2');
  font-weight: 700; font-style: normal; font-display: swap;
}

/* ========== RESET & VARIABLES ========== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --rose: #D4A5A5;
  --rose-light: #E8C8C8;
  --lavender: #B8A9C9;
  --coral: #E8A87C;
  --gradient: linear-gradient(135deg, #D4A5A5, #B8A9C9);
  --brand-pink: #DFC6C6;
  --brand-brown: #6D5954;

  --text-primary: #333333;
  --text-secondary: #4A4A4A;
  --text-muted: #888888;
  --text-hint: #AAAAAA;

  --bg-page: #FAFAFA;
  --bg-card: #FFFFFF;
  --bg-secondary: #F5F0EE;
  --border: #E8E4E1;

  --shadow-sm: 0 2px 8px rgba(212,165,165,0.08);
  --shadow-md: 0 4px 16px rgba(212,165,165,0.10);
  --shadow-lg: 0 8px 32px rgba(212,165,165,0.14);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 24px;
  --radius-full: 9999px;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'GenSenRounded', 'Noto Sans TC', sans-serif;
  font-weight: 500;
  font-size: 16px;
  line-height: 1.8;
  color: var(--text-secondary);
  background: var(--bg-page);
  min-height: 100vh;
}

/* ========== BRAND HEADER ========== */
hello-ruru-header {
  display: block;
  margin-bottom: 28px;
}

/* ========== LAYOUT ========== */
.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 24px 48px;
}

/* ========== CARDS ========== */
.card {
  border-radius: var(--radius-lg);
  padding: 32px;
  margin-bottom: 24px;
  transition: box-shadow 0.3s ease;
}

.card-a {
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
}

.card-b {
  background: linear-gradient(135deg, rgba(245,208,197,0.08), rgba(196,183,215,0.08));
  border: 1px solid rgba(212,165,165,0.15);
  box-shadow: var(--shadow-sm);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.card-header h2 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
}

.icon-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.icon-circle.rose {
  background: rgba(212,165,165,0.15);
  color: var(--rose);
}

.icon-circle.lavender {
  background: rgba(184,169,201,0.15);
  color: var(--lavender);
}

/* ========== PRIVACY NOTE ========== */
.privacy-note {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.privacy-note svg {
  color: var(--rose);
  flex-shrink: 0;
}

/* ========== DROP ZONE ========== */
.drop-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
}

.drop-zone:hover,
.drop-zone.dragging {
  border-color: var(--rose);
  background: rgba(212,165,165,0.05);
}

.drop-zone.dragging {
  background: rgba(212,165,165,0.1);
}

.drop-icon {
  color: var(--rose);
  margin-bottom: 16px;
}

.drop-text {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.drop-hint {
  font-size: 14px;
  color: var(--text-muted);
}

.drop-limit {
  font-size: 12px;
  color: var(--text-hint);
  margin-top: 8px;
}

/* ========== FILE INFO ========== */
.file-info {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  margin-top: 16px;
}

.file-info-icon {
  color: var(--lavender);
  flex-shrink: 0;
}

.file-info-text {
  flex: 1;
  min-width: 0;
}

.file-name {
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-size {
  font-size: 14px;
  color: var(--text-muted);
}

.btn-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--bg-card);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.btn-icon:hover {
  color: var(--rose);
  background: var(--bg-secondary);
}

/* ========== INSTRUCTIONS ========== */
.instructions {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.instructions p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ========== EPUB INFO ========== */
.epub-info {
  padding: 16px 20px;
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  margin-bottom: 24px;
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.8;
}

.epub-info:empty {
  display: none;
}

/* ========== SETTINGS ========== */
.setting-group {
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.setting-group:last-of-type {
  border-bottom: none;
  padding-bottom: 0;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.setting-label {
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.setting-desc {
  font-size: 13px;
  color: var(--text-muted);
}

.setting-section-title {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.setting-note {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.setting-note svg {
  color: var(--lavender);
  flex-shrink: 0;
}

/* ========== TOGGLE SWITCH ========== */
.toggle {
  position: relative;
  width: 52px;
  height: 28px;
  border-radius: var(--radius-full);
  border: none;
  background: var(--border);
  cursor: pointer;
  transition: background 0.3s;
  flex-shrink: 0;
  padding: 0;
}

.toggle.active {
  background: var(--gradient);
}

.toggle-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
  transition: transform 0.3s;
}

.toggle.active .toggle-knob {
  transform: translateX(24px);
}

/* ========== OPTION BUTTONS ========== */
.option-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.option-buttons.cols-2 {
  grid-template-columns: 1fr 1fr;
}

.option-buttons.cols-4 {
  grid-template-columns: repeat(4, 1fr);
}

.option-btn {
  padding: 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  font-size: inherit;
}

.option-btn:hover {
  border-color: var(--lavender);
}

.option-btn.active {
  border-color: var(--rose);
  background: rgba(212,165,165,0.08);
}

.option-title {
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.option-desc {
  font-size: 12px;
  color: var(--text-muted);
}

.option-btn.small-btn {
  padding: 10px 16px;
  text-align: center;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
}

.option-btn.small-btn.active {
  color: var(--text-primary);
}

/* ========== COVER IMAGE ========== */
.cover-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
}

.cover-zone:hover,
.cover-zone.dragging {
  border-color: var(--rose);
  background: rgba(212,165,165,0.05);
}

.cover-zone.dragging {
  background: rgba(212,165,165,0.1);
}

.cover-zone svg {
  color: var(--rose);
  margin-bottom: 12px;
}

.cover-zone-text {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 2px;
}

.cover-zone-hint {
  font-size: 12px;
  color: var(--text-hint);
}

.cover-preview {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 16px;
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
}

.cover-img {
  width: 80px;
  height: 120px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}

.cover-preview-info {
  flex: 1;
  min-width: 0;
}

.cover-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.cover-actions {
  display: flex;
  gap: 8px;
}

.btn-small {
  padding: 6px 14px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--bg-card);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-small:hover {
  border-color: var(--rose);
  color: var(--text-primary);
}

.btn-small.danger:hover {
  border-color: #C9929A;
  color: #C9929A;
}

/* ========== BUTTONS ========== */
.action-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 24px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  border-radius: var(--radius-full);
  border: none;
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

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

.btn-gradient {
  background: var(--gradient);
  color: #fff;
  box-shadow: var(--shadow-sm);
}

.btn-gradient:hover:not(:disabled) {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.btn-outline {
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn-outline:hover:not(:disabled) {
  border-color: var(--rose);
  color: var(--text-primary);
}

/* ========== PROGRESS ========== */
.progress-container {
  margin-top: 8px;
}

.progress-bar {
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--bg-secondary);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--gradient);
  transition: width 0.3s ease;
}

.progress-text {
  font-size: 14px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 12px;
}

/* ========== COMPLETE ========== */
.complete-content {
  text-align: center;
  padding: 24px 0;
}

.complete-icon {
  color: var(--rose);
  margin-bottom: 16px;
}

.complete-content h2 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.complete-stats {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.complete-hint {
  font-size: 13px;
  color: var(--text-muted);
}

/* ========== TOAST ========== */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-family: inherit;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toast-in 0.3s ease, toast-out 0.3s ease 3.7s forwards;
  pointer-events: auto;
  max-width: 420px;
  text-align: center;
}

.toast.error {
  background: #C9929A;
  color: #fff;
}

.toast.success {
  background: #A8B5A0;
  color: #fff;
}

.toast.info {
  background: var(--lavender);
  color: #fff;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes toast-out {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(16px); }
}

/* ========== SPINNER ========== */
.spin {
  animation: spin 1s linear infinite;
}

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

/* ========== FOOTER ========== */
.site-footer {
  text-align: center;
  padding: 32px 24px;
  font-size: 14px;
  color: var(--text-muted);
  position: relative;
}

.site-footer::before {
  content: '';
  display: block;
  width: 120px;
  height: 1px;
  background: var(--gradient);
  margin: 0 auto 24px;
}

.site-footer a {
  color: var(--rose);
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 767px) {
  .container {
    padding: 0 16px 32px;
  }

  .card {
    padding: 24px 20px;
  }

  .card-header h2 {
    font-size: 20px;
  }

  .option-buttons.cols-4 {
    grid-template-columns: repeat(2, 1fr);
  }

  .option-buttons.cols-2 {
    grid-template-columns: 1fr;
  }

  .action-buttons {
    flex-direction: column;
  }

  .btn {
    justify-content: center;
    width: 100%;
  }

  .drop-zone {
    padding: 32px 16px;
  }

  .setting-row {
    gap: 12px;
  }

  .cover-preview {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .cover-actions {
    justify-content: center;
  }
}
