/* Custom CSS variables for a premium neon-dark layout with glassmorphism */
:root {
    --bg-dark: #090a0f;
    --surface-dark: rgba(20, 22, 33, 0.7);
    --surface-dark-solid: #141621;
    --border-color: rgba(255, 255, 255, 0.08);
    --text-primary: #ffffff;
    --text-muted: #8e92a8;
    
    /* Dynamic phase colors (HLS customized) */
    --color-prep: #f59e0b; /* Amber */
    --color-work: #10b981; /* Emerald/Teal */
    --color-pause: #8b5cf6; /* Violet */
    --color-ready: #3b82f6; /* Blue */
    
    /* Default state is READY */
    --accent-color: var(--color-ready);
    --accent-glow: rgba(59, 130, 246, 0.2);
    
    --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    
    --transition-speed: 0.3s;
    --border-radius-lg: 24px;
    --border-radius-md: 16px;
    --border-radius-sm: 12px;
}

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

/* Allow text selection & typing in inputs, textareas and selects */
input, textarea, select, .number-input-wrapper {
    user-select: text !important;
    -webkit-user-select: text !important;
}

/* Optimize touch interactions for all buttons and click items on mobile */
button, .adjust-btn, .control-btn, .icon-button, .routine-card {
    touch-action: manipulation;
}

html, body {
    width: 100%;
    height: 100%;
    background-color: var(--bg-dark);
    font-family: var(--font-sans);
    color: var(--text-primary);
    overflow: hidden;
    position: relative;
}

/* Dynamic background aura */
body::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 150vw;
    height: 150vw;
    background: radial-gradient(circle, var(--accent-glow) 0%, rgba(9, 10, 15, 0) 60%);
    z-index: 0;
    pointer-events: none;
    transition: background var(--transition-speed) ease;
}

/* Base App Layout */
.app-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    max-width: 480px;
    margin: 0 auto;
    padding: 20px 24px;
    position: relative;
    z-index: 1;
}

/* Header styling */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    margin-bottom: auto;
}

.logo {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.logo-accent {
    color: var(--accent-color);
    transition: color var(--transition-speed) ease;
}

.header-actions {
    display: flex;
    gap: 12px;
}

.icon-button {
    background: var(--surface-dark);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.icon-button:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.icon-button:active {
    transform: scale(0.95);
}

/* Main Display / Visual Timer Area */
.timer-display-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: auto 0;
    width: 100%;
}

.active-routine-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 24px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

/* SVG Ring Visual Container */
.timer-visual-container {
    position: relative;
    width: 280px;
    height: 280px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.progress-ring {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.progress-ring-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.04);
    stroke-width: 8;
}

.progress-ring-glow {
    transition: all var(--transition-speed) ease;
}

.progress-ring-fill {
    fill: none;
    stroke: var(--accent-color);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 552.92; /* 2 * PI * 88 */
    stroke-dashoffset: 552.92;
    transition: stroke-dashoffset 0.1s linear, stroke var(--transition-speed) ease;
}

.timer-text-overlay {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 80%;
    height: 80%;
    text-align: center;
}

.timer-phase-label {
    font-size: 18px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 3px;
    color: var(--accent-color);
    transition: color var(--transition-speed) ease;
    margin-bottom: 4px;
}

.timer-countdown-digits {
    font-family: var(--font-mono);
    font-size: 52px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 8px;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.1);
}

.timer-sub-info {
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 500;
}

.next-phase-preview {
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 500;
    padding: 8px 16px;
    background: var(--border-color);
    border-radius: 20px;
    backdrop-filter: blur(8px);
    transition: all var(--transition-speed) ease;
}

/* Playback Control Section */
.playback-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 28px;
    margin-bottom: 30px;
    width: 100%;
}

.control-btn {
    border-radius: 50%;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.primary-btn {
    width: 76px;
    height: 76px;
    background: var(--accent-color);
    border: none;
    color: #000;
    box-shadow: 0 10px 25px rgba(255, 255, 255, 0.05), 0 0 20px var(--accent-glow);
    transition: all var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
}

.primary-btn:hover {
    transform: scale(1.08);
}

.primary-btn:active {
    transform: scale(0.94);
}

.secondary-btn {
    width: 52px;
    height: 52px;
    background: var(--surface-dark);
    backdrop-filter: blur(12px);
}

.secondary-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.05);
}

.secondary-btn:active {
    transform: scale(0.95);
}

/* Quick Config Section */
.quick-config-section {
    background: var(--surface-dark);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 20px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    margin-bottom: 10px;
    transition: all 0.4s ease;
}

.quick-config-section.collapsed {
    opacity: 0.15;
    pointer-events: none;
    transform: scale(0.97);
}

.section-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 16px;
}

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

.input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.input-group label {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
}

.number-input-wrapper {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    overflow: hidden;
}

.number-input-wrapper input {
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text-primary);
    text-align: center;
    font-family: var(--font-mono);
    font-size: 18px;
    font-weight: 600;
    padding: 8px 0;
}

/* Remove default spin buttons */
.number-input-wrapper input::-webkit-outer-spin-button,
.number-input-wrapper input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.number-input-wrapper input[type=number] {
    -moz-appearance: textfield;
}

.adjust-btn {
    background: transparent;
    border: none;
    color: var(--text-primary);
    width: 36px;
    font-size: 20px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

.adjust-btn:active {
    background: rgba(255, 255, 255, 0.08);
}

.action-btn-primary {
    background: var(--accent-color);
    color: #000;
    border: none;
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 16px;
    padding: 14px;
    border-radius: var(--border-radius-md);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 15px var(--accent-glow);
}

.action-btn-primary:active {
    transform: scale(0.97);
}

.action-btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    font-family: var(--font-sans);
    font-weight: 500;
    font-size: 14px;
    padding: 10px;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.action-btn-secondary:active {
    background: rgba(255, 255, 255, 0.1);
}

.mt-1 {
    margin-top: 14px;
    width: 100%;
}

/* Drawer Component styling - Slide in from bottom (PWA Mobile optimal) */
.drawer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100;
    visibility: hidden;
    transition: visibility 0.3s;
}

.drawer:not(.hidden) {
    visibility: visible;
}

.drawer-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.drawer:not(.hidden) .drawer-backdrop {
    opacity: 1;
}

.drawer-content {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translate(-50%, 100%);
    width: 100%;
    max-width: 480px;
    background: var(--surface-dark-solid);
    border-top: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
    padding: 24px 24px 34px 24px;
    display: flex;
    flex-direction: column;
    max-height: 85vh;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.5);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.drawer:not(.hidden) .drawer-content {
    transform: translate(-50%, 0);
}

.drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.drawer-header h3 {
    font-size: 20px;
    font-weight: 700;
}

.close-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 32px;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
}

.drawer-body {
    overflow-y: auto;
    flex: 1;
    padding-bottom: 10px;
}

.drawer-footer-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}

/* Routines list styling */
.routines-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 40vh;
    overflow-y: auto;
    padding-right: 4px;
}

.routines-list::-webkit-scrollbar {
    width: 6px;
}
.routines-list::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.routine-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s;
}

.routine-card:hover {
    border-color: rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.05);
}

.routine-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.routine-title {
    font-weight: 600;
    font-size: 16px;
}

.routine-meta {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    gap: 10px;
}

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

.routine-play-btn {
    background: var(--accent-color);
    border: none;
    color: #000;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(255, 255, 255, 0.05);
}

.routine-delete-btn {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #ef4444;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.routine-delete-btn:active {
    background: rgba(239, 68, 68, 0.3);
}

/* Settings styling */
.settings-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.setting-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-width: 75%;
}

.setting-label {
    font-weight: 600;
    font-size: 16px;
}

.setting-description {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
}

.setting-item-column {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-bottom: 16px;
}

/* Switch Styles */
.switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    transition: .3s;
    border-radius: 34px;
    border: 1px solid var(--border-color);
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .25s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--accent-color);
}

input:checked + .slider:before {
    transform: translateX(22px);
    background-color: #000;
}

/* Range Slider Styles */
.volume-slider {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.1);
    outline: none;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent-color);
    cursor: pointer;
    transition: transform 0.1s;
}

.volume-slider::-webkit-slider-thumb:active {
    transform: scale(1.3);
}

.about-app {
    margin-top: 30px;
    text-align: center;
    font-size: 13px;
}

.text-muted {
    color: var(--text-muted);
}

/* Modal styling */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    visibility: hidden;
    transition: visibility 0.2s;
}

.modal:not(.hidden) {
    visibility: visible;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    opacity: 0;
    transition: opacity 0.2s;
}

.modal:not(.hidden) .modal-backdrop {
    opacity: 1;
}

.modal-content {
    position: relative;
    background: var(--surface-dark-solid);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 24px;
    width: 90%;
    max-width: 380px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
    transform: scale(0.9);
    opacity: 0;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal:not(.hidden) .modal-content {
    transform: scale(1);
    opacity: 1;
}

.modal-content h3 {
    margin-bottom: 18px;
    font-size: 18px;
}

.modal-content input[type="text"] {
    width: 100%;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 16px;
    padding: 12px;
    outline: none;
    margin-top: 6px;
}

.modal-content input[type="text"]:focus {
    border-color: var(--accent-color);
}

.modal-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 24px;
}

/* Install PWA Banner */
.install-banner {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 40px);
    max-width: 440px;
    background: var(--surface-dark-solid);
    border: 1px solid var(--accent-color);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 15px rgba(59, 130, 246, 0.1);
    border-radius: var(--border-radius-md);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    z-index: 99;
    backdrop-filter: blur(20px);
    transition: all 0.3s ease;
}

.banner-text {
    font-size: 14px;
    font-weight: 500;
}

.banner-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.banner-btn-primary {
    background: var(--accent-color);
    color: #000;
    border: none;
    padding: 6px 14px;
    border-radius: var(--border-radius-sm);
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
}

.banner-btn-secondary {
    background: transparent;
    color: var(--text-muted);
    border: none;
    padding: 6px 14px;
    font-family: var(--font-sans);
    font-weight: 500;
    font-size: 13px;
    cursor: pointer;
}

/* Utility classes */
.hidden {
    display: none !important;
}

/* Animations */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

.pulsing {
    animation: pulse 2s infinite ease-in-out;
}

/* --- Exercise Media Card Styling --- */
.exercise-media-card {
    width: 100%;
    max-width: 320px;
    height: 160px;
    background: var(--surface-dark);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 8px;
    margin-bottom: 20px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
}

.exercise-image-wrapper {
    width: 100%;
    height: 100%;
    border-radius: var(--border-radius-md);
    overflow: hidden;
    position: relative;
    background: rgba(0, 0, 0, 0.2);
}

.exercise-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: opacity 0.3s ease, transform 0.5s ease;
}

.exercise-image-wrapper img.hidden {
    opacity: 0;
    transform: scale(1.05);
}

.exercise-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
}

.exercise-placeholder svg {
    opacity: 0.6;
    stroke: var(--accent-color);
    transition: stroke var(--transition-speed);
}

.exercise-name-badge {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 16px;
    background: rgba(9, 10, 15, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 600;
    border-radius: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    letter-spacing: 0.5px;
    max-width: 85%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
}

/* --- Routine Editor Styles --- */
.editor-scrollable-body::-webkit-scrollbar {
    width: 6px;
}
.editor-scrollable-body::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.editor-exercise-item {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: relative;
    animation: slideIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.editor-exercise-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    padding-bottom: 8px;
}

.editor-exercise-num {
    font-size: 13px;
    font-weight: 700;
    color: var(--accent-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-remove-exercise {
    background: transparent;
    border: none;
    color: #ef4444;
    cursor: pointer;
    padding: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.btn-remove-exercise:hover {
    background: rgba(239, 68, 68, 0.1);
}

.editor-exercise-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.editor-exercise-item input[type="text"],
.editor-exercise-item input[type="number"] {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 13px;
    padding: 8px 10px;
    outline: none;
    width: 100%;
}

.editor-exercise-item input[type="number"] {
    font-family: var(--font-mono);
}

.editor-exercise-item input:focus {
    border-color: var(--accent-color);
}

/* File Upload inside Editor Item */
.image-upload-wrapper {
    grid-column: span 2;
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(0, 0, 0, 0.15);
    border: 1px dashed var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 8px 10px;
    position: relative;
    cursor: pointer;
    transition: border-color var(--transition-speed);
}

.image-upload-wrapper:hover {
    border-color: var(--accent-color);
}

.image-upload-wrapper input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.upload-thumbnail-preview {
    width: 44px;
    height: 44px;
    border-radius: 6px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.upload-thumbnail-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.upload-thumbnail-preview svg {
    color: var(--text-muted);
}

.upload-label-text {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.upload-label-text span.upload-title {
    color: var(--text-primary);
    font-weight: 600;
}

/* Edit action inside list routines card */
.routine-edit-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.routine-edit-btn:hover {
    background: rgba(255, 255, 255, 0.12);
}

.routine-edit-btn:active {
    transform: scale(0.95);
}

/* ==========================================================================
   RESPONSIVE DESIGN & DISPLAY SIZING ADAPTATIONS (PWA SMARTPHONE EXCELLENCE)
   ========================================================================== */

/* Proportional scaling for standard mobile displays */
.timer-visual-container {
    width: 240px;
    height: 240px;
    margin-bottom: 16px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.active-routine-title {
    font-size: 15px;
    margin-bottom: 12px;
    transition: all 0.3s ease;
}

.timer-countdown-digits {
    font-size: 46px;
    transition: all 0.3s ease;
}

.timer-phase-label {
    font-size: 16px;
    transition: all 0.3s ease;
}

.playback-controls {
    margin-bottom: 20px;
    gap: 20px;
    transition: all 0.3s ease;
}

.exercise-media-card {
    height: 140px;
    margin-bottom: 16px;
    transition: all 0.3s ease;
}

.quick-config-section {
    padding: 16px;
    margin-bottom: 8px;
    transition: all 0.3s ease;
}

/* Proportional shrinking for flacher mobile viewport heights (<= 740px) */
@media (max-height: 740px) {
    .app-container {
        padding: 12px 16px;
    }
    
    .timer-visual-container {
        width: 180px;
        height: 180px;
        margin-bottom: 10px;
    }
    
    .active-routine-title {
        font-size: 13px;
        margin-bottom: 8px;
        letter-spacing: 1px;
    }
    
    .timer-countdown-digits {
        font-size: 38px;
        margin-bottom: 4px;
    }
    
    .timer-phase-label {
        font-size: 13px;
        letter-spacing: 2px;
    }
    
    .timer-sub-info {
        font-size: 12px;
    }
    
    .next-phase-preview {
        font-size: 12px;
        padding: 6px 12px;
    }
    
    .playback-controls {
        gap: 16px;
        margin-bottom: 12px;
    }
    
    .primary-btn {
        width: 60px;
        height: 60px;
    }
    
    .primary-btn svg {
        width: 22px;
        height: 22px;
    }
    
    .secondary-btn {
        width: 44px;
        height: 44px;
    }
    
    .secondary-btn svg {
        width: 18px;
        height: 18px;
    }
    
    .exercise-media-card {
        height: 105px;
        margin-bottom: 10px;
        border-radius: var(--border-radius-md);
    }
    
    .exercise-name-badge {
        bottom: 8px;
        font-size: 12px;
        padding: 4px 12px;
    }
    
    .quick-config-section {
        padding: 12px 14px;
        border-radius: var(--border-radius-md);
    }
    
    .section-title {
        font-size: 12px;
        margin-bottom: 8px;
    }
    
    .config-grid {
        gap: 10px;
    }
    
    .input-group label {
        font-size: 11px;
    }
    
    .number-input-wrapper input {
        font-size: 15px;
        padding: 6px 0;
    }
    
    .adjust-btn {
        width: 30px;
        font-size: 16px;
    }
    
    .action-btn-secondary {
        font-size: 12px;
        padding: 8px;
        margin-top: 6px;
    }
}

/* Extreme compact styling for very short screen heights (<= 640px) or split screens */
@media (max-height: 640px) {
    .app-container {
        padding: 8px 12px;
    }
    
    .timer-visual-container {
        width: 140px;
        height: 140px;
        margin-bottom: 6px;
    }
    
    .timer-countdown-digits {
        font-size: 28px;
        margin-bottom: 2px;
    }
    
    .timer-phase-label {
        font-size: 10px;
    }
    
    .playback-controls {
        margin-bottom: 6px;
    }
    
    .exercise-media-card {
        height: 80px;
        margin-bottom: 6px;
    }
    
    .quick-config-section {
        padding: 8px 10px;
    }
    
    .config-grid {
        gap: 6px;
    }
}

