@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap");

:root {
    --ink: #ffffff;
    --panel: rgba(43, 46, 62, 0.54);
    --panel-solid: rgba(245, 241, 249, 0.94);
    --purple: #6e3fa5;
    --purple-deep: #40275f;
    --lavender: #d7b7f2;
    --lilac-soft: rgba(234, 219, 249, 0.88);
    --glass: rgba(255, 255, 255, 0.18);
    --line: rgba(255, 255, 255, 0.62);
    --shadow: 0 22px 60px rgba(13, 17, 31, 0.35);
}

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

html {
    min-width: 320px;
}

body {
    min-height: 100vh;
    overflow-x: hidden;
    color: var(--ink);
    font-family: "Inter", Arial, sans-serif;
}

button,
input,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

.focus-scene {
    position: relative;
    min-height: 100vh;
    overflow: hidden;
    background:
        linear-gradient(90deg, rgba(20, 22, 34, 0.38) 0%, rgba(20, 22, 34, 0.12) 45%, rgba(20, 22, 34, 0.2) 100%),
        linear-gradient(180deg, rgba(14, 16, 28, 0.38) 0%, rgba(14, 16, 28, 0.02) 42%, rgba(14, 16, 28, 0.46) 100%),
        url("assets/fairycore-focus-background.png") center / cover no-repeat;
    isolation: isolate;
}

.focus-scene::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: radial-gradient(circle at 22% 74%, rgba(255, 255, 255, 0.12), transparent 30%);
    pointer-events: none;
}

.scene-header {
    position: relative;
    z-index: 5;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    padding: 46px 56px 0;
}

.date-block {
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.36);
}

.date-block span {
    display: block;
    font-size: 22px;
    font-weight: 700;
}

.date-block strong {
    display: block;
    margin-top: -4px;
    font-size: clamp(40px, 4vw, 60px);
    font-weight: 900;
    line-height: 1;
}

.utility-bar {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 14px;
    max-width: 330px;
}

.utility-button {
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    border: 0;
    border-radius: 7px;
    background: rgba(74, 39, 111, 0.88);
    box-shadow: 0 12px 30px rgba(36, 17, 58, 0.3);
    color: #ffffff;
    cursor: pointer;
    font-size: 21px;
    text-decoration: none;
    transition: background 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.utility-button:hover,
.utility-button:focus-visible {
    background: rgba(91, 52, 132, 0.96);
    box-shadow: 0 16px 34px rgba(36, 17, 58, 0.38);
    transform: translateY(-2px);
}

.utility-button:focus-visible {
    outline: 3px solid rgba(255, 255, 255, 0.78);
    outline-offset: 3px;
}

.utility-button.is-active {
    background: linear-gradient(135deg, rgba(134, 91, 198, 0.96), rgba(95, 123, 84, 0.96));
}

#ambient-button.is-active i {
    animation: ambientPulse 1.2s ease-in-out infinite;
}

.utility-status {
    flex: 1 0 100%;
    min-height: 24px;
    border-radius: 999px;
    color: rgba(255, 255, 255, 0.88);
    font-size: 13px;
    font-weight: 900;
    letter-spacing: 0;
    line-height: 24px;
    text-align: right;
    text-shadow: 0 4px 16px rgba(0, 0, 0, 0.36);
}

.utility-status.is-active {
    color: #f7ffef;
}

@keyframes ambientPulse {
    0%,
    100% {
        opacity: 0.72;
        transform: scale(1);
    }

    50% {
        opacity: 1;
        transform: scale(1.18);
    }
}

.timer-stage {
    position: absolute;
    left: clamp(28px, 4vw, 66px);
    bottom: clamp(48px, 7vh, 86px);
    z-index: 4;
    width: min(720px, calc(100vw - 380px));
}

.timer-copy {
    display: grid;
    gap: 6px;
    margin-bottom: 14px;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.42);
}

.timer-copy > span {
    width: fit-content;
    border-radius: 999px;
    background: rgba(74, 39, 111, 0.74);
    font-size: 13px;
    font-weight: 900;
    padding: 6px 12px;
    text-transform: uppercase;
}

.timer-copy small {
    max-width: 380px;
    color: rgba(255, 255, 255, 0.82);
    font-size: 14px;
    font-weight: 700;
}

.timer-copy .number-text {
    font-family: inherit;
}

.timer-row {
    display: flex;
    align-items: flex-end;
    gap: 20px;
}

#time-display {
    font-family: "Microsoft JhengHei", "Microsoft JhengHei UI", Arial, sans-serif;
    font-size: clamp(92px, 12vw, 160px);
    font-weight: 700;
    line-height: 0.8;
    text-shadow: 0 12px 36px rgba(0, 0, 0, 0.38);
}

.progress-dots {
    display: grid;
    gap: 10px;
    padding-bottom: 18px;
}

.progress-dots span {
    width: 21px;
    height: 21px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.76);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2);
}

.progress-dots span.is-active {
    background: #7445cf;
}

.timer-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 16px;
}

.mini-control,
.play-button {
    border: 0;
    border-radius: 7px;
    background: rgba(74, 39, 111, 0.9);
    box-shadow: 0 10px 28px rgba(36, 17, 58, 0.34);
    color: #ffffff;
    font-weight: 900;
}

.mini-control {
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    font-size: 21px;
}

.play-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-width: 112px;
    height: 52px;
    padding: 0 18px;
}

.progress-ring {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.progress-ring__track,
.progress-ring__bar {
    fill: none;
    stroke-width: 11;
}

.mode-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-top: 24px;
}

.mode-tab {
    min-width: 154px;
    min-height: 50px;
    border: 3px solid rgba(255, 255, 255, 0.88);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.14);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.14);
    color: #ffffff;
    font-size: 20px;
    font-weight: 900;
    line-height: 1;
    padding: 0 20px;
    text-shadow: 0 3px 14px rgba(0, 0, 0, 0.32);
    white-space: nowrap;
}

.mode-tab.is-active {
    border-color: transparent;
    background: linear-gradient(135deg, #8a55dd, #6742be);
}

.current-task {
    position: absolute;
    top: 146px;
    right: 54px;
    z-index: 4;
    width: 280px;
}

.current-task h2,
.task-panel h2 {
    margin-bottom: 14px;
    font-size: 28px;
    font-weight: 900;
    text-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
}

.current-task article,
.task-card,
.settings-panel,
.stats-grid div {
    border: 1px solid rgba(255, 255, 255, 0.66);
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.92);
    color: #14101a;
    box-shadow: var(--shadow);
}

.current-task article,
.task-card {
    padding: 14px 16px;
}

.current-task strong,
.task-card strong {
    display: block;
    margin-bottom: 5px;
    font-weight: 900;
}

.current-task__status {
    display: inline-flex;
    width: fit-content;
    margin-bottom: 8px;
    border-radius: 999px;
    background: rgba(104, 125, 91, 0.14);
    color: #4d6746;
    font-size: 11px;
    font-weight: 900;
    padding: 4px 8px;
    text-transform: uppercase;
}

.current-task p,
.task-card p {
    color: #201827;
    font-size: 14px;
    line-height: 1.25;
}

.task-toggle {
    position: fixed;
    top: 50%;
    right: 0;
    z-index: 31;
    display: grid;
    place-items: center;
    width: 42px;
    height: 138px;
    border: 0;
    border-radius: 12px 0 0 12px;
    background: rgba(74, 39, 111, 0.94);
    color: #ffffff;
    font-size: 24px;
    transform: translateY(-50%);
}

.task-panel {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 30;
    width: min(350px, 92vw);
    height: 100vh;
    overflow-y: auto;
    background: linear-gradient(180deg, rgba(51, 57, 75, 0.76), rgba(80, 58, 70, 0.76));
    box-shadow: -24px 0 60px rgba(0, 0, 0, 0.3);
    padding: 24px 24px 40px;
    transform: translateX(100%);
    transition: transform 260ms ease;
    backdrop-filter: blur(16px);
}

.task-panel.is-open {
    transform: translateX(0);
}

.task-toggle.is-open {
    right: min(350px, 92vw);
}

.task-toggle.is-open i {
    transform: rotate(180deg);
}

.panel-top {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 12px;
}

.panel-top div {
    display: flex;
    gap: 8px;
}

.panel-top button {
    border: 0;
    background: transparent;
    color: #ffffff;
    font-size: 19px;
}

.task-form {
    display: grid;
    gap: 8px;
    margin-top: 18px;
    border: 1px solid rgba(255, 255, 255, 0.42);
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.18);
    padding: 12px;
}

.task-form label {
    color: rgba(255, 255, 255, 0.86);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.task-form input,
.task-form textarea {
    width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.58);
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.92);
    color: #14101a;
    padding: 10px 11px;
    outline: none;
}

.task-form textarea {
    resize: vertical;
}

.task-form input:focus,
.task-form textarea:focus {
    border-color: #ffffff;
    box-shadow: 0 0 0 4px rgba(215, 183, 242, 0.24);
}

.task-form button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    border: 0;
    border-radius: 7px;
    background: var(--purple);
    color: #ffffff;
    font-weight: 900;
}

.task-day {
    display: grid;
    gap: 14px;
    margin-top: 18px;
}

.task-day h3 {
    border-bottom: 3px solid rgba(255, 255, 255, 0.9);
    font-size: 24px;
    font-weight: 900;
    padding-bottom: 4px;
}

.task-list {
    display: grid;
    gap: 14px;
}

.task-card {
    display: grid;
    grid-template-columns: 22px minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    width: 100%;
    cursor: pointer;
    text-align: left;
}

.task-card__check {
    color: rgba(110, 63, 165, 0.54);
    font-size: 17px;
    line-height: 1.2;
    padding-top: 1px;
}

.task-card:focus-visible {
    outline: 3px solid rgba(255, 255, 255, 0.8);
    outline-offset: 3px;
}

.task-card--active {
    background: var(--lilac-soft);
}

.task-card--completed {
    background: rgba(255, 255, 255, 0.72);
    opacity: 0.82;
}

.task-card--completed .task-card__check {
    color: #5f7b54;
}

.task-card--completed strong {
    color: #4d4652;
    text-decoration: line-through;
}

.task-card--completed p {
    color: rgba(32, 24, 39, 0.64);
}

.task-empty {
    border: 1px dashed rgba(255, 255, 255, 0.62);
    border-radius: 7px;
    color: rgba(255, 255, 255, 0.84);
    font-size: 14px;
    font-weight: 800;
    padding: 14px;
}

.undo-toast {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 16px;
    border: 1px solid rgba(255, 255, 255, 0.48);
    border-radius: 9px;
    background: rgba(20, 16, 26, 0.52);
    color: #ffffff;
    font-size: 14px;
    font-weight: 900;
    padding: 12px;
}

.undo-toast[hidden] {
    display: none;
}

.undo-toast button {
    border: 0;
    border-radius: 999px;
    background: #ffffff;
    color: var(--purple-deep);
    cursor: pointer;
    font: inherit;
    padding: 8px 13px;
}

.undo-toast button:focus-visible {
    outline: 3px solid rgba(255, 255, 255, 0.8);
    outline-offset: 3px;
}

.settings-panel {
    display: grid;
    gap: 16px;
    margin-top: 28px;
    padding: 18px;
}

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

.eyebrow {
    color: var(--purple-deep);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.text-button {
    border: 1px solid rgba(64, 39, 95, 0.18);
    border-radius: 7px;
    background: #ffffff;
    color: var(--purple-deep);
    font-size: 12px;
    font-weight: 900;
    padding: 8px 10px;
}

.setting-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.setting-grid label {
    display: grid;
    gap: 5px;
    border: 1px solid rgba(64, 39, 95, 0.12);
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.78);
    padding: 10px;
}

.setting-grid span,
.toggle-row strong {
    font-size: 13px;
    font-weight: 900;
}

.setting-grid input {
    width: 100%;
    border: 1px solid rgba(64, 39, 95, 0.16);
    border-radius: 7px;
    background: #ffffff;
    color: #14101a;
    font-family: "Microsoft JhengHei", "Microsoft JhengHei UI", Arial, sans-serif;
    font-weight: 700;
    padding: 8px;
    outline: none;
}

.setting-grid input:focus {
    border-color: var(--purple);
    box-shadow: 0 0 0 4px rgba(110, 63, 165, 0.13);
}

.setting-grid small,
.toggle-row small {
    color: #5f5368;
    font-size: 12px;
}

.toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border: 1px solid rgba(64, 39, 95, 0.12);
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.78);
    padding: 10px;
}

.toggle-row > span {
    display: grid;
    gap: 2px;
}

.switch {
    position: relative;
    flex: 0 0 auto;
}

.switch input {
    position: absolute;
    opacity: 0;
}

.switch span {
    position: relative;
    display: block;
    width: 48px;
    height: 28px;
    border-radius: 999px;
    background: #d8d1dc;
    transition: background 180ms ease;
}

.switch span::after {
    content: "";
    position: absolute;
    top: 4px;
    left: 4px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(33, 25, 41, 0.18);
    transition: transform 180ms ease;
}

.switch input:checked + span {
    background: var(--purple);
}

.switch input:checked + span::after {
    transform: translateX(20px);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-top: 16px;
}

.stats-grid div {
    display: grid;
    gap: 3px;
    padding: 12px;
}

.stats-grid span {
    color: var(--purple);
    font-family: "Microsoft JhengHei", "Microsoft JhengHei UI", Arial, sans-serif;
    font-size: 28px;
    font-weight: 700;
    line-height: 1;
}

.stats-grid small {
    color: #5f5368;
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
}

@media (min-width: 1120px) {
    .task-panel.is-open ~ * {
        pointer-events: auto;
    }
}

@media (max-width: 1120px) {
    .current-task {
        display: none;
    }

    .timer-stage {
        width: calc(100vw - 64px);
    }
}

@media (max-width: 760px) {
    .focus-scene {
        min-height: 100svh;
        overflow-y: auto;
        background-position: 58% center;
    }

    .scene-header {
        align-items: stretch;
        flex-direction: column;
        padding: 24px 18px 0;
    }

    .date-block span {
        font-size: 16px;
    }

    .date-block strong {
        font-size: 38px;
    }

    .utility-bar {
        justify-content: flex-start;
        gap: 8px;
    }

    .utility-button {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }

    .timer-stage {
        position: relative;
        left: auto;
        bottom: auto;
        width: calc(100vw - 30px);
        margin: 34vh auto 42px;
    }

    .timer-row {
        align-items: flex-start;
        flex-direction: column;
        gap: 14px;
    }

    #time-display {
        font-size: clamp(74px, 23vw, 104px);
    }

    .progress-dots {
        display: none;
    }

    .timer-controls {
        padding-bottom: 0;
    }

    .mode-tabs {
        gap: 8px;
    }

    .mode-tab {
        min-width: 0;
        flex: 1 1 100%;
        font-size: 20px;
    }

    .task-toggle {
        width: 38px;
        height: 112px;
        box-shadow: -8px 0 24px rgba(0, 0, 0, 0.28);
    }

    .task-toggle.is-open {
        right: 0;
        border-radius: 0 0 0 12px;
        top: 0;
        transform: none;
    }

    .setting-grid,
    .stats-grid {
        grid-template-columns: 1fr;
    }
}
