:root {
  --bg: #f6f8f5;
  --card: #ffffff;
  --ink: #1c2b21;
  --muted: #5b6b60;
  --brand: #2e7d4f;
  --brand-dark: #1f5c39;
  --brand-soft: #e3f0e8;
  --accent: #e8a13c;
  --line: #dde5de;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(28, 43, 33, 0.08), 0 8px 24px rgba(28, 43, 33, 0.06);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
}

h1, h2, h3 { line-height: 1.25; color: var(--ink); }
h1 { font-size: 2rem; margin: 0 0 0.4rem; }
h2 { font-size: 1.4rem; margin: 2.2rem 0 0.8rem; }
h3 { font-size: 1.1rem; margin: 1.4rem 0 0.4rem; }
p { margin: 0 0 1rem; }
a { color: var(--brand-dark); }

.container { max-width: 980px; margin: 0 auto; padding: 0 18px; }

/* Header */
.site-header {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 50;
}
.site-header .container {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 12px; padding-bottom: 12px;
}
.brand { font-weight: 700; font-size: 1.15rem; color: var(--brand-dark); text-decoration: none; }
.brand span { color: var(--accent); }
.main-nav a {
  margin-left: 18px; color: var(--muted); text-decoration: none; font-size: 0.95rem;
}
.main-nav a:hover { color: var(--brand-dark); }

/* Hero */
.hero { padding: 34px 0 8px; }
.hero p.lead { font-size: 1.1rem; color: var(--muted); max-width: 640px; }

/* Card / calculator */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 22px; margin: 18px 0;
}
.calc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
.field { display: flex; flex-direction: column; }
.field.full { grid-column: 1 / -1; }
label { font-size: 0.9rem; font-weight: 600; margin-bottom: 6px; }
.hint { font-size: 0.8rem; color: var(--muted); font-weight: 400; }

input[type="number"], select, input[type="text"] {
  font-size: 16px; padding: 12px 12px; border: 1px solid var(--line);
  border-radius: 10px; background: #fff; color: var(--ink); width: 100%;
}
input:focus, select:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }

.seg { display: flex; gap: 8px; }
.seg button {
  flex: 1; padding: 11px 10px; font-size: 0.95rem; cursor: pointer;
  background: #fff; border: 1px solid var(--line); border-radius: 10px; color: var(--muted);
}
.seg button.active { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-dark); font-weight: 600; }

.unit-toggle { display: flex; justify-content: flex-end; margin-bottom: 10px; }
.unit-toggle button {
  background: none; border: none; color: var(--brand-dark); cursor: pointer;
  font-size: 0.85rem; text-decoration: underline; padding: 4px;
}

.btn {
  display: inline-block; width: 100%; padding: 14px 20px; font-size: 1.05rem; font-weight: 700;
  color: #fff; background: var(--brand); border: none; border-radius: 12px; cursor: pointer;
  margin-top: 16px; min-height: 48px;
}
.btn:hover { background: var(--brand-dark); }
.btn-outline { background: #fff; color: var(--brand-dark); border: 2px solid var(--brand); }
.btn-outline:hover { background: var(--brand-soft); color: var(--brand-dark); }

.mode-tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.mode-tabs button {
  flex: 1; padding: 11px; font-size: 0.92rem; cursor: pointer; border-radius: 10px;
  border: 1px solid var(--line); background: #fff; color: var(--muted);
}
.mode-tabs button.active { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }

/* Result */
.result { display: none; }
.result.show { display: block; }
.result-hero {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
  color: #fff; border-radius: var(--radius); padding: 24px; text-align: center; margin: 18px 0;
}
.result-hero .big { font-size: 3rem; font-weight: 800; line-height: 1; }
.result-hero .unit { font-size: 1.1rem; opacity: 0.9; }
.result-hero .sub { margin-top: 8px; opacity: 0.92; font-size: 0.95rem; }
.result-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 14px; }
.result-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px; text-align: center;
}
.result-card .num { font-size: 1.4rem; font-weight: 700; color: var(--brand-dark); }
.result-card .lbl { font-size: 0.82rem; color: var(--muted); }
.result-note { font-size: 0.9rem; color: var(--muted); margin-top: 14px; }

/* Tables */
.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.95rem; background: var(--card); }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); }
th { background: var(--brand-soft); color: var(--brand-dark); font-weight: 700; }
tr:last-child td { border-bottom: none; }

/* FAQ */
details {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 16px; margin-bottom: 10px;
}
summary { cursor: pointer; font-weight: 600; }
details p { margin: 10px 0 0; color: var(--muted); }

/* Food tool */
.food-list { max-height: 320px; overflow-y: auto; border: 1px solid var(--line); border-radius: 12px; margin-top: 10px; }
.food-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px; border-bottom: 1px solid var(--line); background: #fff;
}
.food-item:last-child { border-bottom: none; }
.food-item .name { font-weight: 600; }
.food-item .meta { font-size: 0.82rem; color: var(--muted); }
.food-item button {
  background: var(--brand-soft); color: var(--brand-dark); border: none; border-radius: 8px;
  padding: 8px 12px; cursor: pointer; font-weight: 700; min-width: 44px; min-height: 44px;
}
.today-bar {
  position: sticky; bottom: 0; background: var(--brand-dark); color: #fff;
  border-radius: 12px; padding: 12px 16px; margin-top: 14px;
  display: flex; justify-content: space-between; align-items: center; font-weight: 600;
}
.today-bar button { background: rgba(255,255,255,0.2); color:#fff; border:none; border-radius:8px; padding:8px 12px; cursor:pointer; }

/* Footer */
.site-footer {
  margin-top: 48px; border-top: 1px solid var(--line); background: var(--card);
  padding: 26px 0; font-size: 0.88rem; color: var(--muted);
}
.site-footer .container { display: flex; flex-wrap: wrap; gap: 10px 22px; align-items: center; justify-content: space-between; }
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--brand-dark); }
.disclaimer { font-size: 0.8rem; color: var(--muted); max-width: 720px; margin-top: 10px; }

.related { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 12px; }
.related a {
  display: block; background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px; text-decoration: none; color: var(--ink); font-weight: 600;
}
.related a span { display: block; font-weight: 400; font-size: 0.85rem; color: var(--muted); margin-top: 4px; }
.related a:hover { border-color: var(--brand); }

@media (max-width: 640px) {
  h1 { font-size: 1.6rem; }
  .calc-grid { grid-template-columns: 1fr; }
  .result-cards { grid-template-columns: 1fr; }
  .related { grid-template-columns: 1fr; }
  .main-nav a { margin-left: 12px; font-size: 0.88rem; }
}
