﻿/* ============================================================
   Linerdiary — كۈندىلىك خاتىرە
   ئىسسىق قەغەز ئۇسلۇبى، RTL
   ============================================================ */

@font-face {
    font-family: "UKIJ Qara";
    src: url("../../font/UKIJQara.ttf") format("truetype");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "UKIJ Qara";
    src: url("../../font/UKIJQara-b.ttf") format("truetype");
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

:root {
    --paper: #faf6ee;
    --paper-deep: #f2eadb;
    --card: #fffdf8;
    --ink: #2b2520;
    --ink-soft: #5f554b;
    --muted: #94897b;
    --line: #e9dfcf;
    --line-strong: #dccfb9;
    --accent: #b85434;
    --accent-dark: #94402a;
    --accent-soft: #f7e5dc;
    --gold: #c09355;
    --green: #6d7f5f;

    /* --- تېما ئالماشتۇرۇشقا تەييار قىممەتلەر (ئىسسىق قەغەز = ئۆزلۈكىدىن) --- */
    --accent-rgb: 184 84 52;
    --accent-dark-rgb: 148 64 42;
    --accent-deep: #7f3523;
    --accent-line: #e5c5b3;
    --accent-line-soft: #ecc7b5;
    --accent-pale: #fbeee6;
    --on-accent: #fff9f2;
    --dot-1: #d9a98c;
    --dot-2: #c47b56;
    --danger: #8f3120;
    --danger-strong: #a33227;
    --danger-bg: #fbebe7;
    --danger-line: #f0d2c9;
    --danger-hover: #f1e3da;
    --muted-soft: #b3a795;
    --muted-faint: #c8bdae;
    --note-bg: #fbf7ef;
    --cal-tint: #f7efe3;
    --cal-tint-line: #ecdbc5;
    --streak-bg-a: #fffaf2;
    --streak-bg-b: #f7ecdd;
    --streak-line: #e8d8c3;
    --quote-bg-a: #f6eddf;
    --quote-bg-b: #faf4ea;
    --search-active-bg: #fffdfa;
    --privacy-line: #e3d2bd;
    --paper-rgb: 250 246 238;
    --card-rgb: 255 253 248;
    --spot-rgb: 120 98 72;
    --ink-rgb: 43 37 32;
    --gold-rgb: 192 147 85;

    --shadow-sm: 0 1px 2px rgb(var(--ink-rgb) / .05);
    --shadow-md: 0 12px 30px -18px rgb(var(--ink-rgb) / .35);
    --shadow-lg: 0 30px 60px -30px rgb(var(--ink-rgb) / .45);
    --radius: 18px;
    --radius-sm: 12px;
    --font: "UKIJ Qara", "UKIJ Tuz Tom", "Noto Naskh Arabic", "Scheherazade New",
        "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC",
        "Segoe UI", Tahoma, "Microsoft Uighur", sans-serif;
}

/* ---------------- زەيتۇن يېشىل تېما ---------------- */

html[data-theme="olive"] {
    --paper: #f4f6ee;
    --paper-deep: #e7ecdd;
    --card: #fcfdf7;
    --ink: #22271f;
    --ink-soft: #4e5747;
    --muted: #7f8a76;
    --line: #dfe4d4;
    --line-strong: #cbd4bd;
    --accent: #4f7a4a;
    --accent-dark: #3b5f38;
    --accent-soft: #e5efe0;
    --gold: #a6975c;
    --green: #557d4b;

    --accent-rgb: 79 122 74;
    --accent-dark-rgb: 59 95 56;
    --accent-deep: #2f4e2d;
    --accent-line: #c3d6bb;
    --accent-line-soft: #cfe0c8;
    --accent-pale: #eaf2e3;
    --on-accent: #fbfdf6;
    --dot-1: #a9c39a;
    --dot-2: #7fa46e;

    --muted-soft: #a8b29f;
    --muted-faint: #c2cbb8;
    --note-bg: #f3f7ec;
    --cal-tint: #eef2e4;
    --cal-tint-line: #dbe2cd;
    --streak-bg-a: #fbfdf5;
    --streak-bg-b: #eef3e2;
    --streak-line: #d8e0c8;
    --quote-bg-a: #eef2e3;
    --quote-bg-b: #f7f9ef;
    --search-active-bg: #fbfdf7;
    --privacy-line: #d5dfc8;
    --paper-rgb: 244 246 238;
    --card-rgb: 252 253 247;
    --spot-rgb: 98 112 82;
    --ink-rgb: 34 39 31;
    --gold-rgb: 166 151 92;
}

/* ---------------- بەنەفشە تېما ---------------- */

html[data-theme="purple"] {
    --paper: #f7f3fa;
    --paper-deep: #ece4f2;
    --card: #fdfbff;
    --ink: #262231;
    --ink-soft: #514a5f;
    --muted: #847b91;
    --line: #e4dbea;
    --line-strong: #d1c4dc;
    --accent: #7b5aa6;
    --accent-dark: #5f4385;
    --accent-soft: #ece2f5;
    --gold: #ad8aa8;
    --green: #6d7f76;

    --accent-rgb: 123 90 166;
    --accent-dark-rgb: 95 67 133;
    --accent-deep: #4c3469;
    --accent-line: #cdb9df;
    --accent-line-soft: #d8c9e6;
    --accent-pale: #f0e8f8;
    --on-accent: #fdfbff;
    --dot-1: #c4a9dd;
    --dot-2: #9877bd;

    --muted-soft: #a99fb5;
    --muted-faint: #c6bcd0;
    --note-bg: #f6f1fb;
    --cal-tint: #f0eaf7;
    --cal-tint-line: #ded2e9;
    --streak-bg-a: #fcfaff;
    --streak-bg-b: #f0e9f8;
    --streak-line: #dbcfea;
    --quote-bg-a: #f0e9f7;
    --quote-bg-b: #f9f5fc;
    --search-active-bg: #fdfbff;
    --privacy-line: #d8cbe4;
    --paper-rgb: 247 243 250;
    --card-rgb: 253 251 255;
    --spot-rgb: 104 92 116;
    --ink-rgb: 38 34 49;
    --gold-rgb: 173 138 168;
}

/* ---------------- سەپسەر كۆك تېما ---------------- */

html[data-theme="blue"] {
    --paper: #f2f5f9;
    --paper-deep: #e3eaf3;
    --card: #fbfdff;
    --ink: #1f2733;
    --ink-soft: #485464;
    --muted: #79879a;
    --line: #dbe3ee;
    --line-strong: #c5d2e1;
    --accent: #3f6f9e;
    --accent-dark: #2e547b;
    --accent-soft: #e0ebf5;
    --gold: #b09a6c;
    --green: #557c72;

    --accent-rgb: 63 111 158;
    --accent-dark-rgb: 46 84 123;
    --accent-deep: #24425f;
    --accent-line: #b9cee2;
    --accent-line-soft: #c7d9e9;
    --accent-pale: #e6f0f9;
    --on-accent: #fbfdff;
    --dot-1: #9fbcd8;
    --dot-2: #6d97bd;

    --muted-soft: #9dabbd;
    --muted-faint: #bcc8d7;
    --note-bg: #f3f7fc;
    --cal-tint: #eaeff6;
    --cal-tint-line: #d3dfeb;
    --streak-bg-a: #fbfdff;
    --streak-bg-b: #eaf1f8;
    --streak-line: #d4e0ec;
    --quote-bg-a: #edf2f8;
    --quote-bg-b: #f7fafd;
    --search-active-bg: #fbfdff;
    --privacy-line: #d0dce9;
    --paper-rgb: 242 245 249;
    --card-rgb: 251 253 255;
    --spot-rgb: 88 103 120;
    --ink-rgb: 31 39 51;
    --gold-rgb: 176 154 108;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: var(--paper);
    background-image:
        radial-gradient(circle at 12% 0%, rgb(var(--gold-rgb) / .10), transparent 42%),
        radial-gradient(circle at 88% 8%, rgb(var(--accent-rgb) / .07), transparent 38%);
    background-repeat: no-repeat;
    color: var(--ink);
    font-family: var(--font);
    font-size: 17px;
    line-height: 1.9;
    text-rendering: optimizeLegibility;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background-image: radial-gradient(rgb(var(--spot-rgb) / .055) 1px, transparent 1px);
    background-size: 22px 22px;
}

h1, h2, h3, p, ul, ol, figure {
    margin: 0;
}

ul, ol {
    padding: 0;
    list-style: none;
}

a {
    color: var(--accent-dark);
    text-decoration: none;
}

button {
    font-family: inherit;
    font-size: inherit;
    color: inherit;
    cursor: pointer;
}

input, textarea {
    font-family: inherit;
    font-size: inherit;
    color: inherit;
}

svg {
    display: block;
}

[v-cloak] {
    display: none !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 6px;
}

.skip-link {
    position: absolute;
    inset-inline-start: 16px;
    top: -60px;
    z-index: 100;
    padding: 8px 16px;
    background: var(--ink);
    color: var(--paper);
    border-radius: 0 0 10px 10px;
    transition: top .15s ease;
}

.skip-link:focus {
    top: 0;
}


/* ---------------- Header ---------------- */

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgb(var(--paper-rgb) / .88);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(14px) saturate(140%);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
}

.site-header-inner {
    max-width: 1120px;
    margin: 0 auto;
    padding: 14px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: var(--ink);
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 13px;
    background: var(--accent);
    color: var(--on-accent);
    box-shadow: 0 8px 16px -10px rgb(var(--accent-dark-rgb) / .9);
    transform: rotate(-3deg);
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
}

.brand-name {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: .2px;
}

.brand-sub {
    font-size: 11px;
    letter-spacing: 2.4px;
    text-transform: uppercase;
    color: var(--muted);
    direction: ltr;
    text-align: right;
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 6px;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    padding: 8px 14px;
    border-radius: 999px;
    color: var(--ink-soft);
    font-size: 15.5px;
    border: 1px solid transparent;
    background: none;
    transition: background .15s ease, color .15s ease;
}

.nav-link:hover {
    background: rgb(var(--accent-rgb) / .08);
    color: var(--accent-dark);
}

.nav-link.is-active {
    background: var(--card);
    border-color: var(--line-strong);
    color: var(--ink);
    box-shadow: var(--shadow-sm);
}

.logout-form {
    display: inline-flex;
    margin: 0;
}

.nav-button {
    font: inherit;
    line-height: inherit;
    cursor: pointer;
    appearance: none;
}

.nav-link-icon {
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
}

.nav-link-icon svg {
    display: block;
}

/* ---------------- Layout ---------------- */

.site-main {
    position: relative;
    z-index: 1;
    flex: 1 0 auto;
    width: 100%;
    max-width: 1120px;
    margin: 0 auto;
    padding: 34px 28px 56px;
}

.site-footer {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 22px 28px 30px;
    color: var(--muted);
    font-size: 13.5px;
}

.footer-sep {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--line-strong);
}

.noscript {
    position: fixed;
    inset-inline: 16px;
    bottom: 16px;
    z-index: 50;
    padding: 12px 18px;
    background: var(--ink);
    color: var(--paper);
    border-radius: 12px;
    text-align: center;
    font-size: 15px;
}

/* ---------------- Buttons ---------------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 22px;
    border-radius: 999px;
    border: 1px solid var(--line-strong);
    background: var(--card);
    color: var(--ink);
    font-size: 16px;
    font-weight: 600;
    line-height: 1.4;
    transition: transform .15s ease, box-shadow .15s ease, background .15s ease, border-color .15s ease;
}

.btn:hover:not(:disabled) {
    border-color: var(--accent);
    color: var(--accent-dark);
    transform: translateY(-1px);
}

.btn:disabled {
    opacity: .55;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    border-color: transparent;
    color: var(--on-accent);
    box-shadow: 0 14px 24px -16px rgb(var(--accent-dark-rgb) / .9);
}

.btn-primary:hover:not(:disabled) {
    color: var(--on-accent);
    background: linear-gradient(135deg, var(--accent-dark), var(--accent-deep));
    box-shadow: 0 18px 30px -16px rgb(var(--accent-dark-rgb) / .95);
}

.btn-ghost {
    background: transparent;
    border-color: transparent;
    color: var(--muted);
}

.btn-ghost:hover:not(:disabled) {
    background: rgb(var(--ink-rgb) / .05);
    color: var(--ink);
}

.btn-small {
    padding: 8px 16px;
    font-size: 14.5px;
}

.btn-block {
    width: 100%;
}

.btn-icon {
    flex: 0 0 auto;
}

.icon-btn {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid var(--line-strong);
    background: var(--card);
    color: var(--ink-soft);
    transition: background .15s ease, color .15s ease, border-color .15s ease;
}

.icon-btn:hover:not(:disabled) {
    background: var(--accent-soft);
    color: var(--accent-dark);
    border-color: transparent;
}

.icon-btn:disabled {
    opacity: .35;
    cursor: not-allowed;
}

.link-btn {
    padding: 0;
    border: 0;
    background: none;
    color: var(--muted);
    font-size: 14.5px;
    text-decoration: underline;
    text-decoration-color: transparent;
    text-underline-offset: 4px;
    transition: color .15s ease, text-decoration-color .15s ease;
}

.link-btn:hover {
    color: var(--accent-dark);
    text-decoration-color: currentColor;
}

.link-danger:hover {
    color: var(--danger-strong);
}

/* ---------------- Shared pieces ---------------- */

.card {
    position: relative;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.card-title {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: .2px;
}

.count-pill {
    display: inline-grid;
    place-items: center;
    min-width: 24px;
    height: 24px;
    padding: 0 7px;
    border-radius: 999px;
    background: var(--paper-deep);
    color: var(--ink-soft);
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--muted);
    font-size: 14px;
    letter-spacing: .3px;
}

.eyebrow-line {
    width: 26px;
    height: 1px;
    background: var(--line-strong);
}

.form-error,
.inline-error {
    margin-top: 10px;
    padding: 9px 14px;
    border-radius: var(--radius-sm);
    background: var(--danger-bg);
    border: 1px solid var(--danger-line);
    color: var(--danger);
    font-size: 14.5px;
}

.hint {
    margin-top: 10px;
    color: var(--muted);
    font-size: 13px;
}

/* ---------------- Home ---------------- */

.hero {
    padding: 6px 4px 28px;
}

.hero-title {
    margin-top: 10px;
    font-size: clamp(40px, 6vw, 58px);
    font-weight: 700;
    line-height: 1.18;
    letter-spacing: -.5px;
}

.hero-tagline {
    margin-top: 10px;
    max-width: 46ch;
    color: var(--ink-soft);
    font-size: 17.5px;
}

.hero-actions {
    margin-top: 22px;
    display: flex;
    align-items: center;
    gap: 8px 18px;
    flex-wrap: wrap;
}

.hero-note {
    color: var(--accent-dark);
    font-size: 14.5px;
}

.hero-note-muted {
    color: var(--muted);
}

.stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}

.stat-card {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 16px 22px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.stat-value {
    display: flex;
    align-items: baseline;
    gap: 6px;
    font-size: 32px;
    font-weight: 700;
    line-height: 1.25;
}

.stat-label {
    color: var(--muted);
    font-size: 13.5px;
}

.stat-card-streak {
    background: linear-gradient(135deg, var(--streak-bg-a), var(--streak-bg-b));
    border-color: var(--streak-line);
}

.stat-spark {
    color: var(--gold);
    font-size: 16px;
}

.home-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 22px;
    align-items: start;
}

.calendar-card {
    padding: 22px;
}

.calendar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.calendar-title {
    text-align: center;
}

.calendar-title h2 {
    font-size: 22px;
    font-weight: 700;
    line-height: 1.5;
}

.calendar-title p {
    color: var(--muted);
    font-size: 13.5px;
}

/* ---------------- Calendar search ---------------- */

.calendar-search {
    margin-bottom: 16px;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 10px;
    border: 1px solid var(--line-strong);
    border-radius: 14px;
    background: var(--card);
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}

.search-box:focus-within {
    border-color: var(--accent);
    outline: none;
    box-shadow: 0 0 0 3px rgb(var(--accent-rgb) / .10);
}

.search-box.is-active {
    border-color: var(--accent-line);
    background: var(--search-active-bg);
}

.search-icon {
    flex: 0 0 auto;
    color: var(--muted);
}

.search-input {
    flex: 1 1 auto;
    min-width: 0;
    padding: 5px 2px;
    border: 0;
    outline: none;
    background: transparent;
    font-size: 14.5px;
    line-height: 1.7;
}

.search-input::placeholder {
    color: var(--muted-soft);
}

.search-input::-webkit-search-cancel-button {
    display: none;
}

.search-clear {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 26px;
    height: 26px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--muted);
    font-size: 17px;
    line-height: 1;
}

.search-clear:hover {
    background: var(--paper-deep);
    color: var(--ink);
}

.search-divider {
    flex: 0 0 auto;
    width: 1px;
    height: 20px;
    background: var(--line);
}

.mood-select-wrap {
    position: relative;
    display: flex;
    align-items: center;
    flex: 0 0 auto;
}

.mood-select {
    max-width: 128px;
    padding-block: 5px;
    padding-inline: 4px 18px;
    border: 0;
    outline: none;
    background: transparent;
    color: var(--ink-soft);
    font-family: inherit;
    font-size: 12.5px;
    line-height: 1.6;
    text-overflow: ellipsis;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}

.mood-caret {
    position: absolute;
    inset-inline-end: 1px;
    color: var(--muted);
    pointer-events: none;
}

.search-meta {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin-top: 7px;
    padding: 0 3px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.8;
}

.search-meta strong {
    color: var(--accent-dark);
    font-weight: 700;
}

.search-empty {
    margin-top: 7px;
    padding: 0 3px;
    color: var(--danger);
    font-size: 13px;
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 6px;
    margin-top: 18px;
    align-items: center;
    color: var(--muted);
    font-size: 13px;
    text-align: center;
}

.calendar-weekdays .is-weekend {
    color: var(--accent);
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 6px;
    margin-top: 8px;
    transition: opacity .2s ease;
}

.calendar-grid.is-loading {
    opacity: .45;
    pointer-events: none;
}

.cal-blank {
    aspect-ratio: 1 / 1;
}

.cal-day {
    position: relative;
    aspect-ratio: 1 / 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 13px;
    background: transparent;
    color: var(--ink-soft);
    font-size: 16px;
    line-height: 1;
    transition: background .15s ease, border-color .15s ease, color .15s ease, transform .15s ease;
}

.cal-day:hover:not(:disabled) {
    background: var(--paper-deep);
    border-color: var(--line-strong);
    transform: translateY(-1px);
}

.cal-day .cal-num {
    font-variant-numeric: tabular-nums;
}

.cal-day.is-weekend .cal-num {
    color: var(--accent-dark);
}

.cal-day.has-entry {
    background: var(--cal-tint);
    border-color: var(--cal-tint-line);
    color: var(--ink);
    font-weight: 700;
}

.cal-day.is-today {
    background: var(--accent-soft);
    border-color: var(--accent);
    box-shadow: inset 0 0 0 1px var(--accent);
    color: var(--accent-dark);
}

.cal-day.is-future,
.cal-day:disabled {
    color: var(--muted-faint);
    cursor: default;
}

.calendar-grid.is-search .cal-day:not(.is-match) .cal-num {
    opacity: .38;
}

.calendar-grid.is-search .cal-day.is-match {
    background: var(--accent-pale);
    border-color: var(--accent-line-soft);
    color: var(--accent-dark);
    font-weight: 700;
    box-shadow: inset 0 0 0 1.5px rgb(var(--accent-rgb) / .32);
}

.calendar-grid.is-search .cal-day.is-today {
    background: var(--accent-soft);
    border-color: var(--accent);
    box-shadow: inset 0 0 0 1px var(--accent);
}

.cal-dot,
.legend-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
}

.cal-dot[data-level="1"],
.legend-dot[data-level="1"] {
    width: 5px;
    height: 5px;
    background: var(--dot-1);
}

.cal-dot[data-level="2"],
.legend-dot[data-level="2"] {
    background: var(--dot-2);
}

.cal-dot[data-level="3"],
.legend-dot[data-level="3"] {
    width: 8px;
    height: 8px;
    background: var(--accent-dark);
}

.calendar-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px dashed var(--line);
}

.legend {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--muted);
    font-size: 12.5px;
}

.legend-dot {
    margin-inline: 1px;
}

.calendar-error {
    color: var(--danger);
    font-size: 13.5px;
}

.home-side {
    position: sticky;
    top: 88px;
    display: grid;
    gap: 18px;
}

.recent-card {
    padding: 20px;
}

.recent-list {
    display: grid;
    gap: 2px;
    margin-top: 10px;
}

.recent-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 8px;
    border-radius: 12px;
    border-bottom: 1px solid var(--line);
    color: var(--ink);
    transition: background .15s ease;
}

.recent-list li:last-child .recent-item {
    border-bottom: 0;
}

.recent-item:hover {
    background: var(--paper);
}

.recent-date {
    display: flex;
    flex-direction: column;
    line-height: 1.5;
}

.recent-day {
    font-size: 16px;
    font-weight: 600;
}

.recent-weekday {
    color: var(--muted);
    font-size: 12.5px;
}

.recent-count {
    color: var(--muted);
    font-size: 13px;
    white-space: nowrap;
}

.empty-mini {
    padding: 14px 4px 4px;
}

.empty-title {
    font-size: 16px;
    font-weight: 700;
}

.empty-hint {
    margin-top: 4px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.8;
}

.quote-card {
    position: relative;
    overflow: hidden;
    padding: 20px 22px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: linear-gradient(135deg, var(--quote-bg-a), var(--quote-bg-b));
    color: var(--ink-soft);
    font-size: 15.5px;
}

.quote-mark {
    position: absolute;
    inset-inline-end: 14px;
    top: -6px;
    color: rgb(var(--accent-rgb) / .14);
    font-size: 58px;
    line-height: 1;
}

/* ---------------- Diary day ---------------- */

.diary {
    max-width: 860px;
    margin: 0 auto;
}

.diary-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--muted);
    font-size: 14.5px;
    transition: color .15s ease;
}

.back-link:hover {
    color: var(--accent-dark);
}

.diary-badge {
    padding: 5px 14px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent-dark);
    font-size: 13px;
    font-weight: 600;
}

.diary-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 24px 26px;
    background: linear-gradient(135deg, var(--card), var(--paper));
    box-shadow: var(--shadow-md);
}

.diary-date h1 {
    margin-top: 4px;
    font-size: clamp(26px, 3.4vw, 34px);
    line-height: 1.45;
}

.diary-sub {
    margin-top: 2px;
    color: var(--muted);
    font-size: 14.5px;
}

.weather-box {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 0 0 auto;
}

.weather-icon-btn {
    display: grid;
    place-items: center;
    width: 62px;
    height: 62px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--card);
    color: var(--muted);
    transition: border-color .15s ease, transform .15s ease;
}

.weather-icon-btn:hover:not(:disabled) {
    border-color: var(--accent);
    transform: translateY(-1px);
}

.weather-icon-btn:disabled {
    cursor: default;
}

.weather-emoji {
    font-size: 32px;
    line-height: 1;
}

.weather-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.55;
    min-width: 76px;
}

.weather-temp {
    font-size: 26px;
    font-weight: 700;
}

.weather-label {
    color: var(--ink-soft);
    font-size: 14px;
}

.weather-city {
    max-width: 180px;
    overflow: hidden;
    color: var(--muted);
    font-size: 12.5px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.weather-meta .link-btn {
    font-size: 12.5px;
}

.readonly-note {
    margin-top: 16px;
    padding: 12px 16px;
    border: 1px dashed var(--line-strong);
    border-radius: 14px;
    background: rgb(var(--gold-rgb) / .10);
    color: var(--ink-soft);
    font-size: 14px;
}

.composer {
    margin-top: 18px;
    padding: 20px 22px;
}

.composer-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.composer-head h2 {
    font-size: 17px;
    font-weight: 700;
}

.char-count {
    color: var(--muted);
    font-size: 12.5px;
}

.char-count.is-over {
    color: var(--danger-strong);
    font-weight: 700;
}

.composer-input {
    width: 100%;
    min-height: 128px;
    margin-top: 10px;
    padding: 0;
    border: 0;
    outline: none;
    background: transparent;
    font-size: 17.5px;
    line-height: 2;
    resize: vertical;
}

.composer-input::placeholder {
    color: var(--muted-soft);
}

.composer-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 10px;
    padding-top: 14px;
    border-top: 1px dashed var(--line);
}

.mood-pick {
    display: flex;
    gap: 4px;
}

.mood-btn {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border: 1px solid transparent;
    border-radius: 50%;
    background: transparent;
    font-size: 20px;
    filter: grayscale(1);
    opacity: .55;
    transition: filter .15s ease, opacity .15s ease, background .15s ease, transform .15s ease;
}

.mood-btn:hover {
    background: var(--paper);
    opacity: 1;
}

.mood-btn.is-active {
    background: var(--accent-soft);
    border-color: var(--accent-line-soft);
    filter: none;
    opacity: 1;
    transform: scale(1.06);
}

.composer-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.entries-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 26px 4px 12px;
}

.entries-head h2 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 17px;
    font-weight: 700;
}

.toast {
    color: var(--green);
    font-size: 13.5px;
    animation: fade-in .2s ease;
}

.empty-state {
    padding: 34px 24px;
    border-style: dashed;
    background: transparent;
    box-shadow: none;
    text-align: center;
}

.empty-icon {
    display: inline-block;
    color: var(--accent);
    font-size: 30px;
    opacity: .55;
}

.empty-state .empty-title {
    margin-top: 6px;
}

.empty-state .empty-hint {
    max-width: 36ch;
    margin: 4px auto 0;
}

/* ---------------- Entries ---------------- */

.entry-card {
    margin-bottom: 14px;
    padding: 20px 22px;
    transition: border-color .15s ease, box-shadow .15s ease;
    animation: lift-in .25s ease both;
}

.entry-card.is-editing {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgb(var(--accent-rgb) / .10);
}

.entry-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.entry-meta {
    display: flex;
    align-items: center;
    gap: 10px;
}

.entry-time {
    color: var(--muted);
    font-size: 14.5px;
    font-variant-numeric: tabular-nums;
    letter-spacing: .5px;
}

.mood-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 9px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--paper);
    color: var(--ink-soft);
    font-size: 12.5px;
}

.entry-tools {
    display: flex;
    align-items: center;
    gap: 12px;
    opacity: .55;
    transition: opacity .15s ease;
}

.entry-card:hover .entry-tools,
.entry-card:focus-within .entry-tools {
    opacity: 1;
}

.entry-body {
    margin-top: 10px;
    font-size: 17.5px;
    line-height: 2.05;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.entry-foot {
    display: flex;
    justify-content: flex-end;
    margin-top: 12px;
}

.note-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 1px solid transparent;
    border-radius: 999px;
    background: transparent;
    color: var(--muted);
    font-size: 13.5px;
}

.note-toggle:hover {
    background: var(--paper);
    color: var(--accent-dark);
}

.notes {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed var(--line);
}

.note-list {
    display: grid;
    gap: 8px;
}

.note {
    display: flex;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    background: var(--note-bg);
}

.note-dot {
    flex: 0 0 auto;
    width: 6px;
    height: 6px;
    margin-top: 11px;
    border-radius: 50%;
    background: var(--gold);
}

.note-content {
    flex: 1;
    min-width: 0;
}

.note-content p {
    font-size: 15.5px;
    line-height: 1.9;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.note-time {
    color: var(--muted);
    font-size: 12px;
}

.note-del {
    flex: 0 0 auto;
    width: 26px;
    height: 26px;
    border: 0;
    border-radius: 50%;
    background: none;
    color: var(--muted);
    font-size: 19px;
    line-height: 1;
}

.note-del:hover {
    background: var(--danger-hover);
    color: var(--danger-strong);
}

.note-empty {
    color: var(--muted);
    font-size: 14px;
}

.note-form {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.note-form input {
    flex: 1;
    min-width: 0;
    padding: 9px 14px;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    background: var(--card);
    font-size: 15px;
}

.note-form input:focus {
    border-color: var(--accent);
    outline: none;
    box-shadow: 0 0 0 3px rgb(var(--accent-rgb) / .10);
}

/* ---------------- Modal ---------------- */

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgb(var(--ink-rgb) / .38);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    animation: fade-in .15s ease;
}

.modal {
    width: min(420px, 100%);
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--card);
    box-shadow: var(--shadow-lg);
    animation: lift-in .2s ease;
}

.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.modal-head h2 {
    font-size: 18px;
    font-weight: 700;
}

.modal-head .icon-btn {
    width: 32px;
    height: 32px;
    font-size: 21px;
    line-height: 1;
}

.modal-hint {
    margin-top: 6px;
    color: var(--muted);
    font-size: 13.5px;
    line-height: 1.8;
}

.modal-locate {
    width: 100%;
    margin-top: 14px;
}

.city-form {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.city-form input {
    flex: 1;
    min-width: 0;
    padding: 10px 16px;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    background: var(--card);
    font-size: 15px;
}

.city-form input:focus {
    border-color: var(--accent);
    outline: none;
    box-shadow: 0 0 0 3px rgb(var(--accent-rgb) / .10);
}

/* ---------------- Login ---------------- */

.page-login {
    min-height: 100vh;
}

.page-login .site-header,
.page-login .site-footer {
    display: none;
}

.page-login .site-main {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 24px;
}

.login-wrap {
    display: grid;
    place-items: center;
    width: 100%;
    padding: 0;
}

.login-card {
    width: min(430px, 100%);
    padding: 28px 30px 26px;
    text-align: start;
    background: linear-gradient(160deg, var(--card) 0%, var(--paper) 100%);
    box-shadow: var(--shadow-lg);
}

.login-mark {
    display: grid;
    place-items: center;
    width: 50px;
    height: 50px;
    border-radius: 16px;
    background: var(--accent-soft);
    color: var(--accent-dark);
    box-shadow: inset 0 0 0 1px rgb(var(--accent-rgb) / .08);
    transform: rotate(-2deg);
}

.login-descriptions {
    display: grid;
    gap: 0;
    margin-top: 17px;
    padding: 3px 15px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgb(var(--card-rgb) / .72);
}

.login-description {
    padding: 8px 0;
    color: var(--ink-soft);
    font-size: 13.5px;
    line-height: 1.85;
    text-align: start;
}

.login-description + .login-description {
    border-top: 1px dashed var(--line);
}

.login-description[lang="en"] {
    color: var(--muted);
    font-size: 13px;
    letter-spacing: .15px;
}

.login-kicker {
    margin-top: 22px;
    color: var(--gold);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 2.2px;
    line-height: 1.8;
}

.login-title {
    margin-top: 3px;
    font-size: 27px;
    font-weight: 700;
    line-height: 1.55;
}

.login-privacy {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    margin-top: 16px;
    padding: 13px 14px;
    border: 1px dashed var(--privacy-line);
    border-radius: 14px;
    background: rgb(var(--gold-rgb) / .08);
}

.login-privacy-icon {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    border-radius: 10px;
    background: var(--card);
    color: var(--accent-dark);
    box-shadow: var(--shadow-sm);
}

.login-privacy-label {
    display: block;
    color: var(--accent-dark);
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 1.2px;
    line-height: 1.7;
}

.login-privacy-text {
    margin-top: 2px;
    color: var(--ink-soft);
    font-size: 13.5px;
    line-height: 1.9;
}

.login-hint {
    margin-top: 15px;
    color: var(--muted);
    font-size: 14px;
}

.login-form {
    margin-top: 11px;
    text-align: start;
}

.field-label {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 13.5px;
}

.field-input {
    width: 100%;
    padding: 11px 16px;
    border: 1px solid var(--line-strong);
    border-radius: 12px;
    background: var(--card);
    font-size: 17px;
    letter-spacing: 3px;
}

.field-input:focus {
    border-color: var(--accent);
    outline: none;
    box-shadow: 0 0 0 3px rgb(var(--accent-rgb) / .10);
}

.field-input:disabled {
    background: var(--paper-deep);
    color: var(--muted);
}

.login-form .btn {
    margin-top: 14px;
}

.login-form .btn:disabled {
    cursor: not-allowed;
    opacity: .55;
}

.login-form .form-error {
    margin-top: 8px;
    text-align: start;
}

.login-transport {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    margin-top: 11px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.75;
}

.login-transport svg {
    flex: 0 0 auto;
    margin-top: 2px;
}

.login-transport.is-secure {
    color: var(--green);
}

.login-transport.is-warning {
    color: var(--danger);
}

/* ---------------- Error ---------------- */

.error-wrap {
    display: grid;
    place-items: center;
    gap: 10px;
    min-height: 52vh;
    padding: 20px;
    text-align: center;
}

.error-eyebrow {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

.error-code {
    color: var(--line-strong);
    font-size: 60px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 2px;
}

.error-title {
    font-size: 24px;
    font-weight: 700;
}

.error-message {
    max-width: 48ch;
    color: var(--ink-soft);
    font-size: 15px;
    line-height: 1.95;
}

.error-hint {
    max-width: 50ch;
    color: var(--muted);
    font-size: 13.5px;
    line-height: 1.9;
}

.error-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-top: 6px;
}

.error-actions .btn {
    margin: 0;
}

.error-detail-label {
    margin-top: 8px;
    color: var(--muted);
    font-size: 12.5px;
    font-weight: 700;
}

.error-detail {
    max-width: 100%;
    overflow: auto;
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--card);
    color: var(--muted);
    font-family: Consolas, "Courier New", monospace;
    font-size: 13px;
    direction: ltr;
}

.error-wrap .btn {
    margin-top: 0;
}

/* ---------------- Maintenance ---------------- */

.maintenance-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px 14px;
    padding: 9px 20px;
    border-bottom: 1px solid var(--danger-line);
    background: var(--danger-bg);
    color: var(--danger);
    font-size: 13.5px;
    line-height: 1.7;
    text-align: center;
}

.maintenance-bar-link {
    color: var(--danger-strong);
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.page-maintenance .site-main {
    display: grid;
    place-items: center;
    min-height: 62vh;
    padding: 32px 20px;
}

.maintenance-wrap {
    width: min(620px, 100%);
}

.maintenance-card {
    padding: 34px 30px;
    background: var(--card);
    text-align: center;
}

.maintenance-badge {
    display: inline-block;
    padding: 4px 12px;
    border: 1px dashed var(--privacy-line);
    border-radius: 999px;
    background: rgb(var(--gold-rgb) / .10);
    color: var(--accent-dark);
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 1.2px;
    line-height: 1.8;
}

.maintenance-title {
    margin-top: 14px;
    font-size: clamp(25px, 4vw, 32px);
    font-weight: 700;
    line-height: 1.5;
}

.maintenance-text {
    margin-top: 12px;
    color: var(--ink-soft);
    font-size: 16.5px;
    line-height: 2;
}

.maintenance-text.is-extra {
    color: var(--muted);
    font-size: 14px;
}

.maintenance-login {
    margin-top: 22px;
}

/* ---------------- Preferences ---------------- */

.page-preferences .site-main {
    padding-top: 26px;
}

.prefs {
    width: 100%;
    max-width: 1040px;
    margin: 0 auto;
}

.prefs-head {
    margin-bottom: 18px;
}

.prefs-title {
    margin-top: 6px;
    font-size: clamp(28px, 4vw, 36px);
    font-weight: 700;
    line-height: 1.35;
}

.prefs-sub {
    margin-top: 6px;
    max-width: 62ch;
    color: var(--muted);
    font-size: 15.5px;
    line-height: 1.9;
}

.prefs-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    align-items: start;
}

.pref-card {
    margin: 0;
    padding: 22px 24px;
}

.pref-card-wide {
    grid-column: 1 / -1;
}

.pref-card-head-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px 12px;
}

.pref-title {
    font-size: 17.5px;
    font-weight: 700;
}

.pref-hint {
    margin-top: 5px;
    color: var(--muted);
    font-size: 13.5px;
    line-height: 1.85;
}

.pref-note {
    margin-top: 10px;
    padding: 9px 13px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--note-bg);
    color: var(--ink-soft);
    font-size: 13px;
    line-height: 1.8;
}

.pref-note.is-warning {
    border-style: dashed;
    border-color: var(--privacy-line);
    background: rgb(var(--gold-rgb) / .10);
    color: var(--accent-dark);
}

.pref-label {
    display: block;
    margin: 14px 0 6px;
    color: var(--muted);
    font-size: 13.5px;
}

.pref-input,
.pref-textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--line-strong);
    border-radius: 12px;
    background: var(--card);
    color: var(--ink);
    font: inherit;
    font-size: 15.5px;
    line-height: 1.7;
}

.pref-textarea {
    min-height: 62px;
    resize: vertical;
}

.pref-input:focus,
.pref-textarea:focus {
    border-color: var(--accent);
    outline: none;
    box-shadow: 0 0 0 3px rgb(var(--accent-rgb) / .10);
}

.pref-input::placeholder,
.pref-textarea::placeholder {
    color: var(--muted-soft);
}

.pref-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 16px;
}

.pref-grid-2 > div {
    min-width: 0;
}

.pref-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

.pref-actions .btn {
    margin: 0;
}

.prefs-foot-note {
    margin-top: 18px;
    color: var(--muted-soft);
    font-size: 12.5px;
    text-align: center;
}

/* ---------------- Backup ---------------- */

.backup-card {
    max-width: 1100px;
    margin: 0 auto;
}

.backup-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
    color: var(--muted);
    font-size: 13px;
    line-height: 1.8;
}

.backup-meta strong {
    color: var(--ink-soft);
    font-weight: 700;
}

.backup-sql {
    min-height: 46vh;
    max-height: 70vh;
    padding: 14px 16px;
    overflow: auto;
    font-family: Consolas, "Courier New", monospace;
    font-size: 12.5px;
    line-height: 1.65;
    white-space: pre;
    tab-size: 4;
}

.pref-warning {
    margin-top: 12px;
    padding: 9px 13px;
    border: 1px dashed var(--danger-line);
    border-radius: var(--radius-sm);
    background: var(--danger-bg);
    color: var(--danger);
    font-size: 13px;
    line-height: 1.8;
}

.pref-status {
    padding: 3px 11px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.9;
}

.pref-status.is-on {
    background: var(--danger-bg);
    color: var(--danger);
}

.pref-status.is-off {
    background: var(--accent-soft);
    color: var(--accent-dark);
}

.flash {
    margin-bottom: 14px;
    padding: 11px 16px;
    border-radius: var(--radius-sm);
    font-size: 14.5px;
    line-height: 1.8;
}

.flash.is-ok {
    border: 1px solid var(--accent-line);
    background: var(--accent-soft);
    color: var(--accent-dark);
}

.flash.is-error {
    border: 1px solid var(--danger-line);
    background: var(--danger-bg);
    color: var(--danger);
}

/* ---------------- Theme picker ---------------- */

.theme-options {
    display: grid;
    gap: 10px;
    margin-top: 14px;
}

.theme-option {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--card);
    cursor: pointer;
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}

.theme-option:hover {
    border-color: var(--line-strong);
}

.theme-option:has(input:checked) {
    border-color: var(--accent);
    background: var(--note-bg);
    box-shadow: 0 0 0 3px rgb(var(--accent-rgb) / .10);
}

.theme-option:has(input:focus-visible) {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.theme-option input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.theme-swatch {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    flex: 0 0 auto;
    gap: 4px;
    width: 46px;
    height: 46px;
    padding: 7px;
    border: 1px solid var(--line-strong);
    border-radius: 12px;
    background: var(--swatch-paper);
}

.theme-swatch-bar {
    height: 7px;
    border-radius: 4px;
    background: var(--swatch);
}

.theme-swatch-bar.is-soft {
    height: 5px;
    opacity: .55;
}

.theme-swatch-dot {
    align-self: flex-end;
    width: 10px;
    height: 10px;
    margin-top: auto;
    border: 1px solid var(--swatch);
    border-radius: 50%;
    background: var(--swatch-soft);
}

.theme-copy {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.theme-name {
    color: var(--ink);
    font-size: 15.5px;
    font-weight: 700;
}

.theme-option:hover .theme-name {
    color: var(--accent-dark);
}

.theme-hint {
    color: var(--muted);
    font-size: 12.5px;
    line-height: 1.7;
}

.theme-check {
    margin-inline-start: auto;
    color: var(--accent);
    font-size: 15px;
    font-weight: 700;
    opacity: 0;
}

.theme-option input:checked ~ .theme-check {
    opacity: 1;
}

/* ---------------- Switch ---------------- */

.pref-switch {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    margin-top: 14px;
    cursor: pointer;
    user-select: none;
}

.pref-switch input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.pref-switch-track {
    position: relative;
    display: inline-block;
    flex: 0 0 auto;
    width: 46px;
    height: 26px;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    background: var(--paper-deep);
    direction: ltr;
    transition: background .18s ease, border-color .18s ease;
}

.pref-switch-knob {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--card);
    box-shadow: var(--shadow-sm);
    transition: transform .18s ease, background .18s ease;
}

.pref-switch input:checked + .pref-switch-track {
    border-color: var(--accent);
    background: var(--accent);
}

.pref-switch input:checked + .pref-switch-track .pref-switch-knob {
    transform: translateX(20px);
    background: var(--on-accent);
}

.pref-switch input:focus-visible + .pref-switch-track {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.pref-switch-text {
    color: var(--ink);
    font-size: 15px;
}

@media (max-width: 900px) {
    .prefs-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 560px) {
    .pref-card {
        padding: 18px 16px;
    }

    .pref-grid-2 {
        grid-template-columns: minmax(0, 1fr);
    }

    .maintenance-card {
        padding: 26px 18px;
    }
}

/* ---------------- Motion ---------------- */

@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes lift-in {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes rise {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (prefers-reduced-motion: no-preference) {
    .ui-ready .hero > * {
        animation: rise .45s ease both;
    }

    .ui-ready .hero > *:nth-child(2) { animation-delay: .04s; }
    .ui-ready .hero > *:nth-child(3) { animation-delay: .08s; }
    .ui-ready .hero > *:nth-child(4) { animation-delay: .12s; }

    .ui-ready .stat-card {
        animation: lift-in .35s ease both;
    }

    .ui-ready .stat-card:nth-child(2) { animation-delay: .05s; }
    .ui-ready .stat-card:nth-child(3) { animation-delay: .1s; }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
    }
}

/* ---------------- Responsive ---------------- */

@media (max-width: 900px) {
    .home-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .home-side {
        position: static;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 700px) {
    .site-header-inner {
        padding: 10px 16px;
        gap: 10px;
    }

    .site-main {
        padding: 22px 16px 42px;
    }

    .brand-sub {
        display: none;
    }

    .brand-name {
        font-size: 18px;
    }

    .brand-mark {
        width: 36px;
        height: 36px;
        border-radius: 12px;
    }

    .site-nav {
        gap: 2px;
    }

    .nav-link {
        padding: 8px 9px;
        font-size: 15.5px;
    }

    .hero {
        padding: 2px 2px 22px;
    }

    .hero-tagline {
        font-size: 17px;
    }

    .stats {
        gap: 8px;
    }

    .stat-card {
        padding: 12px 14px;
    }

    .stat-value {
        font-size: 26px;
    }

    .stat-label {
        font-size: 14px;
    }

    .calendar-card {
        padding: 14px;
    }

    .calendar-title h2 {
        font-size: 21px;
    }

    .search-box {
        gap: 6px;
        padding: 4px 8px;
    }

    .search-input {
        font-size: 16px;
    }

    .mood-select {
        max-width: 118px;
        font-size: 14px;
    }

    .search-meta {
        flex-direction: column;
        gap: 0;
    }

    .page-login .site-main {
        padding: 16px;
    }

    .login-card {
        padding: 24px 20px 22px;
    }

    .calendar-grid,
    .calendar-weekdays {
        gap: 4px;
    }

    .cal-day {
        border-radius: 10px;
        font-size: 16px;
    }

    .diary-head {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
        padding: 20px;
    }

    .weather-box {
        justify-content: flex-start;
        padding-top: 14px;
        border-top: 1px dashed var(--line);
    }

    .weather-icon-btn {
        width: 52px;
        height: 52px;
        border-radius: 15px;
    }

    .weather-emoji {
        font-size: 28px;
    }

    .composer,
    .entry-card {
        padding: 16px;
    }

    .entry-tools {
        opacity: 1;
    }

    .home-side {
        grid-template-columns: minmax(0, 1fr);
    }

    .quote-card {
        display: none;
    }
}

@media (max-width: 420px) {
    .stat-value {
        font-size: 25px;
    }

    .stat-label {
        font-size: 13px;
    }

    .toast {
        display: none;
    }

    .login-title {
        font-size: 26px;
    }

    .login-card {
        padding: 20px 16px 18px;
    }

    .search-divider {
        display: none;
    }

    .mood-select {
        max-width: 104px;
    }
}

/* ---------------- Mobile typography ---------------- */
/* تېلېفوندا (iPhone قاتارلىق) خەت نۇسخىسى سەل چوڭ قىلىنىدۇ — كومپيۇتېردىكى
   كۆرۈنۈش ئۆزگەرمەيدۇ. كىرگۈزۈش ئورۇنلىرىنىڭ خېتى 16px دىن تۆۋەن ئەمەس،
   شۇڭا iOS ئاپتوماتىك چوڭايتىپ (zoom) قويمايدۇ. */

@media (max-width: 700px) {
    body {
        font-size: 18px;
    }

    .btn {
        font-size: 17px;
    }

    .btn-small {
        font-size: 15.5px;
    }

    .link-btn {
        font-size: 15px;
    }

    .card-title {
        font-size: 17px;
    }

    .count-pill {
        min-width: 26px;
        height: 26px;
        font-size: 14px;
    }

    .eyebrow {
        font-size: 15px;
    }

    .form-error,
    .inline-error {
        font-size: 15.5px;
    }

    .hint {
        font-size: 14px;
    }

    .site-footer {
        font-size: 14.5px;
    }

    .hero-note {
        font-size: 15.5px;
    }

    .calendar-title p {
        font-size: 14.5px;
    }

    .calendar-weekdays {
        font-size: 14px;
    }

    .legend {
        font-size: 13.5px;
    }

    .calendar-error {
        font-size: 14.5px;
    }

    .search-meta {
        font-size: 13.5px;
    }

    .search-empty {
        font-size: 14px;
    }

    .recent-day {
        font-size: 17px;
    }

    .recent-weekday {
        font-size: 13.5px;
    }

    .recent-count {
        font-size: 14px;
    }

    .empty-title {
        font-size: 17px;
    }

    .empty-hint {
        font-size: 15px;
    }

    .back-link {
        font-size: 15.5px;
    }

    .diary-badge {
        font-size: 14px;
    }

    .diary-sub {
        font-size: 15.5px;
    }

    .diary-date h1 {
        font-size: 28px;
    }

    .weather-label {
        font-size: 15px;
    }

    .weather-city,
    .weather-meta .link-btn {
        font-size: 13.5px;
    }

    .readonly-note {
        font-size: 15px;
    }

    .composer-head h2 {
        font-size: 18px;
    }

    .char-count {
        font-size: 13.5px;
    }

    .composer-input {
        font-size: 18.5px;
    }

    .mood-btn {
        font-size: 22px;
    }

    .entries-head h2 {
        font-size: 18px;
    }

    .toast {
        font-size: 14.5px;
    }

    .entry-time {
        font-size: 15.5px;
    }

    .mood-chip {
        font-size: 13.5px;
    }

    .entry-body {
        font-size: 18.5px;
        line-height: 2.05;
    }

    .note-toggle {
        font-size: 14.5px;
    }

    .note-content p {
        font-size: 16.5px;
        line-height: 1.95;
    }

    .note-time {
        font-size: 13px;
    }

    .note-empty {
        font-size: 15px;
    }

    .note-form input,
    .city-form input {
        font-size: 16px;
    }

    .note-del {
        font-size: 20px;
    }

    .modal-head h2 {
        font-size: 19px;
    }

    .modal-hint {
        font-size: 14.5px;
    }

    .login-description {
        font-size: 14.5px;
    }

    .login-description[lang="en"] {
        font-size: 14px;
    }

    .login-kicker {
        font-size: 12px;
    }

    .login-privacy-label {
        font-size: 12.5px;
    }

    .login-privacy-text {
        font-size: 14.5px;
    }

    .login-hint {
        font-size: 15px;
    }

    .field-label {
        font-size: 14.5px;
    }

    .login-transport {
        font-size: 13px;
    }

    .error-title {
        font-size: 26px;
    }

    .error-detail {
        font-size: 14px;
    }

    .prefs-title {
        font-size: 26px;
    }

    .prefs-sub {
        font-size: 15px;
    }

    .pref-title {
        font-size: 16.5px;
    }

    .pref-hint,
    .pref-note {
        font-size: 13.5px;
    }

    .pref-input,
    .pref-textarea {
        font-size: 16px;
    }

    .theme-name {
        font-size: 15px;
    }

    .theme-hint {
        font-size: 12.5px;
    }

    .flash {
        font-size: 14.5px;
    }

    .maintenance-title {
        font-size: 24px;
    }

    .maintenance-text {
        font-size: 16px;
    }

    .maintenance-bar {
        font-size: 13px;
    }
}

