:root {
  --bg: #f4f1ea;
  --surface: #ffffff;
  --ink: #1c1a17;
  --ink-soft: #5b564e;
  --accent: #1c1a17;
  --accent-contrast: #ffffff;
  --border: #ddd7c9;
  --radius: 14px;
  --max-width: 640px;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.page {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.25rem 1rem 2.5rem;
}

.site-header {
  text-align: center;
  padding: 1rem 0 1.5rem;
}

.site-header h1 {
  font-size: clamp(1.5rem, 6vw, 2rem);
  margin: 0 0 0.5rem;
  letter-spacing: -0.01em;
}

.subtitle {
  color: var(--ink-soft);
  margin: 0;
  font-size: 0.95rem;
}

main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.drop-zone {
  background: var(--surface);
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 2.5rem 1.25rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.drop-zone:hover,
.drop-zone:focus-visible {
  border-color: var(--ink);
  outline: none;
}

.drop-zone.dragover {
  border-color: var(--ink);
  background: #fbfaf6;
}

.drop-zone__icon {
  font-size: 2.5rem;
  display: block;
  margin-bottom: 0.75rem;
}

.drop-zone__content p {
  margin: 0.25rem 0;
}

.drop-zone__hint {
  color: var(--ink-soft);
  font-size: 0.85rem;
}

.error {
  color: #b3261e;
  background: #fdecea;
  border: 1px solid #f4c7c3;
  border-radius: 10px;
  padding: 0.6rem 0.85rem;
  font-size: 0.9rem;
  margin-top: 0.75rem;
}

.result {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  align-items: center;
}

.canvas-wrap {
  width: 100%;
  display: flex;
  justify-content: center;
}

#canvas {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
}

.btn {
  appearance: none;
  border: none;
  border-radius: 999px;
  padding: 0.9rem 1.25rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.08s ease, opacity 0.15s ease;
}

.btn:active {
  transform: scale(0.98);
}

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

.btn--secondary {
  background: transparent;
  color: var(--ink);
  border: 1.5px solid var(--border);
}

.site-footer {
  text-align: center;
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  color: var(--ink-soft);
  font-size: 0.85rem;
}

.site-footer a {
  color: var(--ink);
  font-weight: 600;
}

.prompt-history {
  margin-top: 1.25rem;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem 1rem;
}

.prompt-history summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--ink);
}

.prompt-history__content {
  margin-top: 0.75rem;
}

.prompt-history__content ol {
  padding-left: 1.1rem;
  margin: 0;
}

.prompt-history__content li {
  margin-bottom: 0.6rem;
  white-space: pre-wrap;
  word-break: break-word;
}

@media (min-width: 600px) {
  .actions {
    flex-direction: row;
    justify-content: center;
  }

  .btn {
    flex: 0 0 auto;
    min-width: 180px;
  }
}
