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

:root {
    --bg1: #f4f1ea;
    --bg2: #f7fbf1;
    --ink: #1a1a1a;
    --muted: #6b6b6b;
    --train: #e2f4d7;
    --rest: #faf7f2;
    --future: #eef2ea;
    --line: #ded7cc;
    --accent: #d24b3a;
    --card: rgba(255, 255, 255, 0.85);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Onest", "PingFang SC", "Microsoft YaHei", sans-serif;
    color: var(--ink);
    background: radial-gradient(900px 500px at 6% -6%, #ebe2d1 10%, transparent 62%),
        radial-gradient(900px 500px at 98% 0%, #dbe9cf 8%, transparent 62%),
        linear-gradient(150deg, var(--bg1), var(--bg2));
    min-height: 100vh;
}

.app {
    max-width: 980px;
    margin: 0 auto;
    padding: 18px 14px 32px;
}

.hero p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 0.92rem;
}

.hero-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
}

.today-text {
    margin: 4px 0 0;
    text-align: right;
    white-space: nowrap;
}

.cloud-status {
    margin: 0;
    font-size: 0.82rem;
    color: var(--muted);
}

.cloud-status.ok {
    color: #1f7a3a;
}

.cloud-status.error {
    color: #c23a2e;
}

.sync-row {
    min-height: 31px;
    margin-top: 6px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.auth-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.stat-card {
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--card);
    box-shadow: 0 14px 30px rgba(27, 25, 22, 0.06);
    padding: 12px 12px 14px;
}

.stat-card h2 {
    margin: 0;
    font-size: 0.86rem;
    color: var(--muted);
    font-weight: 600;
    letter-spacing: 0.02em;
}

.stat-value {
    margin: 8px 0 0;
    font-size: 1.25rem;
    font-weight: 700;
    font-family: "Newsreader", "Onest", serif;
}

.calendar-wrap {
    margin-top: 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--card);
    overflow: hidden;
}

.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    border-bottom: 1px solid var(--line);
}

.toolbar h2 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    font-family: "Newsreader", "Onest", serif;
}

button {
    border: 1px solid #b0b0b0;
    border-radius: 10px;
    padding: 8px 10px;
    background: #fff;
    color: #111;
    cursor: pointer;
    font: inherit;
}

button:hover {
    border-color: #666;
}

.hidden {
    display: none;
}

.weekday-row {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.8);
}

.weekday-row span {
    padding: 8px 0;
    text-align: center;
    font-size: 0.82rem;
    color: var(--muted);
}

.grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}

.day {
    min-height: 92px;
    border: 0;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    padding: 8px 8px 10px;
    position: relative;
    text-align: left;
    background: #fff;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.day:nth-child(7n) {
    border-right: none;
}

.day:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(22, 22, 22, 0.08);
}

.day.empty {
    background: transparent;
    box-shadow: none;
    pointer-events: none;
}

.day.train {
    background: var(--train);
}

.day.rest {
    background: var(--rest);
}

.day.future {
    background: var(--future);
    color: var(--ink);
}

.date-num {
    height: 18px;
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 18px;
}

.day.today .date-num {
    color: var(--accent);
}

.date-marker {
    position: absolute;
    top: 7px;
    right: 7px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.75);
}

.date-marker.yellow {
    background: #f2c94c;
}

.date-marker.blue {
    background: #b9dff4;
}

.tag {
    margin-top: 8px;
    display: inline-block;
    min-height: 21px;
    font-size: 0.78rem;
    line-height: 15px;
    padding: 2px 6px;
    border-radius: 999px;
    border: 1px solid rgba(0, 0, 0, 0.25);
    background: rgba(255, 255, 255, 0.7);
}

.footer-actions {
    margin-top: 12px;
    display: flex;
    justify-content: center;
}

.notes-view {
    margin-top: 14px;
}

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

.notes-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    font-family: "Newsreader", "Onest", serif;
}

.notes-groups {
    margin-top: 12px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.notes-card {
    margin-top: 12px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--card);
    box-shadow: 0 14px 30px rgba(27, 25, 22, 0.06);
    padding: 12px;
}

.notes-content {
    color: var(--ink);
}

.notes-content h3 {
    margin: 4px 0 10px;
    font-size: 1.05rem;
    font-weight: 700;
}

.notes-content h4 {
    margin: 14px 0 8px;
    font-size: 0.98rem;
    font-weight: 700;
}

.notes-content p {
    margin: 8px 0;
    color: var(--muted);
    font-size: 0.92rem;
}

.notes-content ol {
    margin: 6px 0 12px 1.2em;
    padding: 0;
    color: var(--ink);
    font-size: 0.92rem;
}

.notes-content li {
    margin: 4px 0;
}

.weight {
    margin-top: 10px;
    min-height: 15px;
    font-size: 0.72rem;
    line-height: 15px;
    color: var(--muted);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.modal {
    position: fixed;
    inset: 0;
    background: rgba(12, 12, 12, 0.45);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 18px;
    z-index: 30;
}

.modal.show {
    display: flex;
}

.modal-card {
    width: min(420px, 100%);
    background: #fff;
    border-radius: 16px;
    border: 1px solid var(--line);
    box-shadow: 0 20px 45px rgba(20, 20, 20, 0.25);
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
}

.modal-body {
    display: grid;
    gap: 10px;
}

.field {
    display: grid;
    gap: 6px;
    font-size: 0.86rem;
    color: var(--muted);
}

.field input,
.field select {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 8px 10px;
    font-size: 0.95rem;
    background: #fff;
    color: var(--ink);
}

.field.hidden {
    display: none;
}

.hint {
    margin: 0;
    font-size: 0.78rem;
    color: var(--muted);
}

.hint.error {
    color: #c23a2e;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.ghost {
    background: transparent;
    border: 1px solid var(--line);
    color: var(--muted);
}

@media (max-width: 760px) {
    .hero-row {
        gap: 8px;
    }

    .hero p,
    .today-text {
        font-size: 0.88rem;
    }

    .day {
        min-height: 82px;
        padding: 6px;
    }

    .weight {
        font-size: 0.68rem;
    }

    .toolbar h2 {
        font-size: 1rem;
    }

    button {
        padding: 6px 8px;
    }

    .stat-value {
        font-size: 1.05rem;
    }
}
