:root {
    color-scheme: light;
    --bg: #f4f7fb;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --text: #172033;
    --muted: #667085;
    --line: #dce3ee;
    --ink: #111827;
    --accent: #2563eb;
    --accent-strong: #1746a2;
    --mint: #10b981;
    --gold: #f59e0b;
    --rose: #e11d48;
    --ok: #e8f8ee;
    --warn: #fff7e5;
    --error: #ffeaea;
    --shadow: 0 10px 28px rgba(17, 24, 39, .08);
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background:
        linear-gradient(180deg, rgba(37, 99, 235, .09), transparent 320px),
        radial-gradient(circle at 20% 0%, rgba(16, 185, 129, .14), transparent 260px),
        var(--bg);
    color: var(--text);
}

a {
    color: inherit;
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 2rem;
    border-bottom: 1px solid rgba(220, 227, 238, .8);
    background: rgba(255, 255, 255, .88);
    backdrop-filter: blur(14px);
}

.brand,
.app-header nav a {
    text-decoration: none;
    font-weight: 800;
}

.brand {
    color: var(--ink);
}

.app-header nav {
    display: flex;
    gap: .5rem;
}

.app-header nav a {
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: .45rem .75rem;
    color: var(--muted);
    background: var(--surface);
}

main {
    width: min(1180px, calc(100% - 2rem));
    margin: 0 auto;
    padding: 1.5rem 0 3rem;
}

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1.8fr) minmax(280px, .9fr);
    gap: 1rem;
    align-items: stretch;
}

.card,
.panel,
.quest-card,
.month {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, .92);
    box-shadow: var(--shadow);
}

.card,
.panel {
    padding: 1.25rem;
}

.hero-card {
    padding: clamp(1.25rem, 3vw, 2rem);
    color: #ffffff;
    background:
        linear-gradient(135deg, rgba(17, 24, 39, .98), rgba(23, 70, 162, .95)),
        var(--ink);
}

.hero-card h1 {
    max-width: 760px;
    margin: 0 0 .75rem;
    font-size: clamp(2rem, 5vw, 4.25rem);
    line-height: .98;
}

.hero-card .muted {
    color: rgba(255, 255, 255, .78);
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    margin-top: 1.2rem;
}

.muted {
    color: var(--muted);
}

.kicker,
.topic,
.badge {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 800;
}

.kicker {
    margin-bottom: .85rem;
    padding: .28rem .6rem;
    color: #bfdbfe;
    background: rgba(255, 255, 255, .1);
}

.badge {
    padding: .25rem .6rem;
    color: var(--accent-strong);
    background: #dbeafe;
}

.badge.success {
    color: #047857;
    background: #d1fae5;
}

.badge.warn {
    color: #92400e;
    background: #fef3c7;
}

.topic {
    padding: .2rem .5rem;
    color: var(--muted);
    background: #eef2f7;
}

.stats-row,
.grid {
    display: grid;
    gap: 1rem;
}

.stats-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: 1.5rem;
}

.stat {
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 8px;
    padding: .85rem;
    background: rgba(255, 255, 255, .08);
}

.stat strong {
    display: block;
    font-size: 1.55rem;
}

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

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

.progress {
    width: 100%;
    height: 12px;
    overflow: hidden;
    border-radius: 999px;
    background: #e6edf7;
}

.hero-card .progress {
    height: 16px;
    background: rgba(255, 255, 255, .18);
}

.progress > span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--mint), var(--gold));
    transition: width .65s ease;
}

.quest-map {
    margin-top: 1rem;
}

.quest-card {
    position: relative;
    display: grid;
    gap: .8rem;
    min-height: 148px;
    padding: 1rem;
}

.quest-card.current {
    border-color: var(--accent);
    box-shadow: 0 14px 34px rgba(37, 99, 235, .18);
}

.quest-card.complete {
    border-color: rgba(16, 185, 129, .35);
    background: linear-gradient(180deg, #ffffff, #f0fdf4);
}

.quest-card h3,
.month h2,
.week h3 {
    margin: 0;
}

.quest-meta {
    display: flex;
    justify-content: space-between;
    gap: .75rem;
    color: var(--muted);
    font-size: .9rem;
}

.current-panel {
    display: grid;
    gap: .9rem;
}

.date-form,
.reset-form {
    display: grid;
    gap: .65rem;
}

.month {
    margin-top: 1.25rem;
    padding: 1.25rem;
}

.month-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.week {
    margin-top: 1rem;
    padding: 1rem;
    border: 1px solid var(--line);
    border-left: 5px solid var(--line);
    border-radius: 8px;
    background: var(--surface-soft);
}

.week.current {
    border-left-color: var(--accent);
    background: #eff6ff;
}

.item {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: .85rem;
    margin: .75rem 0;
    padding: .9rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
}

.item.done {
    border-color: rgba(16, 185, 129, .35);
    background: var(--ok);
}

.item-title {
    display: block;
    margin-bottom: .3rem;
}

button,
input,
textarea {
    font: inherit;
}

button,
.button-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    border: 0;
    border-radius: 8px;
    padding: .55rem .9rem;
    color: #ffffff;
    background: var(--accent);
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
}

button.secondary,
.button-link.secondary {
    color: var(--text);
    background: #e8eef7;
}

.toggle-button {
    width: 42px;
    height: 42px;
    padding: 0;
    font-size: 1rem;
}

input,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: .6rem .75rem;
    color: var(--text);
    background: #ffffff;
}

textarea {
    min-height: 62px;
    resize: vertical;
}

.note-editor {
    display: grid;
    gap: .35rem;
}

.note-preview {
    justify-content: flex-start;
    width: 100%;
    min-height: 52px;
    border: 1px solid var(--line);
    padding: .65rem .75rem;
    color: var(--text);
    background: #ffffff;
    font-weight: 500;
    line-height: 1.45;
    text-align: left;
    white-space: pre-wrap;
}

.note-preview:hover,
.note-preview:focus-visible {
    border-color: rgba(37, 99, 235, .45);
    color: var(--ink);
    background: #f8fbff;
    outline: 3px solid rgba(37, 99, 235, .14);
    outline-offset: 0;
}

.note-preview.empty {
    color: var(--muted);
    font-style: italic;
}

.note-edit {
    display: grid;
    gap: .35rem;
}

.note-edit textarea {
    min-height: 94px;
}

.note-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    color: var(--muted);
    font-size: .85rem;
}

.note-status {
    font-weight: 700;
}

form.inline {
    display: inline;
}

.login-card {
    max-width: 420px;
    margin: 3rem auto;
}

.login-card h1 {
    margin: .25rem 0 1rem;
}

.login-card form {
    display: grid;
    gap: .5rem;
}

.login-card button {
    margin-top: .5rem;
}

.login-card .checkbox {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin: .25rem 0 0;
    font-weight: 400;
}

.login-card .checkbox input {
    width: auto;
}

.flash {
    border-radius: 8px;
    padding: .8rem 1rem;
    margin-bottom: 1rem;
    font-weight: 700;
}

.flash-success {
    color: #065f46;
    background: var(--ok);
}

.flash-error {
    color: #9f1239;
    background: var(--error);
}

table {
    width: 100%;
    overflow: hidden;
    border-collapse: collapse;
    border-radius: 8px;
    background: #ffffff;
}

th,
td {
    padding: .8rem;
    border-bottom: 1px solid var(--line);
    text-align: left;
}

th {
    background: #f1f4f9;
}

code {
    overflow-wrap: anywhere;
}

.guide-hero {
    align-items: start;
}

.guide-nav {
    position: sticky;
    top: 88px;
    display: grid;
    gap: .75rem;
    max-height: calc(100vh - 110px);
    overflow: auto;
}

.guide-nav nav {
    display: grid;
    gap: .35rem;
}

.guide-nav-link {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: .55rem .65rem;
    color: var(--muted);
    background: var(--surface-soft);
    text-decoration: none;
    font-weight: 700;
}

.guide-nav-link.level-3 {
    margin-left: .75rem;
    font-size: .92rem;
}

.guide-layout {
    margin-top: 1rem;
}

.guide-document {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: clamp(1rem, 3vw, 2rem);
    background: rgba(255, 255, 255, .96);
    box-shadow: var(--shadow);
}

.guide-document h1,
.guide-document h2,
.guide-document h3,
.guide-document h4 {
    scroll-margin-top: 96px;
}

.guide-document h1 {
    margin-top: 0;
    font-size: clamp(2rem, 4vw, 3.5rem);
}

.guide-document h2 {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--line);
}

.guide-document p,
.guide-document li {
    line-height: 1.7;
}

.guide-document table {
    margin: 1rem 0;
}

.guide-document blockquote {
    border-left: 5px solid var(--gold);
    border-radius: 8px;
    margin: 1rem 0;
    padding: .9rem 1rem;
    background: #fffbeb;
    color: #713f12;
    font-weight: 700;
}

.guide-document blockquote p {
    margin: 0;
}

.guide-code {
    overflow: auto;
    border-radius: 8px;
    padding: 1rem;
    background: #0f172a;
    color: #e5eefb;
    font: .92rem/1.55 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

.guide-code code {
    color: inherit;
}

.hljs-keyword,
.hljs-built_in,
.hljs-type {
    color: #93c5fd;
}

.hljs-title,
.hljs-name,
.hljs-function {
    color: #fcd34d;
}

.hljs-string,
.hljs-attr,
.hljs-symbol {
    color: #86efac;
}

.hljs-variable,
.hljs-template-variable {
    color: #f9a8d4;
}

.hljs-comment,
.hljs-meta {
    color: #94a3b8;
}

.hljs-number,
.hljs-literal {
    color: #fdba74;
}

.guide-document ul,
.guide-document ol {
    padding-left: 1.4rem;
}

.guide-check {
    list-style: none;
    margin: .55rem 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: .75rem;
    background: var(--surface-soft);
    font-weight: 700;
}

.guide-check::marker {
    content: "";
}

.guide-check input {
    width: 20px;
    height: 20px;
    margin-top: .1rem;
    margin-right: .65rem;
    accent-color: var(--mint);
}

@media (max-width: 900px) {
    .hero,
    .grid-2,
    .grid-3,
    .stats-row {
        grid-template-columns: 1fr;
    }

    .app-header {
        align-items: flex-start;
        flex-direction: column;
        padding: .9rem 1rem;
    }

    main {
        width: min(100% - 1rem, 1180px);
        padding-top: 1rem;
    }

    .guide-nav {
        position: static;
        max-height: none;
    }
}
