* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #0a0a0a;
  --surface: #111111;
  --surface2: #161616;
  --border: #1e1e1e;
  --border2: #2a2a2a;
  --text: #c8c8c8;
  --muted: #555;
  --accent: #5fa3ff;
  --accent-dark: #1a6cf6;
}

html, body {
  min-height: 100vh;
  background: var(--bg);
  font-family: Arial, sans-serif;
  color: var(--text);
}

body::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-dark), var(--accent));
  z-index: 100;
}

body {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 52px 24px 100px;
}

.page {
  width: 100%;
  max-width: 560px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.disclaimer {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #2e2e2e;
  text-align: center;
}

.unit-toggle {
  display: flex;
  justify-content: flex-end;
  gap: 0;
}

.unit-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  font-family: Arial, sans-serif;
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  padding: 8px 14px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.unit-btn { position: relative; }
.unit-btn:first-child { margin-right: -1px; }
.unit-btn:hover { background: var(--surface2); color: var(--text); z-index: 1; }
.unit-btn.active { color: var(--accent); border-color: var(--accent-dark); background: var(--surface2); z-index: 2; }

.section-label {
  font-size: 11px;
  font-weight: bold;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #555;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 420px) {
  .form-grid { grid-template-columns: 1fr; }
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field.hidden { display: none; }

.field-label {
  font-size: 11px;
  font-weight: bold;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #555;
}

.field-input {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: Arial, sans-serif;
  font-size: 15px;
  padding: 12px 14px;
  width: 100%;
  outline: none;
  transition: border-color 0.15s;
  -moz-appearance: textfield;
}

.field-input::-webkit-outer-spin-button,
.field-input::-webkit-inner-spin-button { -webkit-appearance: none; }

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

.btn-group {
  display: flex;
  gap: 0;
}

.toggle-btn {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  font-family: Arial, sans-serif;
  font-size: 12px;
  letter-spacing: 0.06em;
  padding: 12px 0;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.toggle-btn { position: relative; }
.toggle-btn:first-child { margin-right: -1px; }
.toggle-btn:hover { background: var(--surface2); color: var(--text); z-index: 1; }
.toggle-btn.active { color: var(--accent); border-color: var(--accent-dark); background: var(--surface2); z-index: 2; }

.height-imperial {
  display: flex;
  align-items: center;
  gap: 8px;
}

.height-imperial .field-input { flex: 1; min-width: 0; }

.height-sep {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.1em;
  flex-shrink: 0;
}

.activity-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}

.activity-row::-webkit-scrollbar { display: none; }

.activity-btn {
  flex: 1;
  min-width: 72px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid #1e1e1e;
  color: var(--muted);
  font-family: Arial, sans-serif;
  font-size: 11px;
  line-height: 1.5;
  letter-spacing: 0.04em;
  padding: 10px 14px;
  cursor: pointer;
  text-align: center;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.activity-btn span {
  display: block;
  font-size: 9px;
  color: #333;
  letter-spacing: 0.06em;
  margin-top: 2px;
}

.activity-btn:hover { background: var(--surface2); color: var(--text); }
.activity-btn.active { color: var(--accent); border-color: var(--border2); border-left-color: var(--accent-dark); background: var(--surface2); }
.activity-btn.active span { color: var(--muted); }

.goal-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.goal-btn {
  flex: 1;
  min-width: 80px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid #1e1e1e;
  color: var(--muted);
  font-family: Arial, sans-serif;
  font-size: 10px;
  line-height: 1.5;
  letter-spacing: 0.06em;
  padding: 10px 8px;
  cursor: pointer;
  text-align: center;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.goal-btn:hover { background: var(--surface2); color: var(--text); }

.goal-btn.red       { border-left-color: #8a1a2e; }
.goal-btn.red-soft  { border-left-color: #5a1020; }
.goal-btn.green-soft { border-left-color: #0a3020; }
.goal-btn.green     { border-left-color: #0a5030; }

.goal-btn.active {
  background: var(--surface2);
  border-color: var(--border2);
  color: var(--text);
}

.goal-btn.red.active       { border-left-color: #c0294e; color: #f06080; }
.goal-btn.red-soft.active  { border-left-color: #8a1a2e; color: #d05060; }
.goal-btn.active[data-offset="0"] { border-left-color: var(--accent-dark); color: var(--accent); }
.goal-btn.green-soft.active { border-left-color: #16a87a; color: #4dd9a6; }
.goal-btn.green.active     { border-left-color: #16a87a; color: #4dd9a6; }

.results {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.results.hidden { display: none; }

.result-main {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent-dark);
  padding: 24px 20px;
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.result-kcal {
  font-size: 48px;
  font-weight: bold;
  color: #fff;
  letter-spacing: -0.02em;
  line-height: 1;
}

.result-label {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.macro-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

@media (max-width: 380px) {
  .macro-row { grid-template-columns: 1fr; }
}

.macro-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid #1e1e1e;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.macro-card.protein { border-left-color: #5fa3ff; }
.macro-card.carbs   { border-left-color: #f5cc50; }
.macro-card.fat     { border-left-color: #f59a72; }

.macro-name {
  font-size: 9px;
  font-weight: bold;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #444;
}

.macro-g {
  font-size: 22px;
  font-weight: bold;
  color: #d0d0d0;
  line-height: 1.1;
}

.macro-kcal {
  font-size: 11px;
  color: var(--muted);
}

.macro-note {
  font-size: 9px;
  color: #333;
  letter-spacing: 0.08em;
  margin-top: 2px;
}

.macro-disclaimer {
  font-size: 9px;
  color: #2a2a2a;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-align: center;
}

.home-btn {
  position: fixed;
  bottom: 32px;
  right: 32px;
  width: 44px;
  height: 44px;
  background: #111;
  border: 1px solid #2a2a2a;
  color: #444;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s, transform 0.2s, color 0.15s, border-color 0.15s;
  pointer-events: none;
  z-index: 100;
}

.home-btn.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.home-btn:hover {
  background: #1a1a1a;
  border-color: #444;
  color: #aaa;
}
