: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(1120px, 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: minmax(0, 1fr) minmax(340px, 420px);
    gap: 20px;
    align-items: stretch;
}

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

.timer-panel {
    padding: 26px;
}

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

.timer {
    margin: 22px 0 18px;
    font-size: clamp(4.4rem, 8.2vw, 6.7rem);
    font-weight: 800;
    line-height: 0.9;
    letter-spacing: 0;
    font-variant-numeric: tabular-nums;
    text-align: center;
    white-space: nowrap;
}

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

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

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

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

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

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

.session-block {
    min-height: 54px;
    padding: 9px 6px;
    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: 10px;
    margin-top: 20px;
}

.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-button {
    display: inline-grid;
    place-items: center;
    width: 48px;
    min-width: 48px;
    height: 48px;
    padding: 0;
    background: var(--surface-muted);
    border-radius: 8px;
    color: var(--primary);
}

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

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

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

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

.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;
    padding: 20px;
}

.panel-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

h2 {
    font-size: 1.35rem;
}

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

.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;
}

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

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

.todo-toggle,
.todo-delete {
    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;
}

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

.clear-button {
    min-height: 38px;
    margin-top: 14px;
    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 {
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

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

.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: 18px;
    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: 820px) {
    .app {
        display: block;
        width: min(100% - 20px, 620px);
        min-height: 0;
        padding-top: 18px;
    }

    .layout {
        grid-template-columns: 1fr;
        align-items: start;
    }

    .timer-panel,
    .todo-panel {
        padding: 18px;
    }

    .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;
    }

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

    .controls {
        grid-template-columns: 1fr;
    }

    .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;
    }
}
