* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background:
        radial-gradient(circle at top left, rgba(180, 80, 255, 0.18), transparent 35%),
        radial-gradient(circle at bottom right, rgba(255, 80, 180, 0.14), transparent 35%),
        #08070d;
    color: #f7ecff;
    min-height: 100vh;
    overflow-x: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(12, 10, 20, 0.92);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid rgba(255,255,255,0.08);
    padding: 14px 18px;
}

.brand {
    font-size: 1.2rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.brand-icon {
    filter: drop-shadow(0 0 8px rgba(255, 90, 190, 0.8));
}

.nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
}

.nav::-webkit-scrollbar {
    display: none;
}

.nav a {
    white-space: nowrap;
    padding: 9px 12px;
    border-radius: 999px;
    background: rgba(255,255,255,0.06);
    color: #f4dcff;
    font-size: 0.9rem;
    flex: 0 0 auto;
}

.nav a:hover,
.nav a.active {
    background: linear-gradient(135deg, #9c4dff, #ff4db8);
}

.logout-link {
    color: #ffb3d9 !important;
}

.container {
    width: min(1150px, 100%);
    margin: 0 auto;
    padding: 22px 16px 50px;
}

.footer {
    text-align: center;
    color: #9f91ad;
    font-size: 0.85rem;
    padding: 20px;
}

.hero {
    margin-bottom: 22px;
}

.hero h1 {
    margin: 0 0 8px;
    font-size: clamp(1.8rem, 5vw, 3rem);
    line-height: 1.05;
}

.hero p {
    margin: 0;
    color: #cdbdda;
    line-height: 1.5;
}

.grid {
    display: grid;
    gap: 16px;
}

.grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.card {
    background: rgba(20, 17, 32, 0.86);
    border: 1px solid rgba(255,255,255,0.09);
    border-radius: 22px;
    padding: 18px;
    box-shadow: 0 18px 40px rgba(0,0,0,0.32);
    min-width: 0;
}

.card.glow {
    box-shadow:
        0 0 0 1px rgba(255, 80, 180, 0.1),
        0 0 30px rgba(160, 90, 255, 0.18);
}

.card h2,
.card h3 {
    margin-top: 0;
    line-height: 1.2;
}

.stat-number {
    font-size: 2rem;
    font-weight: 900;
    margin: 8px 0;
    line-height: 1;
}

.muted {
    color: #a99ab7;
}

.progress-wrap {
    background: rgba(255,255,255,0.08);
    height: 13px;
    border-radius: 999px;
    overflow: hidden;
    margin: 12px 0;
}

.progress-bar {
    height: 100%;
    width: 0;
    background: linear-gradient(135deg, #9c4dff, #ff4db8);
    border-radius: 999px;
}

.button,
button {
    border: none;
    cursor: pointer;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding: 11px 15px;
    border-radius: 999px;
    background: linear-gradient(135deg, #9c4dff, #ff4db8);
    color: white;
    font-weight: 700;
    font-size: 0.95rem;
    box-shadow: 0 10px 26px rgba(255, 77, 184, 0.24);
    min-height: 42px;
}

.button.secondary,
button.secondary {
    background: rgba(255,255,255,0.08);
    box-shadow: none;
}

.button.danger,
button.danger {
    background: linear-gradient(135deg, #ff704d, #ff3f7f);
}

.form {
    display: grid;
    gap: 14px;
}

label {
    display: grid;
    gap: 7px;
    color: #e8d9f5;
    font-weight: 650;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.07);
    color: #fff;
    border-radius: 14px;
    padding: 12px;
    outline: none;
    font-size: 1rem;
}

select {
    background-color: rgba(20, 17, 32, 0.95);
    color: #ffffff;
    border: 1px solid rgba(255,255,255,0.15);
    background-image: url("data:image/svg+xml;utf8,<svg fill='white' height='24' viewBox='0 0 24 24' width='24'><path d='M7 10l5 5 5-5z'/></svg>");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px;
    padding-right: 34px;
    appearance: none;
}

select option {
    background: #1a1626;
    color: #ffffff;
}

textarea {
    min-height: 100px;
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #ff4db8;
    box-shadow: 0 0 0 3px rgba(255, 77, 184, 0.14);
}

.login-wrap {
    max-width: 430px;
    margin: 8vh auto;
}

.alert {
    padding: 12px 14px;
    border-radius: 15px;
    margin-bottom: 14px;
}

.alert.error {
    background: rgba(255, 77, 110, 0.15);
    color: #ffc2d0;
    border: 1px solid rgba(255, 77, 110, 0.28);
}

.alert.success {
    background: rgba(80, 255, 170, 0.12);
    color: #baffdc;
    border: 1px solid rgba(80, 255, 170, 0.24);
}

.exercise-list {
    display: grid;
    gap: 12px;
}

.exercise-item {
    display: grid;
    gap: 12px;
    padding: 14px;
    border-radius: 18px;
    background: rgba(255,255,255,0.055);
    border: 1px solid rgba(255,255,255,0.08);
}

.exercise-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
}

.exercise-name {
    font-weight: 850;
    font-size: 1.05rem;
}

.badge {
    display: inline-flex;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 800;
    flex: 0 0 auto;
}

.badge.done {
    background: rgba(74, 255, 167, 0.15);
    color: #9affce;
}

.badge.skipped {
    background: rgba(255, 170, 74, 0.15);
    color: #ffd59a;
}

.badge.open {
    background: rgba(255,255,255,0.09);
    color: #d6c9e4;
}

.inline-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chart-card {
    height: 390px;
    position: relative;
    overflow: hidden;
}

.chart-box {
    position: relative;
    height: 300px;
    width: 100%;
}

.chart-box canvas {
    width: 100% !important;
    height: 100% !important;
    display: block;
}

.exercise-guide {
    margin-top: 12px;
    display: grid;
    gap: 10px;
    background: rgba(255,255,255,0.03);
    padding: 10px;
    border-radius: 16px;
}

.exercise-media {
    width: 100%;
    height: 220px;
    object-fit: contain;
    object-position: center;
    border-radius: 16px;
    background: rgba(255,255,255,0.06);
    padding: 10px;
}

.exercise-description {
    margin: 0;
    color: #dbcdec;
    line-height: 1.5;
    font-size: 0.95rem;
    background: rgba(255,255,255,0.045);
    border-left: 3px solid #ff4db8;
    padding: 10px 12px;
    border-radius: 12px;
}

.week-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 12px;
    margin-top: 14px;
}

.week-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 210px;
    padding: 14px;
    border-radius: 18px;
    background: rgba(255,255,255,0.055);
    border: 1px solid rgba(255,255,255,0.09);
    transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
    min-width: 0;
}

.week-card:hover {
    transform: translateY(-3px);
    border-color: rgba(255, 77, 184, 0.45);
    box-shadow: 0 14px 30px rgba(0,0,0,0.28);
}

.week-card.today {
    border-color: rgba(255, 77, 184, 0.75);
    box-shadow: 0 0 24px rgba(255, 77, 184, 0.18);
}

.week-card.done {
    background: rgba(74, 255, 167, 0.08);
}

.week-card.partial {
    background: rgba(255, 190, 80, 0.08);
}

.week-card.open {
    background: rgba(255,255,255,0.045);
}

.week-card.rest {
    background: rgba(160, 120, 255, 0.08);
}

.week-card-top {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    align-items: center;
}

.week-date {
    color: #a99ab7;
    font-size: 0.85rem;
}

.week-card h3 {
    margin: 4px 0 0;
    font-size: 1rem;
    line-height: 1.2;
}

.week-card p {
    margin: 0;
    color: #cdbdda;
    font-size: 0.88rem;
    line-height: 1.35;
}

.week-alt {
    font-size: 0.85rem;
    color: #ffd1ec;
    background: rgba(255, 77, 184, 0.1);
    padding: 7px 9px;
    border-radius: 12px;
}

.week-meta {
    color: #a99ab7;
    font-size: 0.82rem;
}

.week-status {
    margin-top: auto;
    display: inline-flex;
    justify-content: center;
    padding: 7px 9px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 800;
    background: rgba(255,255,255,0.08);
}

.mini-badge {
    font-size: 0.72rem;
    font-weight: 900;
    padding: 5px 7px;
    border-radius: 999px;
    background: linear-gradient(135deg, #9c4dff, #ff4db8);
}

.progress-wrap.small {
    height: 8px;
    margin: 2px 0;
}

@media (max-width: 1050px) {
    .week-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 780px) {
    body {
        background:
            radial-gradient(circle at top left, rgba(180, 80, 255, 0.14), transparent 45%),
            radial-gradient(circle at bottom right, rgba(255, 80, 180, 0.10), transparent 45%),
            #08070d;
    }

    .topbar {
        padding: 12px 12px 10px;
    }

    .brand {
        margin-bottom: 10px;
        font-size: 1.05rem;
    }

    .nav {
        gap: 7px;
        padding-bottom: 4px;
        margin-left: -2px;
        margin-right: -2px;
    }

    .nav a {
        font-size: 0.82rem;
        padding: 8px 10px;
    }

    .container {
        padding: 18px 12px 40px;
    }

    .hero {
        margin-bottom: 16px;
    }

    .hero h1 {
        font-size: 1.75rem;
    }

    .hero p {
        font-size: 0.95rem;
    }

    .grid-2,
    .grid-3 {
        grid-template-columns: 1fr;
    }

    .grid {
        gap: 12px;
    }

    .card {
        padding: 14px;
        border-radius: 18px;
    }

    .card h2 {
        font-size: 1.25rem;
    }

    .card h3 {
        font-size: 1.05rem;
    }

    .stat-number {
        font-size: 1.65rem;
    }

    .button,
    button {
        width: 100%;
        padding: 12px 14px;
    }

    .inline-actions {
        display: grid;
        grid-template-columns: 1fr;
        width: 100%;
    }

    .exercise-head {
        flex-direction: column;
        align-items: stretch;
    }

    .badge {
        align-self: flex-start;
    }

    .exercise-media {
        height: 190px;
        padding: 8px;
    }

    .chart-card {
        height: 330px;
    }

    .chart-box {
        height: 245px;
    }

    .week-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .week-card {
        min-height: auto;
        padding: 13px;
        gap: 7px;
    }

    .week-card h3 {
        font-size: 1rem;
    }

    .week-status {
        margin-top: 4px;
    }

    .footer {
        padding: 16px 12px 24px;
    }
}

@media (max-width: 430px) {
    .container {
        padding: 16px 10px 36px;
    }

    .topbar {
        padding: 10px;
    }

    .nav a {
        font-size: 0.78rem;
        padding: 7px 9px;
    }

    .card {
        padding: 13px;
        border-radius: 16px;
    }

    .hero h1 {
        font-size: 1.55rem;
    }

    input,
    select,
    textarea {
        padding: 11px;
        border-radius: 13px;
    }

    .exercise-item {
        padding: 12px;
        border-radius: 16px;
    }

    .exercise-media {
        height: 170px;
    }

    .chart-card {
        height: 310px;
    }

    .chart-box {
        height: 225px;
    }
}