:root {
  --bg: #fbf7f2;
  --card: #fffdf9;
  --text: #332f2c;
  --muted: #766e68;
  --line: #eadfd4;
  --accent: #b98375;
  --accent-2: #8fae93;
  --accent-dark: #7c554d;
  --danger: #b85c5c;
  --ok: #6f9d73;
  --warn: #c49a45;
  --shadow: 0 18px 45px rgba(99, 70, 45, .10);
  --radius: 22px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(185,131,117,.20), transparent 32rem),
    radial-gradient(circle at top right, rgba(143,174,147,.22), transparent 30rem),
    var(--bg);
}

.hero {
  padding: 56px 20px 42px;
  text-align: center;
}
.hero__content { max-width: 980px; margin: 0 auto; }
.eyebrow {
  display: inline-flex;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--accent-dark);
  background: rgba(255,255,255,.62);
  font-size: 14px;
}
h1 { margin: 18px 0 14px; font-size: clamp(34px, 5vw, 64px); line-height: 1.02; letter-spacing: -0.04em; }
.hero p { max-width: 760px; margin: 0 auto; font-size: 20px; color: var(--muted); line-height: 1.5; }
.hero__actions { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; margin-top: 28px; }

.container { max-width: 1220px; margin: 0 auto; padding: 0 18px 54px; }
.notice, .card {
  background: rgba(255,253,249,.86);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.notice { padding: 18px 22px; margin-bottom: 18px; color: var(--muted); line-height: 1.55; }
.notice strong { color: var(--text); }
.card { padding: 24px; margin: 18px 0; }
.card__header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
h2 { margin: 0 0 6px; font-size: 25px; letter-spacing: -.02em; }
.card__header p { margin: 0; color: var(--muted); line-height: 1.45; }

.btn {
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn--primary { background: var(--accent); color: white; box-shadow: 0 12px 28px rgba(185,131,117,.24); }
.btn--ghost { color: var(--accent-dark); background: rgba(255,255,255,.72); border: 1px solid var(--line); }
.btn--soft { color: var(--accent-dark); background: #f3e7dd; }
.btn--danger { color: white; background: var(--danger); }
.icon-btn {
  width: 34px; height: 34px;
  border-radius: 50%; border: 0;
  background: #f3e7dd; color: var(--accent-dark);
  font-size: 22px; cursor: pointer;
}

.grid { display: grid; gap: 14px; margin-bottom: 14px; }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }
.field { display: flex; flex-direction: column; gap: 7px; }
.field--full { margin-top: 12px; }
.field span { font-size: 13px; color: var(--muted); font-weight: 700; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fffaf5;
  border-radius: 14px;
  padding: 12px 12px;
  color: var(--text);
  font: inherit;
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(185,131,117,.12); }
textarea { resize: vertical; }
.hidden { display: none !important; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 18px; background: #fffaf5; }
.calc-table { width: 100%; border-collapse: collapse; min-width: 920px; }
.calc-table th, .calc-table td { padding: 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.calc-table th { font-size: 12px; color: var(--muted); background: #f8eee5; white-space: nowrap; }
.calc-table tr:last-child td { border-bottom: 0; }
.calc-table input, .calc-table select { padding: 9px 10px; border-radius: 12px; min-width: 90px; }
.row-total { font-weight: 800; white-space: nowrap; color: var(--accent-dark); }
.hint { color: var(--muted); font-size: 14px; margin-top: 12px; line-height: 1.45; }

.result-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }
.summary-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.summary-card {
  border-radius: 20px;
  padding: 16px;
  background: linear-gradient(180deg, #fffaf5, #f9eee6);
  border: 1px solid var(--line);
}
.summary-card h3 { margin: 0 0 10px; font-size: 16px; }
.summary-card .price { font-size: 28px; font-weight: 900; letter-spacing: -.03em; margin-bottom: 8px; }
.summary-card p { margin: 5px 0; color: var(--muted); font-size: 14px; }
.badge { display: inline-flex; padding: 5px 9px; border-radius: 999px; font-size: 12px; font-weight: 800; margin-top: 8px; }
.badge--ok { background: rgba(111,157,115,.16); color: var(--ok); }
.badge--warn { background: rgba(196,154,69,.18); color: var(--warn); }
.badge--bad { background: rgba(184,92,92,.14); color: var(--danger); }
.recommendation, .reverse-result {
  margin-top: 16px;
  padding: 16px;
  border-radius: 18px;
  background: #f5eee6;
  color: var(--text);
  line-height: 1.6;
}
.recommendation strong, .reverse-result strong { color: var(--accent-dark); }

.history-list { display: grid; gap: 10px; }
.history-item {
  display: flex; justify-content: space-between; gap: 16px; align-items: center;
  padding: 14px; border: 1px solid var(--line); border-radius: 18px; background: #fffaf5;
}
.history-item__title { font-weight: 800; }
.history-item__meta { color: var(--muted); font-size: 14px; margin-top: 4px; }
.history-item__actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.footer { text-align: center; color: var(--muted); padding: 22px 18px 40px; }

@media (max-width: 920px) {
  .grid--3, .grid--4, .summary-grid { grid-template-columns: 1fr 1fr; }
  .card__header { flex-direction: column; }
  .result-actions { justify-content: flex-start; }
}
@media (max-width: 640px) {
  .hero { padding-top: 36px; }
  .hero p { font-size: 17px; }
  .grid--3, .grid--4, .summary-grid { grid-template-columns: 1fr; }
  .card { padding: 18px; border-radius: 18px; }
  .history-item { flex-direction: column; align-items: flex-start; }
  .history-item__actions { justify-content: flex-start; }
  .btn { width: 100%; }
  .hero__actions { width: 100%; }
}

@media print {
  .hero, .notice, .btn, .icon-btn, #reverse, .history-list, .footer { display: none !important; }
  body { background: white; }
  .card { box-shadow: none; border: 1px solid #ddd; break-inside: avoid; }
  .container { max-width: none; }
}
