@import url('fonts/fonts.css');

:root {
  --bg: #f5efe6;
  --bg-alt: #ede4d3;
  --ink: #1f1a14;
  --ink-soft: #5b4f3e;
  --accent: #9c5a35;
  --accent-dark: #7a4225;
  --line: #d8c9b0;
  --white: #ffffff;
  --shadow: 0 10px 30px rgba(60, 40, 20, 0.12);
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

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

body {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  padding: 28px 24px 8px;
  text-align: center;
}

header h1 {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 700;
  font-style: italic;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  margin: 0 0 6px;
  letter-spacing: -0.01em;
}

header p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.98rem;
}

main {
  flex: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
  display: grid;
  grid-template-columns: minmax(280px, 380px) 1fr;
  gap: 28px;
  width: 100%;
}

@media (max-width: 820px) {
  main {
    grid-template-columns: 1fr;
  }
}

.panel {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 18px;
}

label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

input[type='text'] {
  font-family: inherit;
  font-size: 1.05rem;
  padding: 12px 14px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--ink);
  transition: border-color 0.15s, background 0.15s;
  width: 100%;
}

input[type='text']:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--white);
}

.hint {
  font-size: 0.82rem;
  color: var(--ink-soft);
  margin-top: 4px;
}

.error {
  font-size: 0.82rem;
  color: #a8341c;
  margin-top: 4px;
  min-height: 1.1em;
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

button {
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  padding: 13px 18px;
  border-radius: 10px;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: transform 0.08s, background 0.15s, border-color 0.15s;
}

button:active {
  transform: translateY(1px);
}

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

.btn-primary:hover {
  background: var(--accent-dark);
}

.btn-primary:disabled {
  background: var(--line);
  color: var(--ink-soft);
  cursor: not-allowed;
}

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

.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
}

.preview {
  background: var(--bg-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 320px;
}

.canvas-wrap {
  width: 100%;
  max-width: 620px;
  aspect-ratio: 1 / 1;
  background: var(--white);
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  box-shadow: var(--shadow);
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.loader {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-alt);
  color: var(--ink-soft);
  font-size: 0.9rem;
  z-index: 2;
  transition: opacity 0.25s;
}

.loader.hidden {
  opacity: 0;
  pointer-events: none;
}

footer {
  text-align: center;
  padding: 18px 24px 28px;
  color: var(--ink-soft);
  font-size: 0.82rem;
}

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