/* ==========================================================================
   光遇每日信息 · 设计系统
   中性色 + 明暗对比，无渐变、无发光、无投影。
   设计变量均为固定档位：间距 4/8/12/16/20/24/32/48/64，圆角 4/6/8/12。
   ========================================================================== */

:root {
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

    /* 间距档位 */
    --sp-1: 4px;
    --sp-2: 8px;
    --sp-3: 12px;
    --sp-4: 16px;
    --sp-5: 20px;
    --sp-6: 24px;
    --sp-8: 32px;
    --sp-12: 48px;
    --sp-16: 64px;

    /* 圆角档位 */
    --r-sm: 6px;
    --r-md: 8px;
    --r-lg: 12px;
    --r-full: 999px;

    /* 字号档位 */
    --fs-2xs: 11px;
    --fs-xs: 12px;
    --fs-sm: 13px;
    --fs-base: 14px;
    --fs-md: 15px;
    --fs-lg: 16px;
    --fs-xl: 20px;
    --fs-2xl: 24px;

    --container: 1040px;
    --gutter: 24px;

    /* 浅色主题 */
    color-scheme: light;
    --bg: #f7f7f8;
    --surface: #ffffff;
    --surface-2: #f2f2f3;
    --surface-3: #e9e9eb;
    --border: #e4e4e7;
    --border-strong: #d4d4d8;
    --text: #18181b;
    --text-2: #52525b;
    --text-3: #6b6b74;
    --primary: #18181b;
    --primary-text: #fafafa;
    --primary-hover: #3f3f46;
    --focus: #18181b;
    --danger: #b42318;
    --danger-bg: #fef3f2;
    --danger-border: #fecdca;
    --on-overlay: #fafafa;
}

[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0b0b0d;
    --surface: #131316;
    --surface-2: #1a1a1e;
    --surface-3: #242429;
    --border: #26262b;
    --border-strong: #3a3a41;
    --text: #f4f4f5;
    --text-2: #b4b4bb;
    --text-3: #8e8e97;
    --primary: #fafafa;
    --primary-text: #18181b;
    --primary-hover: #e4e4e7;
    --focus: #fafafa;
    --danger: #f97066;
    --danger-bg: #251314;
    --danger-border: #4a2320;
    --on-overlay: #fafafa;
}

/* --------------------------------------------------------------------------
   Reset
   -------------------------------------------------------------------------- */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: var(--fs-base);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

main {
    flex: 1 0 auto;
    min-width: 0;
}

h1, h2, h3, p, dl, dd, ol, ul, figure {
    margin: 0;
}

ul, ol {
    padding: 0;
}

img {
    display: block;
    max-width: 100%;
    height: auto;
}

button,
input {
    font: inherit;
    color: inherit;
}

button {
    background: none;
    border: 0;
}

a {
    color: var(--text);
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}

svg {
    flex: none;
}

[hidden] {
    display: none !important;
}

::selection {
    background: var(--text);
    color: var(--surface);
}

:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
}

:focus:not(:focus-visible) {
    outline: none;
}

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

/* --------------------------------------------------------------------------
   基础布局
   -------------------------------------------------------------------------- */

.container {
    width: 100%;
    max-width: var(--container);
    margin-inline: auto;
    padding-inline: var(--gutter);
}

.page {
    padding-block: var(--sp-8) var(--sp-12);
}

.stack {
    display: flex;
    flex-direction: column;
    gap: var(--sp-5);
}

.grid {
    display: grid;
    gap: var(--sp-5);
}

.grid--split {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
}

.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;
}

.skip-link {
    position: absolute;
    top: var(--sp-2);
    left: -9999px;
    z-index: 100;
    padding: var(--sp-2) var(--sp-3);
    border-radius: var(--r-sm);
    background: var(--primary);
    color: var(--primary-text);
    font-size: var(--fs-sm);
    text-decoration: none;
}

.skip-link:focus {
    left: var(--sp-2);
}

/* --------------------------------------------------------------------------
   站点头部
   -------------------------------------------------------------------------- */

.site-header {
    position: relative;
    z-index: 30;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    view-transition-name: site-header;
}

.site-header__inner {
    display: flex;
    align-items: center;
    gap: var(--sp-6);
    height: 56px;
}

.brand {
    color: var(--text);
    font-size: var(--fs-md);
    font-weight: 600;
    letter-spacing: 0.08em;
    text-decoration: none;
}

.nav {
    display: flex;
    align-items: stretch;
    gap: var(--sp-5);
    height: 100%;
}

.nav__link {
    position: relative;
    display: inline-flex;
    align-items: center;
    height: 100%;
    color: var(--text-2);
    font-size: var(--fs-sm);
    text-decoration: none;
    white-space: nowrap;
    transition: color 0.15s ease;
}

.nav__link:hover {
    color: var(--text);
}

.nav__link.is-active {
    color: var(--text);
    font-weight: 500;
}

.nav__link.is-active::after {
    content: "";
    position: absolute;
    right: 0;
    bottom: -1px;
    left: 0;
    height: 2px;
    background: var(--text);
}

.theme-toggle {
    margin-left: auto;
}

.theme-toggle__icon {
    display: none;
    line-height: 0;
}

[data-theme="light"] .theme-toggle__icon--moon,
[data-theme="dark"] .theme-toggle__icon--sun {
    display: block;
}

/* --------------------------------------------------------------------------
   页头
   -------------------------------------------------------------------------- */

.page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--sp-4);
    margin-bottom: var(--sp-6);
}

.page-head__main {
    min-width: 0;
}

.page-head__title {
    font-size: var(--fs-2xl);
    font-weight: 600;
    line-height: 1.25;
    letter-spacing: -0.01em;
}

.page-head__sub {
    max-width: 56ch;
    margin-top: var(--sp-2);
    color: var(--text-2);
    font-size: var(--fs-base);
}

.page-head__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--sp-2);
    margin-top: var(--sp-2);
    color: var(--text-3);
    font-size: var(--fs-sm);
}

.page-head__sep {
    color: var(--border-strong);
}

.page-head__actions {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    flex: none;
}

/* --------------------------------------------------------------------------
   按钮
   -------------------------------------------------------------------------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-2);
    height: 36px;
    padding: 0 var(--sp-4);
    border: 1px solid transparent;
    border-radius: var(--r-md);
    background: transparent;
    color: var(--text);
    font-family: inherit;
    font-size: var(--fs-sm);
    font-weight: 500;
    line-height: 1;
    white-space: nowrap;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn--primary {
    background: var(--primary);
    color: var(--primary-text);
}

.btn--primary:hover {
    background: var(--primary-hover);
}

.btn--secondary {
    background: var(--surface);
    border-color: var(--border-strong);
    color: var(--text);
}

.btn--secondary:hover {
    background: var(--surface-2);
}

.btn--ghost {
    color: var(--text-2);
}

.btn--ghost:hover {
    background: var(--surface-2);
    color: var(--text);
}

.btn--sm {
    height: 32px;
    padding: 0 var(--sp-3);
    font-size: var(--fs-xs);
}

.btn--lg {
    height: 40px;
    padding: 0 var(--sp-5);
    font-size: var(--fs-base);
}

.btn--block {
    display: flex;
    width: 100%;
}

.btn:disabled,
.icon-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: var(--r-sm);
    background: transparent;
    color: var(--text-2);
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.icon-btn:hover {
    background: var(--surface-2);
    border-color: var(--border);
    color: var(--text);
}

.spinner {
    width: 14px;
    height: 14px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: var(--r-full);
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* --------------------------------------------------------------------------
   卡片
   -------------------------------------------------------------------------- */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
}

.card__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-3);
    min-height: 48px;
    padding: var(--sp-3) var(--sp-5);
    border-bottom: 1px solid var(--border);
}

.card__title {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    font-size: var(--fs-base);
    font-weight: 600;
    letter-spacing: 0.01em;
    min-width: 0;
}

.card__title svg {
    color: var(--text-3);
}

.card__meta {
    flex: none;
    color: var(--text-3);
    font-size: var(--fs-xs);
    font-variant-numeric: tabular-nums;
}

.card__body {
    padding: var(--sp-5);
}

/* --------------------------------------------------------------------------
   提示条
   -------------------------------------------------------------------------- */

.notice {
    display: flex;
    align-items: flex-start;
    gap: var(--sp-2);
    margin-bottom: var(--sp-5);
    padding: var(--sp-3) var(--sp-4);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    background: var(--surface);
    color: var(--text-2);
    font-size: var(--fs-xs);
    line-height: 1.6;
}

.notice svg {
    margin-top: 1px;
    color: var(--text-3);
}

/* --------------------------------------------------------------------------
   每日任务
   -------------------------------------------------------------------------- */

.tasks {
    list-style: none;
}

.task {
    display: grid;
    grid-template-columns: 16px minmax(0, 1fr);
    align-items: start;
    gap: var(--sp-3);
    padding-block: var(--sp-3);
    border-bottom: 1px solid var(--border);
}

.task:first-child {
    padding-top: 0;
}

.task:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}

.task__check {
    width: 16px;
    height: 16px;
    margin: 3px 0 0;
    accent-color: var(--primary);
    cursor: pointer;
}

.task__text {
    color: var(--text);
    font-size: var(--fs-base);
    line-height: 1.6;
    overflow-wrap: anywhere;
    cursor: pointer;
}

.task.is-done .task__text,
.task:has(.task__check:checked) .task__text {
    color: var(--text-3);
    text-decoration: line-through;
    text-decoration-thickness: 1px;
}

/* --------------------------------------------------------------------------
   天气
   -------------------------------------------------------------------------- */

.weather__lead {
    color: var(--text);
    font-size: var(--fs-md);
    line-height: 1.7;
    overflow-wrap: anywhere;
}

.weather__block {
    margin-top: var(--sp-5);
    padding-top: var(--sp-4);
    border-top: 1px solid var(--border);
}

.field-label {
    margin-bottom: var(--sp-2);
    color: var(--text-3);
    font-size: var(--fs-xs);
}

.times {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-2) var(--sp-4);
    color: var(--text);
    font-family: var(--font-mono);
    font-size: var(--fs-lg);
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
}

.weather__fall {
    color: var(--text-2);
    font-size: var(--fs-base);
    line-height: 1.7;
    white-space: pre-line;
}

.note {
    margin-top: var(--sp-2);
    color: var(--text-3);
    font-size: var(--fs-xs);
}

/* --------------------------------------------------------------------------
   图片区
   -------------------------------------------------------------------------- */

.gallery {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--sp-3);
}

.gallery__item {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    background: var(--surface-2);
    cursor: zoom-in;
    line-height: 0;
}

.gallery__item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery__item:hover,
.figure:hover {
    border-color: var(--border-strong);
}

.figure {
    display: block;
    width: 100%;
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    background: var(--surface-2);
    cursor: zoom-in;
    line-height: 0;
}

.figure img {
    width: 100%;
    height: auto;
}

/* --------------------------------------------------------------------------
   空状态
   -------------------------------------------------------------------------- */

.empty {
    display: grid;
    justify-items: start;
    gap: var(--sp-2);
    padding-block: var(--sp-2);
    color: var(--text-3);
}

.empty__title {
    color: var(--text-2);
    font-size: var(--fs-sm);
    font-weight: 500;
}

.empty__desc {
    font-size: var(--fs-xs);
}

/* --------------------------------------------------------------------------
   身高查询
   -------------------------------------------------------------------------- */

.layout-side {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    align-items: start;
    gap: var(--sp-5);
}

.layout-side__aside {
    position: sticky;
    top: var(--sp-5);
}

.field {
    margin-bottom: var(--sp-4);
}

.dropzone {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-4);
    border: 1px dashed var(--border-strong);
    border-radius: var(--r-md);
    background: var(--surface-2);
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.dropzone:hover {
    background: var(--surface);
    border-color: var(--text-3);
}

.dropzone.is-dragover {
    background: var(--surface);
    border-color: var(--text);
}

.dropzone:focus-within {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
}

.dropzone__icon {
    display: flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    background: var(--surface);
    color: var(--text-2);
}

.dropzone__main {
    flex: 1 1 auto;
    min-width: 0;
}

.dropzone__title {
    display: block;
    color: var(--text);
    font-size: var(--fs-sm);
    font-weight: 500;
}

.dropzone__hint {
    display: block;
    margin-top: 2px;
    color: var(--text-3);
    font-size: var(--fs-xs);
}

.dropzone__action {
    flex: none;
}

.file {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-3);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    background: var(--surface-2);
}

.file__thumb {
    flex: none;
    width: 44px;
    height: 44px;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    background: var(--surface);
    object-fit: contain;
}

.file__meta {
    flex: 1 1 auto;
    min-width: 0;
}

.file__name {
    overflow: hidden;
    color: var(--text);
    font-size: var(--fs-sm);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file__size {
    margin-top: 2px;
    color: var(--text-3);
    font-size: var(--fs-xs);
    font-variant-numeric: tabular-nums;
}

.file__actions {
    display: flex;
    flex: none;
    align-items: center;
    gap: var(--sp-1);
}

.error {
    display: flex;
    align-items: flex-start;
    gap: var(--sp-2);
    margin-bottom: var(--sp-4);
    padding: var(--sp-3) var(--sp-4);
    border: 1px solid var(--danger-border);
    border-radius: var(--r-md);
    background: var(--danger-bg);
    color: var(--danger);
    font-size: var(--fs-xs);
    line-height: 1.6;
}

.error svg {
    margin-top: 1px;
}

.form-action {
    margin-top: var(--sp-5);
}

/* 查询结果 */

.result__eyebrow {
    color: var(--text-3);
    font-size: var(--fs-xs);
}

.result__value {
    display: flex;
    align-items: baseline;
    gap: var(--sp-2);
    margin-top: var(--sp-1);
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 32px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
    line-height: 1.1;
}

.result__unit {
    color: var(--text-3);
    font-size: var(--fs-sm);
    font-weight: 400;
    letter-spacing: 0;
}

.range {
    margin-top: var(--sp-5);
}

.range__track {
    position: relative;
    height: 4px;
    border-radius: var(--r-full);
    background: var(--surface-3);
}

.range__marker {
    position: absolute;
    top: 50%;
    width: 8px;
    height: 8px;
    border: 2px solid var(--surface);
    border-radius: var(--r-full);
    background: var(--text);
    transform: translate(-50%, -50%);
}

.range__labels {
    display: flex;
    justify-content: space-between;
    gap: var(--sp-3);
    margin-top: var(--sp-2);
    color: var(--text-3);
    font-size: var(--fs-xs);
}

.range__label-value {
    color: var(--text-2);
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
}

.stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1px;
    margin-top: var(--sp-5);
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    background: var(--border);
}

.stat {
    padding: var(--sp-3) var(--sp-4);
    background: var(--surface);
}

.stat dt {
    color: var(--text-3);
    font-size: var(--fs-xs);
}

.stat dd {
    margin-top: 2px;
    color: var(--text);
    font-family: var(--font-mono);
    font-size: var(--fs-base);
    font-variant-numeric: tabular-nums;
}

.result__note {
    margin-top: var(--sp-4);
    color: var(--text-3);
    font-size: var(--fs-xs);
}

/* 教程与说明 */

.steps {
    display: grid;
    gap: var(--sp-3);
    list-style: none;
    counter-reset: step;
}

.steps li {
    position: relative;
    padding-left: var(--sp-6);
    color: var(--text-2);
    font-size: var(--fs-xs);
    line-height: 1.7;
}

.steps li::before {
    position: absolute;
    top: 1px;
    left: 0;
    color: var(--text-3);
    font-family: var(--font-mono);
    font-size: var(--fs-2xs);
    letter-spacing: 0.04em;
    content: counter(step, decimal-leading-zero);
    counter-increment: step;
}

.notes {
    display: grid;
    gap: var(--sp-3);
    color: var(--text-2);
    font-size: var(--fs-xs);
    line-height: 1.7;
}

.notes p + p {
    padding-top: var(--sp-3);
    border-top: 1px solid var(--border);
}

/* --------------------------------------------------------------------------
   图片预览
   -------------------------------------------------------------------------- */

.lightbox {
    position: fixed;
    inset: 0;
    width: 100%;
    max-width: none;
    height: 100%;
    max-height: none;
    margin: 0;
    padding: 0;
    overflow: hidden;
    border: 0;
    background: rgba(9, 9, 11, 0.92);
    color: var(--on-overlay);
    touch-action: none;
}

.lightbox:not([open]) {
    display: none;
}

.lightbox::backdrop {
    /* 伪元素不继承自定义属性，这里直接使用固定值 */
    background: rgba(9, 9, 11, 0.92);
}

.lightbox__bar {
    position: absolute;
    inset: 0 0 auto;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-4);
    padding: var(--sp-4) var(--sp-5);
}

.lightbox__count {
    color: rgba(250, 250, 250, 0.64);
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    letter-spacing: 0.04em;
}

.lightbox__count:empty {
    display: none;
}

.lightbox__hint {
    display: none;
    color: rgba(250, 250, 250, 0.58);
    font-size: var(--fs-2xs);
    letter-spacing: 0.02em;
}

@media (pointer: coarse) {
    .lightbox__hint {
        display: inline;
    }
}

.lightbox__stage {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--sp-16);
    overflow: hidden;
    touch-action: none;
}

.lightbox__img {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    border-radius: var(--r-sm);
    object-fit: contain;
    transform: translate3d(0, 0, 0) scale(1);
    transform-origin: center center;
    transition: transform 0.18s ease;
    user-select: none;
    -webkit-user-drag: none;
    touch-action: none;
    will-change: transform;
    cursor: zoom-in;
}

.lightbox__img.is-zoomed {
    cursor: grab;
}

.lightbox__img.is-gesturing {
    cursor: grabbing;
    transition: none;
}

.lightbox__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid rgba(250, 250, 250, 0.24);
    border-radius: var(--r-md);
    background: rgba(9, 9, 11, 0.5);
    color: var(--on-overlay);
    cursor: pointer;
    touch-action: manipulation;
}

.lightbox__btn:hover {
    border-color: rgba(250, 250, 250, 0.4);
    background: rgba(250, 250, 250, 0.12);
}

.lightbox__nav {
    position: absolute;
    top: 50%;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid rgba(250, 250, 250, 0.24);
    border-radius: var(--r-md);
    background: rgba(9, 9, 11, 0.5);
    color: var(--on-overlay);
    transform: translateY(-50%);
    cursor: pointer;
    touch-action: manipulation;
}

.lightbox__nav:hover {
    border-color: rgba(250, 250, 250, 0.4);
    background: rgba(250, 250, 250, 0.12);
}

.lightbox__nav--prev {
    left: var(--sp-4);
}

.lightbox__nav--next {
    right: var(--sp-4);
}

.lightbox__nav[hidden] {
    display: none !important;
}

body.is-dialog-open {
    overflow: hidden;
}

/* --------------------------------------------------------------------------
   页脚
   -------------------------------------------------------------------------- */

.site-footer {
    border-top: 1px solid var(--border);
}

.site-footer__inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-2) var(--sp-4);
    padding-block: var(--sp-5);
}

.site-footer__text {
    color: var(--text-3);
    font-size: var(--fs-xs);
}

/* --------------------------------------------------------------------------
   页面切换
   -------------------------------------------------------------------------- */

@view-transition {
    navigation: auto;
}

::view-transition-old(root) {
    animation: page-fade-out 0.16s ease both;
}

::view-transition-new(root) {
    animation: page-fade-in 0.2s ease both;
}

@keyframes page-fade-out {
    to {
        opacity: 0;
    }
}

@keyframes page-fade-in {
    from {
        opacity: 0;
    }
}

/* 不支持跨文档转场时的兜底：先淡出到页面底色，再进入新页面 */
.page-curtain {
    position: fixed;
    inset: 0;
    z-index: 20;
    background: var(--bg);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.16s ease;
}

.page-curtain.is-active {
    opacity: 1;
    pointer-events: auto;
}

html.no-view-transition .page,
html.no-view-transition .site-footer {
    animation: page-reveal 0.18s ease-out both;
}

@keyframes page-reveal {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@media (prefers-reduced-motion: reduce) {
    ::view-transition-old(root),
    ::view-transition-new(root),
    ::view-transition-old(site-header),
    ::view-transition-new(site-header),
    ::view-transition-group(site-header) {
        animation: none !important;
    }
}

/* --------------------------------------------------------------------------
   响应式
   -------------------------------------------------------------------------- */

@media (max-width: 900px) {
    .grid--split,
    .layout-side {
        grid-template-columns: minmax(0, 1fr);
    }

    .layout-side__aside {
        position: static;
    }

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

    /* 奇数张图时最后一张通栏，避免留下空位 */
    .gallery__item:last-child:nth-child(odd) {
        grid-column: 1 / -1;
    }
}

@media (max-width: 640px) {
    :root {
        --gutter: 16px;
    }

    /* 长页面滚动时保持导航可达 */
    .site-header {
        position: sticky;
        top: 0;
        z-index: 30;
    }

    html {
        scroll-padding-top: 60px;
    }

    #main {
        scroll-margin-top: 64px;
    }

    .page {
        padding-block: var(--sp-6) var(--sp-8);
    }

    .site-header__inner {
        gap: var(--sp-3);
        height: 52px;
    }

    .nav {
        gap: var(--sp-4);
    }

    .page-head {
        flex-direction: column;
        align-items: flex-start;
        margin-bottom: var(--sp-5);
    }

    .page-head__title {
        font-size: var(--fs-xl);
    }

    .page-head__actions {
        align-self: flex-start;
    }

    /* 移动端加大可点击区域 */
    .btn--sm {
        height: 36px;
    }

    .btn--lg {
        height: 44px;
    }

    .icon-btn,
    .theme-toggle {
        width: 36px;
        height: 36px;
    }

    .card__head {
        padding-inline: var(--sp-4);
    }

    .card__body {
        padding: var(--sp-4);
    }

    .task {
        grid-template-columns: 18px minmax(0, 1fr);
    }

    .task__check {
        width: 18px;
        height: 18px;
        margin-top: 2px;
    }

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

    .dropzone {
        flex-wrap: wrap;
    }

    .dropzone__action {
        display: none;
    }

    .dropzone__main {
        flex: 1 1 180px;
    }

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

    .lightbox__stage {
        padding: var(--sp-16) var(--sp-3) calc(var(--sp-16) + var(--sp-4));
    }

    .lightbox__img {
        border-radius: 0;
    }

    .lightbox__hint {
        display: inline;
    }

    .lightbox__btn,
    .lightbox__nav {
        width: 40px;
        height: 40px;
    }

    .lightbox__nav {
        position: fixed;
        top: auto;
        bottom: calc(var(--sp-6) + env(safe-area-inset-bottom, 0px));
        transform: none;
    }

    .lightbox__nav--prev {
        left: calc(50% - 46px);
    }

    .lightbox__nav--next {
        right: auto;
        left: calc(50% + 6px);
    }

    .site-footer__inner {
        padding-block: var(--sp-4);
    }
}

@media (max-width: 380px) {
    :root {
        --gutter: 12px;
    }

    .site-header__inner {
        gap: var(--sp-2);
    }

    .nav {
        gap: var(--sp-3);
    }

    .brand {
        font-size: var(--fs-base);
    }

    .nav__link {
        font-size: var(--fs-xs);
    }

    .page-head__title {
        font-size: 18px;
    }

    .card__head {
        padding-inline: var(--sp-3);
    }

    .card__body {
        padding: var(--sp-3);
    }

    .dropzone {
        padding: var(--sp-3);
    }

    .dropzone__icon {
        width: 32px;
        height: 32px;
    }

    .result__value {
        font-size: 28px;
    }
}
