:root {
    --bg-color: #F4F6F0;
    --text-color: #3A4036;
    --accent-color: #7A8B76;
    --accent-hover: #697866;
    --track-color: #E2E5DC;
    --surface-color: rgba(255, 255, 255, 0.7);
    --shadow: 0 8px 32px rgba(122, 139, 118, 0.1);
    --font-family: 'Outfit', sans-serif;
}

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

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

/* Modifiers for different states */
body.mode-shortBreak {
    --bg-color: #F0F4F6;
    --accent-color: #768B96;
    --accent-hover: #667A85;
    --track-color: #DCE3E5;
    --shadow: 0 8px 32px rgba(118, 139, 150, 0.1);
}

body.mode-longBreak {
    --bg-color: #F4F0F6;
    --accent-color: #89768B;
    --accent-hover: #77667A;
    --track-color: #E4DCE5;
    --shadow: 0 8px 32px rgba(137, 118, 139, 0.1);
}

.app-container {
    background: var(--surface-color);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 32px;
    padding: 3.5rem 3rem;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 90%;
    max-width: 450px;
    transition: box-shadow 0.8s ease;
}

header {
    text-align: center;
    margin-bottom: 2rem;
}

h1 {
    font-size: 2.5rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    margin-bottom: 0.25rem;
}

.subtitle {
    font-size: 0.95rem;
    font-weight: 300;
    opacity: 0.7;
}

.mode-selector {
    display: flex;
    background: rgba(255,255,255,0.6);
    border-radius: 100px;
    padding: 0.35rem;
    margin-bottom: 2.5rem;
    gap: 0.25rem;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}

.mode-btn {
    border: none;
    background: transparent;
    padding: 0.6rem 1.25rem;
    border-radius: 100px;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-color);
    cursor: pointer;
    opacity: 0.6;
    transition: all 0.3s ease;
}

.mode-btn:hover {
    opacity: 0.9;
}

.mode-btn.active {
    background: #ffffff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    opacity: 1;
}

.timer-container {
    position: relative;
    width: 300px;
    height: 300px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 2.5rem;
}

.progress-ring {
    position: absolute;
    transform: rotate(-90deg);
}

.progress-ring__track {
    stroke: var(--track-color);
    transition: stroke 0.8s ease;
}

.progress-ring__circle {
    stroke: var(--accent-color);
    stroke-dasharray: 879; /* 2 * pi * 140 */
    stroke-dashoffset: 0;
    stroke-linecap: round;
    transition: stroke-dashoffset 1s linear, stroke 0.8s ease;
}

.time-display {
    font-size: 5.5rem;
    font-weight: 300;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.04em;
    z-index: 2;
}

.controls {
    display: flex;
    gap: 1.5rem;
}

.control-btn {
    border: none;
    border-radius: 50%;
    width: 64px;
    height: 64px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    color: white;
}

.control-btn.primary {
    background: var(--accent-color);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.control-btn.primary:hover {
    transform: translateY(-3px) scale(1.05);
    background: var(--accent-hover);
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}

.control-btn.primary:active {
    transform: translateY(0) scale(0.95);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.control-btn.secondary {
    background: white;
    color: var(--accent-color);
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), color 0.8s ease;
}

.control-btn.secondary:hover {
    transform: translateY(-3px) scale(1.05);
    color: var(--accent-hover);
    box-shadow: 0 8px 20px rgba(0,0,0,0.1);
}

.control-btn.secondary:active {
    transform: translateY(0) scale(0.95);
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.hidden {
    display: none;
}

.hourglass-container {
    margin-top: 1.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 140px;
}

.hourglass-svg {
    transition: transform 0.6s cubic-bezier(0.4, 0.0, 0.2, 1);
}

@keyframes fall {
    0% { stroke-dashoffset: 0; }
    100% { stroke-dashoffset: -8; }
}

#sand-stream.running {
    animation: fall 0.3s linear infinite;
    display: block;
}

#sand-stream.hidden {
    display: none;
}

#top-sand, #bottom-sand {
    transition: y 0.2s linear, height 0.2s linear;
}

.tasks-container {
    width: 100%;
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

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

.tasks-header h2 {
    font-size: 1.2rem;
    font-weight: 500;
}

.add-task-btn {
    background: transparent;
    border: 1px dashed var(--accent-color);
    color: var(--accent-color);
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.add-task-btn:hover {
    background: var(--accent-color);
    color: white;
}

.task-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 180px;
    overflow-y: auto;
}

.task-item {
    background: rgba(255, 255, 255, 0.5);
    padding: 0.8rem 1rem;
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.task-item:hover {
    background: white;
    border-color: var(--accent-color);
}

.task-item.active {
    border-left: 4px solid var(--accent-color);
    background: white;
}

.task-name {
    font-weight: 500;
}

.task-duration {
    font-size: 0.85rem;
    opacity: 0.7;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(4px);
    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;
    display: flex;
}

.modal-content {
    background: white;
    padding: 2rem;
    border-radius: 24px;
    width: 90%;
    max-width: 350px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
    transform: translateY(0);
    transition: transform 0.3s ease;
}

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

.modal-content h3 {
    margin-bottom: 1.5rem;
    font-weight: 500;
}

.input-group {
    margin-bottom: 1rem;
}

.input-group input {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 1px solid #E2E5DC;
    border-radius: 12px;
    font-family: inherit;
    font-size: 1rem;
    background: #F9FAF8;
    outline: none;
    transition: border-color 0.2s;
}

.input-group input:focus {
    border-color: var(--accent-color);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1.5rem;
}

.modal-btn {
    padding: 0.6rem 1.2rem;
    border-radius: 100px;
    border: none;
    font-family: inherit;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal-btn.secondary {
    background: #F4F6F0;
    color: var(--text-color);
}

.modal-btn.primary {
    background: var(--accent-color);
    color: white;
}

.modal-btn:hover {
    filter: brightness(0.95);
}
