* {
    box-sizing: border-box;
}

.train-container {
    min-height: 100vh;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: white;
    display: flex;
    flex-direction: column;
    position: relative;
    align-items: center;
    padding: 0 2rem;
    max-width: 900px;
    margin: 0 auto;
}

.train-container.paused {
    background: linear-gradient(135deg, #2d2d44 0%, #1f1f3a 100%);
}

.countdown-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.countdown-number {
    font-size: 8rem;
    font-weight: 700;
    animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.countdown-text {
    font-size: 1.5rem;
    color: rgba(255,255,255,0.7);
    margin-top: 1rem;
}

.train-header {
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.progress-info {
    flex: 1;
    margin-right: 1rem;
}

.progress-text {
    font-size: 0.9rem;
    color: rgba(255,255,255,0.7);
    display: block;
    margin-bottom: 0.5rem;
}

.progress-bar {
    height: 6px;
    background: rgba(255,255,255,0.2);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: #4F46E5;
    transition: width 0.3s;
}

.total-time {
    background: rgba(255,255,255,0.1);
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: 1.2rem;
    font-weight: 600;
}

.train-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    padding-bottom: 140px;
}

.exercise-display {
    text-align: center;
    margin-bottom: 2rem;
}

.exercise-name {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.exercise-set {
    font-size: 1.2rem;
    color: rgba(255,255,255,0.8);
}

.timer-display {
    text-align: center;
    margin-bottom: 1rem;
}

.timer-value {
    font-size: 6rem;
    font-weight: 700;
    line-height: 1;
}

.timer-unit {
    font-size: 1.5rem;
    color: rgba(255,255,255,0.7);
    display: block;
    margin-top: 0.5rem;
}

.phase-indicator {
    background: rgba(255,255,255,0.1);
    padding: 0.5rem 1.5rem;
    border-radius: 2rem;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.next-preview {
    background: rgba(255,255,255,0.05);
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    text-align: center;
    margin-top: 1rem;
}

.next-label {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.5);
    display: block;
}

.next-name {
    font-size: 1.1rem;
    display: block;
    margin: 0.25rem 0;
}

.next-info {
    font-size: 0.85rem;
    color: rgba(255,255,255,0.6);
    display: block;
}

.train-sidebar {
    width: 100%;
    max-width: 600px;
    padding: 1.5rem;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 1rem;
    margin-top: 1rem;
}

.sidebar-section {
    margin-bottom: 1.5rem;
}

.sidebar-section h3 {
    font-size: 1rem;
    margin-bottom: 0.75rem;
    color: rgba(255,255,255,0.7);
}

.technique-text, .breathing-text {
    font-size: 0.9rem;
    line-height: 1.6;
    opacity: 0.9;
}

.caution-section {
    background: rgba(239, 68, 68, 0.1);
    padding: 1rem;
    border-radius: 0.5rem;
}

.caution-text {
    color: #FCA5A5;
}

.train-footer {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    padding: 1rem !important;
    display: flex !important;
    gap: 0.75rem !important;
    justify-content: center !important;
    background: rgba(26, 26, 46, 0.98) !important;
    border-top: 1px solid rgba(255,255,255,0.15) !important;
    z-index: 9999 !important;
    padding-bottom: calc(1rem + env(safe-area-inset-bottom)) !important;
    backdrop-filter: blur(10px) !important;
}

.train-footer.hidden {
    display: none !important;
}

.train-footer .btn {
    flex: 1;
    max-width: 150px;
    min-height: 52px !important;
    font-size: 1rem !important;
    font-weight: 600 !important;
    border-radius: 0.75rem !important;
    border-width: 2px !important;
}

.train-footer .btn-secondary {
    background: rgba(255, 255, 255, 0.1) !important;
    color: white !important;
    border-color: rgba(255, 255, 255, 0.3) !important;
}

.train-footer .btn-primary {
    background: #4F46E5 !important;
    color: white !important;
    border-color: #4F46E5 !important;
}

.train-footer .btn-outline {
    background: transparent !important;
    color: white !important;
    border-color: rgba(255, 255, 255, 0.5) !important;
}

.train-footer .btn.paused {
    background: var(--warning);
}

.rest-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(16, 185, 129, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.rest-content {
    text-align: center;
    color: white;
    padding: 0 1.5rem;
}

.rest-content h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.rest-timer {
    margin-bottom: 2rem;
}

.rest-timer span {
    display: block;
}

#restTimerValue {
    font-size: 6rem;
    font-weight: 700;
    line-height: 1;
}

.rest-unit {
    font-size: 1.5rem;
    opacity: 0.8;
}

.next-exercise {
    font-size: 1.2rem;
    margin-bottom: 2rem;
    opacity: 0.9;
}

.complete-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 1rem;
}

.modal-content {
    background: white;
    color: var(--gray-900);
    border-radius: 1.5rem;
    padding: 1.5rem;
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.celebration {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.summary-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin: 1.5rem 0;
}

.summary-item {
    background: var(--gray-50);
    padding: 1rem;
    border-radius: 0.75rem;
}

.summary-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

.summary-label {
    color: var(--gray-500);
    font-size: 0.9rem;
}

.form-group {
    text-align: left;
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: 0.5rem;
    font-size: 1rem;
    resize: vertical;
    min-height: 80px;
}

.mobile-detail-btn {
    display: none;
}

.mobile-detail-modal {
    display: none;
}

/* 可选动作选择界面样式 */
.options-select-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.95);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 1rem;
    overflow-y: auto;
}

.options-select-content {
    width: 100%;
    max-width: 500px;
    background: #1a1a2e;
    border-radius: 1.5rem;
    padding: 1.5rem;
    border: 1px solid rgba(255,255,255,0.1);
}

.options-select-content h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    text-align: center;
}

.options-hint {
    color: rgba(255,255,255,0.6);
    text-align: center;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.options-groups {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.option-group {
    background: rgba(255,255,255,0.03);
    border-radius: 1rem;
    padding: 1rem;
}

.option-group h3 {
    font-size: 1rem;
    color: rgba(255,255,255,0.8);
    margin-bottom: 1rem;
    font-weight: 500;
}

.option-cards {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.option-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: rgba(255,255,255,0.05);
    border: 2px solid rgba(255,255,255,0.1);
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
}

.option-card:hover {
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.2);
}

.option-card.selected {
    background: rgba(79, 70, 229, 0.2);
    border-color: #4F46E5;
}

.option-radio {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
}

.option-card.selected .option-radio {
    background: #4F46E5;
    border-color: #4F46E5;
}

.option-radio span {
    font-size: 0.8rem;
    color: white;
    font-weight: 700;
}

.option-info {
    flex: 1;
    min-width: 0;
}

.option-info h4 {
    font-size: 1rem;
    margin-bottom: 0.25rem;
    font-weight: 600;
}

.option-info p {
    font-size: 0.85rem;
    color: rgba(255,255,255,0.6);
    margin: 0;
}

.option-info .caution-hint {
    font-size: 0.75rem;
    color: #FCA5A5;
    margin-top: 0.3rem;
}

.options-select-content .btn-primary {
    width: 100%;
    margin-top: 1.5rem;
    padding: 1rem;
    font-size: 1.1rem;
    font-weight: 600;
    background: #4F46E5;
    border-color: #4F46E5;
    color: white;
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
}

.options-select-content .btn-primary:disabled {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.2);
    color: rgba(255,255,255,0.4);
    cursor: not-allowed;
}

.options-select-content .btn-primary:not(:disabled):hover {
    background: #4338CA;
    border-color: #4338CA;
}

.estimated-duration {
    background: rgba(79, 70, 229, 0.15);
    border: 1px solid rgba(79, 70, 229, 0.3);
    border-radius: 0.75rem;
    padding: 0.75rem 1rem;
    margin-top: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.estimated-duration .duration-label {
    font-size: 0.9rem;
    color: rgba(255,255,255,0.7);
}

.estimated-duration .duration-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: #818CF8;
}

@media (max-width: 768px) {
    .train-header {
        padding: 0.75rem;
    }

    .progress-text {
        font-size: 0.8rem;
    }

    .total-time {
        font-size: 1rem;
        padding: 0.4rem 0.75rem;
    }

    .train-main {
        padding: 1rem;
        padding-bottom: 120px;
    }

    .exercise-name {
        font-size: 1.3rem;
        margin-bottom: 0.3rem;
    }

    .exercise-set {
        font-size: 1rem;
    }

    .timer-value {
        font-size: 4rem;
    }

    .timer-unit {
        font-size: 1.2rem;
        margin-top: 0.3rem;
    }

    .phase-indicator {
        font-size: 0.8rem;
        padding: 0.3rem 1rem;
        margin-bottom: 0.5rem;
    }

    .train-sidebar {
        display: none !important;
    }

    .next-preview {
        padding: 0.5rem;
        margin-top: 0.5rem;
    }

    .next-label {
        font-size: 0.65rem;
    }

    .next-name {
        font-size: 0.9rem;
    }

    .next-info {
        font-size: 0.7rem;
    }

    .train-footer {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        padding: 0.75rem !important;
        gap: 0.5rem !important;
        padding-bottom: calc(0.75rem + env(safe-area-inset-bottom)) !important;
        z-index: 9999 !important;
        display: flex !important;
        justify-content: center !important;
    }

    .train-footer .btn {
        flex: 1;
        min-width: 70px;
        max-width: 110px;
        min-height: 48px;
        font-size: 0.75rem;
        padding: 0.75rem 0.5rem;
    }

    .mobile-detail-btn {
        display: flex;
        position: fixed;
        bottom: 110px;
        right: 15px;
        width: 56px;
        height: 56px;
        border-radius: 50%;
        background: rgba(79, 70, 229, 0.9);
        border: none;
        color: white;
        cursor: pointer;
        z-index: 50;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
    }

    .mobile-detail-btn .detail-icon {
        font-size: 1.3rem;
    }

    .mobile-detail-btn .detail-text {
        font-size: 0.65rem;
        margin-top: 2px;
    }

    .mobile-detail-modal {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.85);
        z-index: 200;
        display: none;
        flex-direction: column;
        justify-content: flex-end;
        padding-bottom: 80px;
    }

    .mobile-detail-content {
        background: #1a1a2e;
        border-radius: 1.5rem 1.5rem 0 0;
        padding: 1.25rem;
        padding-bottom: calc(1.25rem + env(safe-area-inset-bottom));
        max-height: 85vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .mobile-detail-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 1rem;
        padding-bottom: 0.75rem;
        border-bottom: 1px solid rgba(255,255,255,0.1);
        position: sticky;
        top: 0;
        background: #1a1a2e;
        z-index: 10;
    }

    .mobile-detail-header h3 {
        font-size: 1rem;
        flex: 1;
        padding-right: 1rem;
    }

    .close-detail-btn {
        background: none;
        border: none;
        color: rgba(255,255,255,0.7);
        font-size: 1.5rem;
        cursor: pointer;
        width: 32px;
        height: 32px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
    }

    .close-detail-btn:active {
        background: rgba(255,255,255,0.1);
    }

    .detail-section {
        margin-bottom: 1rem;
        padding: 0.75rem;
        background: rgba(255,255,255,0.03);
        border-radius: 0.75rem;
    }

    .detail-section h4 {
        font-size: 0.8rem;
        color: rgba(255,255,255,0.6);
        margin-bottom: 0.4rem;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

    .detail-section p {
        font-size: 0.9rem;
        line-height: 1.5;
        opacity: 0.95;
    }

    .detail-section.caution {
        background: rgba(239, 68, 68, 0.15);
        padding: 0.75rem;
        border-radius: 0.75rem;
        border-left: 3px solid #EF4444;
    }

    .detail-section.caution h4 {
        color: #FCA5A5;
    }

    .detail-section.caution p {
        color: #FCA5A5;
    }

    .rest-content h2 {
        font-size: 1.5rem;
    }

    #restTimerValue {
        font-size: 4.5rem;
    }

    .complete-modal {
        padding: 0.5rem;
    }

    .modal-content {
        padding: 1.25rem;
        border-radius: 1.25rem;
    }

    .celebration {
        font-size: 3rem;
        margin-bottom: 0.75rem;
    }

    .summary-stats {
        gap: 0.75rem;
        margin: 1rem 0;
    }

    .summary-value {
        font-size: 1.25rem;
    }
}
