:root{
    --bg:#111;
    --card:#1d1d1d;
    --panel:#222;
    --panel-2:#2a2a2a;
    --border:#333;
    --text:#ffffff;
    --muted:#bbb;
    --muted-2:#aaa;
    --accent:#00d4ff;
    --start:#28a745;
    --pause:#ff9800;
    --reset:#dc3545;
    --overlay-bg:rgba(0,0,0,.96);
}

[data-theme="light"]{
    --bg:#f2f4f7;
    --card:#ffffff;
    --panel:#e9edf2;
    --panel-2:#dde2e8;
    --border:#d0d5db;
    --text:#14181d;
    --muted:#4a5560;
    --muted-2:#5b6672;
    --accent:#0077cc;
    --overlay-bg:rgba(242,244,247,.97);
}

*{
    box-sizing:border-box;
}

html,body{
    margin:0;
    padding:0;
}

body{
    padding:12px;
    font-family:-apple-system,BlinkMacSystemFont,sans-serif;
    background:var(--bg);
    color:var(--text);
    transition:background .3s,color .3s;
}

.emoji{
    font-family:"Apple Color Emoji","Segoe UI Emoji","Noto Color Emoji",sans-serif;
}

.fa-mode .emoji{
    display:none;
}

body:not(.fa-mode) .fa-i{
    display:none;
}

.topbar{
    max-width:480px;
    margin:0 auto 12px;
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:10px;
}

.theme-toggle{
    display:flex;
    gap:8px;
}

.top-btn{
    flex:none;
    width:44px;
    height:44px;
    padding:0;
    border:none;
    border-radius:12px;
    font-size:20px;
    cursor:pointer;
    background:var(--panel);
    color:var(--text);
    display:flex;
    justify-content:center;
    align-items:center;
    -webkit-tap-highlight-color:transparent;
    border:2px solid transparent;
}

.top-btn.active{
    border-color:var(--accent);
    color:var(--accent);
}

.container{
    max-width:480px;
    margin:auto;
}

h1{
    text-align:center;
    font-size:22px;
    margin:8px 0 16px;
}

h1 .fa-i{
    margin-right:8px;
}

h1 .emoji{
    margin-right:8px;
}

.card{
    background:var(--card);
    border-radius:16px;
    padding:16px;
    margin-bottom:14px;
}

select{
    width:100%;
    padding:14px;
    border:none;
    border-radius:12px;
    margin-top:10px;
    font-size:16px;
    background:var(--panel-2);
    color:var(--text);
}

select option{
    font-family:"Font Awesome 6 Free","Apple Color Emoji","Segoe UI Emoji","Noto Color Emoji",sans-serif;
}

.controls{
    display:flex;
    gap:10px;
    margin-top:10px;
}

button{
    flex:1;
    padding:14px;
    border:none;
    border-radius:12px;
    font-size:16px;
    cursor:pointer;
    -webkit-tap-highlight-color:transparent;
    color:white;
    display:flex;
    justify-content:center;
    align-items:center;
    gap:8px;
}

.start{
    background:var(--start);
}

.pause{
    background:var(--pause);
}

.reset{
    background:var(--reset);
}

.exercise-image{
    width:100%;
    min-height:200px;
    max-height:300px;
    object-fit:contain;
    border-radius:12px;
    background:var(--panel);
}

.status{
    text-align:center;
    color:var(--accent);
    font-size:22px;
    margin-top:12px;
}

.status .fa-i,
.status .emoji{
    margin-right:8px;
}

.exercise{
    text-align:center;
    font-size:28px;
    font-weight:bold;
    margin-top:8px;
}

.reps{
    text-align:center;
    color:var(--muted);
    font-size:15px;
    margin-top:4px;
}

.timer{
    text-align:center;
    font-size:clamp(56px,20vw,96px);
    font-weight:bold;
    line-height:1.1;
    margin-top:10px;
}

.round{
    text-align:center;
    font-size:18px;
    margin-top:8px;
}

.progress{
    width:100%;
    height:14px;
    background:var(--panel);
    border-radius:20px;
    overflow:hidden;
    margin-top:12px;
}

.progress-bar{
    height:100%;
    width:0%;
    background:var(--accent);
    transition:width .3s;
}

.overlay{
    position:fixed;
    inset:0;
    background:var(--overlay-bg);
    z-index:9999;
    display:flex;
    justify-content:center;
    align-items:center;
}

.hidden{
    display:none;
}

.overlay-content{
    text-align:center;
    padding:20px;
}

.overlay-content.big{
    display:flex;
    flex-direction:column;
    justify-content:center;
    align-items:center;
    min-height:80vh;
}

.overlay-content.big #overlayNextLabel,
.overlay-content.big .overlay-image,
.overlay-content.big #overlayExercise{
    display:none;
}

.overlay-content.big #overlayCountdown{
    font-size:clamp(120px,40vw,280px);
}

.overlay-image{
    width:180px;
    height:180px;
    object-fit:contain;
    background:var(--panel);
    border-radius:16px;
}

#overlayExercise{
    font-size:28px;
    margin-top:16px;
}

#overlayCountdown{
    font-size:clamp(80px,30vw,140px);
    font-weight:bold;
    color:var(--accent);
    margin-top:16px;
}

#overlayNextLabel{
    color:var(--muted);
    margin-bottom:16px;
    font-size:18px;
}

@media(min-width:768px){

    body{
        padding:32px;
    }

    .topbar{
        max-width:720px;
        margin-bottom:20px;
    }

    .container{
        max-width:720px;
    }

    h1{
        font-size:28px;
        margin:8px 0 24px;
    }

    .card{
        padding:24px;
        margin-bottom:20px;
    }

    .exercise-image{
        min-height:260px;
        max-height:340px;
    }

    .timer{
        font-size:96px;
    }

    .overlay-image{
        width:220px;
        height:220px;
    }

    #overlayExercise{
        font-size:36px;
    }
}
