:root {
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #eef2ff;
  --primary-50: #eef2ff;
  --primary-100: #e0e7ff;
  --primary-200: #c7d2fe;
  --secondary: #64748b;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --text: #1e293b;
  --text-secondary: #64748b;
  --text-light: #94a3b8;
  --bg: #f8fafc;
  --bg-white: #ffffff;
  --border: #e2e8f0;
  --border-focus: #4f46e5;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --transition: 0.2s ease;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Noto Sans TC', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Header */
.app-header {
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
  padding: 16px 0;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(8px);
  background: rgba(255,255,255,0.95);
}

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

.logo h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

.tagline {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* Pricing banner */
.pricing-banner {
  margin: 24px 0 0;
  padding: 20px 24px;
  background: linear-gradient(135deg, var(--primary-50) 0%, #faf5ff 100%);
  border: 1px solid var(--primary-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.pricing-heading {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 14px;
  letter-spacing: 0.02em;
}

.pricing-list {
  list-style: none;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.pricing-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  background: var(--bg-white);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.pricing-item--free {
  border-color: #a7f3d0;
  background: #ecfdf5;
}

.pricing-item--pay {
  border-color: var(--primary-200);
}

.pricing-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: none;
}

.pricing-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
}

.pricing-item--free .pricing-value {
  color: #047857;
}

.pricing-item--pay .pricing-value {
  color: var(--primary);
}

.pricing-note {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

.pricing-store-hint {
  margin-top: 14px;
  font-size: 0.88rem;
  color: var(--text-secondary);
  text-align: center;
}

.pricing-store-hint a {
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
}

.pricing-store-hint a:hover {
  text-decoration: underline;
}

@media (max-width: 600px) {
  .pricing-list {
    grid-template-columns: 1fr;
  }
}

/* Benefits */
.benefits-section {
  margin: 28px 0 0;
  padding: 28px 28px 32px;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.benefits-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
  margin-bottom: 10px;
  text-align: center;
}

.benefits-lead {
  font-size: 0.95rem;
  line-height: 1.65;
  color: var(--text-secondary);
  max-width: 52em;
  margin: 0 auto 24px;
  text-align: center;
}

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

.benefit-card {
  padding: 18px 18px 20px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.benefit-card:hover {
  border-color: var(--primary-200);
  box-shadow: var(--shadow-sm);
}

.benefit-card--accent {
  background: var(--primary-50);
  border-color: var(--primary-200);
}

.benefit-card-title {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
  padding-left: 12px;
  border-left: 3px solid var(--primary);
  line-height: 1.35;
}

.benefit-card-text {
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--text-secondary);
  margin: 0;
}

.benefit-card-text a {
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
}

.benefit-card-text a:hover {
  text-decoration: underline;
}

@media (max-width: 480px) {
  .benefits-section {
    padding: 20px 18px 24px;
  }
}

/* Progress Bar */
.progress-bar {
  margin: 32px 0 24px;
  position: relative;
}

.progress-track {
  position: absolute;
  top: 20px;
  left: 40px;
  right: 40px;
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  z-index: 0;
}

.progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 2px;
  transition: width 0.4s ease;
  width: 0%;
}

.progress-steps {
  display: flex;
  justify-content: space-between;
  position: relative;
  z-index: 1;
}

.step-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  transition: var(--transition);
}

.step-num {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.9rem;
  background: var(--bg-white);
  border: 2px solid var(--border);
  color: var(--text-light);
  transition: all 0.3s ease;
}

.step-indicator.active .step-num {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
  box-shadow: 0 0 0 4px var(--primary-100);
}

.step-indicator.completed .step-num {
  background: var(--success);
  border-color: var(--success);
  color: white;
}

.step-label {
  font-size: 0.78rem;
  color: var(--text-light);
  font-weight: 500;
  transition: var(--transition);
  white-space: nowrap;
}

.step-indicator.active .step-label {
  color: var(--primary);
  font-weight: 600;
}

.step-indicator.completed .step-label {
  color: var(--success);
}

/* Step Panels */
.step-panel {
  display: none;
  animation: fadeIn 0.3s ease;
}

.step-panel.active {
  display: block;
}

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

.panel-header {
  margin-bottom: 24px;
}

.panel-header h2 {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}

.panel-header p {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.panel-header code {
  background: var(--primary-50);
  color: var(--primary);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.85rem;
  font-family: 'Consolas', 'Monaco', monospace;
}

.panel-body {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow);
}

.panel-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 20px;
  padding-top: 20px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
  text-decoration: none;
  line-height: 1.5;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

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

.btn-secondary:hover {
  background: var(--border);
  color: var(--text);
}

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

.btn-outline:hover {
  background: var(--bg);
  border-color: var(--primary-200);
  color: var(--primary);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 0.85rem;
}

.btn-generate {
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  color: white;
  padding: 16px 40px;
  font-size: 1.1rem;
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 700;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.btn-generate:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(79,70,229,0.35);
}

.btn-generate:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.arrow {
  font-size: 1.1em;
}

/* Form */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

.form-group label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
}

.form-group.required label::after {
  content: ' *';
  color: var(--danger);
}

.form-group input,
.form-group textarea,
.form-group select {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--text);
  background: var(--bg-white);
  transition: all 0.2s ease;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--primary-100);
}

.form-group textarea {
  resize: vertical;
}

/* Cover Upload */
.cover-upload-area {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  align-items: start;
}

.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  min-height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background: var(--bg);
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--primary);
  background: var(--primary-50);
}

.upload-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.upload-text {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
}

.upload-hint {
  font-size: 0.85rem;
  color: var(--text-light);
}

.cover-preview-container {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
}

.cover-preview-container img {
  max-width: 100%;
  max-height: 400px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  object-fit: contain;
}

.btn-remove-cover {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.btn-remove-cover:hover {
  background: var(--danger);
}

.cover-info {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.info-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}

.info-card h4 {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--text);
}

.info-card ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.info-card li {
  font-size: 0.85rem;
  color: var(--text-secondary);
  padding-left: 16px;
  position: relative;
}

.info-card li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary-200);
}

/* Content Editor */
.content-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 10px;
}

.toolbar-left {
  display: flex;
  gap: 8px;
  align-items: center;
}

.toolbar-right {
  display: flex;
  gap: 16px;
  align-items: center;
}

.char-count, .chapter-count {
  font-size: 0.82rem;
  color: var(--text-light);
  font-weight: 500;
  background: var(--bg);
  padding: 4px 12px;
  border-radius: 20px;
}

.content-editor {
  width: 100%;
  min-height: 400px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: 'Noto Serif TC', 'Noto Sans TC', serif;
  font-size: 1rem;
  line-height: 1.8;
  color: var(--text);
  resize: vertical;
  transition: border-color 0.2s ease;
  background: var(--bg-white);
}

.content-editor:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--primary-100);
}

.content-tips {
  margin-top: 16px;
  padding: 16px;
  background: var(--primary-50);
  border-radius: var(--radius);
}

.content-tips h4 {
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--primary);
}

.tips-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.tip {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tip code {
  background: var(--bg-white);
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 0.85rem;
  font-family: 'Consolas', 'Monaco', monospace;
  color: var(--primary);
  border: 1px solid var(--primary-200);
}

.tip span {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

/* Layout Settings */
.layout-settings {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  align-items: start;
}

.settings-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.setting-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.setting-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.setting-group select {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--text);
  background: var(--bg-white);
  cursor: pointer;
  transition: all 0.2s ease;
}

.setting-group select:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--primary-100);
}

.setting-group input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
}

/* Radio Cards */
.radio-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.radio-card {
  cursor: pointer;
}

.radio-card input {
  display: none;
}

.radio-card-body {
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.radio-card input:checked + .radio-card-body {
  border-color: var(--primary);
  background: var(--primary-50);
  box-shadow: 0 0 0 3px var(--primary-100);
}

.radio-card-body strong {
  font-size: 0.95rem;
}

.radio-card-body small {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.writing-demo {
  font-family: 'Noto Serif TC', serif;
  color: var(--text);
  padding: 8px;
  border-radius: 4px;
  background: var(--bg);
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.vertical-demo {
  writing-mode: vertical-rl;
  font-size: 0.9rem;
  letter-spacing: 2px;
}

.horizontal-demo {
  font-size: 0.85rem;
}

/* Book Preview */
.layout-preview-container h4 {
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text);
}

.book-preview {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fffef5;
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.preview-page {
  padding: 32px;
  font-family: 'Noto Serif TC', serif;
  font-size: 16px;
  line-height: 1.8;
  color: #333;
  min-height: 320px;
  transition: all 0.3s ease;
}

.preview-page.vertical {
  writing-mode: vertical-rl;
  -webkit-writing-mode: vertical-rl;
  min-height: auto;
  height: 320px;
  overflow-x: auto;
}

.preview-page p {
  text-indent: 2em;
  margin-bottom: 0.8em;
}

/* Step 5 Generate */
.generate-layout {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.book-summary {
  display: flex;
  gap: 28px;
  padding: 24px;
  background: var(--bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.summary-cover {
  flex-shrink: 0;
}

.summary-cover img {
  width: 140px;
  height: auto;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}

.summary-details {
  flex: 1;
}

.summary-table {
  width: 100%;
  border-collapse: collapse;
}

.summary-table th,
.summary-table td {
  padding: 8px 12px;
  text-align: left;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--border);
}

.summary-table th {
  width: 100px;
  color: var(--text-secondary);
  font-weight: 500;
}

.summary-table td {
  color: var(--text);
  font-weight: 500;
}

/* Validation */
.validation-results {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.validation-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: var(--radius);
  font-size: 0.9rem;
}

.validation-item.pass {
  background: #ecfdf5;
  color: #065f46;
}

.validation-item.fail {
  background: #fef2f2;
  color: #991b1b;
}

.validation-item.warn {
  background: #fffbeb;
  color: #92400e;
}

.validation-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
}

/* Generate Actions */
.generate-actions {
  text-align: center;
  padding: 8px 0;
}

.generating-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px;
  color: var(--primary);
  font-weight: 500;
}

.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--primary-200);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Publishing Guide */
.publish-guide {
  border-top: 1px solid var(--border);
  padding-top: 28px;
}

.publish-guide h3 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 16px;
}

.guide-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 0;
  border-bottom: 2px solid var(--border);
}

.guide-tab {
  padding: 10px 24px;
  background: none;
  border: none;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  font-family: inherit;
  transition: var(--transition);
}

.guide-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.guide-tab:hover {
  color: var(--primary);
}

.guide-content {
  display: none;
  padding: 24px 0;
}

.guide-content.active {
  display: block;
}

.guide-content ol {
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.guide-content li {
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--text);
}

.guide-content a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}

.guide-content a:hover {
  text-decoration: underline;
}

.guide-note {
  margin-top: 16px;
  padding: 14px 18px;
  background: var(--primary-50);
  border-radius: var(--radius);
  font-size: 0.88rem;
  color: var(--text);
  border-left: 3px solid var(--primary);
}

/* Footer */
.app-footer {
  margin-top: 48px;
  padding: 24px 0;
  background: var(--bg-white);
  border-top: 1px solid var(--border);
  text-align: center;
}

.app-footer p {
  font-size: 0.82rem;
  color: var(--text-light);
}

.app-footer .footer-pricing {
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

/* Responsive */
@media (max-width: 768px) {
  .container {
    padding: 0 16px;
  }

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

  .cover-upload-area {
    grid-template-columns: 1fr;
  }

  .layout-settings {
    grid-template-columns: 1fr;
  }

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

  .panel-body {
    padding: 20px;
  }

  .step-label {
    display: none;
  }

  .progress-track {
    left: 20px;
    right: 20px;
  }

  .book-summary {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .radio-cards {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .logo h1 {
    font-size: 1.2rem;
  }

  .panel-header h2 {
    font-size: 1.3rem;
  }

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

/* Site navigation */
.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.logo-link {
  text-decoration: none;
  color: inherit;
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.logo-link:hover .logo h1 {
  color: var(--primary);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-link {
  padding: 8px 14px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-decoration: none;
  transition: background var(--transition), color var(--transition);
}

.nav-link:hover {
  color: var(--primary);
  background: var(--primary-50);
}

.nav-link--active {
  color: var(--primary);
  background: var(--primary-50);
}

.footer-store-link {
  margin-bottom: 8px;
}

.footer-store-link a {
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
}

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

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Store page */
.store-body {
  min-height: 100vh;
}

.store-main {
  padding-bottom: 48px;
}

.store-hero {
  margin: 28px 0 20px;
  text-align: center;
}

.store-hero-title {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.store-hero-sub {
  font-size: 1rem;
  color: var(--text-secondary);
  max-width: 520px;
  margin: 0 auto;
}

.store-seller-policy {
  margin-top: 14px;
  padding: 10px 16px;
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--text);
  background: var(--primary-50);
  border: 1px solid var(--primary-200);
  border-radius: var(--radius);
  max-width: 640px;
  margin-left: auto;
  margin-right: auto;
  text-align: center;
}

.store-notice {
  margin-top: 14px;
  padding: 12px 16px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  background: var(--bg);
  border-radius: var(--radius);
  border: 1px dashed var(--border);
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
  text-align: left;
}

.store-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

.store-search-wrap {
  flex: 1;
  min-width: 200px;
  max-width: 400px;
}

.store-search {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-family: inherit;
}

.store-search:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--primary-100);
}

.store-count {
  font-size: 0.88rem;
  color: var(--text-light);
  font-weight: 500;
}

.store-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
}

.store-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.store-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.store-card-cover {
  background: var(--bg);
  aspect-ratio: 2 / 3;
  max-height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.store-card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.store-card-body {
  padding: 18px;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 8px;
}

.store-card-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.35;
}

.store-card-author {
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.store-card-desc {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

.store-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.store-tag {
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 20px;
  background: var(--primary-50);
  color: var(--primary);
  font-weight: 500;
}

.store-card-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.store-card-price {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--primary);
}

.store-card-btn {
  flex-shrink: 0;
}

.store-empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-light);
  font-size: 0.95rem;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal[hidden] {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
}

.modal-dialog {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 440px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-xl);
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  font-size: 1.75rem;
  line-height: 1;
  color: var(--text-light);
  cursor: pointer;
  border-radius: var(--radius);
}

.modal-close:hover {
  background: var(--bg);
  color: var(--text);
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 12px;
  padding-right: 32px;
}

.modal-body {
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--text);
}

.modal-body p {
  margin-bottom: 12px;
}

.modal-body code {
  font-size: 0.85rem;
  background: var(--bg);
  padding: 2px 6px;
  border-radius: 4px;
}

.modal-book {
  font-weight: 600;
  color: var(--text);
}

.modal-pay-link {
  color: var(--primary);
  font-weight: 600;
}

.modal-hint {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.modal-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  font-size: 0.9rem;
  margin-top: 8px;
}

.modal-check input {
  margin-top: 4px;
  accent-color: var(--primary);
}

.modal-warn {
  color: #b45309;
  background: #fffbeb;
  padding: 10px 12px;
  border-radius: var(--radius);
  font-size: 0.88rem;
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

@media (max-width: 768px) {
  .site-nav {
    width: 100%;
    justify-content: flex-end;
  }
}
