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

:root {
    --primary: #21a675;
    --primary-deep: #14845b;
    --primary-soft: #e5f7ef;
    --primary-faint: #f3fbf7;
    --gold: #b98426;
    --gold-soft: #fff7e5;
    --danger: #df5c60;
    --warning: #d88b2d;
    --success: #24a268;
    --text: #1f2a26;
    --text-2: #53615b;
    --text-3: #87938e;
    --border: #e3ebe7;
    --surface: rgba(255, 255, 255, .92);
    --surface-solid: #ffffff;
    --surface-soft: #f7faf8;
    --surface-glass: rgba(255, 255, 255, .82);
    --header-bg: rgba(243, 248, 245, .80);
    --page: #f3f8f5;
    --shadow-sm: 0 1px 2px rgba(18, 48, 38, .05), 0 8px 24px rgba(18, 48, 38, .06);
    --shadow-md: 0 1px 2px rgba(18, 48, 38, .06), 0 8px 24px rgba(18, 48, 38, .11);
    --radius-sm: 12px;
    --radius-md: 16px;
    --radius-lg: 18px;
    --ease: cubic-bezier(.22, .8, .25, 1);
}


html[data-theme="light"] {
    color-scheme: light;
    --primary: #15966a;
    --primary-deep: #0f7651;
    --primary-soft: #e1f5ec;
    --primary-faint: #f1faf6;
    --gold: #a86f12;
    --gold-soft: #fff4d9;
    --danger: #cf474d;
    --warning: #bd721d;
    --success: #16895a;
    --text: #18241f;
    --text-2: #4d5c55;
    --text-3: #74827b;
    --border: #dbe7e1;
    --surface: #ffffff;
    --surface-solid: #ffffff;
    --surface-soft: #f5f9f7;
    --surface-glass: rgba(255, 255, 255, .82);
    --header-bg: rgba(242, 247, 244, .80);
    --page: #f2f7f4;
    --shadow-sm: 0 1px 2px rgba(16, 44, 34, .05), 0 8px 24px rgba(16, 44, 34, .06);
    --shadow-md: 0 1px 2px rgba(16, 44, 34, .06), 0 8px 24px rgba(16, 44, 34, .11);
}

html[data-theme="dark"] {
    color-scheme: dark;
    --primary: #54d3a2;
    --primary-deep: #2bb47d;
    --primary-soft: rgba(66, 201, 148, .14);
    --primary-faint: rgba(66, 201, 148, .07);
    --gold: #e5bd68;
    --gold-soft: rgba(229, 189, 104, .12);
    --danger: #ff8589;
    --warning: #f1aa55;
    --success: #57d69d;
    --text: #eef6f2;
    --text-2: #b3c0ba;
    --text-3: #75837c;
    --border: rgba(226, 242, 235, .12);
    --surface: rgba(19, 27, 23, .90);
    --surface-solid: #141d19;
    --surface-soft: #19241f;
    --surface-glass: rgba(18, 27, 22, .78);
    --header-bg: rgba(11, 18, 15, .72);
    --page: #0d1511;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .38), 0 8px 24px rgba(0, 0, 0, .26);
    --shadow-md: 0 1px 2px rgba(0, 0, 0, .42), 0 8px 24px rgba(0, 0, 0, .34);
}

html {
    min-height: 100%;
    background: var(--page);
    -webkit-text-size-adjust: 100%;
}

body {
    color-scheme: inherit;
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--page);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    line-height: 1.5;
    overflow-x: hidden;
    transition: background .2s ease, color .2s ease;
}

button, input, select {
    font: inherit;
}

button {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.brand:focus-visible,
.section-detail-link:focus-visible,
.icon-button:focus-visible,
.logout-button:focus-visible,
.download-button:focus-visible,
.primary-button:focus-visible,
.secondary-button:focus-visible,
.password-toggle:focus-visible,
.remove-offset-btn:focus-visible,
.announce-banner:focus-visible,
.announce-modal-close:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--primary) 55%, transparent);
    outline-offset: 2px;
}

.page-background {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.background-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(4px);
}

.orb-one {
    width: 520px;
    height: 520px;
    left: -220px;
    top: -230px;
    background: radial-gradient(circle, rgba(73, 205, 151, .22), transparent 68%);
}

.orb-two {
    width: 640px;
    height: 640px;
    right: -320px;
    bottom: -340px;
    background: radial-gradient(circle, rgba(232, 190, 100, .13), transparent 68%);
}

.background-grid {
    position: absolute;
    inset: 0;
    opacity: .22;
    background-image:
        linear-gradient(rgba(40, 116, 84, .045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(40, 116, 84, .045) 1px, transparent 1px);
    background-size: 42px 42px;
    mask-image: linear-gradient(to bottom, #000, transparent 82%);
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 30;
    padding-top: env(safe-area-inset-top);
    border-bottom: 1px solid color-mix(in srgb, var(--border) 78%, transparent);
    background: var(--header-bg);
    backdrop-filter: saturate(1.2) blur(12px);
    -webkit-backdrop-filter: saturate(1.2) blur(12px);
}

.header-inner {
    width: min(1180px, calc(100% - 36px));
    height: 68px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
    color: inherit;
    text-decoration: none;
    border-radius: 10px;
}

.brand-logo {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border-radius: 12px;
    color: var(--primary);
    background: var(--surface-solid);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

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

.brand-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.brand-copy strong {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: .04em;
}

.brand-copy small {
    margin-top: 1px;
    color: var(--text-3);
    font-size: 11px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.icon-button,
.logout-button,
.download-button {
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text-2);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: transform .2s ease, border-color .2s ease, color .2s ease, background .2s ease, box-shadow .2s ease;
}

.icon-button {
    width: 40px;
}

.logout-button {
    padding: 0 15px;
    color: var(--danger);
}

.download-button {
    padding: 0 15px;
    color: var(--text-2);
    text-decoration: none;
}

.icon-button:hover,
.logout-button:hover,
.download-button:hover {
    transform: translateY(-1px);
    border-color: color-mix(in srgb, var(--primary) 36%, var(--border));
    box-shadow: var(--shadow-md);
}

.page-shell {
    position: relative;
    z-index: 1;
    width: min(1180px, calc(100% - 36px));
    margin: 0 auto;
    padding: 34px 0 60px;
    display: grid;
    grid-template-columns: 350px minmax(0, 1fr);
    gap: 34px;
    align-items: start;
}

.intro-panel {
    position: sticky;
    top: 102px;
}

.intro-card {
    position: relative;
    padding: 38px 34px;
    overflow: hidden;
    border: 1px solid color-mix(in srgb, var(--primary) 20%, var(--border));
    border-radius: var(--radius-lg);
    background:
        linear-gradient(145deg, color-mix(in srgb, var(--surface-solid) 96%, transparent), color-mix(in srgb, var(--primary-faint) 70%, var(--surface-solid)));
    box-shadow: var(--shadow-md);
    backdrop-filter: saturate(1.2) blur(12px);
    -webkit-backdrop-filter: saturate(1.2) blur(12px);
}

.intro-card::after {
    content: "";
    position: absolute;
    width: 210px;
    height: 210px;
    right: -95px;
    top: -95px;
    border-radius: 50%;
    background: radial-gradient(circle, color-mix(in srgb, var(--primary) 17%, transparent), transparent 70%);
}

.intro-eyebrow {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 11px;
    border-radius: 999px;
    color: var(--primary-deep);
    background: var(--primary-soft);
    font-size: 12px;
    font-weight: 650;
}

.intro-card h1 {
    position: relative;
    z-index: 1;
    margin-top: 24px;
    font-size: clamp(30px, 3vw, 42px);
    font-weight: 800;
    line-height: 1.25;
    letter-spacing: -.035em;
}

.intro-card h1 em {
    font-style: normal;
    color: var(--primary);
}

.intro-card > p {
    position: relative;
    z-index: 1;
    margin-top: 17px;
    color: var(--text-2);
    font-size: 14px;
    line-height: 1.85;
}

.feature-list {
    position: relative;
    z-index: 1;
    margin-top: 30px;
    display: grid;
    gap: 12px;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: color-mix(in srgb, var(--surface-solid) 74%, transparent);
}

.feature-icon {
    width: 37px;
    height: 37px;
    flex: 0 0 37px;
    display: grid;
    place-items: center;
    border-radius: 11px;
    color: var(--primary);
    background: var(--primary-soft);
}

.feature-item div {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.feature-item strong {
    font-size: 13px;
    font-weight: 700;
}

.feature-item small {
    margin-top: 2px;
    color: var(--text-3);
    font-size: 11px;
    line-height: 1.45;
}

.intro-note {
    position: relative;
    z-index: 1;
    margin-top: 26px;
    padding-top: 20px;
    display: flex;
    gap: 8px;
    color: var(--text-3);
    border-top: 1px dashed var(--border);
    font-size: 11px;
    line-height: 1.6;
}

.content-panel {
    min-width: 0;
}

.mobile-intro {
    display: none;
}

.surface-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface-glass);
    box-shadow: var(--shadow-md);
    backdrop-filter: saturate(1.2) blur(12px);
    -webkit-backdrop-filter: saturate(1.2) blur(12px);
}

#authCheckingSection {
    display: none;
}

html[data-auth-state="checking"] #loginSection,
html[data-auth-state="checking"] #profileSection {
    display: none !important;
}

html[data-auth-state="checking"] #authCheckingSection {
    display: flex;
}

.auth-checking-card {
    min-height: 330px;
    padding: 42px 36px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.auth-checking-visual {
    position: relative;
    width: 92px;
    height: 92px;
    display: grid;
    place-items: center;
    margin-bottom: 26px;
}

.auth-checking-ring {
    position: absolute;
    inset: 0;
    border: 3px solid var(--primary-soft);
    border-top-color: var(--primary);
    border-right-color: color-mix(in srgb, var(--primary) 42%, transparent);
    border-radius: 50%;
    animation: auth-check-spin 1s linear infinite;
}

.auth-checking-ring::after {
    content: "";
    position: absolute;
    inset: 9px;
    border: 1px dashed color-mix(in srgb, var(--primary) 34%, var(--border));
    border-radius: 50%;
}

.auth-checking-icon {
    width: 58px;
    height: 58px;
    display: grid;
    place-items: center;
    border-radius: 16px;
    color: var(--primary);
    background: var(--primary-soft);
    box-shadow: 0 12px 28px color-mix(in srgb, var(--primary) 18%, transparent);
    font-size: 21px;
}

.auth-checking-copy {
    width: min(100%, 390px);
}

.auth-checking-copy .intro-eyebrow {
    margin: 0 auto 13px;
}

.auth-checking-copy h2 {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -.025em;
}

.auth-checking-copy p {
    margin-top: 9px;
    color: var(--text-3);
    font-size: 13px;
    line-height: 1.75;
}

.auth-checking-progress {
    width: min(240px, 76%);
    height: 4px;
    margin: 24px auto 0;
    overflow: hidden;
    border-radius: 999px;
    background: var(--surface-soft);
}

.auth-checking-progress span {
    display: block;
    width: 42%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, transparent, var(--primary), transparent);
    animation: auth-check-progress 1.25s ease-in-out infinite;
}

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

@keyframes auth-check-progress {
    from { transform: translateX(-130%); }
    to { transform: translateX(330%); }
}

.auth-card {
    max-width: 540px;
    margin: 24px auto 0;
    padding: 36px;
    animation: card-in .5s var(--ease) both;
}

.card-heading {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 30px;
}

.heading-icon {
    width: 50px;
    height: 50px;
    flex: 0 0 50px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    color: #fff;
    background: linear-gradient(140deg, var(--primary-deep), var(--primary));
    box-shadow: 0 1px 2px rgba(15, 80, 56, .18), 0 8px 24px color-mix(in srgb, var(--primary) 22%, transparent);
}

.card-heading h2 {
    font-size: 23px;
    font-weight: 700;
    letter-spacing: -.02em;
}

.card-heading p {
    margin-top: 5px;
    color: var(--text-3);
    font-size: 13px;
}

.auth-form {
    display: grid;
    gap: 18px;
}

.field-group {
    display: grid;
    gap: 8px;
}

.field-label {
    color: var(--text-2);
    font-size: 12px;
    font-weight: 650;
}

.field-control {
    position: relative;
    display: flex;
    align-items: center;
}

.field-control > i {
    position: absolute;
    left: 15px;
    z-index: 1;
    color: var(--text-3);
    font-size: 13px;
    pointer-events: none;
}

.field-control input {
    width: 100%;
    height: 50px;
    padding: 0 48px 0 42px;
    border: 1px solid var(--border);
    border-radius: 12px;
    outline: 0;
    color: var(--text);
    background: var(--surface-soft);
    /* 16px 可避免 iOS 聚焦时页面自动缩放 */
    font-size: 16px;
    transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}

.field-control input::placeholder {
    color: var(--text-3);
}

.field-control input:focus {
    border-color: color-mix(in srgb, var(--primary) 58%, var(--border));
    background: var(--surface-solid);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 15%, transparent);
}

.field-control:focus-within > i {
    color: var(--primary);
}

.password-toggle {
    position: absolute;
    right: 5px;
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 10px;
    color: var(--text-3);
    background: transparent;
    cursor: pointer;
    transition: color .2s ease, background .2s ease;
}

.password-toggle:hover {
    color: var(--primary);
    background: var(--primary-soft);
}

.primary-button,
.secondary-button {
    min-height: 46px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    border: 1px solid transparent;
    cursor: pointer;
    font-weight: 650;
    transition: transform .2s ease, box-shadow .2s ease, opacity .2s ease, border-color .2s ease, background .2s ease, filter .2s ease;
}

.primary-button {
    color: #fff;
    background: linear-gradient(135deg, var(--primary-deep), var(--primary));
}

.auth-form .primary-button {
    width: 100%;
    min-height: 50px;
    margin-top: 2px;
}

.primary-button:hover:not(:disabled) {
    transform: translateY(-1px);
    filter: brightness(1.06);
    box-shadow: 0 8px 20px color-mix(in srgb, var(--primary) 26%, transparent);
}

.secondary-button:hover {
    transform: translateY(-1px);
    border-color: color-mix(in srgb, var(--primary) 45%, var(--border));
    box-shadow: var(--shadow-sm);
}

.primary-button:not(:disabled):active,
.secondary-button:active {
    transform: scale(.98);
}

.primary-button:disabled {
    opacity: .58;
    cursor: not-allowed;
    transform: none;
}

.primary-button.compact {
    padding: 0 18px;
}

.secondary-button {
    padding: 0 17px;
    color: var(--primary-deep);
    border-color: color-mix(in srgb, var(--primary) 25%, var(--border));
    background: var(--primary-faint);
}

.button-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, .35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .7s linear infinite;
}

.login-error {
    display: none;
    padding: 11px 13px;
    border: 1px solid color-mix(in srgb, var(--danger) 22%, transparent);
    border-radius: 12px;
    color: var(--danger);
    background: color-mix(in srgb, var(--danger) 9%, transparent);
    font-size: 12px;
}

.security-tip {
    margin-top: 22px;
    padding-top: 18px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    color: var(--text-3);
    border-top: 1px dashed var(--border);
    font-size: 11px;
    line-height: 1.65;
}

.profile-layout {
    display: grid;
    gap: 20px;
    animation: card-in .45s var(--ease) both;
}

.profile-overview {
    padding: 26px;
}

.profile-identity {
    display: flex;
    align-items: center;
    gap: 15px;
}

.profile-avatar {
    width: 62px;
    height: 62px;
    flex: 0 0 62px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border-radius: 16px;
    color: #fff;
    background: linear-gradient(145deg, var(--primary-deep), var(--primary));
    /* box-shadow: 0 1px 2px rgba(15, 80, 56, .18), 0 8px 24px color-mix(in srgb, var(--primary) 20%, transparent); */
    font-size: 24px;
    font-weight: 700;
}

.profile-info {
    min-width: 0;
}

.verified-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--success);
    font-size: 11px;
    font-weight: 650;
}

.profile-name {
    margin-top: 3px;
    font-size: 22px;
    font-weight: 700;
    line-height: 1.25;
    word-break: break-word;
}

.profile-email {
    margin-top: 4px;
    color: var(--text-3);
    font-size: 12px;
    word-break: break-all;
}

.stats-grid {
    margin-top: 24px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.stat-item {
    min-width: 0;
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 11px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface-soft);
}

.stat-icon {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    display: grid;
    place-items: center;
    border-radius: 11px;
    color: var(--primary);
    background: var(--primary-soft);
}

.stat-item div {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.stat-item strong {
    overflow: hidden;
    color: var(--text);
    font-size: 20px;
    font-weight: 750;
    line-height: 1.15;
    text-overflow: ellipsis;
    font-variant-numeric: tabular-nums;
}

.stat-item small {
    margin-top: 4px;
    color: var(--text-3);
    font-size: 11px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.dashboard-card,
.offset-settings {
    padding: 24px;
}

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

.section-kicker {
    display: block;
    margin-bottom: 4px;
    color: var(--primary);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .16em;
}

.section-heading h3 {
    font-size: 17px;
    font-weight: 700;
}

.section-icon {
    width: 39px;
    height: 39px;
    flex: 0 0 39px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    color: var(--primary);
    background: var(--primary-soft);
}

.section-heading-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-detail-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 0;
    color: var(--primary);
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    text-decoration: none;
    border-radius: 8px;
    transition: color .2s ease;
}

.section-detail-link:hover {
    color: var(--primary-deep);
}

.section-detail-link i {
    font-size: 10px;
}

.status-list {
    display: grid;
    gap: 10px;
}

.status-item {
    min-width: 0;
    padding: 13px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface-soft);
}

.status-label {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.status-label strong {
    font-size: 12px;
    font-weight: 700;
}

.status-label small {
    margin-top: 2px;
    color: var(--text-3);
    font-size: 10px;
}

.status-indicator {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--text-2);
    font-size: 11px;
    font-weight: 650;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-3);
}

.status-dot.abundant,
.status-dot.healthy {
    background: var(--success);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--success) 13%, transparent);
}

.status-dot.warning {
    background: var(--warning);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--warning) 13%, transparent);
}

.status-dot.critical,
.status-dot.offline {
    background: var(--danger);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--danger) 12%, transparent);
}

.vip-card {
    position: relative;
    overflow: hidden;
}

.vip-card::before {
    content: "";
    position: absolute;
    width: 180px;
    height: 180px;
    right: -95px;
    top: -100px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--gold-soft), transparent 70%);
}

.vip-card .section-heading,
.vip-card .vip-info,
.vip-card .vip-expired-tip,
.vip-card .membership-options,
.vip-card .membership-note {
    position: relative;
    z-index: 1;
}

.vip-card .section-icon {
    color: var(--gold);
    background: var(--gold-soft);
}

.vip-info {
    display: grid;
    gap: 9px;
}

.vip-item {
    padding: 11px 12px;
    display: flex;
    justify-content: space-between;
    gap: 15px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-soft);
    font-size: 12px;
}

.vip-label {
    color: var(--text-3);
}

.vip-value {
    color: var(--gold);
    font-weight: 700;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.vip-expired-tip {
    margin-top: 11px;
    padding: 10px 11px;
    display: flex;
    gap: 8px;
    color: var(--danger);
    border-radius: 11px;
    background: color-mix(in srgb, var(--danger) 9%, transparent);
    font-size: 11px;
}

.membership-options {
    margin-top: 15px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
}

.membership-option {
    min-width: 0;
    padding: 11px;
    display: flex;
    align-items: flex-start;
    gap: 9px;
    border: 1px dashed var(--border);
    border-radius: 12px;
}

.membership-mark {
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    display: grid;
    place-items: center;
    border-radius: 9px;
}

.membership-mark.free {
    color: var(--primary);
    background: var(--primary-soft);
}

.membership-mark.vip {
    color: var(--gold);
    background: var(--gold-soft);
}

.membership-option div {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.membership-option strong {
    font-size: 11px;
    font-weight: 700;
}

.membership-option small {
    margin-top: 2px;
    color: var(--text-3);
    font-size: 9px;
    line-height: 1.45;
}

.membership-note {
    margin-top: 14px;
    color: var(--text-3);
    font-size: 10px;
    line-height: 1.65;
}

.offset-heading {
    margin-bottom: 18px;
}

.offset-heading p {
    max-width: 600px;
    margin-top: 7px;
    color: var(--text-3);
    font-size: 11px;
    line-height: 1.65;
}

.offset-table-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 100px 42px;
    gap: 10px;
    padding: 0 4px 8px;
    color: var(--text-3);
    font-size: 10px;
}

.offset-table-head span:nth-child(2),
.offset-table-head span:nth-child(3) {
    text-align: center;
}

.offset-list {
    display: grid;
    gap: 10px;
}

.offset-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 100px 42px;
    gap: 10px;
    align-items: center;
}

.offset-row input,
.offset-row select {
    width: 100%;
    height: 44px;
    min-width: 0;
    border: 1px solid var(--border);
    border-radius: 12px;
    outline: 0;
    color: var(--text);
    background: var(--surface-soft);
    /* 16px 可避免 iOS 聚焦时页面自动缩放 */
    font-size: 16px;
    font-variant-numeric: tabular-nums;
    transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}

.offset-row input {
    padding: 0 13px;
}

.offset-row select {
    padding: 0 10px;
    text-align: center;
    text-align-last: center;
    cursor: pointer;
}

.offset-row input:focus,
.offset-row select:focus {
    border-color: color-mix(in srgb, var(--primary) 55%, var(--border));
    background: var(--surface-solid);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 15%, transparent);
}

.remove-offset-btn {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border: 1px solid color-mix(in srgb, var(--danger) 20%, var(--border));
    border-radius: 12px;
    color: var(--danger);
    background: color-mix(in srgb, var(--danger) 7%, transparent);
    cursor: pointer;
    transition: background .2s ease, transform .2s ease;
}

.remove-offset-btn:hover {
    background: color-mix(in srgb, var(--danger) 13%, transparent);
}

.remove-offset-btn:active {
    transform: scale(.94);
}

.offset-actions {
    margin-top: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.custom-toast {
    position: fixed;
    left: 50%;
    bottom: calc(28px + env(safe-area-inset-bottom));
    z-index: 100;
    max-width: calc(100% - 24px);
    padding: 12px 17px;
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text);
    background: var(--surface-solid);
    box-shadow: var(--shadow-md);
    font-size: 12px;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 12px);
    transition: opacity .2s ease, transform .2s ease;
}

.custom-toast.show {
    opacity: 1;
    transform: translate(-50%, 0);
}

.custom-toast.error {
    color: var(--danger);
    border-color: color-mix(in srgb, var(--danger) 25%, var(--border));
}


/* 明确的浅色主题覆盖，避免部分 WebView 对半透明与 color-mix 支持不一致 */
html[data-theme="light"] .site-header {
    border-bottom-color: #dbe7e1;
    background: rgba(242, 247, 244, .88);
    box-shadow: 0 1px 0 rgba(255, 255, 255, .72);
}

html[data-theme="light"] .background-grid {
    opacity: .3;
    background-image:
        linear-gradient(rgba(21, 150, 106, .055) 1px, transparent 1px),
        linear-gradient(90deg, rgba(21, 150, 106, .055) 1px, transparent 1px);
}

html[data-theme="light"] .orb-one {
    background: radial-gradient(circle, rgba(47, 191, 137, .18), transparent 68%);
}

html[data-theme="light"] .orb-two {
    background: radial-gradient(circle, rgba(221, 173, 73, .11), transparent 68%);
}

html[data-theme="light"] .surface-card,
html[data-theme="light"] .intro-card {
    border-color: #dbe7e1;
}

html[data-theme="light"] .icon-button,
html[data-theme="light"] .logout-button,
html[data-theme="light"] .download-button,
html[data-theme="light"] .brand-logo,
html[data-theme="light"] .custom-toast {
    background-color: #ffffff;
    border-color: #dbe7e1;
}

html[data-theme="light"] .intro-card {
    background: linear-gradient(145deg, rgba(255, 255, 255, .96) 0%, rgba(241, 250, 246, .96) 100%);
}

html[data-theme="light"] .feature-item,
html[data-theme="light"] .field-control input,
html[data-theme="light"] .stat-item,
html[data-theme="light"] .status-item,
html[data-theme="light"] .vip-item,
html[data-theme="light"] .offset-row input,
html[data-theme="light"] .offset-row select {
    color: #18241f;
    background: #f5f9f7;
    border-color: #dbe7e1;
}

html[data-theme="light"] .field-control input:focus,
html[data-theme="light"] .offset-row input:focus,
html[data-theme="light"] .offset-row select:focus {
    color: #18241f;
    background: #ffffff;
    border-color: #15966a;
    box-shadow: 0 0 0 3px rgba(21, 150, 106, .15);
}

html[data-theme="light"] input::placeholder {
    color: #8a9791;
    opacity: 1;
}

html[data-theme="light"] select,
html[data-theme="light"] option {
    color: #18241f;
    background-color: #ffffff;
}

html[data-theme="light"] .secondary-button {
    color: #0f7651;
    background: #f1faf6;
    border-color: #bcded0;
}

html[data-theme="light"] .membership-option {
    background: rgba(255, 255, 255, .58);
    border-color: #d3e3dc;
}

html[data-theme="light"] .login-error,
html[data-theme="light"] .vip-expired-tip {
    color: #bd363d;
    background: #fff0f1;
    border-color: #f1c8cb;
}

html[data-theme="light"] .remove-offset-btn {
    color: #c83e45;
    background: #fff5f5;
    border-color: #f0cfd1;
}

html[data-theme="light"] .status-dot.abundant,
html[data-theme="light"] .status-dot.healthy {
    box-shadow: 0 0 0 4px rgba(22, 137, 90, .13);
}

html[data-theme="light"] .status-dot.warning {
    box-shadow: 0 0 0 4px rgba(189, 114, 29, .13);
}

html[data-theme="light"] .status-dot.critical,
html[data-theme="light"] .status-dot.offline {
    box-shadow: 0 0 0 4px rgba(207, 71, 77, .12);
}

/* color-mix 不可用时仍保持完整布局和可读性 */
@supports not (color: color-mix(in srgb, #000 50%, #fff)) {
    .site-header { border-bottom-color: var(--border); background: var(--page); }
    .intro-card { border-color: var(--border); background: var(--surface-solid); }
    .intro-card::after { background: radial-gradient(circle, var(--primary-soft), transparent 70%); }
    .feature-item { background: var(--surface-soft); }
    .icon-button:hover,
    .logout-button:hover,
    .download-button:hover,
    .field-control input:focus,
    .offset-row input:focus,
    .offset-row select:focus { border-color: var(--primary); }
    .field-control input:focus,
    .offset-row input:focus,
    .offset-row select:focus { box-shadow: 0 0 0 3px rgba(33, 166, 117, .15); }
    .primary-button,
    .heading-icon,
    .secondary-button { border-color: var(--border); }
    .login-error,
    .vip-expired-tip { background: rgba(223, 92, 96, .09); border-color: rgba(223, 92, 96, .22); }
    .remove-offset-btn { background: rgba(223, 92, 96, .07); border-color: rgba(223, 92, 96, .20); }
}

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

@keyframes card-in {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== 平板（≤980px）：收窄双栏 ===== */
@media (max-width: 980px) {
    .page-shell {
        grid-template-columns: 300px minmax(0, 1fr);
        gap: 22px;
    }

    .intro-card {
        padding: 30px 26px;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

/* ===== 手机端（≤768px）：单栏 + 触控优化 ===== */
@media (max-width: 768px) {
    .header-inner,
    .page-shell {
        width: min(100% - 24px, 680px);
    }

    .header-inner {
        height: 60px;
    }

    .brand-copy small {
        display: none;
    }

    .icon-button,
    .logout-button,
    .download-button {
        height: 44px;
    }

    .icon-button {
        width: 44px;
    }

    .logout-button,
    .download-button {
        width: 44px;
        padding: 0;
    }

    .logout-button span,
    .download-button span {
        display: none;
    }

    .page-shell {
        padding: 16px 0 calc(36px + env(safe-area-inset-bottom));
        display: block;
    }

    .intro-panel {
        display: none;
    }

    .mobile-intro {
        display: block;
        padding: 6px 2px 18px;
    }

    .mobile-intro h1 {
        margin-top: 12px;
        font-size: 26px;
        font-weight: 800;
        letter-spacing: -.03em;
    }

    .mobile-intro p {
        margin-top: 6px;
        color: var(--text-3);
        font-size: 13px;
    }

    .auth-card {
        margin: 0;
        padding: 24px 16px;
    }

    .auth-checking-card {
        min-height: 300px;
        padding: 32px 18px;
    }

    .auth-checking-visual {
        width: 80px;
        height: 80px;
        margin-bottom: 20px;
    }

    .auth-checking-icon {
        width: 50px;
        height: 50px;
        border-radius: 15px;
    }

    .card-heading {
        margin-bottom: 24px;
    }

    .heading-icon {
        width: 46px;
        height: 46px;
        flex-basis: 46px;
    }

    .card-heading h2 {
        font-size: 20px;
    }

    .profile-overview,
    .dashboard-card,
    .offset-settings {
        padding: 16px;
    }

    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
        gap: 8px;
    }

    .stat-item {
        padding: 12px 8px;
        display: block;
        text-align: center;
    }

    .stat-icon {
        width: 32px;
        height: 32px;
        margin: 0 auto 8px;
    }

    .stat-item strong {
        font-size: 18px;
    }

    .password-toggle {
        width: 44px;
        height: 44px;
        right: 3px;
    }

    .announce-banner {
        padding: 10px 14px;
        min-height: 44px;
    }

    /* 表格式区域 → 卡片式（不动 HTML，仅重排 grid） */
    .offset-table-head {
        display: none;
    }

    .offset-row {
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-areas:
            "bookid bookid"
            "select remove";
        gap: 10px;
        padding: 12px;
        border: 1px solid var(--border);
        border-radius: 14px;
        background: var(--primary-faint);
    }

    .offset-row input {
        grid-area: bookid;
    }

    .offset-row select {
        grid-area: select;
    }

    .offset-row .remove-offset-btn {
        grid-area: remove;
    }

    .offset-actions {
        gap: 10px;
    }

    .offset-actions button {
        min-height: 44px;
    }

    /* 弹窗：手机端全宽 - 24px，关闭按钮大热区 */
    .announce-overlay {
        padding: 12px;
    }

    .announce-modal {
        width: calc(100vw - 24px);
        max-width: calc(100vw - 24px);
        max-height: 80vh;
        max-height: 80dvh;
    }

    .announce-modal-header {
        padding: 14px 12px 12px 16px;
    }

    .announce-modal-close {
        flex: 0 0 auto;
        width: 44px;
        height: 44px;
        margin: -6px -6px -6px 0;
        font-size: 22px;
        display: grid;
        place-items: center;
        border-radius: 12px;
    }

    .announce-modal-body {
        padding: 16px;
    }

    .membership-options {
        grid-template-columns: 1fr;
    }
}

/* ===== 小屏手机（≤480px）===== */
@media (max-width: 480px) {
    .brand-copy strong {
        font-size: 14px;
    }

    .profile-avatar {
        width: 54px;
        height: 54px;
        flex-basis: 54px;
        border-radius: 15px;
    }

    .profile-name {
        font-size: 19px;
    }

    .status-item {
        align-items: flex-start;
    }

    .status-indicator {
        margin-top: 2px;
    }

    .offset-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .offset-actions button {
        width: 100%;
        padding: 0 10px;
    }
}

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

/* ===== 公告滚动横幅 ===== */
.announce-banner {
    display: none;
    align-items: center;
    background: linear-gradient(135deg, #fff8e8, #ffefd2);
    border: 1px solid rgba(200, 150, 40, .25);
    border-radius: var(--radius-sm);
    padding: 11px 18px;
    cursor: pointer;
    overflow: hidden;
    user-select: none;
    transition: box-shadow .2s ease, transform .2s ease;
}
.announce-banner:hover {
    box-shadow: 0 1px 2px rgba(180, 120, 20, .10), 0 8px 24px rgba(180, 120, 20, .12);
    transform: translateY(-1px);
}
.announce-banner-scroll {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    width: 100%;
}
.announce-banner-icon {
    flex-shrink: 0;
    color: #c88820;
    font-size: 16px;
    animation: announce-pulse 2s ease-in-out infinite;
}
@keyframes announce-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: .7; }
}
.announce-banner-text {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 14px;
    font-weight: 500;
    color: #6b4c1a;
    line-height: 1.4;
}
@keyframes announce-scroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}
.announce-banner-text.scroll {
    animation: announce-scroll 20s linear infinite;
    white-space: nowrap;
    display: inline-block;
}

/* ===== 公告弹窗 ===== */
.announce-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .45);
    backdrop-filter: saturate(1.2) blur(6px);
    -webkit-backdrop-filter: saturate(1.2) blur(6px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.announce-overlay.show {
    display: flex;
}
.announce-modal {
    background: var(--surface-solid);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    max-width: 560px;
    width: 100%;
    max-height: 80vh;
    max-height: 80dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.announce-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 20px 20px 16px 24px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.announce-modal-header .intro-eyebrow {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 6px;
}
.announce-modal-close {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    margin: -8px -8px -8px 0;
    background: none;
    border: none;
    font-size: 22px;
    line-height: 1;
    color: var(--text-3);
    cursor: pointer;
    display: grid;
    place-items: center;
    border-radius: 10px;
    transition: color .2s ease, background .2s ease;
}
.announce-modal-close:hover {
    color: var(--text);
    background: var(--surface-soft);
}
.announce-modal-body {
    padding: 20px 24px;
    overflow-y: auto;
    flex: 1;
}
.announce-item h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}
.announce-item .announce-time {
    font-size: 12px;
    color: var(--text-3);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 5px;
}
.announce-item .announce-content {
    font-size: 14px;
    line-height: 1.7;
    color: var(--text-2);
    overflow-wrap: anywhere;
}
.announce-item .announce-content p {
    margin-bottom: 8px;
}
.announce-item .announce-content a {
    color: var(--primary);
}
.announce-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 16px 0;
}
.announce-empty {
    text-align: center;
    color: var(--text-3);
    padding: 24px 0;
    font-size: 14px;
}

/* 暗色主题 */
[data-theme="dark"] .announce-banner {
    background: linear-gradient(135deg, rgba(200, 150, 40, .12), rgba(200, 150, 40, .2));
    border-color: rgba(200, 150, 40, .25);
}
[data-theme="dark"] .announce-banner-icon {
    color: #d4a040;
}
[data-theme="dark"] .announce-banner-text {
    color: #c8b88a;
}
[data-theme="dark"] .announce-overlay {
    background: rgba(0, 0, 0, .7);
}
[data-theme="dark"] .announce-modal {
    background: #1a2520;
    border: 1px solid #2a3a32;
}
[data-theme="dark"] .announce-modal-header {
    border-color: #2a3a32;
}
[data-theme="dark"] .announce-modal-close:hover {
    background: rgba(255, 255, 255, .06);
}
[data-theme="dark"] .announce-item h3 {
    color: #e0e8e3;
}
[data-theme="dark"] .announce-item .announce-content {
    color: #9caaa3;
}
[data-theme="dark"] .announce-item .announce-time {
    color: #6b7b73;
}
[data-theme="dark"] .announce-divider {
    border-color: #2a3a32;
}
[data-theme="dark"] .announce-modal-close {
    color: #6b7b73;
}
[data-theme="dark"] .announce-modal-close:hover {
    color: #c0ccc5;
}
