* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    -webkit-user-select: none;
    user-select: none;
}

html {
    height: 100%;
    width: 100%;
    -webkit-touch-callout: none;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #e4f4f8;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    display: flex;
    justify-content: center;
    align-items: center;
    position: fixed;
}

#app {
    width: 100%;
    height: 100vh;
    max-width: 430px;
    display: flex;
    flex-direction: column;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    position: relative;
}

.header {
    background: linear-gradient(135deg, #ff4081 0%, #ff6b9d 100%);
    padding: 16px;
    text-align: center;
    color: #1a1a2e;
    font-size: 28px;
    font-weight: 700;
    letter-spacing: 2px;
    box-shadow: 0 8px 24px rgba(255, 107, 157, 0.3);
    flex-shrink: 0;
    position: relative;
    z-index: 10;
}

.container {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding-bottom: 70px;
    -webkit-overflow-scrolling: touch;
}

.screen {
    display: none;
    padding: 0;
    animation: fadeIn 0.3s ease;
    min-height: 100%;
}

.screen.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Home Screen */
.home-screen {
    padding: 20px;
}

.welcome-title {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 8px;
    color: #ff6b9d;
}

.welcome-subtitle {
    color: #a0aec0;
    margin-bottom: 20px;
    font-size: 14px;
}

.stats-card {
    background: linear-gradient(135deg, #16213e 0%, #0f3460 100%);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 16px;
    border: 2px solid #ff6b9d;
    display: flex;
    justify-content: space-around;
    align-items: center;
    box-shadow: 0 8px 24px rgba(255, 107, 157, 0.15);
}

.stat-item {
    text-align: center;
}

.stat-label {
    color: #a0aec0;
    font-size: 12px;
    margin-bottom: 4px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #ff6b9d;
}

.btn-start {
    background: linear-gradient(135deg, #ff6b9d 0%, #ff4081 100%);
    color: #1a1a2e;
    border: none;
    padding: 18px;
    border-radius: 16px;
    font-size: 16px;
    font-weight: 700;
    width: 100%;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 16px rgba(255, 107, 157, 0.3);
    margin-bottom: 12px;
    active-color: #1a1a2e;
}

.btn-start:active {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(255, 107, 157, 0.4);
}

.exercise-card {
    background: linear-gradient(135deg, #16213e 0%, #0f3460 100%);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 16px;
    border-left: 4px solid #ff6b9d;
}

.section-title {
    font-size: 14px;
    font-weight: 700;
    color: #ff6b9d;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.section-content {
    color: #a0aec0;
    line-height: 1.6;
    font-size: 14px;
}

/* Workout Screen */
.workout-list {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.workout-card {
    background: linear-gradient(135deg, #16213e 0%, #0f3460 100%);
    border-radius: 16px;
    padding: 16px;
    border: 2px solid #ff6b9d;
    cursor: pointer;
    transition: all 0.3s ease;
    active-opacity: 0.8;
}

.workout-card:active {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(255, 107, 157, 0.2);
}

.workout-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.workout-title {
    font-weight: 700;
    font-size: 16px;
}

.xp-badge {
    background: #f59e0b;
    color: #1a1a2e;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}

.workout-desc {
    color: #a0aec0;
    font-size: 13px;
    margin-bottom: 10px;
}

.workout-meta {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: #a0aec0;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Exercise Detail */
.exercise-detail {
    padding: 20px;
}

.back-btn {
    background: #0f3460;
    border: none;
    color: #ff6b9d;
    padding: 10px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    margin-bottom: 20px;
    transition: all 0.3s;
    font-weight: 600;
}

.back-btn:active {
    background: #16213e;
    transform: translateX(-4px);
}

.exercise-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 12px;
    color: #ff6b9d;
}

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

.benefit-item {
    display: flex;
    gap: 8px;
    font-size: 14px;
}

.benefit-item::before {
    content: '✓';
    color: #10b981;
    font-weight: 700;
    flex-shrink: 0;
}

.timer-section {
    background: linear-gradient(135deg, #ff6b9d 0%, #ff4081 100%);
    border-radius: 16px;
    padding: 24px;
    text-align: center;
    color: #1a1a2e;
    margin-bottom: 16px;
}

.timer-display {
    font-size: 48px;
    font-weight: 700;
    margin-bottom: 16px;
    font-family: 'Monaco', 'Courier New', monospace;
}

.timer-controls {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-timer {
    background: #1a1a2e;
    color: #ff6b9d;
    border: 2px solid #ff6b9d;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-timer:active {
    background: #ff6b9d;
    color: #1a1a2e;
}

.btn-complete {
    background: #10b981;
    color: white;
    border: none;
    padding: 18px;
    border-radius: 16px;
    font-size: 16px;
    font-weight: 700;
    width: 100%;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-complete:active {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(16, 185, 129, 0.3);
}

/* Progress Screen */
.progress-screen {
    padding: 20px;
}

.progress-stat {
    background: linear-gradient(135deg, #16213e 0%, #0f3460 100%);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 12px;
    border: 2px solid #ff6b9d;
}

.progress-bar-container {
    width: 100%;
    height: 8px;
    background: #0f3460;
    border-radius: 10px;
    overflow: hidden;
    margin-top: 8px;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #ff6b9d, #00d4ff);
    border-radius: 10px;
    transition: width 0.5s ease;
}

.achievements {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-top: 16px;
}

.achievement {
    background: linear-gradient(135deg, #16213e 0%, #0f3460 100%);
    border-radius: 16px;
    padding: 16px;
    text-align: center;
    border: 2px solid #0f3460;
}

.achievement.unlocked {
    border-color: #f59e0b;
}

.achievement-icon {
    font-size: 32px;
    margin-bottom: 8px;
}

.achievement-name {
    font-size: 12px;
    font-weight: 700;
}

/* Settings Screen */
.settings-screen {
    padding: 20px;
}

.setting-item {
    background: linear-gradient(135deg, #16213e 0%, #0f3460 100%);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 2px solid #0f3460;
}

.setting-label {
    font-weight: 600;
}

.toggle-switch {
    width: 48px;
    height: 24px;
    background: #0f3460;
    border-radius: 12px;
    position: relative;
    cursor: pointer;
    transition: background 0.3s;
}

.toggle-switch.active {
    background: #ff6b9d;
}

.toggle-switch::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: left 0.3s;
}

.toggle-switch.active::after {
    left: 26px;
}

.btn-reset {
    background: #ef4444;
    color: white;
    border: none;
    padding: 14px;
    border-radius: 16px;
    font-size: 14px;
    font-weight: 700;
    width: 100%;
    cursor: pointer;
    margin-top: 20px;
    transition: all 0.3s;
}

.btn-reset:active {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(239, 68, 68, 0.3);
}

.info-text {
    color: #a0aec0;
    font-size: 12px;
    margin-top: 12px;
    text-align: center;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: #16213e;
    border-radius: 16px;
    padding: 24px;
    width: 90%;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    border: 2px solid #ff6b9d;
}

.modal-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 12px;
    color: #ff6b9d;
}

.modal-desc {
    color: #a0aec0;
    margin-bottom: 20px;
    font-size: 14px;
}

/* Nav Bottom */
.nav-bottom {
    display: flex;
    gap: 8px;
    padding: 12px;
    background: #16213e;
    border-top: 1px solid #0f3460;
    position: fixed;
    bottom: 0;
    width: 100%;
    max-width: 430px;
    z-index: 100;
}

.nav-btn {
    flex: 1;
    padding: 12px;
    background: #0f3460;
    border: none;
    color: #e4f4f8;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.nav-btn:active {
    background: #ff6b9d;
    color: #1a1a2e;
    transform: translateY(-2px);
}

.nav-btn.active {
    background: linear-gradient(135deg, #ff6b9d 0%, #ff4081 100%);
    color: #1a1a2e;
    box-shadow: 0 8px 16px rgba(255, 107, 157, 0.4);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #16213e;
}

::-webkit-scrollbar-thumb {
    background: #ff6b9d;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #ff4081;
}

/* Responsivo */
@media (max-height: 600px) {
    .container {
        padding-bottom: 70px;
    }

    .timer-display {
        font-size: 36px;
    }
}

@supports (padding: max(0px)) {
    body {
        padding-left: max(12px, env(safe-area-inset-left));
        padding-right: max(12px, env(safe-area-inset-right));
        padding-top: max(12px, env(safe-area-inset-top));
        padding-bottom: max(12px, env(safe-area-inset-bottom));
    }
}
