/* ---------- Base reset and variables ---------- */
:root {
  --bg: #f6f1e7;
  --card: #ffffff;
  --ink: #2b2118;
  --muted: #8a7d6d;
  --accent: #c0622d;
  --accent-dark: #a14f22;
  --line: #e7ddcd;
  --good: #3c7a4b;
  --warn: #b03a2e;
  --radius: 14px;
  --shadow: 0 6px 24px rgba(60, 40, 20, 0.08);
}

* {
  box-sizing: border-box;
}

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

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

/* ---------- Layout ---------- */
.app {
  max-width: 560px;
  margin: 0 auto;
  padding: 24px 16px 64px;
}

.app__topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.app__header h1 {
  font-size: 1.6rem;
  margin: 0 0 6px;
}

/* Language switcher */
.lang {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.lang__icon {
  font-size: 1rem;
}
.lang__select {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.85rem;
  cursor: pointer;
}
.lang__select:focus {
  outline: none;
  border-color: var(--accent);
}

/* ---------- Presets ---------- */
.presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.preset {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 0.9rem;
  color: var(--ink);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

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

/* Currently selected bread type */
.preset.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.preset.is-active:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
  color: #fff;
}

/* ---------- Form ---------- */
.form {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

.field {
  margin-bottom: 16px;
}

/* Two fields side by side. The min-width:0 lets inputs shrink inside the grid
   instead of overflowing on narrow screens. */
.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 14px;
}
.grid .field {
  min-width: 0;
}

.field label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 6px;
}

.field input {
  width: 100%;
  padding: 12px 14px;
  font-size: 1.1rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fdfbf7;
  color: var(--ink);
}

.field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(192, 98, 45, 0.15);
}

.group {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px 4px;
  margin: 0 0 16px;
}

.group legend {
  font-weight: 600;
  padding: 0 6px;
  color: var(--accent-dark);
}

.hint {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 4px 0 8px;
}
.hint.is-error {
  color: var(--warn);
}

/* ---------- Buttons ---------- */
.actions {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}

.btn {
  flex: 1;
  padding: 14px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s, transform 0.05s;
}
.btn:active {
  transform: translateY(1px);
}

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

.btn--ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--ink);
}
.btn--ghost:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
}

/* ---------- Result card ---------- */
.result {
  margin-top: 20px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
}

.result__title {
  font-size: 1.2rem;
  margin: 0 0 2px;
}

.result__hydration {
  color: var(--muted);
  margin: 0 0 12px;
  font-size: 0.9rem;
}
.result__hydration strong {
  color: var(--accent-dark);
}

.result__section-title {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin: 12px 0 2px;
}

.row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
}
.row:last-child {
  border-bottom: none;
}

.row__label {
  font-size: 0.95rem;
}

.row__value {
  font-size: 1.15rem;
  font-weight: 700;
}

/* Nested rows (starter / potato breakdown) */
.row--sub {
  padding: 2px 0 2px 16px;
  border-bottom: none;
}
.row--sub .row__label {
  color: var(--muted);
  font-size: 0.85rem;
}
.row--sub .row__value {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
}

.result__warning {
  background: #fdecea;
  color: var(--warn);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 12px;
  font-size: 0.85rem;
}

/* ---------- Responsive ---------- */
@media (max-width: 480px) {
  .app__header h1 { font-size: 1.35rem; }
  .actions { flex-direction: column; }
}
