:root {
    /* Color Palette - Premium Dark Mode */
    --bg-color: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.6);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    
    /* Work Mode Colors - Vibrant Coral/Red */
    --work-primary: #f43f5e;
    --work-gradient: linear-gradient(135deg, #f43f5e, #e11d48);
    --work-glow: rgba(244, 63, 94, 0.3);
    
    /* Break Mode Colors - Emerald Green */
    --break-primary: #10b981;
    --break-gradient: linear-gradient(135deg, #10b981, #059669);
    --break-glow: rgba(16, 185, 129, 0.3);
    
    /* Typography */
    --font-txt: 'Inter', system-ui, sans-serif;
    --font-heading: 'Outfit', system-ui, sans-serif;
}

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

body {
    font-family: var(--font-txt);
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
    transition: background-color 0.8s ease;
}

/* Dynamic background blob animation */
body::before {
    content: '';
    position: absolute;
    width: 60vw;
    height: 60vw;
    max-width: 600px;
    max-height: 600px;
    background: radial-gradient(circle, var(--work-glow) 0%, transparent 70%);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: -1;
    animation: pulse 8s ease-in-out infinite alternate;
    transition: background 0.8s ease;
    filter: blur(40px);
}

body.break-mode-bg::before {
    background: radial-gradient(circle, var(--break-glow) 0%, transparent 70%);
}

@keyframes pulse {
    0% { transform: translate(-50%, -50%) scale(0.9); opacity: 0.7; }
    100% { transform: translate(-50%, -50%) scale(1.1); opacity: 1; }
}

.app-container {
    width: 100%;
    max-width: 420px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    z-index: 10;
}

header h1 {
    font-family: var(--font-heading);
    font-size: 2.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    background: linear-gradient(to right, #ffffff, #94a3b8);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Glassmorphism Card styling */
.timer-card {
    background: var(--card-bg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 2.5rem;
    padding: 2.5rem 2rem;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transition: box-shadow 0.6s cubic-bezier(0.16, 1, 0.3, 1), transform 0.3s ease;
}

.timer-card:hover {
    transform: translateY(-5px);
}

.timer-card.work-mode {
    box-shadow: 0 20px 40px -10px rgba(244, 63, 94, 0.15);
}

.timer-card.break-mode {
    box-shadow: 0 20px 40px -10px rgba(16, 185, 129, 0.15);
}

.mode-indicator {
    background: rgba(255, 255, 255, 0.05);
    padding: 0.5rem 1.25rem;
    border-radius: 2rem;
    margin-bottom: 2rem;
    border: 1px solid rgba(255, 255, 255, 0.03);
}

#mode-text {
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    transition: color 0.4s ease;
}

.work-mode #mode-text { color: var(--work-primary); }
.break-mode #mode-text { color: var(--break-primary); }

/* SVG Progress Ring & Timer Display */
.progress-ring-container {
    position: relative;
    width: 300px;
    height: 300px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 2.5rem;
}

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

.progress-ring__circle {
    stroke-dasharray: 880; 
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 1s linear, stroke 0.6s ease;
    filter: drop-shadow(0 0 8px currentColor);
}

.work-mode .progress-ring__circle { stroke: var(--work-primary); }
.break-mode .progress-ring__circle { stroke: var(--break-primary); }

.time-display {
    position: absolute;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
}

#time-left {
    font-family: var(--font-heading);
    font-size: 4.5rem;
    font-weight: 700;
    letter-spacing: -0.04em;
    font-variant-numeric: tabular-nums;
    text-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

/* Button Controls */
.controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: center;
    width: 100%;
}

button {
    font-family: var(--font-txt);
    border: none;
    cursor: pointer;
    border-radius: 1rem;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
}

/* Efecto de presión nativo súper estable */
button::after {
    content: '';
    position: absolute;
    top: 0; left: 0;right: 0; bottom: 0;
    background: white;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

button:active:not(:disabled)::after {
    opacity: 0.15;
    transition: opacity 0s;
}

button:active:not(:disabled) {
    transform: scale(0.95);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    padding: 1rem 0.5rem;
    color: white;
    flex: 2;
    position: relative;
    overflow: hidden;
    min-width: max-content;
}

/* Highlight effect on primary button */
.btn-primary::after {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(rgba(255,255,255,0.2), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.btn-primary:hover:not(:disabled)::after {
    opacity: 1;
}

.work-mode .btn-primary {
    background: var(--work-gradient);
    box-shadow: 0 8px 20px -6px var(--work-primary);
}

.break-mode .btn-primary {
    background: var(--break-gradient);
    box-shadow: 0 8px 20px -6px var(--break-primary);
}

.btn-secondary {
    padding: 1rem 0.5rem;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    flex: 1.5;
    border: 1px solid rgba(255, 255, 255, 0.05);
    min-width: max-content;
}

.btn-secondary:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.15);
}

.btn-icon {
    width: 3rem;
    height: 3rem;
    border-radius: 1rem;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    flex-shrink: 0;
}

.btn-icon:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.1);
}

/* PWA Update Toast */
.update-toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    padding: 1rem 1.5rem;
    border-radius: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    z-index: 100;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s ease;
    opacity: 0;
    pointer-events: none;
    font-family: var(--font-txt);
    font-size: 0.9rem;
    font-weight: 500;
}

.update-toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.update-toast button {
    background: var(--break-primary);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.85rem;
    box-shadow: 0 4px 14px -4px var(--break-primary);
    flex-shrink: 0;
}

.update-toast button:hover {
    transform: scale(1.05);
}

/* Startup Menu Overlay */
.startup-menu {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: var(--bg-color);
    z-index: 50;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
    padding: 2rem;
}

.startup-menu.show {
    opacity: 1;
    pointer-events: auto;
}

.menu-content {
    text-align: center;
    max-width: 500px;
    width: 100%;
}

.menu-content h2 {
    font-family: var(--font-txt);
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
    color: var(--text-secondary);
    font-weight: 500;
}

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

.menu-card {
    background: var(--card-bg);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 1.5rem;
    padding: 2rem;
    text-align: left;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-primary);
    display: block;
    width: 100%;
    backdrop-filter: blur(16px);
}

.menu-card:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 15px 30px rgba(0,0,0,0.3);
}

.menu-card:active:not(:disabled) {
    transform: translateY(-2px) scale(0.98);
}

.menu-card h3 {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--work-primary);
}

#btn-mode-long h3 {
    color: #8b5cf6; /* Purple for long mode */
}

.menu-card p {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.menu-card small {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* Cycle Indicators */
.cycle-indicator {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 2rem;
    justify-content: center;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    transition: all 0.3s ease;
}

.dot.active {
    background: var(--text-primary);
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
}

.dot.current {
    background: var(--work-primary);
    box-shadow: 0 0 10px var(--work-glow);
    transform: scale(1.3);
}

/* Long Break Theme */
.timer-card.long-break-mode {
    box-shadow: 0 20px 40px -10px rgba(56, 189, 248, 0.15);
}

body.long-break-mode-bg::before {
    background: radial-gradient(circle, rgba(56, 189, 248, 0.3) 0%, transparent 70%);
}

.long-break-mode #mode-text { color: #38bdf8; }
.long-break-mode .progress-ring__circle { stroke: #38bdf8; }
.long-break-mode .btn-primary {
    background: linear-gradient(135deg, #38bdf8, #0ea5e9);
    box-shadow: 0 8px 20px -6px #38bdf8;
}

/* Confirm Modal */
.confirm-modal {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    padding: 2rem;
}

.confirm-modal.show {
    opacity: 1;
    pointer-events: auto;
}

.confirm-card {
    background: var(--card-bg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 1.5rem;
    padding: 2rem;
    width: 100%;
    max-width: 320px;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.confirm-modal.show .confirm-card {
    transform: scale(1);
}

.confirm-card h3 {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.confirm-card p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-size: 0.95rem;
}

.confirm-actions {
    display: flex;
    gap: 1rem;
}

.confirm-actions .btn {
    flex: 1;
    padding: 0.8rem 0.5rem;
    font-size: 0.95rem;
}

.confirm-actions .btn-primary {
    background: var(--work-gradient);
    box-shadow: 0 4px 14px -4px var(--work-primary);
}

/* Menu Header & Footer */
.menu-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 2.5rem;
}

.app-logo {
    color: var(--work-primary);
    filter: drop-shadow(0 0 15px var(--work-glow));
}

.app-title {
    font-family: var(--font-heading);
    font-size: 3.5rem;
    font-weight: 700;
    letter-spacing: -0.04em;
    background: linear-gradient(to right, #ffffff, #94a3b8);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 0;
    line-height: 1;
}

.menu-footer {
    position: absolute;
    bottom: 2rem;
    width: 100%;
    text-align: center;
    left: 0;
}

.menu-footer p {
    font-family: var(--font-txt);
    font-size: 0.85rem;
    color: var(--text-secondary);
    letter-spacing: 0.05em;
    opacity: 0.6;
    margin: 0;
}
