:root {
  --red: #8a1218;
  --red-dark: #5c0c10;
  --gold: #c9a227;
  --cream: #faf7f2;
  --ink: #241412;
  --muted: #74605c;
  --line: #e7ddd3;
  --error: #b3261e;
  --radius: 3px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: 'Poppins', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.page {
  max-width: 640px;
  margin: 0 auto;
  padding: 28px 20px 56px;
}

/* Header */
.header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
}

.header__mark {
  flex: none;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--red);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.02em;
}

.header__eyebrow {
  margin: 0 0 2px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}

.header__title {
  margin: 0;
  font-size: 24px;
  font-weight: 600;
  color: var(--ink);
}

/* Panels */
.panel {
  background: #fff;
  border: 1px solid var(--line);
  border-top: 3px solid var(--gold);
  border-radius: var(--radius);
  padding: 24px 20px;
  margin-bottom: 20px;
}

.panel__hint {
  margin: 0 0 20px;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.5;
}

/* Form */
.field {
  display: block;
  margin-bottom: 18px;
}

.field__label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 6px;
}

.field input {
  width: 100%;
  padding: 12px 14px;
  font-size: 16px;
  font-family: inherit;
  color: var(--ink);
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.15s ease;
}

.field input:focus {
  border-color: var(--red);
}

.field input:invalid:not(:placeholder-shown) {
  border-color: var(--error);
}

.field__error {
  display: block;
  min-height: 16px;
  font-size: 12px;
  color: var(--error);
  margin-top: 5px;
}

.field__hint {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 5px;
}

/* Buttons */
.btn {
  appearance: none;
  border: none;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  padding: 13px 20px;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.05s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn--primary {
  background: var(--red);
  color: #fff;
  width: 100%;
}

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

.btn--primary:disabled {
  background: #c9a9a9;
  cursor: not-allowed;
}

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

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

/* Result panel */
.preview {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 20px;
  background: #f2ede6;
}

.preview canvas {
  display: block;
  width: 100%;
  height: auto;
}

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

@media (min-width: 480px) {
  .actions {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .actions .btn { flex: 1 1 auto; }
  .actions .btn--secondary { flex: 0 0 auto; }
}

.status {
  min-height: 18px;
  font-size: 13px;
  color: var(--muted);
  margin: 14px 0 0;
  text-align: center;
}

.status--error {
  color: var(--error);
}

/* Footer */
.footer {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
  padding: 0 10px;
}

@media (prefers-reduced-motion: reduce) {
  .btn { transition: none; }
}
