:root {
    --bg-color: #f0ebe3;
    --bg-gradient: linear-gradient(135deg, #f5f0e8 0%, #e8e0f0 100%);
    --card-bg: rgba(255, 255, 255, 0.75);
    --card-border: rgba(255, 255, 255, 0.9);
    --text-main: #3d3552;
    --text-muted: #9993aa;
    --shadow: 0 8px 32px rgba(100, 80, 140, 0.12);
    --shadow-deep: 0 20px 50px rgba(100, 80, 140, 0.18);

    --focus-primary: #e07a7a;
    --focus-secondary: #c96aa0;
    --focus-glow: rgba(224, 122, 122, 0.3);
    --focus-accent-bg: rgba(224, 122, 122, 0.08);
    --break-primary: #6abf8a;
    --break-secondary: #4aaa7a;
    --break-glow: rgba(106, 191, 138, 0.3);
    --long-break-primary: #7a96e0;
    --long-break-secondary: #6070c9;
    --long-break-glow: rgba(122, 150, 224, 0.3);
    --theme-primary: var(--focus-primary);
    --theme-secondary: var(--focus-secondary);
    --theme-glow: var(--focus-glow);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', sans-serif;
    background: var(--bg-gradient);
    background-attachment: fixed;
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
}

.app-container {
    width: 100%;
    max-width: 520px;
    margin: 0 auto;
    padding: 2rem 1.5rem 4rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 0 0.25rem;
}

header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, var(--theme-primary), var(--theme-secondary));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    transition: all 0.5s ease;
}

.icon-btn {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    box-shadow: var(--shadow);
}

.icon-btn:hover {
    color: var(--theme-primary);
    transform: rotate(15deg);
}

.timer-card {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--card-border);
    border-radius: 2rem;
    padding: 2rem;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    box-shadow: var(--shadow-deep);
    transition: box-shadow 0.5s ease;
}

.mode-toggle {
    display: flex;
    background: rgba(0, 0, 0, 0.04);
    border-radius: 2rem;
    padding: 0.3rem;
    gap: 0.25rem;
    width: 100%;
}

.mode-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0.55rem 0.5rem;
    border-radius: 1.5rem;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.mode-btn:hover:not(.active) {
    color: var(--text-main);
    background: rgba(0, 0, 0, 0.04);
}

.mode-btn.active {
    background: white;
    color: var(--theme-primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Circular Progress */
.circular-progress {
    position: relative;
    width: 220px;
    height: 220px;
    display: flex;
    justify-content: center;
    align-items: center;
}

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

.progress-ring__circle-bg {
    stroke: rgba(0, 0, 0, 0.06);
    stroke-linecap: round;
}

.progress-ring__circle {
    stroke-linecap: round;
    transition: stroke-dashoffset 0.1s linear;
    filter: drop-shadow(0 0 6px var(--theme-glow));
}

#gradient-start {
    stop-color: var(--theme-primary);
    transition: stop-color 0.5s ease;
}

#gradient-end {
    stop-color: var(--theme-secondary);
    transition: stop-color 0.5s ease;
}

.time-display {
    position: absolute;
    font-size: 4rem;
    font-weight: 300;
    letter-spacing: -2px;
    font-variant-numeric: tabular-nums;
    color: var(--text-main);
}

/* Stats */
.stats-display {
    display: flex;
    gap: 1rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    background: rgba(0, 0, 0, 0.04);
    padding: 0.45rem 1rem;
    border-radius: 1rem;
}

.dot-separator {
    color: rgba(0, 0, 0, 0.15);
}

/* Controls */
.controls {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.btn {
    border: none;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.primary-btn {
    width: 3.8rem;
    height: 3.8rem;
    background: linear-gradient(135deg, var(--theme-primary), var(--theme-secondary));
    color: white;
    box-shadow: 0 6px 20px var(--theme-glow);
}

.primary-btn:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 10px 24px var(--theme-glow);
}

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

.secondary-btn {
    width: 2.8rem;
    height: 2.8rem;
    background: white;
    color: var(--text-muted);
    border: 1px solid rgba(0, 0, 0, 0.07);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.secondary-btn:hover {
    background: var(--theme-primary);
    color: white;
    transform: scale(1.05);
}

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

.hidden {
    display: none !important;
}

/* Settings Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(61, 53, 82, 0.2);
    backdrop-filter: blur(6px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    background: white;
    border: 1px solid rgba(255, 255, 255, 0.9);
    border-radius: 2rem;
    width: 90%;
    max-width: 380px;
    padding: 2rem;
    box-shadow: 0 25px 60px rgba(61, 53, 82, 0.2);
    transform: translateY(0);
    transition: transform 0.3s ease;
}

.modal.hidden .modal-content {
    transform: translateY(16px);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.modal-header h2 {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-main);
}

.setting-group {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.setting-group:last-child {
    border-bottom: none;
}

.setting-group label {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.setting-group input {
    background: #f8f6fc;
    border: 1.5px solid rgba(0, 0, 0, 0.07);
    color: var(--text-main);
    padding: 0.5rem 0.75rem;
    border-radius: 0.6rem;
    width: 70px;
    text-align: center;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 500;
    transition: border-color 0.2s ease;
}

.setting-group input:focus {
    outline: none;
    border-color: var(--theme-primary);
}

.modal-footer {
    margin-top: 1.5rem;
}

.save-btn {
    width: 100%;
    background: linear-gradient(135deg, var(--theme-primary), var(--theme-secondary));
    color: white;
    border: none;
    padding: 0.85rem;
    border-radius: 1rem;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 16px var(--theme-glow);
}

.save-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px var(--theme-glow);
}

/* Task Section */
.task-section {
    width: 100%;
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--card-border);
    border-radius: 2rem;
    padding: 1.5rem 1.75rem;
    box-shadow: var(--shadow-deep);
}

.task-header {
    margin-bottom: 1rem;
}

.task-header h2 {
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-size: 0.75rem;
}

.task-input-row {
    display: flex;
    gap: 0.6rem;
    margin-bottom: 1rem;
}

.task-input-row input {
    flex: 1;
    background: rgba(0, 0, 0, 0.03);
    border: 1.5px solid rgba(0, 0, 0, 0.07);
    color: var(--text-main);
    padding: 0.65rem 1rem;
    border-radius: 0.75rem;
    font-family: inherit;
    font-size: 0.95rem;
    transition: border-color 0.2s ease;
}

.task-input-row input:focus {
    outline: none;
    border-color: var(--theme-primary);
    background: white;
}

.task-input-row input::placeholder {
    color: var(--text-muted);
}

.add-task-btn {
    width: 2.6rem;
    height: 2.6rem;
    min-width: 2.6rem;
    background: linear-gradient(135deg, var(--theme-primary), var(--theme-secondary));
    color: white;
    border-radius: 0.75rem;
    box-shadow: 0 3px 10px var(--theme-glow);
    transition: all 0.2s ease;
}

.add-task-btn:hover {
    transform: scale(1.06);
    box-shadow: 0 5px 14px var(--theme-glow);
}

.task-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.task-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 0.9rem;
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid rgba(0, 0, 0, 0.04);
    border-radius: 0.75rem;
    transition: background 0.2s ease;
    animation: slideIn 0.2s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.task-item:hover {
    background: rgba(255, 255, 255, 0.8);
}

.task-item input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 1.15rem;
    height: 1.15rem;
    min-width: 1.15rem;
    border: 2px solid rgba(0, 0, 0, 0.15);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.task-item input[type="checkbox"]:checked {
    background: var(--theme-primary);
    border-color: var(--theme-primary);
}

.task-item input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 3px;
    top: 0px;
    width: 5px;
    height: 8px;
    border: 2px solid white;
    border-top: none;
    border-left: none;
    transform: rotate(45deg);
}

.task-label {
    flex: 1;
    font-size: 0.92rem;
    color: var(--text-main);
    transition: all 0.2s ease;
    word-break: break-word;
}

.task-item.done .task-label {
    text-decoration: line-through;
    color: var(--text-muted);
}

.task-delete-btn {
    background: transparent;
    border: none;
    color: rgba(0, 0, 0, 0.15);
    cursor: pointer;
    padding: 0.2rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
    flex-shrink: 0;
}

.task-delete-btn:hover {
    color: #e07a7a;
}

/* Mode themes */
body.break-mode {
    --theme-primary: var(--break-primary);
    --theme-secondary: var(--break-secondary);
    --theme-glow: var(--break-glow);
    --bg-gradient: linear-gradient(135deg, #eef6f1 0%, #d8f0e5 100%);
}

body.long-break-mode {
    --theme-primary: var(--long-break-primary);
    --theme-secondary: var(--long-break-secondary);
    --theme-glow: var(--long-break-glow);
    --bg-gradient: linear-gradient(135deg, #eef0fa 0%, #dde3f5 100%);
}