/*
Copyright (c) Farland Technology GmbH
SPDX-License-Identifier: LicenseRef-Farland-Proprietary
All rights reserved. Unauthorized copying, modification, distribution, or use is prohibited without prior written permission.
Contact: majed@farland.ch
*/

:root {
    color-scheme: light;
    --background: #f6f5f1;
    --surface: #ffffff;
    --surface-muted: #f0f2f5;
    --text: #172033;
    --muted: #667085;
    --line: #d9dee7;
    --primary: #1f6feb;
    --primary-dark: #1859bd;
    --success: #218358;
    --danger: #c93434;
    --shadow: 0 16px 42px rgba(23, 32, 51, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    display: flex;
    min-height: 100vh;
    margin: 0;
    background: var(--background);
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
}

button,
input {
    font: inherit;
}

button {
    border: 0;
    cursor: pointer;
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.58;
}

.app {
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: min(2140px, calc(100% - 32px));
    min-height: 100vh;
    margin: 0 auto;
    padding: 28px 0 34px;
}

h2,
p {
    margin: 0;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.layout {
    display: grid;
    grid-template-columns: repeat(4, minmax(400px, 520px));
    gap: 20px;
    align-items: stretch;
    justify-content: center;
    width: max-content;
    max-width: 100%;
    margin: 0 auto;
}

.layout[data-panel-count="2"] {
    grid-template-columns: repeat(2, minmax(400px, 520px));
}

.layout[data-panel-count="3"] {
    grid-template-columns: repeat(3, minmax(400px, 520px));
}

.panel {
    background: var(--surface);
    border: 1px solid rgba(23, 32, 51, 0.08);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.timer-panel {
    padding: 22px;
}

.timer-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    color: var(--muted);
    font-size: 0.92rem;
}

.mode-toggle {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 30px;
    padding: 0 9px 0 7px;
    background: var(--surface-muted);
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--primary);
    font-size: 0.82rem;
    font-weight: 400;
    line-height: 1;
}

.mode-toggle:hover {
    border-color: rgba(31, 111, 235, 0.28);
    background: #e9f2ff;
}

.mode-toggle[aria-pressed="true"] {
    background: #e8f5ee;
    color: var(--success);
}

.mode-icon {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
}

.timer {
    margin: 28px 0 22px;
    font-size: clamp(3.25rem, 4.8vw, 4.3rem);
    font-weight: 800;
    line-height: 1;
    letter-spacing: 0;
    font-variant-numeric: tabular-nums;
    text-align: center;
    white-space: nowrap;
}

.timer-flip {
    animation: timer-flip 520ms ease-in-out;
}

@keyframes timer-flip {
    0% {
        transform: rotateX(0deg);
        opacity: 1;
    }

    45% {
        transform: rotateX(90deg);
        opacity: 0.4;
    }

    55% {
        transform: rotateX(90deg);
        opacity: 0.4;
    }

    100% {
        transform: rotateX(0deg);
        opacity: 1;
    }
}

.session-summary {
    display: flex;
    justify-content: center;
    margin-top: -6px;
    margin-bottom: 14px;
    color: var(--text);
    font-size: 1rem;
    font-weight: 400;
}

.session-summary.mode-toggle {
    display: flex;
    width: max-content;
    margin-right: auto;
    margin-left: auto;
    background: transparent;
    color: #3f4654;
}

.session-summary.mode-toggle[aria-pressed="true"] {
    background: transparent;
    color: #3f4654;
}

.session-summary.mode-toggle:hover {
    background: var(--surface-muted);
    border-color: transparent;
    color: #252b36;
}

.status {
    min-height: 22px;
    color: var(--muted);
    font-size: 0.95rem;
}

.progress-track {
    height: 14px;
    overflow: hidden;
    background: var(--surface-muted);
    border-radius: 999px;
}

.progress-fill {
    width: 0%;
    height: 100%;
    background: var(--primary);
    transition: width 0.25s ease;
}

.sessions {
    --session-columns: 8;
    display: grid;
    grid-template-columns: repeat(var(--session-columns), minmax(0, 1fr));
    gap: 6px;
    margin-top: 14px;
}

.manual-hint {
    margin-top: 10px;
    color: var(--muted);
    font-size: 0.86rem;
    line-height: 1.4;
}

.timer-setup-title,
.timer-settings .timer-setup-title {
    margin: 0 0 10px;
    color: var(--text);
    font-size: 1rem;
    text-align: center;
}

.timer-settings-heading {
    display: flex;
    justify-content: center;
    margin-bottom: 14px;
}

.timer-settings-heading .timer-setup-title {
    margin-bottom: 0;
}

.timer-setup-label {
    display: block;
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 0.86rem;
    text-align: center;
}

.timer-setup,
.timer-settings {
    margin-top: 10px;
    min-height: 352px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

.timer-setup {
    padding-top: 14px;
}

.timer-settings {
    padding-top: 10px;
}

.timer-setup[hidden],
.timer-settings[hidden],
.timer-panel-content[hidden] {
    display: none;
}

.timer-panel-content {
    min-height: 352px;
}

.timer-setup-row {
    width: 100%;
}

.timer-settings-form {
    display: flex;
    flex: 0 0 auto;
    flex-direction: column;
    margin-bottom: 16px;
}

.target-hours-input {
    width: 100%;
    min-height: 96px;
    padding: 0 6px;
    border: none;
    background: transparent;
    color: var(--text);
    font-size: clamp(4.225rem, 6.24vw, 5.59rem);
    font-weight: 800;
    line-height: 1;
    text-align: center;
    border-radius: 8px;
    appearance: textfield;
    -moz-appearance: textfield;
    outline: none;
}

.target-hours-input:focus {
    border-color: var(--primary);
    box-shadow: none;
}

.target-hours-input::-webkit-outer-spin-button,
.target-hours-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.timer-setup-submit {
    margin-top: auto;
    width: 100%;
    min-height: 52px;
    font-size: 1.15rem;
}

.timer-setup-hint {
    margin-top: 10px;
    color: var(--muted);
    font-size: 0.82rem;
    text-align: center;
}

.timer-settings-sound,
.timer-settings-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 48px;
    padding: 10px 0;
    color: var(--text);
}

.timer-settings-sound {
    border-top: 1px solid var(--line);
}

.timer-settings-option {
    border-top: 1px solid var(--line);
}

.timer-settings-option:last-of-type {
    margin-bottom: 12px;
}

.timer-settings-actions {
    display: flex;
    margin-top: auto;
    margin-bottom: 0;
    padding-top: 16px;
    border-top: 1px solid var(--line);
}

.settings-apply-button {
    width: 100%;
    margin-top: 0;
}

.settings-button,
.settings-sound-button {
    display: inline-grid;
    place-items: center;
    width: 48px;
    min-width: 48px;
    height: 48px;
    padding: 0;
    border-radius: 8px;
    color: #3d4555;
    background: var(--surface-muted);
}

.settings-text-toggle {
    min-height: 38px;
    padding: 0 12px;
    border-radius: 8px;
    background: var(--surface-muted);
    color: var(--text);
    font-weight: 700;
}

.settings-text-toggle:hover {
    background: #e6eaf1;
}

.settings-text-toggle[aria-pressed="true"] {
    color: var(--success);
}

.settings-button {
    background: var(--surface-muted);
}

.settings-button:hover,
.settings-sound-button:hover {
    background: #e6eaf1;
}

.settings-icon,
.settings-sound-button .sound-icon {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
}

.settings-sound-button[aria-pressed="false"] {
    color: var(--muted);
}

.sound-icon-off,
.settings-sound-button[aria-pressed="false"] .sound-icon-on {
    display: none;
}

.settings-sound-button[aria-pressed="false"] .sound-icon-off {
    display: block;
}

.session-block {
    min-height: 50px;
    padding: 8px 4px;
    background: var(--surface-muted);
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--muted);
    text-align: center;
    font-size: 0.78rem;
    line-height: 1.25;
}

button.session-block {
    cursor: pointer;
}

button.session-block:hover {
    border-color: rgba(31, 111, 235, 0.3);
}

.session-block strong {
    display: block;
    margin-bottom: 2px;
    color: inherit;
    font-size: 0.95rem;
}

.session-block.active {
    background: #e9f2ff;
    border-color: rgba(31, 111, 235, 0.3);
    color: var(--primary);
}

.session-block.done {
    background: #e8f5ee;
    color: var(--success);
}

.session-check {
    display: inline-grid;
    place-items: center;
    width: 18px;
    height: 18px;
    margin: 6px;
    background: var(--success);
    border-radius: 999px;
    color: #fff;
    font-size: 0.78rem;
    font-weight: 800;
    line-height: 1;
}

.controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto 48px;
    gap: 8px;
    margin-top: 18px;
}

.primary-button,
.secondary-button,
.icon-button,
.danger-button {
    min-height: 48px;
    border-radius: 8px;
    font-weight: 700;
}

.primary-button {
    background: var(--primary);
    color: #fff;
    font-size: 1.1rem;
}

.primary-button:hover {
    background: var(--primary-dark);
}

.secondary-button {
    padding: 0 18px;
    background: var(--surface-muted);
    color: var(--text);
}

.sound-icon {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
}

.secondary-button:hover {
    background: #e1e6ee;
}

.danger-button {
    padding: 0 18px;
    background: var(--danger);
    color: #fff;
}

.danger-button:hover {
    background: #a82626;
}

.todo-panel {
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 20px;
}

.task-area-heading,
.panel-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.task-area-heading {
    margin-bottom: 14px;
}

.task-title-group {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.task-list-title {
    min-width: 0;
}

.task-list-title-input {
    width: min(170px, 45vw);
    height: 32px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    color: var(--text);
    font: inherit;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.2;
}

.task-list-title-input:focus {
    border-color: var(--primary);
    outline: 3px solid rgba(31, 111, 235, 0.16);
}

.task-list-rename {
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    width: 24px;
    height: 24px;
    border-radius: 6px;
    background: transparent;
    color: var(--muted);
    font-size: 1rem;
    opacity: 0.58;
}

.task-list-rename svg {
    display: block;
}

.task-list-rename:hover,
.task-list-rename:focus-visible {
    background: rgba(31, 111, 235, 0.06);
    color: var(--primary);
    opacity: 1;
}

.task-list-rename.saving {
    color: var(--success);
    opacity: 0.82;
}

.task-list-rename.saving:hover,
.task-list-rename.saving:focus-visible {
    background: rgba(33, 131, 88, 0.08);
    color: var(--success);
    opacity: 1;
}

h2,
h3 {
    margin: 0;
}

h2 {
    font-size: 1.35rem;
}

h3 {
    font-size: 1rem;
}

.task-list-add {
    min-height: 30px;
    padding: 0 2px;
    background: transparent;
    border-radius: 4px;
    color: var(--primary);
    font-size: 0.88rem;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
}

.task-list-add:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.task-list-add:disabled {
    color: var(--muted);
    text-decoration: none;
}

.task-lists {
    display: contents;
}

.task-list-panel {
    min-height: 100%;
}

.task-list-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.task-count {
    color: var(--muted);
    font-size: 0.88rem;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
}

.task-list-close {
    min-height: 30px;
    padding: 0 2px;
    background: transparent;
    border-radius: 4px;
    color: var(--danger);
    font-size: 0.88rem;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
}

.task-list-close:hover {
    color: #a82626;
    text-decoration: underline;
}

.todo-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 48px;
    gap: 8px;
    margin-bottom: 14px;
}

.todo-input {
    width: 100%;
    min-height: 48px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--text);
}

.todo-input:focus {
    border-color: var(--primary);
    outline: 3px solid rgba(31, 111, 235, 0.16);
}

.icon-button {
    display: inline-grid;
    place-items: center;
    background: var(--primary);
    color: #fff;
    font-size: 1.7rem;
    line-height: 1;
}

.todo-list {
    display: grid;
    align-content: start;
    gap: 8px;
    flex: 1;
    margin: 0;
    padding: 0;
    list-style: none;
}

.task-list-panel > .todo-list:not(.completed-tasks-list) {
    margin-bottom: 12px;
}

.todo-list.is-drop-target {
    border-radius: 8px;
}

.todo-list.is-drop-empty .todo-empty {
    outline: 2px solid rgba(31, 111, 235, 0.42);
    outline-offset: 2px;
}

.todo-empty {
    padding: 20px 12px;
    color: var(--muted);
    text-align: center;
    background: var(--surface-muted);
    border-radius: 8px;
}

.todo-item {
    position: relative;
    display: grid;
    grid-template-columns: 14px 34px minmax(0, 1fr) 34px;
    column-gap: 2px;
    row-gap: 6px;
    align-items: center;
    min-height: 48px;
    padding: 6px 6px 6px 4px;
    background: var(--surface-muted);
    border-radius: 8px;
}

.todo-item.is-drag-pending {
    opacity: 0.45;
    cursor: grabbing;
}

.todo-item.is-dragging {
    position: absolute;
    left: 0;
    right: 0;
    opacity: 0;
    pointer-events: none;
}

.todo-item-preview {
    opacity: 0.58;
    pointer-events: none;
    outline: 1px dashed rgba(31, 111, 235, 0.48);
    outline-offset: -1px;
    box-shadow: inset 0 0 0 1px rgba(31, 111, 235, 0.08);
}

.todo-item-preview .todo-drag-handle {
    cursor: grabbing;
}

.todo-item-preview .todo-delete {
    visibility: hidden;
}

.todo-item.is-drop-before::before,
.todo-item.is-drop-after::after {
    position: absolute;
    left: 6px;
    right: 6px;
    z-index: 1;
    height: 3px;
    border-radius: 999px;
    background: var(--primary);
    box-shadow: 0 0 0 2px rgba(31, 111, 235, 0.14);
    content: "";
}

.todo-item.is-drop-before::before {
    top: -6px;
}

.todo-item.is-drop-after::after {
    bottom: -6px;
}

.todo-drag-handle {
    display: grid;
    place-items: center;
    width: 14px;
    height: 30px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: var(--muted);
    cursor: grab;
    opacity: 0.62;
    touch-action: none;
    transform: translateX(1px);
    padding: 0px;
}

.todo-drag-handle::before {
    width: 10px;
    height: 16px;
    background-image: radial-gradient(circle, currentColor 1px, transparent 1.2px);
    background-position: 0 0;
    background-size: 5px 6px;
    content: "";
    opacity: 0.72;
}

.todo-drag-handle:hover,
.todo-drag-handle:focus-visible {
    background: rgba(31, 111, 235, 0.06);
    border-color: rgba(31, 111, 235, 0.14);
    color: var(--primary);
    opacity: 1;
}

.todo-drag-handle:active,
.todo-item.is-dragging .todo-drag-handle {
    cursor: grabbing;
    opacity: 1;
}

.todo-toggle,
.todo-delete {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: #fff;
    color: var(--text);
}

.todo-toggle {
    border: 1px solid var(--line);
}

.todo-toggle.done {
    background: var(--success);
    border-color: var(--success);
    color: #fff;
}

.todo-delete {
    color: var(--danger);
}

.todo-text {
    overflow-wrap: anywhere;
    line-height: 1.35;
    padding-left: 4px;
}

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

.completed-tasks-section {
    margin-top: 10px;
}

.completed-tasks-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    min-height: 38px;
    border: 1px dashed var(--line);
    border-radius: 8px;
    background: transparent;
}

.completed-tasks-header:hover {
    background: var(--surface-muted);
}

.completed-tasks-header.is-drop-target {
    border-color: var(--accent);
    background: rgba(31, 111, 235, 0.08);
}

.completed-tasks-summary {
    width: 100%;
    min-height: 38px;
    padding: 0 8px 0 12px;
    background: transparent;
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 700;
    text-align: left;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.completed-tasks-summary:hover {
    color: var(--text);
}

.completed-toggle-icon {
    display: inline-grid;
    place-items: center;
    width: 16px;
    height: 16px;
    color: inherit;
    line-height: 1;
}

.completed-toggle-icon svg {
    display: block;
}

.completed-clear-button {
    min-height: 30px;
    margin-right: 4px;
    padding: 0 8px;
    border-radius: 6px;
    background: transparent;
    color: var(--muted);
    font-size: 0.86rem;
    font-weight: 700;
}

.completed-clear-button:hover {
    background: #fff;
    color: var(--danger);
}

.completed-tasks-body {
    display: grid;
    grid-template-rows: 0fr;
    margin-top: 0;
    opacity: 0;
    overflow: hidden;
}

.completed-tasks-body.is-transition-enabled {
    transition:
        grid-template-rows 180ms ease,
        margin-top 180ms ease,
        opacity 180ms ease;
}

.completed-tasks-body.is-expanded {
    grid-template-rows: 1fr;
    margin-top: 8px;
    opacity: 1;
}

@starting-style {
    .completed-tasks-body.is-transition-enabled.is-expanded {
        grid-template-rows: 0fr;
        margin-top: 0;
        opacity: 0;
    }
}

.completed-tasks-list {
    min-height: 0;
    margin-top: 0;
    overflow: hidden;
}

.clear-button {
    min-height: 38px;
    padding: 0 12px;
    background: transparent;
    color: var(--muted);
    border-radius: 8px;
}

.clear-button:hover {
    background: var(--surface-muted);
    color: var(--text);
}

.seo-copy {
    max-width: 760px;
    margin: 22px auto 0;
    color: var(--text);
    line-height: 1.55;
}

.seo-copy p {
    color: var(--muted);
}

.site-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px 14px;
    margin-top: 18px;
    color: var(--muted);
    font-size: 0.86rem;
    line-height: 1.45;
    text-align: center;
}

.footer-note {
    max-width: 520px;
}

.footer-nav {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px 12px;
}

.footer-credit,
.footer-version {
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

.footer-credit::before,
.footer-version::before {
    width: 4px;
    height: 4px;
    background: currentColor;
    border-radius: 999px;
    content: "";
    opacity: 0.55;
}

.footer-version {
    font-weight: 700;
}

.footer-link {
    color: var(--primary);
    font-weight: 700;
    text-decoration: none;
}

.footer-link:hover {
    text-decoration: underline;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 10;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(23, 32, 51, 0.34);
}

.modal-backdrop[hidden] {
    display: none;
}

.modal {
    width: min(100%, 390px);
    padding: 20px;
    background: var(--surface);
    border: 1px solid rgba(23, 32, 51, 0.08);
    border-radius: 8px;
    box-shadow: 0 24px 70px rgba(23, 32, 51, 0.22);
}

.modal h2 {
    font-size: 1.2rem;
}

.modal p {
    margin-top: 8px;
    color: var(--muted);
    line-height: 1.45;
}

.modal-check {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 46px;
    margin-top: 16px;
    padding: 10px 12px;
    background: var(--surface-muted);
    border-radius: 8px;
    color: var(--text);
    cursor: pointer;
    line-height: 1.3;
}

.modal-check input {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    flex: 0 0 auto;
}

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

.faq-list {
    display: grid;
    gap: 8px;
    margin-top: 16px;
}

.faq-list details {
    padding: 12px 14px;
    background: var(--surface-muted);
    border-radius: 8px;
}

.faq-list summary {
    color: var(--text);
    cursor: pointer;
    font-weight: 700;
}

.faq-list details p {
    margin-top: 8px;
}

.info-page {
    width: min(760px, calc(100% - 32px));
    margin: 0 auto;
    padding: 42px 0;
}

.info-panel {
    padding: 24px;
}

.info-panel h1 {
    margin: 0 0 18px;
    font-size: 1.6rem;
}

.info-intro {
    margin-bottom: 18px;
    color: var(--muted);
    line-height: 1.55;
}

.back-link {
    display: inline-block;
    margin-bottom: 14px;
    color: var(--primary);
    font-weight: 700;
    text-decoration: none;
}

.back-link:hover {
    text-decoration: underline;
}

.toast {
    position: fixed;
    right: 18px;
    bottom: 66px;
    z-index: 20;
    max-width: min(340px, calc(100vw - 36px));
    padding: 12px 14px;
    background: var(--text);
    color: #fff;
    border-radius: 8px;
    box-shadow: 0 18px 44px rgba(23, 32, 51, 0.2);
    font-size: 0.94rem;
    line-height: 1.35;
}

.toast[hidden] {
    display: none;
}

.confetti-layer {
    position: fixed;
    inset: 0;
    z-index: 30;
    pointer-events: none;
    overflow: hidden;
}

.confetti-piece {
    position: absolute;
    top: -18px;
    width: 8px;
    height: 14px;
    border-radius: 2px;
    opacity: 0.95;
    animation: confetti-fall 1700ms ease-out forwards;
}

@keyframes confetti-fall {
    0% {
        transform: translate3d(0, -20px, 0) rotate(0deg);
    }

    100% {
        transform: translate3d(var(--drift), calc(100vh + 60px), 0) rotate(var(--spin));
        opacity: 0;
    }
}

@media (max-width: 1720px) {
    .layout {
        grid-template-columns: repeat(2, minmax(400px, 520px));
    }

    .layout[data-panel-count="2"],
    .layout[data-panel-count="3"],
    .layout[data-panel-count="4"] {
        grid-template-columns: repeat(2, minmax(400px, 520px));
    }

    .layout[data-panel-count="1"] {
        grid-template-columns: minmax(400px, 520px);
    }
}

@media (min-width: 821px) {
    .timer {
        margin-top: 34px;
        margin-bottom: 24px;
    }
}

@media (max-width: 820px) {
    .app {
        display: block;
        width: min(100% - 20px, 620px);
        min-height: 0;
        padding-top: 18px;
    }

    .layout {
        display: flex;
        flex-direction: column;
        align-items: start;
        justify-content: flex-start;
        width: 100%;
        overflow-x: visible;
    }

    .timer-panel,
    .todo-panel {
        width: 100%;
        min-width: 0;
        padding: 18px;
    }

    .timer-panel,
    .todo-panel {
        flex: initial;
    }

    .todo-list {
        flex: initial;
    }

    .sessions {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 430px) {
    .app {
        width: min(100% - 20px, 430px);
        padding-bottom: 24px;
    }

    .task-list-title-input {
        width: min(132px, 34vw);
        padding: 0 8px;
    }

    .timer {
        font-size: clamp(3.3rem, 15vw, 4rem);
    }

    .controls {
        grid-template-columns: minmax(0, 1fr) minmax(68px, auto) 44px;
        gap: 6px;
    }

    .controls .primary-button,
    .controls .secondary-button,
    .controls .settings-button {
        min-height: 44px;
    }

    .controls .primary-button {
        min-width: 0;
        font-size: 1rem;
    }

    .controls .secondary-button {
        min-width: 0;
        padding: 0 10px;
    }

    .controls .settings-button {
        width: 44px;
        min-width: 44px;
        height: 44px;
    }

    .sessions {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 6px;
    }

    .session-block {
        min-height: 48px;
        padding: 8px 4px;
    }

    .toast {
        right: 10px;
        bottom: 10px;
        max-width: calc(100vw - 20px);
    }

    footer {
        padding: 0 12px;
        line-height: 1.35;
    }

    .modal-actions {
        grid-template-columns: 1fr;
    }
}
