/* =====================================================
   ФОРМУЛЫ ЗДОРОВЬЯ v3.0 — REFINED DARK THEME
   ===================================================== */
/* Google Fonts loaded via <link> in HTML */

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

:root {
  --bg:          #080d12;
  --bg-card:     rgba(255,255,255,0.04);
  --bg-card-h:   rgba(255,255,255,0.07);
  --border:      rgba(255,255,255,0.07);
  --border-h:    rgba(255,255,255,0.13);
  --text:        #dde8f3;
  --text-muted:  rgba(221,232,243,0.38);
  --text-mid:    rgba(221,232,243,0.62);
  --accent:      #3d8fd4;
  --accent-dim:  rgba(61,143,212,0.15);
  --green:       #29a86a;
  --orange:      #d48a1a;
  --red:         #c94b3b;
  --purple:      #8a6bcc;
  --teal:        #1aaa91;
  --radius-sm:   8px;
  --radius-md:   12px;
  --radius-lg:   18px;
  --radius-xl:   24px;
  --transition:  0.2s cubic-bezier(.4,0,.2,1);
  --font:        'DM Sans', system-ui, sans-serif;
  --font-mono:   'DM Mono', monospace;
}

html, body {
  min-height: 100%;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ── CANVAS BACKGROUND ── */
#bg-canvas {
  position: fixed; inset: 0;
  width: 100vw; height: 100vh;
  z-index: 0; pointer-events: none;
}

/* ── PAGE WRAPPER ── */
.page {
  position: relative; z-index: 1;
  min-height: 100vh;
  display: flex; flex-direction: column; align-items: center;
  padding: 40px 16px 72px;
  animation: fadeUp .45s ease both;
}
@keyframes fadeUp {
  from { opacity:0; transform:translateY(12px); }
  to   { opacity:1; transform:translateY(0); }
}

/* ── GLASS CARD ── */
.card {
  width: 100%; max-width: 820px;
  background: rgba(12,20,30,0.7);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 44px 40px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.03),
              0 24px 60px rgba(0,0,0,0.4);
}

/* ── SITE HEADER ── */
.site-header { margin-bottom: 32px; }

.site-eyebrow {
  font-family: var(--font-mono);
  font-size: 10.5px; letter-spacing: 2.5px; text-transform: uppercase;
  color: var(--accent); opacity: 0.75;
  margin-bottom: 14px;
}

.site-header h1 {
  font-size: clamp(26px, 5vw, 38px);
  font-weight: 300;
  line-height: 1.1;
  letter-spacing: -0.5px;
  color: #fff;
  margin-bottom: 10px;
}
.site-header h1 strong { font-weight: 600; }

.subtitle {
  font-size: 13.5px;
  color: var(--text-muted);
  font-weight: 400;
  line-height: 1.5;
}

/* ── CALCULATOR HEADER (inner pages) ── */
.calc-header { margin-bottom: 32px; }
.calc-header h1 {
  font-size: clamp(20px, 4vw, 28px);
  font-weight: 500;
  color: #fff;
  letter-spacing: -0.3px;
  margin-bottom: 6px;
  display: flex; align-items: center; gap: 10px;
}
.calc-header p {
  font-size: 13px;
  color: var(--text-muted);
}

/* ── NAV BAR ── */
.nav-bar {
  display: flex; align-items: center;
  gap: 2px; flex-wrap: wrap;
  margin-bottom: 40px;
  padding: 4px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 10px;
  width: fit-content;
}
.nav-bar a, .nav-bar button {
  font-family: var(--font);
  font-size: 12px; font-weight: 500;
  color: var(--text-muted);
  padding: 7px 16px; border-radius: 7px;
  transition: all var(--transition);
  text-decoration: none; border: none;
  background: transparent; cursor: pointer;
}
.nav-bar a:hover {
  color: var(--text); background: rgba(255,255,255,0.06);
}
#forget-all-btn {
  color: rgba(201,75,59,0.5);
}
#forget-all-btn:hover {
  color: rgba(201,75,59,0.9); background: rgba(201,75,59,0.08);
}

/* ── SECTION TITLE ── */
.section-title {
  font-size: 10.5px; font-weight: 500;
  letter-spacing: 2.2px; text-transform: uppercase;
  color: var(--text-muted);
  margin: 36px 0 14px;
  display: flex; align-items: center; gap: 12px;
}
.section-title::after {
  content: ''; flex: 1; height: 1px;
  background: var(--border);
}

/* ── BUTTON GRID ── */
.btn-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px,1fr));
  gap: 7px;
  margin-bottom: 4px;
}

.btn {
  position: relative; overflow: hidden;
  display: flex; align-items: flex-start;
  flex-direction: column;
  gap: 0; padding: 16px 18px 16px;
  border-radius: var(--radius-md);
  text-decoration: none; color: var(--text);
  background: var(--bg-card);
  border: 1px solid var(--border);
  cursor: pointer; font-family: var(--font);
  transition: background var(--transition), border-color var(--transition), transform var(--transition);
}
.btn::after {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: var(--btn-line, transparent);
  opacity: 0; transition: opacity var(--transition);
}
.btn:hover {
  background: var(--bg-card-h);
  border-color: var(--border-h);
  transform: translateY(-1px);
}
.btn:hover::after { opacity: 1; }

.btn-icon { font-size: 15px; margin-bottom: 10px; }
.btn-name { font-size: 13px; font-weight: 500; color: rgba(221,232,243,0.9); margin-bottom: 3px; }
.btn-hint { font-size: 11px; color: var(--text-muted); line-height: 1.4; }
.btn-arrow {
  position: absolute; right: 14px; top: 50%;
  transform: translateY(-50%);
  font-size: 13px; color: var(--border-h);
  transition: all var(--transition);
}
.btn:hover .btn-arrow { color: var(--text-muted); transform: translateY(-50%) translateX(2px); }

.btn-blue   { --btn-line: linear-gradient(90deg, #3d8fd4, #85b7eb); }
.btn-green  { --btn-line: linear-gradient(90deg, #29a86a, #97c459); }
.btn-orange { --btn-line: linear-gradient(90deg, #d48a1a, #fac775); }
.btn-red    { --btn-line: linear-gradient(90deg, #c94b3b, #f09595); }
.btn-purple { --btn-line: linear-gradient(90deg, #8a6bcc, #afa9ec); }
.btn-teal   { --btn-line: linear-gradient(90deg, #1aaa91, #5dcaa5); }

/* ── FORM ── */
.form-group { margin-bottom: 16px; }

label {
  display: block; margin-bottom: 7px;
  font-size: 12px; font-weight: 500;
  color: var(--text-mid);
  letter-spacing: 0.2px;
}

input[type="number"], select {
  width: 100%; padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px; font-family: var(--font);
  background: rgba(255,255,255,0.05);
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
  appearance: none; -webkit-appearance: none;
}
input[type="number"]::placeholder { color: rgba(221,232,243,0.2); }
select option { background: #111c28; color: var(--text); }
input[type="number"]:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(61,143,212,0.15);
  outline: none;
}

.radio-group {
  display: flex; gap: 8px; flex-wrap: wrap;
  margin-bottom: 16px;
}
.radio-option {
  flex: 1; min-width: 110px;
  display: flex; align-items: center; gap: 8px;
  cursor: pointer; padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 400;
  color: var(--text-mid);
  background: rgba(255,255,255,0.03);
  transition: all var(--transition);
  user-select: none;
}
.radio-option:hover {
  border-color: var(--accent);
  background: var(--accent-dim);
  color: var(--text);
}
.radio-option input { margin: 0; accent-color: var(--accent); }

/* ── CALCULATE BUTTON ── */
.btn-calculate {
  width: 100%; padding: 14px;
  font-size: 14px; font-weight: 600;
  font-family: var(--font);
  color: #fff; border: none;
  border-radius: var(--radius-sm);
  cursor: pointer; margin-top: 8px;
  transition: all var(--transition);
  letter-spacing: 0.2px;
  background: var(--btn-calc-bg, var(--accent));
  box-shadow: 0 2px 16px rgba(0,0,0,0.25);
}
.btn-calculate:hover { filter: brightness(1.1); transform: translateY(-1px); }
.btn-calculate:active { transform: none; filter: brightness(0.95); }

/* Per-page button colors */
.btn-calc-blue   { --btn-calc-bg: #3d8fd4; }
.btn-calc-green  { --btn-calc-bg: #29a86a; }
.btn-calc-orange { --btn-calc-bg: #c07c12; }
.btn-calc-red    { --btn-calc-bg: #c94b3b; }
.btn-calc-purple { --btn-calc-bg: #7a59be; }
.btn-calc-teal   { --btn-calc-bg: #1aaa91; }

/* ── RESULTS ── */
#result {
  margin-top: 28px; display: none;
  animation: fadeUp .3s ease;
}

.result-title {
  font-size: 11px; font-weight: 500;
  letter-spacing: 1.8px; text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit,minmax(130px,1fr));
  gap: 8px;
}

.result-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  padding: 16px 14px; border-radius: var(--radius-md);
  text-align: center;
  transition: background var(--transition);
}
.result-card:hover { background: rgba(255,255,255,0.07); }
.result-card h4 {
  margin-bottom: 8px; color: var(--text-muted);
  font-size: 10px; text-transform: uppercase;
  letter-spacing: 1.5px; font-weight: 500;
}
.result-value { font-size: 22px; font-weight: 600; color: #fff; }
.unit { font-size: 11px; color: var(--text-muted); margin-left: 3px; }

.result-list { display: flex; flex-direction: column; gap: 7px; }
.result-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px;
  background: rgba(255,255,255,0.03);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-size: 13px; color: var(--text-mid);
}
.result-item .val { font-weight: 600; color: var(--text); font-size: 14px; }
.result-item .val.highlight { color: #e57373; }

.status-badge {
  display: block; margin-top: 12px;
  padding: 10px 18px; border-radius: 50px;
  font-weight: 600; font-size: 14px; text-align: center;
}

/* ── DIVIDER ── */
.divider {
  height: 1px; background: var(--border);
  margin: 24px 0;
}

/* ── INFO BLOCK ── */
.info-block {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px; margin-top: 16px;
}
.info-block h3 {
  font-size: 12px; font-weight: 600;
  color: var(--text-mid); margin-bottom: 8px;
  letter-spacing: 0.3px;
}
.info-block p {
  font-size: 13px; color: var(--text-muted);
  line-height: 1.7;
}

.warn-block {
  background: rgba(201,75,59,0.08);
  border: 1px solid rgba(201,75,59,0.2);
  border-radius: var(--radius-md);
  padding: 16px; margin-top: 14px;
}
.warn-block p { font-size: 12.5px; color: rgba(221,232,243,0.55); line-height: 1.65; }
.warn-block strong { color: rgba(229,115,115,0.9); }

/* ── BACK LINK ── */
.back-link {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 32px; color: var(--text-muted);
  text-decoration: none; font-size: 12.5px; font-weight: 500;
  transition: color var(--transition);
}
.back-link:hover { color: var(--text); }

/* ── FOOTER ── */
footer {
  text-align: center; margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  font-size: 11px; color: rgba(221,232,243,0.18);
  line-height: 2;
}

/* ── RESPONSIVE ── */
@media (max-width: 600px) {
  .card { padding: 28px 18px; border-radius: var(--radius-lg); }
  .btn-grid { grid-template-columns: 1fr; }
  .results-grid { grid-template-columns: repeat(2,1fr); }
  .page { padding: 16px 10px 48px; }
}

/* ── PRO SECTION ── */
.pro-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 50px;
  font-size: 10px; font-weight: 700;
  letter-spacing: 1.2px; text-transform: uppercase;
  background: linear-gradient(135deg, rgba(180,140,60,0.2), rgba(160,110,200,0.2));
  border: 1px solid rgba(180,140,60,0.35);
  color: #c9a84c;
  vertical-align: middle; margin-left: 6px;
}

.btn-pro {
  --btn-line: linear-gradient(90deg, #c9a84c, #a06bc8);
}
.btn-pro:hover {
  background: rgba(180,140,60,0.07);
  border-color: rgba(180,140,60,0.25);
}

.section-title-pro {
  font-size: 10.5px; font-weight: 500;
  letter-spacing: 2.2px; text-transform: uppercase;
  margin: 36px 0 14px;
  display: flex; align-items: center; gap: 12px;
  background: linear-gradient(90deg, #c9a84c, #a06bc8);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.section-title-pro::after {
  content: ''; flex: 1; height: 1px;
  background: linear-gradient(90deg, rgba(180,140,60,0.3), rgba(160,110,200,0.1));
  -webkit-text-fill-color: unset;
}

/* PRO page specifics */
.pro-explain {
  background: rgba(180,140,60,0.06);
  border: 1px solid rgba(180,140,60,0.18);
  border-radius: var(--radius-md);
  padding: 20px; margin-top: 16px;
}
.pro-explain h3 {
  font-size: 12px; font-weight: 600;
  color: #c9a84c; margin-bottom: 8px;
  letter-spacing: 0.3px;
}
.pro-explain p, .pro-explain li {
  font-size: 13px; color: var(--text-muted);
  line-height: 1.75;
}
.pro-explain ul { padding-left: 16px; }
.pro-explain li { margin-bottom: 4px; }

.pro-practice {
  background: rgba(160,110,200,0.06);
  border: 1px solid rgba(160,110,200,0.18);
  border-radius: var(--radius-md);
  padding: 20px; margin-top: 12px;
}
.pro-practice h3 {
  font-size: 12px; font-weight: 600;
  color: #a06bc8; margin-bottom: 8px;
}
.pro-practice p, .pro-practice li {
  font-size: 13px; color: var(--text-muted);
  line-height: 1.75;
}
.pro-practice ul { padding-left: 16px; }
.pro-practice li { margin-bottom: 4px; }

.formula-box {
  background: rgba(0,0,0,0.35);
  border: 1px solid rgba(180,140,60,0.2);
  border-radius: var(--radius-sm);
  padding: 14px 16px; margin: 14px 0;
  font-family: var(--font-mono);
  font-size: 13px; color: #c9a84c;
  line-height: 1.7; overflow-x: auto;
}

.zone-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px; margin-bottom: 8px;
}
.zone-card-header {
  display: flex; justify-content: space-between;
  align-items: center; margin-bottom: 6px;
}
.zone-card-name { font-size: 13px; font-weight: 600; }
.zone-card-bpm { font-size: 14px; font-weight: 700; }
.zone-card-desc { font-size: 12px; color: var(--text-muted); line-height: 1.5; }

.btn-calc-pro { --btn-calc-bg: linear-gradient(135deg, #b08a30, #7a4fa0); }
.btn-calculate.btn-calc-pro { background: linear-gradient(135deg, #b08a30, #7a4fa0); }

/* ── INLINE VALIDATION ERRORS ── */
.field-error {
  display: none;
  align-items: center;
  gap: 5px;
  margin-top: 6px;
  font-size: 12px;
  color: #ff6b6b;
  animation: errorFadeIn 0.2s ease both;
}
.field-error.visible { display: flex; }
@keyframes errorFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── TABLET BREAKPOINT 768px ── */
@media (max-width: 768px) and (min-width: 601px) {
  .card {
    padding: 36px 28px;
  }
  .btn-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .results-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  /* Category grid stays 2×2 on tablet */
  .cat-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  /* Nav bar stays single row */
  .nav-bar {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding: 4px 8px;
  }
  /* Panel items slightly bigger touch target */
  .panel-item {
    padding: 15px 18px;
  }
  /* Related grid: 3 cols still fine at 768 */
  .related-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  /* PRO explain blocks */
  .pro-explain, .pro-practice {
    padding: 18px;
  }
}

/* ── SKIP NAV (a11y) ── */
.skip-nav {
  position: absolute;
  top: -100px;
  left: 16px;
  z-index: 10000;
  padding: 10px 18px;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  text-decoration: none;
  transition: top 0.2s;
  font-family: var(--font);
}
.skip-nav:focus {
  top: 0;
  outline: 2px solid #fff;
  outline-offset: 2px;
}

