:root {
    color-scheme: dark;
    --bg: #101214;
    --panel: #181b1f;
    --panel-2: #20242a;
    --text: #f4f6f3;
    --muted: #a9b1ad;
    --line: #2d3331;
    --green: #52d273;
    --orange: #ff9f3f;
    --danger: #ff6b6b;
    --radius: 8px;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 16px/1.5 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
a { color: inherit; text-decoration: none; }
.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px clamp(16px, 4vw, 40px);
    background: rgba(16, 18, 20, .94);
    border-bottom: 1px solid var(--line);
}
.brand { font-weight: 800; letter-spacing: 0; }
.topnav { display: flex; gap: 14px; color: var(--muted); font-size: 14px; }
.page {
    width: min(1120px, 100%);
    margin: 0 auto;
    padding: 22px 16px 92px;
}
.page-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 18px;
}
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(28px, 4vw, 44px); line-height: 1.05; }
h2 { font-size: 20px; }
.muted { color: var(--muted); }
.grid { display: grid; gap: 14px; }
.grid.two, .grid.three, .stats { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.card, .auth-panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px;
}
.item-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 10px 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel-2);
    color: var(--text);
    cursor: pointer;
    font-weight: 700;
}
.btn.primary { background: var(--green); color: #071108; border-color: var(--green); }
.btn.small { min-height: 36px; padding: 7px 11px; font-size: 14px; }
.btn.huge { width: 100%; min-height: 58px; font-size: 18px; }
.form { display: grid; gap: 14px; }
.form-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.form-grid.three { grid-template-columns: repeat(3, 1fr); }
label { display: grid; gap: 6px; color: var(--muted); font-weight: 700; }
input, select, textarea {
    width: 100%;
    min-height: 44px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #0d0f11;
    color: var(--text);
    padding: 10px 12px;
    font: inherit;
}
textarea { min-height: 110px; resize: vertical; }
.copy-box { min-height: 140px; margin: 8px 0; font-size: 14px; }
.check { display: flex; align-items: center; gap: 10px; }
.check input { width: auto; min-height: auto; }
.alert {
    margin-bottom: 14px;
    padding: 12px 14px;
    border-radius: var(--radius);
    background: rgba(255, 159, 63, .12);
    border: 1px solid rgba(255, 159, 63, .4);
}
.auth-panel { max-width: 430px; margin: 8vh auto; }
.stat span { color: var(--muted); display: block; }
.stat strong { font-size: 34px; color: var(--green); }
.badges, .cue-list { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.badges span, .cue-list span {
    padding: 7px 10px;
    border-radius: 999px;
    background: rgba(82, 210, 115, .12);
    color: var(--green);
    font-weight: 800;
}
.badges.compact { margin: 8px 0 0; }
.badge.forza { background: rgba(82, 210, 115, .16); color: var(--green); }
.badge.accessorio { background: rgba(255, 159, 63, .16); color: var(--orange); }
.badge.cardio { background: rgba(92, 190, 255, .16); color: #7ecbff; }
.badge.mobilita { background: rgba(190, 148, 255, .16); color: #c7a7ff; }
.badge.principiante { background: rgba(82, 210, 115, .12); color: var(--green); }
.badge.intermedio { background: rgba(255, 159, 63, .14); color: var(--orange); }
.badge.avanzato { background: rgba(255, 107, 107, .14); color: var(--danger); }
.filters { margin-bottom: 16px; }
.video {
    width: 100%;
    aspect-ratio: 16 / 9;
    border: 0;
    border-radius: var(--radius);
    background: #050607;
}
.video.placeholder {
    display: grid;
    place-items: center;
    color: var(--muted);
    border: 1px dashed var(--line);
}
.exercise-hero { margin-bottom: 14px; }
.template-rows { display: grid; gap: 12px; }
.template-row {
    display: grid;
    gap: 10px;
    grid-template-columns: 2fr repeat(4, minmax(90px, 1fr)) 1.4fr;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
}
.live-card h2 { font-size: clamp(30px, 8vw, 52px); margin-bottom: 4px; }
.series { color: var(--orange); font-size: 22px; font-weight: 800; }
.progressbar {
    height: 12px;
    background: var(--panel-2);
    border-radius: 999px;
    overflow: hidden;
}
.progressbar span { display: block; height: 100%; background: var(--green); }
.timer {
    margin-top: 16px;
    padding: 18px;
    text-align: center;
    border-radius: var(--radius);
    background: #0d0f11;
    border: 1px solid var(--line);
}
.timer strong {
    display: block;
    font-size: clamp(58px, 18vw, 120px);
    line-height: 1;
    color: var(--orange);
}
.technique { margin-top: 16px; }
.technique summary { cursor: pointer; font-weight: 800; color: var(--green); }
.set-list { display: grid; gap: 10px; }
.set-list > div { padding: 10px 0; border-bottom: 1px solid var(--line); }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; min-width: 920px; }
.table th, .table td { padding: 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.table th { color: var(--muted); font-size: 13px; }
.check-grid { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; display: grid; gap: 8px; }
.check-grid legend { color: var(--muted); font-weight: 800; padding: 0 6px; }
.bottomnav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    display: none;
    grid-template-columns: repeat(4, 1fr);
    background: rgba(16, 18, 20, .96);
    border-top: 1px solid var(--line);
}
.bottomnav a { padding: 12px 8px; text-align: center; color: var(--muted); font-size: 13px; }

@media (max-width: 760px) {
    .topnav { display: none; }
    .bottomnav { display: grid; }
    .page-title { align-items: flex-start; flex-direction: column; }
    .item-card { align-items: stretch; flex-direction: column; }
    .actions { width: 100%; }
    .actions .btn, .actions form { flex: 1; }
    .actions form .btn { width: 100%; }
    .template-row, .form-grid.three { grid-template-columns: 1fr; }
    .card, .auth-panel { padding: 15px; }
}
