:root {
  --bg: #F4F6F8;
  --card-bg: #ffffff;
  --text-main: #0A192F;
  --text-sub: #555;
  --header-dark: #0A192F;
  --accent: #00BFA6;
  --green: #00BFA6;
  --green-hover: #008f7a;
  --hero-gradient: linear-gradient(135deg, #0A192F 0%, #00BFA6 60%, #38EF7D 100%);
  --border: rgba(0, 0, 0, 0.1);
  --soft: rgba(0, 191, 166, 0.06);
}

body.dark-mode {
  --bg: #050d1a;
  --card-bg: #112240;
  --text-main: #ffffff;
  --text-sub: #a8b2d1;
  --border: rgba(255, 255, 255, 0.12);
  --soft: rgba(0, 191, 166, 0.12);
}

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

body {
  font-family: 'Outfit', sans-serif;
  background-color: var(--bg);
  color: var(--text-main);
  line-height: 1.6;
  transition: 0.3s ease;
}

header {
  background: var(--header-dark);
  padding: 15px 5%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 1000;
}

header .logo {
  max-height: 50px;
}

.header-nav {
  display: flex;
  gap: 10px;
  align-items: center;
}

.header-nav a {
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-size: 15px;
  padding: 8px 15px;
  transition: 0.3s;
}

.header-nav a:hover,
.header-nav a.active {
  color: var(--green);
}

.dark-mode-toggle {
  background: var(--green);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 20px;
  cursor: pointer;
  font-weight: 700;
  font-size: 13px;
  margin-left: 10px;
}

.menu-toggle {
  display: none;
  flex-direction: column;
  cursor: pointer;
  gap: 5px;
}

.bar {
  width: 25px;
  height: 3px;
  background-color: white;
  transition: 0.3s;
  border-radius: 2px;
}

.bmr-hero {
  background: var(--hero-gradient);
  color: white;
  text-align: center;
  padding: 80px 20px;
}

.hero-content h1 {
  font-size: 2.8rem;
  margin-bottom: 12px;
  font-weight: 800;
}

.hero-content p {
  font-size: 1.15rem;
  max-width: 780px;
  margin: 0 auto;
  opacity: 0.95;
}

.bmr-container {
  max-width: 980px;
  margin: 50px auto;
  padding: 0 20px;
  display: flex;
  flex-direction: column;
  gap: 30px;
  align-items: center;
}

.tool-card,
.info-card {
  background: var(--card-bg);
  border-radius: 20px;
  padding: 45px;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.08);
  border: 1px solid var(--border);
  width: 100%;
}

.tool-card h2 {
  color: var(--green);
  margin-bottom: 10px;
  font-size: 2rem;
  font-weight: 800;
  text-align: center;
}

.subhead {
  text-align: center;
  color: var(--text-sub);
  margin-bottom: 25px;
}

.controls-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
  margin-top: 18px;
}

.control label {
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-main);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: block;
}

.segmented {
  display: flex;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.seg-btn {
  flex: 1;
  padding: 12px 12px;
  background: transparent;
  border: none;
  cursor: pointer;
  font-weight: 800;
  color: var(--text-main);
  transition: 0.2s;
}

.seg-btn.active {
  background: var(--green);
  color: white;
}

.seg-btn:focus {
  outline: none;
}

.select-input {
  width: 100%;
  padding: 12px 15px;
  border: 2px solid var(--border);
  border-radius: 12px;
  font-size: 1rem;
  font-family: 'Outfit', sans-serif;
  background: var(--bg);
  color: var(--text-main);
  font-weight: 700;
}

.input-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
  margin-top: 22px;
}

.input-group {
  display: flex;
  flex-direction: column;
}

.input-group label {
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-main);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.text-input {
  padding: 12px 15px;
  border: 2px solid var(--border);
  border-radius: 12px;
  font-size: 1.05rem;
  font-family: 'Outfit', sans-serif;
  background: var(--bg);
  color: var(--text-main);
  transition: 0.3s;
  font-weight: 700;
}

.text-input:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(0, 191, 166, 0.12);
}

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

.actions-row {
  display: flex;
  gap: 14px;
  margin-top: 22px;
}

.calculate-btn {
  flex: 1;
  background: var(--green);
  color: white;
  border: none;
  padding: 16px;
  border-radius: 12px;
  font-size: 1.05rem;
  font-weight: 900;
  cursor: pointer;
  transition: 0.3s;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.calculate-btn:hover {
  background: var(--green-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 191, 166, 0.3);
}

.secondary-btn {
  background: transparent;
  color: var(--text-main);
  border: 2px solid var(--border);
  padding: 16px;
  border-radius: 12px;
  font-size: 1.05rem;
  font-weight: 900;
  cursor: pointer;
  transition: 0.3s;
}

.secondary-btn:hover {
  border-color: var(--green);
  box-shadow: 0 8px 20px rgba(0, 191, 166, 0.15);
  transform: translateY(-2px);
}

.results-section {
  margin-top: 35px;
  padding-top: 28px;
  border-top: 3px solid var(--green);
}

.results-section h3 {
  text-align: center;
  color: var(--green);
  font-size: 1.8rem;
  margin-bottom: 22px;
  font-weight: 900;
}

.big-number {
  background: var(--soft);
  border: 2px solid var(--green);
  border-radius: 18px;
  padding: 26px;
  text-align: center;
  margin-bottom: 18px;
}

.big-label {
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-sub);
  margin-bottom: 6px;
}

.big-value {
  font-size: 3rem;
  font-weight: 900;
  color: var(--text-main);
}

.big-sub {
  font-weight: 800;
  color: var(--text-sub);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-top: 18px;
}

.summary-card {
  background: var(--soft);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px;
  text-align: center;
}

.summary-label {
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-size: 0.85rem;
  color: var(--text-sub);
}

.summary-value {
  font-size: 1.6rem;
  font-weight: 900;
  margin-top: 8px;
}

.summary-sub {
  margin-top: 4px;
  font-weight: 800;
  color: var(--text-sub);
  font-size: 0.9rem;
}

.table-card {
  margin-top: 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
}

.tdee-table {
  width: 100%;
  border-collapse: collapse;
}

.tdee-table th,
.tdee-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.tdee-table th {
  background: rgba(0, 0, 0, 0.03);
  text-align: left;
  font-weight: 900;
}

body.dark-mode .tdee-table th {
  background: rgba(255, 255, 255, 0.06);
}

.tdee-table tbody tr:last-child td {
  border-bottom: none;
}

.note-card {
  margin-top: 16px;
  background: rgba(0, 0, 0, 0.03);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  font-weight: 700;
  color: var(--text-main);
}

body.dark-mode .note-card {
  background: rgba(255, 255, 255, 0.06);
}

.warning-card {
  margin-top: 16px;
  border: 1px solid rgba(255, 193, 7, 0.35);
  background: rgba(255, 193, 7, 0.08);
  border-radius: 16px;
  padding: 16px;
}

.warning-card p {
  margin-top: 8px;
  color: var(--text-sub);
  font-weight: 700;
}

.error-card {
  margin-top: 16px;
  border: 1px solid rgba(231, 76, 60, 0.35);
  background: rgba(231, 76, 60, 0.10);
  border-radius: 16px;
  padding: 16px;
  font-weight: 800;
  color: var(--text-main);
}

.info-card h2 {
  text-align: center;
  margin-bottom: 18px;
  color: var(--green);
  font-weight: 900;
}

.info-card p {
  color: var(--text-sub);
  font-weight: 700;
}

.info-card ul {
  margin-top: 14px;
  margin-left: 18px;
}

.info-card li {
  margin-bottom: 10px;
  color: var(--text-sub);
  font-weight: 700;
}

.tool-links {
  list-style: none;
  margin-left: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
}

.tool-link-btn {
  display: inline-block;
  background: var(--bg);
  border: 2px solid var(--border);
  color: var(--text-main);
  padding: 10px 14px;
  border-radius: 12px;
  text-decoration: none;
  font-weight: 900;
  transition: 0.2s;
}

.tool-link-btn:hover {
  border-color: var(--green);
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(0, 191, 166, 0.12);
}

.faq-item {
  margin-top: 18px;
}

.faq-item strong {
  display: block;
  color: var(--green);
  font-weight: 900;
  margin-bottom: 6px;
}

.faq-item p {
  color: var(--text-sub);
  font-weight: 700;
}

footer {
  background: var(--header-dark);
  color: white;
  text-align: center;
  padding: 60px 20px;
  margin-top: 60px;
}

footer a,
footer a:visited {
  color: var(--accent) !important;
  text-decoration: none;
  margin: 0 10px;
  font-weight: 600;
  transition: 0.3s;
}

footer a:hover {
  opacity: 0.8;
  text-decoration: underline;
}

@media (max-width: 900px) {
  .menu-toggle {
    display: flex;
  }

  .header-nav {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: var(--header-dark);
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    gap: 15px;
    text-align: center;
  }

  .header-nav.active {
    display: flex;
  }

  .dark-mode-toggle {
    margin: 10px 0 0 0;
    width: fit-content;
    align-self: center;
  }

  .controls-grid,
  .input-grid {
    grid-template-columns: 1fr;
  }

  .actions-row {
    flex-direction: column;
  }

  .hero-content h1 {
    font-size: 2.2rem;
  }

  .tool-card,
  .info-card {
    padding: 28px;
  }

  .summary-grid {
    grid-template-columns: 1fr;
  }
}

.menu-toggle.is-active .bar:nth-child(2) {
  opacity: 0;
}

.menu-toggle.is-active .bar:nth-child(1) {
  transform: translateY(8px) rotate(45deg);
}

.menu-toggle.is-active .bar:nth-child(3) {
  transform: translateY(-8px) rotate(-45deg);
}

@media print {
  header,
  .bmr-hero,
  .actions-row,
  .info-card,
  footer {
    display: none !important;
  }

  body {
    background: #fff !important;
    color: #000 !important;
  }

  .tool-card {
    box-shadow: none !important;
    border: 1px solid #ddd !important;
  }

  #results {
    display: block !important;
  }
}
