:root {
  --color-primary: #ff6b8a;
  --color-primary-dark: #e94f72;
  --color-bg: #fff7f2;
  --color-card: #ffffff;
  --color-text: #3a2e2e;
  --color-muted: #8a7a7a;
  --radius: 18px;
}

* { box-sizing: border-box; }

.hidden { display: none !important; }

body {
  margin: 0;
  font-family: "M PLUS Rounded 1c", "Hiragino Maru Gothic ProN", sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
}

#app {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px 16px 48px;
}

.app-header {
  text-align: center;
  padding: 24px 8px 8px;
}
.app-header h1 { font-size: 1.4rem; margin: 0 0 4px; }
.subtitle { color: var(--color-muted); font-size: 0.85rem; margin: 0; }

.step {
  background: var(--color-card);
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(0,0,0,0.06);
  padding: 20px;
  margin-top: 16px;
}
.step.hidden { display: none; }

.btn-back {
  display: inline-block;
  background: none;
  border: none;
  color: var(--color-muted);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 4px 0 12px;
  margin: 0;
  cursor: pointer;
}
.btn-back:active { color: var(--color-primary-dark); }

h2 { font-size: 1.1rem; margin-top: 0; }
h3 { font-size: 0.95rem; margin: 16px 0 8px; }

.hint { color: var(--color-muted); font-size: 0.85rem; }
.fineprint { color: var(--color-muted); font-size: 0.75rem; }

input[type="text"], input[type="password"], input[type="file"] {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid #f0dede;
  border-radius: 12px;
  font-size: 1rem;
  margin-bottom: 10px;
  font-family: inherit;
}

.btn-primary, .btn-secondary {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 999px;
  font-size: 1rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  margin-top: 8px;
}
.btn-primary {
  background: var(--color-primary);
  color: white;
}
.btn-primary:active { background: var(--color-primary-dark); }
.btn-primary:disabled { background: #ddd; cursor: not-allowed; }
.btn-secondary {
  background: #fff0f0;
  color: var(--color-primary-dark);
}

.provider-select { display: flex; gap: 8px; margin-bottom: 12px; }
.radio-card {
  flex: 1;
  border: 2px solid #f0dede;
  border-radius: 12px;
  padding: 10px;
  text-align: center;
  font-size: 0.85rem;
  cursor: pointer;
}
.radio-card input { margin-right: 6px; }

.guide {
  background: #fff8f0;
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 12px;
  font-size: 0.85rem;
}
.guide.hidden { display: none; }
.guide summary { cursor: pointer; font-weight: 700; }
.guide ol { padding-left: 1.2em; }

.checkbox-line {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  margin-bottom: 10px;
}

.preview {
  width: 100%;
  border-radius: 12px;
  margin: 10px 0;
  display: block;
}
.preview.hidden { display: none; }

.style-grid, .page-count-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 8px;
}
.page-count-grid { grid-template-columns: repeat(5, 1fr); }

.style-option, .page-count-option {
  border: 2px solid #f0dede;
  border-radius: 12px;
  padding: 10px 6px;
  text-align: center;
  font-size: 0.8rem;
  cursor: pointer;
}
.style-option.selected, .page-count-option.selected {
  border-color: var(--color-primary);
  background: #fff0f0;
  font-weight: 700;
}

.progress-bar {
  width: 100%;
  height: 10px;
  background: #f0dede;
  border-radius: 999px;
  overflow: hidden;
  margin-top: 12px;
}
#progress-fill {
  height: 100%;
  width: 0%;
  background: var(--color-primary);
  transition: width 0.3s ease;
}

#page-gallery {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.page-card {
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.page-card canvas { width: 100%; display: block; }
.page-card a {
  display: block;
  text-align: center;
  padding: 10px;
  background: #fff0f0;
  color: var(--color-primary-dark);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.85rem;
}

.toast {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: #3a2e2e;
  color: white;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 0.85rem;
  z-index: 100;
  max-width: 90vw;
}
.toast.hidden { display: none; }
