:root {
  --ink: #211d1a;
  --paper: #faf7f2;
  --accent: #7a3b2e;
  --accent-dark: #5c2b21;
  --line: #e2dcd2;
  --muted: #756e63;
  --error: #a3312a;
  --success: #2f6b3f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Georgia, 'Iowan Old Style', 'Palatino Linotype', serif;
  line-height: 1.5;
}

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

header.site {
  text-align: center;
  margin-bottom: 40px;
}

header.site .logo {
  font-size: 1.6rem;
  font-weight: bold;
  letter-spacing: 0.02em;
}

header.site .tagline {
  color: var(--muted);
  font-size: 0.95rem;
  margin-top: 4px;
}

.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 32px;
}

.screen {
  animation: fade-in 0.2s ease;
}

.screen[hidden] {
  display: none !important;
}

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

h1 {
  font-size: 1.4rem;
  margin: 0 0 8px;
}

h1 .step {
  color: var(--muted);
  font-weight: normal;
  font-size: 0.9rem;
  display: block;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

p.helper {
  color: var(--muted);
  font-size: 0.92rem;
  margin-top: 0;
}

.field {
  margin-bottom: 22px;
}

.field label {
  display: block;
  font-weight: bold;
  margin-bottom: 6px;
  font-size: 0.95rem;
}

.field .hint {
  color: var(--muted);
  font-size: 0.82rem;
  margin-top: 4px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.field .hint-explainer {
  line-height: 1.5;
}

input[type="file"],
select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 0.95rem;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--paper);
  color: var(--ink);
}

.dropzone {
  border: 2px dashed var(--line);
  border-radius: 8px;
  padding: 22px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.dropzone.drag-over {
  border-color: var(--accent);
}

.dropzone .filename {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.9rem;
  color: var(--muted);
  margin-top: 8px;
}

button {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  padding: 13px 22px;
  border-radius: 7px;
  border: none;
  cursor: pointer;
  width: 100%;
}

button.primary {
  background: var(--accent);
  color: #fff;
}

button.primary:hover:not(:disabled) {
  background: var(--accent-dark);
}

button.primary:disabled {
  background: #c9b9b2;
  cursor: not-allowed;
}

button.secondary {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}

.button-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 20px;
}

.preview-frame-wrap {
  margin: 20px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.preview-frame {
  display: block;
  width: 100%;
  height: min(70vh, 640px);
  border: none;
}

.price-line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 24px 0 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.price-line .amount {
  font-size: 1.3rem;
  font-weight: bold;
}

.error-box {
  background: #fdecea;
  border: 1px solid #f3c6c2;
  color: var(--error);
  padding: 12px 14px;
  border-radius: 6px;
  font-size: 0.9rem;
  margin-bottom: 18px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.notice-box {
  background: #fdf6e8;
  border: 1px solid #efd9a0;
  color: #7a5c14;
  padding: 12px 14px;
  border-radius: 6px;
  font-size: 0.9rem;
  margin-bottom: 18px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.status-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 24px 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

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

.status-text {
  font-size: 1rem;
}

.status-sub {
  color: var(--muted);
  font-size: 0.85rem;
}

.download-buttons {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

.download-buttons a {
  flex: 1;
  display: block;
  text-align: center;
  text-decoration: none;
  background: var(--accent);
  color: #fff;
  padding: 13px 0;
  border-radius: 7px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-weight: 600;
}

.download-buttons a:hover {
  background: var(--accent-dark);
}

.expiry-note {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 16px;
  text-align: center;
}

.review-note {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.85rem;
  background: #eef4ee;
  color: var(--success);
  border: 1px solid #c9e0cb;
  padding: 10px 12px;
  border-radius: 6px;
  margin-top: 16px;
}

footer.site {
  text-align: center;
  margin-top: 40px;
  color: var(--muted);
  font-size: 0.8rem;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

@media (max-width: 480px) {
  .wrap { padding: 28px 14px 60px; }
  .card { padding: 22px; }
}
