*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    background: linear-gradient(135deg, #ff6b6b 0%, #4ecdc4 100%);
    color: #333;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}
header {
    background: linear-gradient(135deg, #ff4757 0%, #3742fa 100%);
    color: white;
    text-align: center;
    padding: 2rem;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}
header h1 {
    margin: 0;
    font-size: 2.5rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}
.container {
    display: flex;
    flex: 1;
    max-width: 1200px;
    margin: 2rem auto;
    padding: 2rem;
    background-color: rgba(255,255,255,0.95);
    border-radius: 12px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.1);
    gap: 2rem;
}
.content {
    flex: 2;
}
.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}
.tab {
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    border: none;
    border-radius: 25px;
    font-weight: bold;
    transition: transform 0.2s, box-shadow 0.2s;
}
.tab:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}
.tab.active {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}
.tab-content {
    display: none;
}
.tab-content.active {
    display: block;
}
.exercise-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}
.exercise-card {
    background: white;
    border-radius: 12px;
    padding: 1rem;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    transition: transform 0.2s, box-shadow 0.2s;
    text-align: center;
}
.exercise-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
}
.exercise-icon {
    width: 50px;
    height: 50px;
    margin: 0 auto 0.5rem;
    fill: #ff4757;
}
.exercise-card h3 {
    margin: 0.5rem 0;
    color: #3742fa;
}
.motivation {
    font-style: italic;
    color: #666;
    margin-top: 0.5rem;
}
h2 {
    color: #3742fa;
    text-align: center;
    margin-bottom: 1rem;
    font-size: 2rem;
}
p {
    line-height: 1.6;
    text-align: center;
}
footer {
    text-align: center;
    padding: 1rem;
    background: linear-gradient(135deg, #ff4757 0%, #3742fa 100%);
    color: white;
    margin-top: auto;
}
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.7);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}
.modal.show {
    display: flex;
}
.modal-content {
    background: white;
    border-radius: 20px;
    padding: 2rem;
    max-width: 500px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    animation: slideIn 0.3s ease-out;
    position: relative;
}
@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}
.exercise-image {
    width: 120px;
    height: 120px;
    margin: 0 auto 1rem;
}
.timer-display {
    font-size: 4rem;
    font-weight: bold;
    color: #ff4757;
    margin: 1rem 0;
    font-family: 'Courier New', monospace;
}
.timer-buttons {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    justify-content: center;
}
.timer-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 10px;
    font-weight: bold;
    cursor: pointer;
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    transition: transform 0.2s;
}
.timer-btn:hover {
    transform: scale(1.05);
}
.timer-btn.stop {
    background: linear-gradient(135deg, #ff6b6b 0%, #ff4757 100%);
}
.close-modal {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 2rem;
    cursor: pointer;
    color: #666;
}
.close-modal:hover {
    color: #ff4757;
}
.exercise-card {
    cursor: pointer;
}
.banner,
.cardio-banner {
    position: relative;
    width: 100%;
    height: 300px;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 2rem;
    box-shadow: 0 8px 16px rgba(0,0,0,0.15);
}
.banner-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.banner-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(255, 71, 87, 0.4) 0%, rgba(55, 66, 250, 0.4) 100%);
}
.banner-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: white;
    width: 100%;
    padding: 2rem;
}
.banner-text h2 {
    color: white;
    font-size: 2.5rem;
    margin: 0 0 0.5rem 0;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}
.banner-text p {
    color: white;
    font-size: 1.1rem;
    margin: 0;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.5);
}

/* ── Übungsauswahl & Transfer ── */
.exercise-card {
    position: relative;
}
.card-select-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 2px solid #c0c4e0;
    background: white;
    cursor: pointer;
    font-size: 0.9rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, border-color 0.15s;
    z-index: 2;
    padding: 0;
    color: #aaa;
}
.card-select-btn.active {
    background: #c4878f;
    border-color: #c4878f;
    color: white;
}
.exercise-card.card-selected {
    outline: 3px solid #c4878f;
    box-shadow: 0 0 0 4px rgba(196,135,143,0.2);
}
.select-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    padding: 0.85rem 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    align-items: center;
    box-shadow: 0 -4px 16px rgba(0,0,0,0.15);
    transform: translateY(100%);
    transition: transform 0.3s ease;
    z-index: 600;
}
.select-panel.show {
    transform: translateY(0);
}
.select-count {
    font-weight: bold;
    color: #c4878f;
    flex: 1 1 100%;
    font-size: 0.9rem;
}
.select-day-pick {
    flex: 1 1 140px;
    background-image: none;
    padding-right: 0.75rem;
}
.select-confirm-btn,
.select-cancel-btn {
    padding: 0.6rem 1.1rem;
    font-size: 0.88rem;
}

/* ── Trainingsplan ── */
.plan-table-wrapper {
    overflow-x: auto;
    margin-bottom: 1.5rem;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}
.plan-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 10px;
    overflow: hidden;
}
.plan-table thead tr {
    background: linear-gradient(135deg, #c4878f 0%, #d4a0a8 100%);
    color: white;
}
.plan-table th {
    padding: 0.85rem 1rem;
    text-align: left;
    font-size: 0.95rem;
    font-weight: bold;
}
.plan-table tbody tr:nth-child(odd) {
    background: #fdf5f6;
}
.plan-table tbody tr:nth-child(even) {
    background: #fff;
}
.plan-table tbody tr:hover {
    background: #f5e6e8;
}
.plan-table td {
    padding: 0.6rem 0.75rem;
    vertical-align: top;
}
.day-label {
    font-weight: bold;
    color: #c4878f;
    white-space: nowrap;
    width: 110px;
    vertical-align: middle !important;
}
.plan-input {
    width: 100%;
    min-height: 60px;
    border: 1.5px solid #e0e3f0;
    border-radius: 8px;
    padding: 0.5rem;
    font-family: inherit;
    font-size: 0.88rem;
    color: #333;
    resize: vertical;
    transition: border-color 0.2s;
}
.plan-input:focus {
    outline: none;
    border-color: #c4878f;
}
.plan-select {
    width: 100%;
    padding: 0.55rem 0.75rem;
    border: 1.5px solid #e0e3f0;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.88rem;
    color: #333;
    background: white;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23c4878f' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2rem;
    transition: border-color 0.2s;
}
.plan-select:focus {
    outline: none;
    border-color: #c4878f;
}
.plan-select-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.plan-select-sub {
    border-color: #c8ccf0;
    color: #888;
    background-color: #f5f6ff;
    min-height: 42px;
}
.plan-select-sub:not([disabled]) {
    color: #333;
    background-color: white;
    border-color: #e0e3f0;
    min-height: unset;
    height: auto;
}
.plan-select-sub:not([disabled]):focus {
    border-color: #c4878f;
}
.plan-select-sub option {
    padding: 0.3rem 0.5rem;
}
.plan-select-hint {
    font-size: 0.72rem;
    color: #999;
    margin-top: 0.2rem;
    display: none;
}
.plan-select-sub:not([disabled]) + .plan-select-hint {
    display: block;
}
.plan-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 0.5rem;
}
.plan-btn {
    padding: 0.75rem 2rem;
    border: none;
    border-radius: 25px;
    font-weight: bold;
    font-size: 1rem;
    cursor: pointer;
    background: linear-gradient(135deg, #c4878f 0%, #d4a0a8 100%);
    color: white;
    transition: transform 0.2s, box-shadow 0.2s;
}
.plan-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}
.plan-btn-reset {
    background: linear-gradient(135deg, #b06060 0%, #c47070 100%);
}

/* ── Tablet ── */
@media (max-width: 768px) {
    header {
        padding: 1rem;
    }
    header h1 {
        font-size: 1.6rem;
    }
    .container {
        margin: 0.75rem;
        padding: 1rem;
        border-radius: 8px;
        width: calc(100% - 1.5rem);
    }
    .tabs {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.4rem;
    }
    .tab {
        padding: 0.6rem 0.9rem;
        font-size: 0.82rem;
        border-radius: 20px;
        text-align: center;
    }
    .exercise-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .banner,
    .cardio-banner {
        height: 200px;
    }
    .banner-text h2 {
        font-size: 1.6rem;
    }
    .banner-text p {
        font-size: 0.95rem;
    }
    h2 {
        font-size: 1.5rem;
    }
    .modal-content {
        width: 90vw;
        max-width: 90vw;
        padding: 1.25rem;
    }
    .timer-display {
        font-size: 3rem;
    }
}

/* ── Smartphone ── */
@media (max-width: 480px) {
    header {
        padding: 0.85rem 0.75rem;
    }
    header h1 {
        font-size: 1.25rem;
    }
    .container {
        margin: 0.5rem;
        padding: 0.75rem;
        width: calc(100% - 1rem);
        border-radius: 8px;
    }
    .tabs {
        justify-content: center;
        gap: 0.35rem;
    }
    .tab {
        padding: 0.55rem 0.75rem;
        font-size: 0.75rem;
        border-radius: 16px;
    }
    .exercise-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    .exercise-card {
        padding: 0.85rem;
    }
    .banner,
    .cardio-banner {
        height: 160px;
        margin-bottom: 1rem;
        border-radius: 8px;
    }
    .banner-text {
        padding: 0.75rem;
    }
    .banner-text h2 {
        font-size: 1.2rem;
        margin-bottom: 0.25rem;
    }
    .banner-text p {
        font-size: 0.82rem;
    }
    h2 {
        font-size: 1.3rem;
    }
    p {
        font-size: 0.9rem;
    }
    .modal-content {
        width: 95vw;
        max-width: 95vw;
        padding: 1rem;
        border-radius: 12px;
        margin: 0 auto;
    }
    .timer-display {
        font-size: 2.5rem;
        margin: 0.75rem 0;
    }
    .timer-buttons {
        flex-wrap: wrap;
        gap: 0.5rem;
        margin-top: 1rem;
    }
    .timer-btn {
        padding: 0.6rem 0.9rem;
        font-size: 0.85rem;
        flex: 1 1 auto;
    }
    footer {
        padding: 0.75rem;
        font-size: 0.82rem;
    }
    .plan-table thead {
        display: none;
    }
    .plan-table tbody tr {
        display: block;
        margin-bottom: 0.75rem;
        border-radius: 10px;
        overflow: hidden;
        box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    }
    .plan-table td {
        display: block;
        width: 100%;
        padding: 0.5rem 0.75rem;
    }
    .plan-table td::before {
        content: attr(data-label);
        display: block;
        font-size: 0.72rem;
        color: #888;
        text-transform: uppercase;
        margin-bottom: 0.25rem;
    }
    .day-label {
        background: linear-gradient(135deg, #c4878f 0%, #d4a0a8 100%);
        color: white !important;
        font-size: 1rem;
        padding: 0.6rem 0.75rem;
        width: 100%;
    }
    .plan-buttons {
        flex-direction: column;
        gap: 0.5rem;
    }
    .plan-btn {
        width: 100%;
        padding: 0.7rem;
    }
}
