:root{
  --bg0:#070A12;
  --bg1:#0B1020;
  --text:#EAF0FF;
  --muted:rgba(234,240,255,.72);
  --muted2:rgba(234,240,255,.55);

  --line:rgba(255,255,255,.10);
  --line2:rgba(255,255,255,.14);

  --shadow: 0 20px 60px rgba(0,0,0,.45);
  --shadow2: 0 10px 30px rgba(0,0,0,.35);

  --r-xl: 22px;

  --accentA: 120, 170, 255;
  --accentB: 120, 242, 194;
  --danger: 255, 120, 120;

  --focus: 0 0 0 5px rgba(var(--accentA), .20);

  /* base hover */
  --hoverLiftWeak: translateY(-1px);
  --hoverBgWeak: rgba(255,255,255,.05);
  --hoverBorderWeak: rgba(255,255,255,.14);

  --hoverLiftStrong: translateY(-2px);
  --hoverBgStrong: rgba(255,255,255,.07);
  --hoverBorderStrong: rgba(255,255,255,.18);

  --tapBg: rgba(255,255,255,.06);
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  position:relative;
  color:var(--text);
  background:
    radial-gradient(1200px 800px at 20% 10%, rgba(var(--accentA), .20), transparent 55%),
    radial-gradient(900px 700px at 80% 0%, rgba(var(--accentB), .14), transparent 48%),
    radial-gradient(1000px 700px at 70% 90%, rgba(255,255,255,.06), transparent 55%),
    linear-gradient(180deg, var(--bg0), var(--bg1));
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  letter-spacing:-.1px;
  padding:24px;
}

/* Background ornaments must stay behind */
.bg-ornaments{
  position:fixed;
  inset:0;
  pointer-events:none;
  overflow:hidden;
  z-index:0;
}
.orb{
  position:absolute; width:520px; height:520px; border-radius:50%;
  filter: blur(40px);
  opacity:.55;
  transform: translateZ(0);
}
.orb-a{left:-140px; top:-180px; background: radial-gradient(circle at 30% 30%, rgba(var(--accentA),.8), transparent 60%)}
.orb-b{right:-220px; bottom:-260px; background: radial-gradient(circle at 40% 40%, rgba(var(--accentB),.8), transparent 60%)}
.gridlines{
  position:absolute; inset:-40px;
  background-image:
    linear-gradient(to right, rgba(255,255,255,.03) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,.03) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(circle at 50% 20%, rgba(0,0,0,.55), transparent 70%);
  opacity:.6;
}

/* UI above background */
.shell{
  max-width:1080px;
  margin:0 auto;
  position:relative;
  z-index:1;
}

.topbar{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:16px;
  margin-bottom:18px;
}
.brand{display:flex; align-items:center; gap:12px; min-width:0;}
.logo{
  width:44px; height:44px; border-radius:14px;
  background:
    radial-gradient(circle at 30% 30%, rgba(var(--accentA), .9), transparent 60%),
    radial-gradient(circle at 70% 70%, rgba(var(--accentB), .9), transparent 62%),
    rgba(255,255,255,.06);
  border:1px solid rgba(255,255,255,.14);
  box-shadow: var(--shadow2);
}
.brand-title{font-size:22px; line-height:1.1; margin:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
.brand-sub{margin:6px 0 0; font-size:13px; color:var(--muted);}

.meta{display:flex; gap:8px; flex-wrap:wrap; justify-content:flex-end}
.chip{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:8px 10px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.05);
  color: var(--muted);
  box-shadow: 0 6px 18px rgba(0,0,0,.25);
  font-size:12px;
}
.chip-btn{
  cursor:pointer;
  color: rgba(234,240,255,.88);
  background:
    radial-gradient(260px 120px at 20% 0%, rgba(var(--accentA), .22), transparent 60%),
    rgba(255,255,255,.05);
  transition: transform .15s ease, background .15s ease, border-color .15s ease;
}
.chip-mono{font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace}

.tabs{
  display:grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap:10px;
  margin: 18px 0 16px;
}
@media (max-width:720px){ .tabs{grid-template-columns:1fr} }
.tab{
  display:flex; flex-direction:column; gap:4px;
  padding:12px 14px;
  border-radius: 18px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.04);
  cursor:pointer;
  text-align:left;
  transition: transform .15s ease, background .15s ease, border-color .15s ease;
}
.tab[aria-selected="true"]{
  background:
    radial-gradient(700px 200px at 10% 10%, rgba(var(--accentA), .18), transparent 60%),
    radial-gradient(700px 200px at 90% 90%, rgba(var(--accentB), .12), transparent 60%),
    rgba(255,255,255,.05);
  border-color: rgba(var(--accentA), .35);
  box-shadow: var(--shadow2);
}
.tab-title{font-weight:900; color:var(--text); font-size:14px}
.tab-sub{font-size:12px; color:var(--muted2)}
.hidden{display:none !important}

.layout{
  display:grid;
  grid-template-columns: 1.05fr .95fr;
  gap:14px;
  align-items:start;
}
@media (max-width:920px){ .layout{grid-template-columns:1fr} }

.card{
  border-radius: var(--r-xl);
  border: 1px solid rgba(255,255,255,.10);
  background: linear-gradient(180deg, rgba(255,255,255,.07), rgba(255,255,255,.04));
  box-shadow: var(--shadow);
  overflow:hidden;
  backdrop-filter: blur(8px);
}
.card-glow{position:relative;}
.card-glow::before{
  content:"";
  position:absolute; inset:-1px;
  border-radius: inherit;
  background:
    radial-gradient(600px 260px at 20% 0%, rgba(var(--accentA), .20), transparent 60%),
    radial-gradient(600px 260px at 80% 100%, rgba(var(--accentB), .16), transparent 60%);
  pointer-events:none;
  opacity:.9;
}
.card-glow > *{position:relative}

.card-hd{
  padding:16px 16px 12px;
  border-bottom:1px solid rgba(255,255,255,.08);
  background: rgba(0,0,0,.12);
}
.card-hd h2{margin:0; font-size:15px; letter-spacing:-.2px;}
.card-hd p{margin:6px 0 0; font-size:12px; color:var(--muted);}
.card-hd-row{display:flex; align-items:flex-start; justify-content:space-between; gap:12px;}
.card-bd{padding:16px}

.row{display:inline-flex; gap:8px; align-items:center;}

/* Form */
.form-grid{display:grid; gap:10px; margin-bottom:12px;}
.form-grid.two{grid-template-columns:1fr 1fr}
.form-grid.three{grid-template-columns:1fr 1fr 1fr}
@media (max-width:640px){
  .form-grid.two, .form-grid.three{grid-template-columns:1fr}
}

.field label{
  display:flex; align-items:baseline; gap:8px;
  margin-bottom:6px;
  font-size:12px; color:var(--muted);
}
.unit{color:var(--muted2); font-weight:700}

input, select{
  width:100%;
  padding:12px 12px;
  border-radius: 14px;
  border:1px solid rgba(255,255,255,.12);
  background: rgba(0,0,0,.18);
  color: var(--text);
  outline:none;
  box-shadow: 0 1px 0 rgba(255,255,255,.05) inset;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
input::placeholder{color:rgba(234,240,255,.45)}
input:focus, select:focus{
  border-color: rgba(var(--accentA), .55);
  box-shadow: var(--focus);
  background: rgba(0,0,0,.22);
}
input.invalid, select.invalid{
  border-color: rgba(var(--danger), .75);
  box-shadow: 0 0 0 5px rgba(var(--danger), .18);
}

.field-msg{
  margin-top:6px;
  font-size:12px;
  color: rgba(var(--danger), .95);
  min-height: 16px;
}

.actions{display:flex; gap:10px; flex-wrap:wrap; margin-top:10px;}
.btn{
  padding:11px 14px;
  border-radius: 14px;
  border:1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.06);
  color: var(--text);
  cursor:pointer;
  font-weight:900;
  transition: transform .15s ease, background .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.btn:active{transform: translateY(0px);}
.btn.primary{
  background:
    radial-gradient(400px 140px at 20% 0%, rgba(var(--accentA), .35), transparent 60%),
    rgba(110,168,255,.14);
  border-color: rgba(var(--accentA), .45);
  box-shadow: 0 10px 26px rgba(var(--accentA), .12);
}
.btn.ghost{background: transparent;}
.btn.tiny{padding:8px 10px; border-radius: 12px; font-size:12px; font-weight:900;}

.preset-row{margin-top:8px; display:flex; gap:8px; flex-wrap:wrap;}

.hint{
  margin-top:12px;
  padding:12px 12px;
  border-radius: 16px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.14);
  color: var(--muted);
  font-size:12px;
  line-height:1.5;
}

.details{
  margin-top:10px;
  border-radius: 14px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.14);
  overflow:hidden;
}
.details summary{
  cursor:pointer;
  padding:10px 12px;
  color: rgba(234,240,255,.86);
  font-weight:900;
  font-size:12px;
}
.details[open] summary{border-bottom: 1px solid rgba(255,255,255,.08);}
.details-body{padding:0 12px 12px; color: var(--muted); font-size:12px; line-height:1.5;}

/* KPIs */
.kpis{display:grid; gap:10px; grid-template-columns: 1fr 1fr;}
@media (max-width:520px){ .kpis{grid-template-columns:1fr} }
.kpi{
  padding:14px 14px;
  border-radius: 18px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.16);
}
.kpi-top{display:flex; align-items:center; justify-content:space-between; gap:10px; margin-bottom:8px;}
.kpi-label{font-size:12px; color: var(--muted); font-weight:800;}
.kpi-value{font-size:22px; font-weight:950; letter-spacing:-.3px; line-height:1.15;}
.kpi-sub{margin-top:6px; font-size:12px; color: var(--muted2); line-height:1.45;}

.divider{height:1px; background: rgba(255,255,255,.10); margin: 14px 0;}

.table-card{
  padding:14px 14px;
  border-radius: 18px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.16);
}
.table-title{font-size:12px; color: var(--muted); font-weight:900; margin-bottom:10px;}
.table-body{font-size:12px; color: rgba(234,240,255,.82); line-height:1.8;}
.table-body.big{font-size:22px; font-weight:950; letter-spacing:-.2px; line-height:1.2;}
.table-foot{margin-top:8px; font-size:12px; color: var(--muted2);}

/* 1RM percent grid */
.pct-grid{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:8px 10px;
}
@media (max-width:520px){
  .pct-grid{grid-template-columns: 1fr;}
}
.pct-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding:10px 12px;
  border-radius: 14px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.14);
}
.pct-p{font-weight:950; color: rgba(234,240,255,.90); font-size:12px;}
.pct-w{font-size:12px; color: rgba(234,240,255,.86);}

/* History */
.history{
  border-radius: 18px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.14);
  padding:12px;
}
.history-hd{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin-bottom:10px;
}
.history-title{font-size:12px; font-weight:950; color: rgba(234,240,255,.86);}
.history-empty{font-size:12px; color: var(--muted2); padding:8px 4px;}
.history-item{
  width:100%;
  text-align:left;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.16);
  border-radius: 16px;
  padding:10px 10px;
  cursor:pointer;
  display:block;
  margin-bottom:8px;
  transition: transform .15s ease, background .15s ease, border-color .15s ease;
  color: var(--text);
}
.history-item:active{transform: translateY(0px);}
.history-sub{margin-top:6px; font-size:12px; color: var(--muted2); line-height:1.35;}

.clamp2{
  display:-webkit-box;
  -webkit-line-clamp:2;
  -webkit-box-orient: vertical;
  overflow:hidden;
}

/* Live toggle */
.toggle{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:8px 10px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.14);
  color: rgba(234,240,255,.86);
  font-size:12px;
  font-weight:900;
  user-select:none;
}
.toggle input{width:16px; height:16px; margin:0;}

/* Toast */
.toast{
  position:fixed;
  left:50%;
  bottom:20px;
  transform: translateX(-50%) translateY(12px);
  opacity:0;
  pointer-events:none;
  z-index:999;
  padding:10px 12px;
  border-radius: 14px;
  border:1px solid rgba(255,255,255,.14);
  background: rgba(0,0,0,.60);
  color: rgba(234,240,255,.92);
  box-shadow: 0 12px 40px rgba(0,0,0,.45);
  transition: opacity .18s ease, transform .18s ease;
  max-width: calc(100vw - 24px);
  font-size:12px;
  font-weight:900;
}
.toast.show{
  opacity:1;
  transform: translateX(-50%) translateY(0);
}

/* Footer */
.footer{margin-top:14px; padding: 12px 4px;}
.footer-row{display:flex; justify-content:space-between; gap:10px; flex-wrap:wrap;}
.fine{font-size:12px; color: var(--muted2)}
.kbd{
  display:inline-block;
  padding:2px 8px;
  border-radius: 10px;
  border:1px solid rgba(255,255,255,.14);
  background: rgba(0,0,0,.18);
  color: rgba(234,240,255,.86);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-weight:800;
}

/* -----------------------------
   Unified clickable affordance
------------------------------ */
.is-clickable,
[data-clickable="true"]{
  cursor:pointer;
  -webkit-tap-highlight-color: transparent;
}

.is-clickable:focus-visible,
[data-clickable="true"]:focus-visible{
  outline:none;
  box-shadow: var(--focus);
  border-radius: 14px;
  scroll-margin-top: 90px; /* (3) keyboard UX */
}

/* Mobile: no hover, keep tap feedback only */
@media (hover: none){
  [data-clickable="true"]:active{
    background: var(--tapBg);
  }
}

/* Desktop: hover only on hover-capable pointers */
@media (hover: hover){
  [data-clickable="true"][data-hover="soft"]:hover{
    transform: var(--hoverLiftWeak);
    background: var(--hoverBgWeak);
    border-color: var(--hoverBorderWeak);
  }
  [data-clickable="true"][data-hover="strong"]:hover{
    transform: var(--hoverLiftStrong);
    background: var(--hoverBgStrong);
    border-color: var(--hoverBorderStrong);
  }
}

/* (4) Result highlight */
@keyframes resultFlash{
  0%   { box-shadow: 0 0 0 0 rgba(var(--accentA), .00); }
  35%  { box-shadow: 0 0 0 6px rgba(var(--accentA), .18); }
  100% { box-shadow: 0 0 0 0 rgba(var(--accentA), .00); }
}
.flash{ animation: resultFlash 650ms ease; }

/* Dark UI hint */
:root { color-scheme: dark; }
select{ color-scheme: dark; background: rgba(0,0,0,.22); border: 1px solid rgba(255,255,255,.14); }
select option{ background-color: #0b1020; color: #eaf0ff; }

/* ===== Service pages (About / Privacy / Terms) ===== */
.fine-link{ color: inherit; text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 3px; }
.fine-link:hover{ opacity: .9; }
.dot-sep{ opacity:.55; padding: 0 6px; }

.page-top{ display:flex; align-items:center; justify-content:space-between; gap: 12px; margin-bottom: 12px; }
.page-title{ font-size: 18px; margin: 0; }
.page-sub{ margin: 0; color: var(--muted); font-size: 13px; }
.page-content{ color: var(--muted); line-height: 1.65; font-size: 14px; }
.page-content h3{ color: var(--text); font-size: 14px; margin: 18px 0 8px; }
.page-content ul{ margin: 8px 0 0 18px; }
.page-content code{ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; font-size: .95em; }
