/* ================================================================
   居所共享 v2 — 以“居所”和“邻里分享”为中心的界面层
   此文件只在 wiki-home.html 中加载，保留原有种植与同步逻辑。
   ================================================================ */

:root {
    --residence-paper: #fbf8f1;
    --residence-paper-deep: #f0eadc;
    --residence-ink: #293d36;
    --residence-copy: #63756e;
    --residence-moss: #5e8976;
    --residence-moss-deep: #426b59;
    --residence-sun: #c8984e;
    --residence-line: rgba(71, 99, 85, .14);
    --residence-shadow: 0 24px 58px rgba(61, 76, 61, .12);
    --residence-small-shadow: 0 12px 28px rgba(61, 76, 61, .09);
    --sidebar-width: 272px;
    --header-height: 68px;
}

html { scroll-behavior: smooth; }

body {
    background: var(--residence-paper) !important;
    color: var(--residence-ink);
    font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

body::before {
    position: fixed;
    z-index: -1;
    inset: 0;
    content: "";
    pointer-events: none;
    background:
        radial-gradient(circle at 80% 8%, rgba(226, 191, 119, .2), transparent 26rem),
        radial-gradient(circle at 9% 72%, rgba(109, 149, 127, .1), transparent 28rem),
        linear-gradient(180deg, #fcfaf4 0%, #f6f1e8 100%);
}

button,
a { -webkit-tap-highlight-color: transparent; }

button:focus-visible,
a:focus-visible {
    outline: 3px solid rgba(94, 137, 118, .46);
    outline-offset: 3px;
}

/* -------------------- 桌面骨架 -------------------- */

.sidebar {
    width: var(--sidebar-width);
    padding-top: 0;
    border: 0;
    background: rgba(255, 253, 248, .92);
    box-shadow: 16px 0 46px rgba(61, 76, 61, .08);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.sidebar-logo {
    padding: 32px 27px 24px;
    text-align: left;
    border-bottom: 1px solid var(--residence-line);
}

.sidebar-logo .sidebar-kicker {
    margin: 0 0 8px;
    color: var(--residence-moss);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .12em;
}

.sidebar-logo h2 {
    margin: 0;
    color: var(--residence-ink);
    font-size: 23px;
    letter-spacing: .04em;
}

.sidebar-logo p:not(.sidebar-kicker) {
    margin: 8px 0 0;
    color: var(--residence-copy);
    font-size: 12px;
}

.sidebar-user {
    margin: 18px 16px 12px;
    padding: 13px 12px;
    border: 1px solid var(--residence-line);
    border-radius: 16px;
    background: rgba(246, 241, 230, .66);
}

.sidebar-user .avatar {
    width: 38px;
    height: 38px;
    border-radius: 13px;
    background: linear-gradient(145deg, var(--residence-moss), var(--residence-moss-deep));
    box-shadow: 0 8px 18px rgba(66, 107, 89, .22);
}

.sidebar-user-info .uid { color: var(--residence-ink); }
.sidebar-user-info .uid:hover { color: var(--residence-moss-deep); }
.sidebar-user-info .label { color: var(--residence-copy); }

.sidebar-nav { padding: 5px 14px 20px; }

.nav-group-label {
    margin: 18px 10px 7px;
    color: #9a9f91;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .14em;
}

.nav-item {
    width: 100%;
    min-height: 43px;
    margin: 2px 0;
    padding: 10px 12px;
    gap: 10px;
    border-radius: 11px;
    color: #52675d;
    font-size: 13px;
    font-weight: 700;
}

.nav-item .nav-icon {
    width: 18px;
    color: var(--residence-moss);
    font-family: Georgia, serif;
    font-size: 18px;
    line-height: 1;
}

.nav-item:hover {
    background: rgba(94, 137, 118, .09);
    color: var(--residence-moss-deep);
}

.nav-item.active {
    background: var(--residence-ink);
    color: #fffdf8;
    box-shadow: 0 10px 20px rgba(41, 61, 54, .18);
}

.nav-item.active .nav-icon { color: #f2c77c; }

.sidebar-footer {
    padding: 16px 22px 20px;
    border-top: 1px solid var(--residence-line);
}

.sidebar-footer .back-link { color: var(--residence-copy); }
.sidebar-footer .back-link:hover { color: var(--residence-moss-deep); }
.sidebar-footer .feedback-link {
    background: rgba(94, 137, 118, .09);
    color: var(--residence-moss-deep);
}
.sidebar-footer .feedback-link:hover { background: rgba(94, 137, 118, .15); }

.top-bar {
    left: var(--sidebar-width);
    height: var(--header-height);
    padding: 0 34px;
    border: 0;
    border-bottom: 1px solid var(--residence-line);
    background: rgba(251, 248, 241, .78);
    box-shadow: none;
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.top-bar .page-title {
    color: var(--residence-ink);
    font-size: 18px;
    letter-spacing: .03em;
}

.top-stats {
    display: flex;
    gap: 20px;
    margin-left: 12px;
    color: var(--residence-copy);
    font-size: 12px;
}

.top-stats b { color: var(--residence-moss-deep); font-variant-numeric: tabular-nums; }
.quick-actions { gap: 10px; }
.online-status { font-size: 10px; }

.sync-indicator,
.residence-badge {
    border: 1px solid var(--residence-line);
    border-radius: 999px;
    background: rgba(255, 253, 248, .74);
    color: var(--residence-copy);
    box-shadow: none;
}

.residence-badge { color: var(--residence-ink); }
.residence-badge:hover { border-color: rgba(94, 137, 118, .38); color: var(--residence-moss-deep); }
.btn-icon { color: var(--residence-moss-deep); border-color: var(--residence-line); background: rgba(255, 253, 248, .66); }

.main-area {
    margin-left: var(--sidebar-width);
    min-height: 100dvh;
    padding-top: var(--header-height);
    background: transparent;
}

.content-panels {
    width: min(100%, 1440px);
    margin: 0 auto;
    padding: 32px clamp(26px, 3.2vw, 52px) 72px;
}

.panel.active { animation: residencePanelIn .38s cubic-bezier(.2, .7, .2, 1); }

@keyframes residencePanelIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* -------------------- 居所总览 -------------------- */

.residence-overview {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(18rem, .8fr);
    gap: clamp(28px, 5vw, 78px);
    min-height: 338px;
    overflow: hidden;
    padding: clamp(30px, 4vw, 54px);
    border: 1px solid rgba(255, 255, 255, .36);
    border-radius: 28px;
    color: #fffdf7;
    background:
        linear-gradient(90deg, rgba(37, 57, 49, .98) 0%, rgba(37, 57, 49, .89) 43%, rgba(37, 57, 49, .56) 70%, rgba(37, 57, 49, .26) 100%),
        url('../jiayuan_nongtian_gongxiang_tu.jpg') 63% center / cover no-repeat;
    box-shadow: var(--residence-shadow);
    isolation: isolate;
}

.residence-overview::after {
    position: absolute;
    z-index: -1;
    inset: 0;
    content: "";
    opacity: .7;
    background-image: radial-gradient(rgba(255, 255, 255, .22) .6px, transparent .7px);
    background-size: 5px 5px;
    mix-blend-mode: soft-light;
}

.residence-overview-copy {
    display: flex;
    max-width: 39rem;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
}

.residence-eyebrow {
    margin: 0 0 11px;
    color: #e4bd79;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .12em;
}

.residence-overview h1 {
    margin: 0;
    color: #fffdf7;
    font-size: clamp(2.25rem, 4vw, 4.25rem);
    font-weight: 800;
    line-height: .98;
    letter-spacing: .035em;
    text-wrap: balance;
}

.residence-overview-copy > p:not(.residence-eyebrow) {
    max-width: 34rem;
    margin: 21px 0 0;
    color: rgba(255, 253, 247, .78);
    font-size: 14px;
    line-height: 1.85;
}

.residence-overview-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 27px;
}

.residence-button {
    display: inline-flex;
    min-height: 45px;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 0 18px;
    border: 1px solid transparent;
    border-radius: 11px;
    font-size: 13px;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
    transition: transform .22s ease, background-color .22s ease, box-shadow .22s ease, border-color .22s ease;
}

.residence-button--solid {
    background: #f0ca84;
    color: #30443b;
    box-shadow: 0 12px 20px rgba(13, 25, 18, .18);
}

.residence-button--solid:hover { background: #f8d996; box-shadow: 0 16px 26px rgba(13, 25, 18, .23); transform: translateY(-2px); }
.residence-button--solid:active { transform: translateY(0) scale(.98); }

.residence-button--quiet {
    border-color: rgba(255, 253, 247, .36);
    background: rgba(255, 253, 247, .09);
    color: #fffdf7;
}

.residence-button--quiet:hover { border-color: rgba(255, 253, 247, .72); background: rgba(255, 253, 247, .17); transform: translateY(-2px); }
.residence-button--quiet:active { transform: translateY(0) scale(.98); }

.residence-home-status {
    align-self: end;
    padding: 21px;
    border: 1px solid rgba(255, 253, 247, .21);
    border-radius: 18px;
    background: rgba(24, 40, 33, .42);
    box-shadow: inset 0 1px rgba(255, 255, 255, .12);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.residence-owner-line {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 14px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(255, 253, 247, .16);
}

.residence-owner-line span,
.residence-level-grid span {
    color: rgba(255, 253, 247, .66);
    font-size: 11px;
}

.residence-owner-line strong { color: #fffdf7; font-size: 15px; }

.residence-level-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding: 16px 0 13px;
}

.residence-level-grid div { display: flex; flex-direction: column; gap: 3px; }
.residence-level-grid strong { color: #f4cc85; font-size: 19px; font-variant-numeric: tabular-nums; }
.residence-home-note { margin: 0; color: rgba(255, 253, 247, .73); font-size: 12px; line-height: 1.68; }

.residence-flow {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin: 16px 0 28px;
}

.residence-flow-card {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 13px;
    min-height: 112px;
    align-items: center;
    padding: 18px;
    border: 1px solid var(--residence-line);
    border-radius: 16px;
    background: rgba(255, 253, 248, .72);
    color: var(--residence-ink);
    text-align: left;
    cursor: pointer;
    box-shadow: 0 5px 14px rgba(61, 76, 61, .035);
    transition: border-color .22s ease, transform .22s ease, box-shadow .22s ease, background-color .22s ease;
}

.residence-flow-card:hover {
    border-color: rgba(94, 137, 118, .38);
    background: #fffdf8;
    box-shadow: var(--residence-small-shadow);
    transform: translateY(-3px);
}

.residence-flow-card:active { transform: translateY(0) scale(.99); }
.residence-flow-index { align-self: start; color: var(--residence-sun); font-family: Georgia, serif; font-size: 21px; font-style: italic; }
.residence-flow-copy { display: flex; flex-direction: column; min-width: 0; }
.residence-flow-copy small { color: var(--residence-moss); font-size: 10px; font-weight: 800; letter-spacing: .08em; }
.residence-flow-copy strong { margin-top: 4px; color: var(--residence-ink); font-size: 16px; }
.residence-flow-copy em { margin-top: 4px; color: var(--residence-copy); font-size: 11px; font-style: normal; line-height: 1.5; }
.residence-flow-card > span:last-child { color: var(--residence-moss); font-size: 16px; }

.residence-sharing-surface {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(18rem, .7fr);
    gap: 16px;
    margin-bottom: 16px;
}

.residence-share-feed-panel,
.residence-share-prompt,
.residence-utility-section {
    border: 1px solid var(--residence-line);
    border-radius: 20px;
    background: rgba(255, 253, 248, .82);
    box-shadow: 0 8px 20px rgba(61, 76, 61, .045);
}

.residence-share-feed-panel { padding: 24px; }
.residence-share-prompt { padding: 25px; background: linear-gradient(155deg, #e6efe9, #f9f4e8 73%); }

.residence-surface-heading,
.residence-workbench-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
}

.residence-surface-heading p,
.residence-workbench-heading p {
    margin: 0 0 5px;
    color: var(--residence-moss);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .12em;
}

.residence-surface-heading h2,
.residence-workbench-heading h2 {
    margin: 0;
    color: var(--residence-ink);
    font-size: 20px;
    letter-spacing: .01em;
}

.residence-text-link {
    padding: 4px 0;
    border: 0;
    background: transparent;
    color: var(--residence-moss-deep);
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
}

.residence-text-link:hover { color: var(--residence-sun); }

.residence-share-feed { margin-top: 18px; }

.residence-feed-item {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    padding: 13px 0;
    border-top: 1px solid rgba(71, 99, 85, .1);
}

.residence-feed-item:first-child { border-top: 0; padding-top: 0; }

.residence-feed-mark {
    display: grid;
    width: 36px;
    height: 36px;
    place-items: center;
    border-radius: 12px;
    background: #e6efe9;
    color: var(--residence-moss-deep);
    font-family: Georgia, serif;
    font-size: 16px;
}

.residence-feed-content { min-width: 0; }
.residence-feed-content strong { display: block; overflow: hidden; color: var(--residence-ink); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.residence-feed-content span { display: block; overflow: hidden; margin-top: 4px; color: var(--residence-copy); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.residence-feed-type { color: var(--residence-moss); font-size: 10px; font-weight: 800; white-space: nowrap; }

.residence-feed-empty {
    display: flex;
    min-height: 152px;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    padding: 21px;
    border: 1px dashed rgba(94, 137, 118, .28);
    border-radius: 14px;
    background: rgba(230, 239, 233, .42);
}

.residence-feed-empty strong { color: var(--residence-ink); font-size: 14px; }
.residence-feed-empty span { max-width: 27rem; margin-top: 7px; color: var(--residence-copy); font-size: 12px; line-height: 1.7; }
.residence-feed-empty button { margin-top: 13px; border: 0; background: transparent; color: var(--residence-moss-deep); font-size: 12px; font-weight: 800; cursor: pointer; }

.residence-share-prompt h2 { max-width: 16rem; margin: 0; color: var(--residence-ink); font-size: 24px; line-height: 1.22; }
.residence-share-prompt > p:not(.residence-eyebrow) { margin: 12px 0 20px; color: var(--residence-copy); font-size: 12px; line-height: 1.78; }
.residence-share-prompt .residence-button { width: 100%; }

.residence-share-chooser {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid rgba(71, 99, 85, .15);
}

.residence-share-chooser[hidden] { display: none; }
.residence-share-chooser p { margin: 0 0 8px; color: var(--residence-copy); font-size: 11px; }
.residence-share-chooser button {
    display: flex;
    width: 100%;
    min-height: 37px;
    align-items: center;
    justify-content: space-between;
    padding: 7px 0;
    border: 0;
    border-bottom: 1px solid rgba(71, 99, 85, .12);
    background: transparent;
    color: var(--residence-ink);
    font-size: 12px;
    font-weight: 800;
    text-align: left;
    cursor: pointer;
}

.residence-share-chooser button:last-child { border-bottom: 0; }
.residence-share-chooser button:hover { color: var(--residence-moss-deep); }

.residence-utility-section { padding: 24px; margin-bottom: 26px; }

.residence-utility-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-top: 18px;
}

.residence-utility-grid button {
    position: relative;
    display: flex;
    min-height: 98px;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-end;
    overflow: hidden;
    padding: 15px;
    border: 1px solid rgba(71, 99, 85, .12);
    border-radius: 14px;
    background: rgba(246, 241, 230, .62);
    color: var(--residence-ink);
    text-align: left;
    cursor: pointer;
    transition: background-color .22s ease, border-color .22s ease, transform .22s ease;
}

.residence-utility-grid button::before {
    position: absolute;
    top: -17px;
    right: -9px;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    content: "";
    background: rgba(200, 152, 78, .18);
}

.residence-utility-grid button:hover { border-color: rgba(94, 137, 118, .35); background: #fffdf8; transform: translateY(-2px); }
.residence-utility-grid button:active { transform: translateY(0) scale(.99); }
.residence-utility-grid span { position: relative; color: var(--residence-ink); font-size: 13px; font-weight: 800; }
.residence-utility-grid small { position: relative; margin-top: 5px; color: var(--residence-copy); font-size: 10px; }
.residence-utility-grid b,
.residence-utility-grid i { position: absolute; top: 13px; right: 14px; color: var(--residence-moss-deep); font-size: 15px; font-style: normal; font-variant-numeric: tabular-nums; }

/* 旧功能模块保留，但以“居所记录”作为次级内容。 */
.residence-legacy-workbench { padding-top: 9px; }
.residence-workbench-heading { margin: 0 2px 14px; }
.residence-workbench-heading > span { color: var(--residence-moss-deep); font-size: 12px; font-weight: 800; }

#panel-dashboard .dash-section {
    border: 1px solid var(--residence-line);
    border-radius: 18px;
    background: rgba(255, 253, 248, .8);
    box-shadow: 0 8px 22px rgba(61, 76, 61, .04);
}

#panel-dashboard .dash-section-header h3 { color: var(--residence-ink); }
#panel-dashboard .dash-section-header .dash-section-sub { color: var(--residence-copy); }
#panel-dashboard .hero-visit-card { border-color: var(--residence-line); background: #f8f4ea; }
#panel-dashboard .hero-visit-card:hover { border-color: rgba(94, 137, 118, .34); box-shadow: var(--residence-small-shadow); }

/* 共享簿及工具面板的统一明亮表面。 */
#panel-hall,
#panel-merchant,
#panel-planting,
#panel-settings,
#panel-pet,
#panel-ranch,
#panel-harvest,
#panel-strategy {
    padding: clamp(18px, 2.5vw, 30px);
    border: 1px solid var(--residence-line);
    border-radius: 24px;
    background: rgba(255, 253, 248, .8);
    box-shadow: 0 10px 28px rgba(61, 76, 61, .05);
}

#panel-hall .toolbar-left,
#panel-merchant .toolbar-left { color: var(--residence-ink); font-size: 16px; font-weight: 800; }

.hall-tabs { border-color: var(--residence-line); background: #f3eee3; }
.hall-tab.active { color: var(--residence-moss-deep); background: #fffdf8; box-shadow: none; }
.hall-tab:hover:not(.active) { color: var(--residence-moss-deep); background: rgba(255, 253, 248, .6); }
/* 标签页内容默认隐藏，只有 active 才显示（使用高优先级选择器确保移动端生效） */
#panel-hall .hall-tab-content, .hall-content .hall-tab-content { display: none !important; }
#panel-hall .hall-tab-content.active, .hall-content .hall-tab-content.active { display: block !important; }
.hall-table { border: 1px solid var(--residence-line); box-shadow: none; }
.hall-table thead { background: #f3eee3; }
.hall-row:hover { background: #faf6ed; }

.btn.btn-primary,
.btn-primary {
    border-color: var(--residence-moss) !important;
    background: var(--residence-moss) !important;
    box-shadow: 0 9px 18px rgba(66, 107, 89, .17);
}

.btn.btn-primary:hover,
.btn-primary:hover { background: var(--residence-moss-deep) !important; }

.residence-mobile-rail { display: none; }

/* -------------------- 移动端：顶部导航，不再使用底部 dock -------------------- */

@media (max-width: 768px) {
    :root { --header-height: 60px; }

    body {
        background: #f8f5ee !important;
        font-size: 14px;
    }

    .sidebar,
    .top-bar,
    .mobile-bottom-bar { display: none !important; }

    .mobile-header {
        z-index: 120;
        height: var(--header-height);
        padding: 0 16px;
        border-bottom: 1px solid var(--residence-line);
        background: rgba(251, 248, 241, .93);
        box-shadow: 0 5px 18px rgba(61, 76, 61, .05);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
    }

    .mobile-back-btn {
        padding: 5px 9px;
        border-radius: 8px;
        background: transparent;
        color: var(--residence-moss-deep);
        font-size: 12px;
    }

    .mobile-back-btn:hover { background: rgba(94, 137, 118, .08); color: var(--residence-moss-deep); }
    .mobile-logo { overflow: hidden; color: var(--residence-ink); font-size: 14px; letter-spacing: .02em; text-overflow: ellipsis; white-space: nowrap; }
    .mobile-header-actions { gap: 5px; }
    .mobile-header .mobile-feedback-btn,
    .mobile-header .uid-display { display: none; }
    .sync-indicator-mobile { width: 28px; height: 28px; border: 1px solid var(--residence-line); background: rgba(255, 253, 248, .76); }

    .residence-mobile-rail {
        position: sticky;
        z-index: 119;
        top: var(--header-height);
        right: 0;
        left: 0;
        display: block;
        width: 100%;
        overflow: visible;
        padding: 0;
        border-bottom: 1px solid var(--residence-line);
        background: rgba(251, 248, 241, .92);
        box-shadow: 0 7px 16px rgba(61, 76, 61, .035);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
    }

    .residence-mobile-rail-track {
        display: grid;
        width: 100%;
        min-width: 0;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 6px;
        padding: 8px 12px 9px;
        overflow: visible;
    }

    .residence-mobile-tab {
        min-width: 0;
        min-height: 33px;
        padding: 5px 3px;
        border: 1px solid transparent;
        border-radius: 8px;
        background: transparent;
        color: var(--residence-copy);
        font-size: 12px;
        font-weight: 800;
        cursor: pointer;
        transition: color .2s ease, background-color .2s ease, border-color .2s ease;
    }

    .residence-mobile-tab.active { border-color: rgba(94, 137, 118, .25); background: #e5eee8; color: var(--residence-moss-deep); }

    .main-area {
        width: 100%;
        min-width: 0;
        margin-left: 0;
        padding-top: 0;
        padding-bottom: max(22px, env(safe-area-inset-bottom));
        overflow-x: clip;
    }

    .content-panels { width: 100%; min-width: 0; padding: 16px; }

    .site-announcement {
        position: relative !important;
        top: auto !important;
        right: auto !important;
        left: auto !important;
    }

    .mobile-header {
        position: sticky;
        top: 0;
        display: flex !important;
    }

    .residence-overview {
        width: 100%;
        min-width: 0;
        grid-template-columns: 1fr;
        gap: 20px;
        min-height: 548px;
        padding: 28px 22px 21px;
        border-radius: 22px;
        background:
            linear-gradient(180deg, rgba(37, 57, 49, .2) 0%, rgba(37, 57, 49, .5) 34%, rgba(37, 57, 49, .96) 66%, rgba(37, 57, 49, .99) 100%),
            url('../jiayuan_nongtian_gongxiang_tu_shouji.png') center 54% / cover no-repeat;
    }

    .residence-overview-copy { justify-content: flex-end; align-self: end; }
    .residence-eyebrow { margin-bottom: 8px; font-size: 10px; }
    .residence-overview h1 { max-width: 11ch; font-size: clamp(2.2rem, 10.7vw, 3.1rem); overflow-wrap: anywhere; }
    .residence-overview-copy > p:not(.residence-eyebrow) { margin-top: 15px; font-size: 12px; line-height: 1.72; }
    .residence-overview-actions { width: 100%; margin-top: 19px; }
    .residence-overview-actions .residence-button { flex: 1; padding: 0 11px; }

    .residence-home-status { width: 100%; min-width: 0; padding: 16px; border-radius: 15px; }
    .residence-owner-line { padding-bottom: 11px; }
    .residence-level-grid { padding: 11px 0 8px; }
    .residence-home-note { font-size: 11px; }

    .residence-flow { grid-template-columns: 1fr; gap: 8px; margin: 12px 0 18px; }
    .residence-flow-card { min-height: 80px; padding: 13px 14px; }
    .residence-flow-index { font-size: 18px; }
    .residence-flow-copy strong { font-size: 14px; }
    .residence-flow-copy em { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

    .residence-sharing-surface { grid-template-columns: 1fr; gap: 10px; margin-bottom: 10px; }
    .residence-share-feed-panel,
    .residence-share-prompt,
    .residence-utility-section { border-radius: 17px; }
    .residence-share-feed-panel,
    .residence-share-prompt,
    .residence-utility-section { padding: 18px; }
    .residence-surface-heading h2,
    .residence-workbench-heading h2 { font-size: 17px; }
    .residence-share-prompt h2 { font-size: 21px; }
    .residence-share-prompt > p:not(.residence-eyebrow) { margin: 9px 0 16px; }

    .residence-feed-item { grid-template-columns: 33px minmax(0, 1fr); gap: 10px; }
    .residence-feed-mark { width: 33px; height: 33px; border-radius: 10px; }
    .residence-feed-type { grid-column: 2; margin-top: -7px; }

    .residence-utility-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 13px; }
    .residence-utility-grid button { min-height: 92px; padding: 13px; }

    .residence-workbench-heading { align-items: flex-end; margin: 8px 2px 12px; }
    .residence-workbench-heading > span { font-size: 11px; white-space: nowrap; }
    #panel-dashboard .dash-section { border-radius: 16px; }

    #panel-hall,
    #panel-merchant,
    #panel-planting,
    #panel-settings,
    #panel-pet,
    #panel-ranch,
    #panel-harvest,
    #panel-strategy {
        padding: 16px;
        border-radius: 18px;
    }

    .hall-tabs { margin-bottom: 12px; }
    .hall-tab { padding: 9px 7px; font-size: 11px; }
    .hall-table { display: block; overflow-x: auto; }
    .toolbar { gap: 9px; }

    .scroll-to-top { right: 16px; bottom: max(16px, env(safe-area-inset-bottom)); background: var(--residence-moss); box-shadow: 0 9px 20px rgba(66, 107, 89, .24); }
}

@media (max-width: 380px) {
    .residence-mobile-rail-track { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .residence-overview { min-height: 516px; padding-inline: 18px; }
    .residence-overview h1 { font-size: 2.2rem; }
    .residence-overview-actions { gap: 7px; }
    .residence-button { min-height: 41px; font-size: 11px; }
    .residence-flow-card { padding-inline: 12px; }
    .residence-flow-copy em { font-size: 10px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* Realtime community status: visible in the existing toolbar on PC and mobile. */
.sync-indicator[data-live="connected"] {
    color: #176346;
    border-color: rgba(45, 151, 108, .28);
    background: rgba(226, 248, 239, .92);
}

.sync-indicator[data-live="connected"]::before,
.sync-indicator-mobile[data-live="connected"]::before {
    background: #2d976c;
    box-shadow: 0 0 0 4px rgba(45, 151, 108, .14);
}

.sync-indicator[data-live="connecting"],
.sync-indicator[data-live="reconnecting"] {
    color: #8a641b;
    border-color: rgba(190, 139, 44, .28);
    background: rgba(255, 247, 226, .92);
}

.sync-indicator-mobile[data-live="connected"] {
    box-shadow: inset 0 0 0 1px rgba(45, 151, 108, .24);
}
