
:root {
    color-scheme: dark;

    --background: #0b1014;
    --surface: #111a20;
    --surface-secondary: #17232b;
    --surface-hover: #1d2b34;
    --border: #2a3942;
    --border-strong: #40535d;

    --primary: #65d6c4;
    --primary-strong: #32b8a5;
    --primary-hover: #65d6c4;
    --primary-soft: rgba(101, 214, 196, 0.12);
    --secondary: #8ae4d6;

    --button-bg: #32b8a5;
    --button-hover: #65d6c4;
    --button-text: #071411;

    --text: #f1f5f7;
    --text-secondary: #c0cbd1;
    --text-muted: #9aaab3;

    --success: #65d6c4;
    --danger: #f87171;

    --shadow: 0 12px 35px rgba(0, 0, 0, 0.16);
}

:root[data-theme="light"] {
    color-scheme: light;

    --background: #f5f7f8;
    --surface: #ffffff;
    --surface-secondary: #f5f7f8;
    --surface-hover: #e7efef;
    --border: #d5dfe2;
    --border-strong: #b9c9ce;

    --primary: #087f70;
    --primary-strong: #087f70;
    --primary-hover: #066b5e;
    --primary-soft: rgba(8, 127, 112, 0.09);
    --secondary: #066b5e;

    --button-bg: #087f70;
    --button-hover: #066b5e;
    --button-text: #ffffff;

    --text: #182329;
    --text-secondary: #394950;
    --text-muted: #52646d;

    --success: #087f70;
    --danger: #c93636;

    --shadow: 0 12px 35px rgba(30, 45, 50, 0.07);
}

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

body {
    min-width: 320px;
    min-height: 100vh;
    background: var(--background);
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.5;
    transition: background-color 0.2s ease, color 0.2s ease;
}

button,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

button:focus-visible,
input:focus-visible,
a:focus-visible {
    outline: 3px solid var(--secondary);
    outline-offset: 3px;
}

.app {
    width: min(100% - 40px, 760px);
    margin: 0 auto;
}

.topbar {
    min-height: 76px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-decoration: none;
}

.brand-symbol {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border: 1px solid var(--primary);
    border-radius: 10px;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 1.1rem;
}

.brand-version {
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 500;
}

.theme-toggle {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text);
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.theme-toggle:hover {
    background: var(--surface-hover);
    border-color: var(--border-strong);
}

.theme-toggle svg {
    width: 19px;
    height: 19px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.icon-moon {
    display: none;
}

:root[data-theme="light"] .icon-sun {
    display: none;
}

:root[data-theme="light"] .icon-moon {
    display: block;
}

.intro {
    padding: 64px 0 38px;
}

.eyebrow,
.section-label {
    color: var(--primary);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.13em;
}

.intro h1 {
    margin-top: 16px;
    font-size: clamp(2.2rem, 7vw, 3.4rem);
    line-height: 1.12;
    letter-spacing: -0.045em;
}

.intro h1 span {
    color: var(--primary);
}

.intro-description {
    max-width: 500px;
    margin-top: 18px;
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.7;
}

.progress-card {
    padding: 25px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.progress-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.progress-date {
    margin-top: 5px;
    color: var(--text-secondary);
    font-size: 0.88rem;
    text-transform: capitalize;
}

.progress-number {
    color: var(--primary);
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -0.04em;
}

.progress-track {
    height: 10px;
    margin-top: 24px;
    overflow: hidden;
    border-radius: 20px;
    background: var(--surface-secondary);
}

.progress-fill {
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(
        90deg,
        var(--primary-strong),
        var(--primary)
    );
    transition: width 0.25s ease;
}

.progress-summary {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 13px;
    color: var(--text-secondary);
    font-size: 0.82rem;
}

.progress-summary strong {
    color: var(--text);
}

.habits-section {
    margin-top: 48px;
}

.section-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.section-heading h2 {
    margin-top: 5px;
    font-size: 1.55rem;
    letter-spacing: -0.03em;
}

.habit-counter {
    padding: 6px 11px;
    border: 1px solid var(--border);
    border-radius: 20px;
    color: var(--text-secondary);
    font-size: 0.78rem;
    white-space: nowrap;
}

.add-form {
    display: flex;
    gap: 10px;
}

.add-form input {
    flex: 1;
    min-width: 0;
    min-height: 48px;
    padding: 0 15px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text);
    font-size: 0.95rem;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.add-form input::placeholder {
    color: var(--text-muted);
    opacity: 1;
}

.add-form input:focus {
    border-color: var(--primary);
}

.add-button {
    min-height: 48px;
    padding: 0 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border: 0;
    border-radius: 10px;
    background: var(--button-bg);
    color: var(--button-text);
    font-weight: 700;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

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

.add-button:active {
    transform: scale(0.98);
}

.add-button span {
    font-size: 1.3rem;
    line-height: 1;
}

.form-feedback {
    min-height: 24px;
    margin-top: 7px;
    color: var(--danger);
    font-size: 0.82rem;
}

.habit-list {
    display: grid;
    gap: 11px;
}

.habit-item {
    min-height: 76px;
    padding: 15px 17px;
    display: flex;
    align-items: center;
    gap: 13px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.habit-item.is-completed {
    border-color: rgba(101, 214, 196, 0.4);
    background: var(--surface-secondary);
}

.habit-check {
    width: 25px;
    height: 25px;
    flex: 0 0 25px;
    display: grid;
    place-items: center;
    border: 2px solid var(--border-strong);
    border-radius: 8px;
    background: transparent;
    color: #071411;
    font-size: 0.9rem;
    font-weight: 700;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.habit-check:hover {
    border-color: var(--primary);
}

.is-completed .habit-check {
    border-color: var(--success);
    background: var(--success);
}

.habit-name {
    flex: 1;
    min-width: 0;
    overflow-wrap: anywhere;
    font-size: 0.96rem;
    font-weight: 600;
}

.is-completed .habit-name {
    color: var(--text-secondary);
    text-decoration: line-through;
    text-decoration-thickness: 1px;
}

.delete-button {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    display: grid;
    place-items: center;
    border: 1px solid transparent;
    border-radius: 9px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 1.15rem;
    transition: border-color 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.delete-button:hover {
    border-color: rgba(248, 113, 113, 0.25);
    background: rgba(248, 113, 113, 0.08);
    color: var(--danger);
}

.empty-state {
    padding: 38px 20px;
    border: 1px dashed var(--border-strong);
    border-radius: 12px;
    text-align: center;
}

.empty-icon {
    margin-bottom: 12px;
    color: var(--primary);
    font-size: 2rem;
}

.empty-state h3 {
    font-size: 1rem;
}

.empty-state p {
    max-width: 340px;
    margin: 8px auto 0;
    color: var(--text-secondary);
    font-size: 0.88rem;
    line-height: 1.6;
}

.footer {
    padding: 38px 0 28px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.78rem;
}

.footer p + p {
    margin-top: 5px;
    color: var(--text-muted);
}

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

@media (max-width: 520px) {
    .app {
        width: min(100% - 28px, 760px);
    }

    .intro {
        padding: 48px 0 30px;
    }

    .intro-description {
        font-size: 0.94rem;
    }

    .progress-card {
        padding: 19px;
    }

    .progress-number {
        font-size: 1.55rem;
    }

    .habits-section {
        margin-top: 38px;
    }

    .add-form {
        flex-direction: column;
    }

    .add-button {
        width: 100%;
    }

    .habit-item {
        padding: 13px;
    }

    .progress-summary {
        font-size: 0.76rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
