:root{
  --bg:#f6f8fb;
  --card:#ffffff;
  --card2:#fbfcff;
  --text:#101828;
  --muted:#667085;
  --line:#e6eaf2;

  --accent:#2e90fa;
  --accentSoft: rgba(46,144,250,.12);

  --good:#12b76a;
  --warn:#f79009;
  --bad:#f04438;

  --radius:18px;
}

#acc-guides{
  white-space: pre-line;
}


*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial;
  background:linear-gradient(180deg,var(--bg),#eef2f8);
  color:var(--text);
}

.topbar{
  position:sticky; top:0; z-index:10;
  padding:14px 14px calc(14px + env(safe-area-inset-top));
  display:flex; align-items:center; justify-content:space-between;
  border-bottom:1px solid var(--line);
  background:rgba(246,248,251,.92);
  backdrop-filter: blur(10px);
}
.topbar__title{font-weight:900; letter-spacing:.4px}

.app{
  padding:14px;
  padding-bottom:calc(84px + env(safe-area-inset-bottom));
  max-width:820px;
  margin:0 auto;
}

.card{
  background:linear-gradient(180deg,var(--card),var(--card2));
  border:1px solid var(--line);
  border-radius:var(--radius);
  padding:14px;
  margin-bottom:12px;
  box-shadow: 0 8px 22px rgba(16,24,40,.06);
}

.h1{font-size:20px; font-weight:900; margin-bottom:6px}
.h2{font-size:16px; font-weight:900; margin-bottom:10px}
.muted{color:var(--muted)}
.small{font-size:12px}
.text{line-height:1.45; white-space:pre-wrap}

.grid2{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:10px;
  margin-bottom:12px;
}

.big{
  border-radius:18px;
  border:1px solid var(--line);
  background:rgba(16,24,40,.02);
  color:var(--text);
  padding:16px 12px;
  font-size:16px;
  font-weight:900;
}
.big:active{transform:scale(.99)}

.row{display:flex; gap:10px; flex-wrap:wrap; align-items:center}

.pill{
  border:1px solid var(--line);
  background:rgba(16,24,40,.02);
  padding:8px 10px;
  border-radius:999px;
  font-size:12px;
  color:var(--muted);
}

button{cursor:pointer;border:none;outline:none}

.primary{
  background:var(--accent);
  color:white;
  font-weight:900;
  padding:10px 12px;
  border-radius:14px;
}
.ghost{
  background:transparent;
  color:var(--muted);
  border:1px solid var(--line);
  padding:8px 10px;
  border-radius:12px;
}

.view{display:none}
.view.active{display:block}

.bottom{
  position:fixed; left:0; right:0; bottom:0; z-index:20;
  padding:10px 10px calc(10px + env(safe-area-inset-bottom));
  background:rgba(246,248,251,.92);
  border-top:1px solid var(--line);
  backdrop-filter: blur(10px);
  display:flex; justify-content:space-around; gap:8px;
}

.tab{
  width:20%;
  max-width:110px;
  padding:10px 0;
  border-radius:16px;
  background:rgba(16,24,40,.03);
  color:var(--muted);
  font-size:18px;
}
.tab.active{
  background:var(--accentSoft);
  color:var(--text);
  border:1px solid rgba(46,144,250,.25);
}

.option{
  border:1px solid var(--line);
  background:rgba(16,24,40,.02);
  border-radius:14px;
  padding:10px 12px;
  display:flex;
  gap:10px;
  align-items:flex-start;
  margin-bottom:8px;
}
.option input{margin-top:4px}
.option .label{flex:1}

.accordion{
  width:100%;
  background:rgba(16,24,40,.02);
  border:1px solid var(--line);
  color:var(--text);
  padding:10px 12px;
  border-radius:14px;
  font-weight:900;
}
.accBody{display:none; margin-top:10px}
.accBody.open{display:block}

.list{display:flex;flex-direction:column;gap:10px}

.exercise{
  border:1px solid var(--line);
  background:rgba(16,24,40,.015);
  border-radius:16px;
  padding:12px;
}

.t{font-weight:900}
.d{color:var(--muted); font-size:13px; white-space:pre-wrap; margin-top:4px}

.ok{color:var(--good)}
.warn{color:var(--warn)}
.bad{color:var(--bad)}

/* Giorni settimana */
.weekbtn{
  padding:10px 12px;
  border-radius:14px;
  border:1px solid var(--line);
  background:rgba(16,24,40,.02);
  color:var(--text);
  font-weight:900;
}
.weekbtn.active{
  background:var(--accentSoft);
  border:1px solid rgba(46,144,250,.25);
}

/* Azioni esercizio (ℹ️ / 📷) */
.exHead{
  display:flex;
  gap:12px;
  align-items:flex-start;
  justify-content:space-between;
}
.exActions{
  display:flex;
  gap:8px;
  flex:0 0 auto;
}
.exBtn{
  width:40px;
  height:40px;
  border-radius:12px;
  border:1px solid var(--line);
  background:rgba(16,24,40,.02);
  color:var(--text);
  font-size:18px;
  display:flex;
  align-items:center;
  justify-content:center;
}
.exBtn:disabled{opacity:.35}

/* MODAL */
.modalBack{
  position:fixed;
  inset:0;
  background:rgba(16,24,40,.45);
  display:flex;
  align-items:flex-end;
  justify-content:center;
  padding:14px;
  z-index:9999;
}
.modal{
  width:100%;
  max-width:720px;
  border-radius:20px;
  border:1px solid var(--line);
  background:linear-gradient(180deg,var(--card),var(--card2));
  overflow:hidden;
  box-shadow: 0 14px 40px rgba(16,24,40,.22);
}
.modalTop{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding:12px 12px;
  border-bottom:1px solid var(--line);
}
.modalTitle{font-weight:900}
.modalClose{
  width:40px;
  height:40px;
  border-radius:12px;
  border:1px solid var(--line);
  background:rgba(16,24,40,.02);
  color:var(--text);
  font-size:16px;
}
.modalBody{padding:12px}
.modalImg{
  width:100%;
  height:auto;
  display:block;
  border-radius:14px;
  border:1px solid var(--line);
}
.exNote{ padding:12px; border:1px dashed rgba(0,0,0,.18); border-radius:14px; }
.exSection{ padding:12px; border:1px solid rgba(0,0,0,.10); border-radius:14px; }

