:root {
  --bg: #f6f1ea;
  --surface: #fffdf9;
  --text: #1f1a17;
  --muted: #6b625c;
  --accent: #c45c26;
  --accent-dark: #9a4520;
  --border: #e6ddd3;
  --success: #2d6a4f;
  --error: #b42318;
  --shadow: 0 18px 50px rgba(31, 26, 23, 0.08);
  --radius: 18px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "DM Sans", system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(ellipse 80% 50% at 10% 0%, rgba(196, 92, 38, 0.12), transparent),
    radial-gradient(ellipse 60% 40% at 90% 10%, rgba(45, 106, 79, 0.08), transparent),
    var(--bg);
}

.page {
  max-width: 760px;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 4rem;
}

.hero {
  margin-bottom: 2rem;
}

.eyebrow {
  margin: 0 0 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.hero h1 {
  margin: 0;
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(2rem, 5vw, 2.75rem);
  font-weight: 600;
  line-height: 1.1;
}

.lead {
  margin: 0.75rem 0 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.5;
}

.layout {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.field span {
  font-weight: 600;
  font-size: 0.92rem;
}

.field small {
  font-weight: 400;
  color: var(--muted);
}

.field input {
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  font: inherit;
  background: #fff;
}

.dropzone {
  border: 2px dashed var(--border);
  border-radius: 14px;
  padding: 2rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  margin-bottom: 1rem;
  position: relative;
}

/* Safari: события drop должны попадать на контейнер, а не на дочерние узлы */
.dropzone-inner,
.dropzone-inner * {
  pointer-events: none;
}

.dropzone:hover,
.dropzone.dragover {
  border-color: var(--accent);
  background: rgba(196, 92, 38, 0.05);
}

.dropzone-icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.dropzone p {
  margin: 0.25rem 0;
}

.hint {
  color: var(--muted);
  font-size: 0.88rem;
}

.file-list {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.file-list li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--bg);
  border-radius: 10px;
  font-size: 0.9rem;
}

.file-list li::before {
  content: "🖼";
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.85rem 1.25rem;
  border-radius: 12px;
  border: none;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.15s, opacity 0.15s;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

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

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

.btn.ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  margin-right: 0.5rem;
  margin-top: 0.75rem;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.75rem;
}

.progress-header h2 {
  margin: 0;
  font-size: 1.15rem;
}

.percent {
  font-weight: 700;
  color: var(--accent);
}

.progress-track {
  height: 10px;
  background: var(--bg);
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), #e09b3e);
  border-radius: 999px;
  transition: width 0.35s ease;
}

.progress-message {
  margin: 0.75rem 0 0;
  color: var(--muted);
}

.result-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.result-header h2 {
  margin: 0;
  font-family: "Fraunces", Georgia, serif;
}

.badge {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  background: rgba(45, 106, 79, 0.12);
  color: var(--success);
}

.preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.preview-grid img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.recipe-content {
  line-height: 1.65;
  font-size: 0.98rem;
}

.recipe-content h1,
.recipe-content h2,
.recipe-content h3 {
  font-family: "Fraunces", Georgia, serif;
  margin-top: 1.25rem;
}

.recipe-content ul,
.recipe-content ol {
  padding-left: 1.25rem;
}

.recipe-content blockquote {
  margin: 1rem 0;
  padding: 0.5rem 1rem;
  border-left: 3px solid var(--accent);
  background: var(--bg);
  color: var(--muted);
}

.audio-block {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.audio-block h3 {
  margin: 0 0 0.75rem;
  font-size: 1rem;
}

.audio-block audio {
  width: 100%;
}

.error-card h2 {
  margin: 0 0 0.5rem;
  color: var(--error);
}

#errorText {
  color: var(--muted);
  margin: 0 0 1rem;
}
