/* Warm, Material-inspired palette — surfaces avoid pure white/black; minimal flat gray fields. */
:root {
    --w-surface: #fdf8f3;
    --w-surface-high: #fff9f4;
    --w-surface-container: #f5ebe0;
    --w-surface-container-high: #ede0d4;
    --w-on-surface: #2c2419;
    --w-on-surface-variant: #5c4f44;
    --w-on-primary: #fffef9;
    --w-outline: rgba(93, 64, 55, 0.22);
    --w-shadow: rgba(62, 39, 35, 0.12);
    --w-ssq: #00695c;
    --w-ssq-container: #e0f2f1;
    --w-ssq-light: #b2dfdb;
    --w-amber: #9a5b1a;
    --w-amber-soft: #ffe8cc;
    --w-content-max: var(--layout-content-max, min(480px, 100%));
    /* Material 3 式：页面与卡片同色相、不同饱和度/亮度，避免「贴白纸」感 */
    --page-h: 32;
    --page-bg-a: hsl(var(--page-h) 22% 93%);
    --page-bg-b: hsl(var(--page-h) 18% 90%);
    --surface-tonal: hsl(var(--page-h) 12% 97% / 0.92);
    --surface-tonal-2: hsl(var(--page-h) 10% 95% / 0.88);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

/* ——— Home (index) ——— */
body.warm-home {
    background: linear-gradient(180deg, var(--page-bg-a) 0%, var(--page-bg-b) 55%, hsl(var(--page-h) 16% 88%) 100%);
    color: var(--w-on-surface);
    font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
    font-size: 15px;
    line-height: 1.55;
    min-height: 100vh;
    padding: clamp(8px, 2.5vw, 14px);
}

body.warm-home .shell {
    width: 100%;
    max-width: var(--w-content-max);
    margin: 0 auto;
}

body.warm-home .hero {
    position: relative;
    padding: clamp(14px, 4vw, 22px) clamp(12px, 3.5vw, 18px) clamp(16px, 4vw, 20px);
    border-radius: 16px;
    border: 1px solid var(--w-outline);
    margin-bottom: 18px;
    background:
        linear-gradient(145deg, hsl(var(--page-h) 14% 96% / 0.65) 0%, transparent 48%),
        linear-gradient(215deg, hsl(168 16% 94% / 0.35) 0%, transparent 52%),
        linear-gradient(180deg, hsl(var(--page-h) 10% 97%) 0%, hsl(var(--page-h) 8% 94%) 100%);
    box-shadow: 0 10px 36px var(--w-shadow), inset 0 1px 0 rgba(255, 255, 255, 0.65);
    overflow: hidden;
}

body.warm-home .hero::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 16px;
    pointer-events: none;
    box-shadow: inset 0 0 0 1px hsl(var(--page-h) 10% 88% / 0.35);
}

body.warm-home .hero-section-title {
    text-align: center;
    font-size: clamp(1.15rem, 4.2vw, 1.55rem);
    font-weight: 800;
    letter-spacing: 0.12em;
    color: var(--w-on-surface);
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);
    margin: 0 0 18px;
    line-height: 1.35;
}

body.warm-home .hero-main-row { display: block; }
body.warm-home .hero-main-col { width: 100%; }

body.warm-home .hero-panel {
    padding: clamp(10px, 3vw, 14px);
    border-radius: 12px;
    background: linear-gradient(180deg, var(--surface-tonal) 0%, var(--surface-tonal-2) 100%);
    border: 1px solid hsl(var(--page-h) 10% 86% / 0.55);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 2px 14px var(--w-shadow);
    width: 100%;
    max-width: 100%;
}

body.warm-home .hero-panel + .hero-panel { margin-top: 14px; }

body.warm-home .hero-game-capture { position: relative; }
body.warm-home .hero-game-main {
    flex: 1;
    min-width: 0;
    width: 100%;
}

body.warm-home .hero-card-header {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: stretch;
    gap: 10px;
    margin-bottom: 0;
}

body.warm-home .hero-card-info {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 2px;
}

body.warm-home .hero-card-actions {
    flex: 0 0 auto;
    align-self: stretch;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: flex-end;
    gap: 4px;
    max-width: 42%;
    min-width: 5.8rem;
    padding: 1px 0;
}

body.warm-home .hero-card-actions .panel-share-hint:not([style*="display: block"]) {
    display: none !important;
}

body.warm-home .hero-card-actions .hero-more-btn,
body.warm-home .hero-card-actions .share-btn,
body.warm-home .hero-card-actions .bookmark-btn {
    flex: 0 0 auto;
}

body.warm-home .hero-draw-head {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 6px 10px;
    margin-bottom: 4px;
}

body.warm-home .hero-draw-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--w-on-surface);
    letter-spacing: 0.06em;
}

body.warm-home .hero-game-capture.card-ssq .hero-draw-name {
    color: #004d40;
}

body.warm-home .hero-draw-when {
    font-size: clamp(11px, 3.1vw, 13px);
    font-weight: 500;
    color: var(--w-on-surface-variant);
    margin: 0;
    letter-spacing: 0.02em;
    font-variant-numeric: tabular-nums;
    line-height: 1.4;
}

body.warm-home .hero-card-info .hero-draw-period {
    font-size: 13px;
    font-weight: 600;
    color: #00695c;
    font-variant-numeric: tabular-nums;
    margin: 0;
}

body.warm-home .hero-card-info .latest-balls {
    margin-top: 4px;
}

body.warm-home .latest-balls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

body.warm-home .ball {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-weight: 700;
    font-size: 16px;
    color: #fffef9;
    box-shadow: 0 2px 8px rgba(62, 39, 35, 0.2), inset 0 -2px 0 rgba(0, 0, 0, 0.12);
}

body.warm-home .ball-red { background: linear-gradient(160deg, #e74c3c, #a93226); }
body.warm-home .ball-blue { background: linear-gradient(160deg, #3498db, #1e6bb8); }

body.warm-home .hero-pick {
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(255, 243, 224, 0.45);
    border: 1px solid rgba(191, 108, 46, 0.2);
    text-align: left;
    color: var(--w-on-surface-variant);
    font-size: 13px;
}

body.warm-home .hero-game-capture.card-ssq .hero-pick {
    border-color: rgba(0, 105, 92, 0.22);
    background: rgba(178, 223, 219, 0.25);
}

body.warm-home .hero-pick-inner h4 { font-size: 14px; color: var(--w-amber); margin-bottom: 8px; }
body.warm-home .hero-pick-empty { color: var(--w-on-surface-variant); font-size: 13px; }

body.warm-home .hero-more-btn,
body.warm-home .hero-card-actions .share-btn,
body.warm-home .hero-card-actions .bookmark-btn {
    margin-top: 0;
    width: auto;
    max-width: 100%;
    min-width: 5.8rem;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: clamp(11px, 3vw, 12px);
    font-weight: 600;
    line-height: 1.3;
    cursor: pointer;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 2px 6px var(--w-shadow);
    transition: background 0.2s ease, transform 0.15s ease, border-color 0.2s ease;
    white-space: nowrap;
}

body.warm-home .hero-more-btn {
    background: linear-gradient(145deg, #00796b, #00695c);
    border: 1px solid rgba(0, 77, 64, 0.35);
    color: var(--w-on-primary);
}

body.warm-home .hero-more-btn:hover {
    background: linear-gradient(145deg, #00897b, #00796b);
    transform: translateY(-1px);
}

body.warm-home .home-expand-slot { margin-bottom: 18px; }

body.warm-home .embed-card {
    max-width: var(--w-content-max);
    margin: 0 auto;
    padding: 16px 14px 20px;
    border-radius: 14px;
    border: 1px solid hsl(var(--page-h) 10% 86% / 0.5);
    background: linear-gradient(180deg, hsl(var(--page-h) 10% 97% / 0.95) 0%, hsl(var(--page-h) 8% 94% / 0.92) 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7), 0 6px 24px var(--w-shadow);
    color: var(--w-on-surface);
}

body.warm-home .embed-card.embed-ssq {
    border-color: hsl(168 16% 78% / 0.55);
    background:
        linear-gradient(165deg, hsl(168 14% 94% / 0.55) 0%, transparent 46%),
        linear-gradient(180deg, hsl(var(--page-h) 10% 96.5% / 0.96) 0%, hsl(var(--page-h) 8% 93% / 0.9) 100%);
}

body.warm-home .cold-hot-table { display: flex; gap: 16px; flex-wrap: wrap; }
body.warm-home .cold-hot-col {
    flex: 1 1 200px;
    border-radius: 10px;
    padding: 12px;
    background: hsl(var(--page-h) 10% 96% / 0.88);
    color: var(--w-on-surface);
    border: 1px solid hsl(var(--page-h) 8% 88% / 0.45);
}

body.warm-home .cold-hot-col h4 { margin-bottom: 8px; font-size: 15px; }
body.warm-home .tag-cold { font-weight: 700; color: #0d4a6b; margin-right: 6px; }
body.warm-home .tag-hot { font-weight: 700; color: #a03030; margin-right: 6px; }

body.warm-home .more-section,
body.warm-home .group-section {
    background: hsl(var(--page-h) 10% 95% / 0.88);
    border-radius: 10px;
    padding: 12px;
    margin-top: 12px;
    color: var(--w-on-surface);
    border: 1px solid hsl(var(--page-h) 8% 88% / 0.4);
}

body.warm-home .more-section h4,
body.warm-home .group-section h4 {
    margin-bottom: 8px;
    font-size: 15px;
    color: var(--w-on-surface);
}

body.warm-home .more-row { margin: 6px 0; font-size: 14px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
body.warm-home .more-hidden { display: none; }
body.warm-home .group-row { margin: 6px 0; font-size: 14px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
body.warm-home .group-more { display: none; }
body.warm-home .group-more.show { display: block; width: 100%; }
body.warm-home .group-more-inner { display: flex; flex-direction: column; gap: 4px; padding-left: 76px; }

@media (max-width: 700px) {
    body.warm-home .group-row {
        display: grid;
        grid-template-columns: 70px minmax(0, 1fr);
        align-items: center;
        column-gap: 6px;
        row-gap: 4px;
    }

    body.warm-home .group-row > .group-label {
        grid-column: 1;
    }

    body.warm-home .group-row > .group-set-inline,
    body.warm-home .group-row > .toggle-btn,
    body.warm-home .group-row > .group-more {
        grid-column: 2;
    }

    body.warm-home .group-row > .toggle-btn {
        justify-self: start;
        margin-left: 0 !important;
    }

    body.warm-home .group-row > .group-more.show {
        width: 100%;
    }

    body.warm-home .group-more-inner {
        padding-left: 0 !important;
    }
}

body.warm-home .group-label { min-width: 70px; flex-shrink: 0; }
body.warm-home .group-set-inline { display: inline-flex; flex-wrap: nowrap; gap: 4px; margin: 2px 0; }

body.warm-home .toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(255, 249, 240, 0.9);
    border: 1px solid var(--w-outline);
    color: var(--w-on-surface);
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    margin-left: 6px;
}

body.warm-home .embed-card .embed-section-title-ssq {
    color: #00695c;
    margin-top: 14px;
    font-size: 1.05rem;
}

body.warm-home .tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 10px;
}

body.warm-home .embed-tool-item {
    background: rgba(255, 252, 248, 0.85);
    border-radius: 10px;
    padding: 14px;
    text-align: center;
    color: var(--w-on-surface);
    cursor: pointer;
    border: 1px solid var(--w-outline);
    transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

body.warm-home .embed-card.embed-ssq .embed-tool-item:hover {
    background: rgba(178, 223, 219, 0.45);
    border-color: rgba(0, 105, 92, 0.35);
    transform: translateY(-2px);
}
body.warm-home .embed-card.embed-ssq .embed-tool-item.active {
    background: rgba(178, 223, 219, 0.7) !important;
    border-color: #00695c !important;
    border-width: 1.5px !important;
}

body.warm-home .embed-tool-item h3 { margin: 0 0 4px; font-size: 15px; color: var(--w-amber); }
body.warm-home .embed-tool-item p { margin: 0; font-size: 12px; color: var(--w-on-surface-variant); }

body.warm-home #homeToolFrameContainer {
    display: none;
    width: 100%;
    margin-top: 14px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--w-outline);
}

body.warm-home #homeToolFrame {
    width: 100%;
    border: none;
    background: var(--w-surface-container);
    min-height: 400px;
}

body.warm-home .hero-load-fail {
    margin-top: 14px;
    text-align: center;
    font-size: 13px;
    color: #c62828;
}

body.warm-home .panel-share-hint {
    display: none;
    background: linear-gradient(180deg, #fff5e6, var(--w-amber-soft));
    color: #4e342e;
    border-radius: 8px;
    padding: 6px 10px;
    max-width: 100%;
    font-size: 10px;
    font-weight: 700;
    line-height: 1.35;
    text-align: center;
    box-shadow: 0 2px 8px var(--w-shadow);
    border: 1px solid rgba(191, 108, 46, 0.22);
    align-self: flex-end;
}

body.warm-home .hero-card-actions .share-btn {
    border: 1px solid rgba(0, 105, 92, 0.35);
    background: var(--w-ssq-container);
    color: #004d40;
}

body.warm-home .hero-card-actions .share-btn:hover {
    background: #b2dfdb;
    transform: translateY(-1px);
}

body.warm-home .hero-card-actions .bookmark-btn {
    background: rgba(255, 252, 248, 0.98);
    border: 1px solid rgba(93, 64, 55, 0.32);
    color: var(--w-on-surface);
}

body.warm-home .hero-card-actions .bookmark-btn:hover {
    background: #fff9f4;
    border-color: rgba(93, 64, 55, 0.45);
    transform: translateY(-1px);
}

body.warm-home .share-btn:active,
body.warm-home .bookmark-btn:active,
body.warm-home .hero-more-btn:active { transform: translateY(0); }

body.warm-home .modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(47, 37, 32, 0.58);
    backdrop-filter: blur(4px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

body.warm-home .modal-overlay img { max-width: 90%; max-height: 70vh; border-radius: 8px; box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2); }
body.warm-home .modal-overlay .tips {
    color: var(--w-surface-high);
    margin-top: 12px;
    font-size: 14px;
    text-align: center;
    max-width: 90%;
    padding: 0 12px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

@media (max-width: 620px) {
    body.warm-home .ball { width: clamp(32px, 9vw, 36px); height: clamp(32px, 9vw, 36px); font-size: clamp(13px, 3.6vw, 14px); }
    body.warm-home .hero-card-actions { max-width: 46%; gap: 5px; }
    body.warm-home .hero-card-actions .share-btn,
    body.warm-home .hero-card-actions .bookmark-btn,
    body.warm-home .hero-card-actions .hero-more-btn { min-width: 5.2rem; font-size: 11px; padding: 5px 8px; }
    body.warm-home .panel-share-hint { font-size: 9px; padding: 5px 8px; }
}

body.warm-home footer {
    text-align: center;
    margin-top: 28px;
    padding: 16px 8px;
    font-size: 12px;
    color: var(--w-on-surface-variant);
}

body.warm-home footer .toggle {
    color: #00695c;
    cursor: pointer;
    text-decoration: underline;
}

body.warm-home #infoDetail {
    display: none;
    margin-top: 14px;
    color: var(--w-on-surface);
    line-height: 1.75;
    text-align: center;
    max-width: 28em;
    margin-left: auto;
    margin-right: auto;
}

body.warm-home #infoDetail p { margin-bottom: 10px; }

body.warm-home .footer-domain {
    margin-top: 10px;
    color: var(--w-on-surface-variant);
}

body.warm-home .empty-inline,
html.warm-site body.warm-portal .empty-inline {
    color: var(--w-on-surface-variant) !important;
    font-size: 13px;
}

/* ——— Portal hub (ssq/index) ——— */
html.warm-site body.warm-portal {
    background: linear-gradient(180deg, #faf3eb, #fdf8f3) !important;
    color: var(--w-on-surface) !important;
}

html.warm-site body.warm-portal .page-container {
    width: 100%;
    max-width: var(--w-content-max) !important;
    margin: 0 auto !important;
    padding: clamp(8px, 2.5vw, 12px) !important;
    background: linear-gradient(180deg, hsl(168 12% 93% / 0.95) 0%, hsl(var(--page-h) 10% 92% / 0.96) 48%, hsl(38 22% 92% / 0.94) 100%) !important;
    border: 1px solid hsl(var(--page-h) 10% 84% / 0.55) !important;
    box-shadow: 0 6px 24px var(--w-shadow) !important;
}

html.warm-site body.warm-portal .card-glass {
    color: var(--w-on-surface) !important;
    background: transparent !important;
}

html.warm-site body.warm-portal #dailyCard > h2,
html.warm-site body.warm-portal .card-glass h2,
html.warm-site body.warm-portal .card-glass h3 {
    color: var(--w-on-surface) !important;
}

html.warm-site body.warm-portal .daily-header-right h2 { color: var(--w-on-surface) !important; }
html.warm-site body.warm-portal .draw-label { color: var(--w-on-surface-variant) !important; }
html.warm-site body.warm-portal .draw-period { color: #00695c !important; }
html.warm-site body.warm-portal .today-date { color: var(--w-on-surface-variant) !important; }

html.warm-site body.warm-portal .highlight-text {
    background: rgba(255, 243, 224, 0.65) !important;
    border: 1px solid rgba(191, 108, 46, 0.12);
}

html.warm-site body.warm-portal #shareHint {
    background: linear-gradient(180deg, #fff5e6, var(--w-amber-soft)) !important;
    color: #4e342e !important;
    border: 1px solid rgba(191, 108, 46, 0.22) !important;
}

html.warm-site body.warm-portal .share-btn,
html.warm-site body.warm-portal .bookmark-btn {
    background: linear-gradient(145deg, #00796b, #00695c) !important;
    border: 1px solid rgba(0, 77, 64, 0.35) !important;
    color: #fffef9 !important;
    box-shadow: 0 2px 8px var(--w-shadow) !important;
}

html.warm-site body.warm-portal .bookmark-btn {
    background: rgba(255, 252, 248, 0.95) !important;
    border: 1px solid rgba(93, 64, 55, 0.28) !important;
    color: var(--w-on-surface) !important;
}

html.warm-site body.warm-portal .toggle-btn {
    background: rgba(255, 249, 240, 0.95) !important;
    border: 1px solid var(--w-outline) !important;
    color: var(--w-on-surface) !important;
}

html.warm-site body.warm-portal .tool-item {
    background: rgba(255, 252, 248, 0.9) !important;
    border: 1px solid var(--w-outline) !important;
    color: var(--w-on-surface) !important;
    box-shadow: 0 2px 10px var(--w-shadow) !important;
}

html.warm-site body.warm-portal .tool-item:hover {
    background: rgba(178, 223, 219, 0.35) !important;
}

html.warm-site body.warm-portal .tool-item h3 { color: var(--w-amber) !important; }
html.warm-site body.warm-portal .tool-item p { color: var(--w-on-surface-variant) !important; }

html.warm-site body.warm-portal #toolFrame {
    background: var(--w-surface-container) !important;
}

html.warm-site body.warm-portal .modal-overlay {
    background: rgba(47, 37, 32, 0.58) !important;
    backdrop-filter: blur(4px);
}

html.warm-site body.warm-portal .modal-overlay .tips { color: var(--w-surface-high) !important; }

html.warm-site body.warm-portal .footer-toggle { color: #00695c !important; }
html.warm-site body.warm-portal .footer-detail {
    background: rgba(255, 249, 240, 0.9) !important;
    color: var(--w-on-surface) !important;
    border: 1px solid rgba(191, 108, 46, 0.12);
}

html.warm-site body.warm-portal .portal-footer-domain {
    margin: 4px 0 !important;
    color: var(--w-on-surface-variant) !important;
}

html.warm-site body.warm-portal nav a { color: #00695c !important; }

/* Portal: force readable text on warm surfaces (overrides legacy inline white) */
html.warm-site body.warm-portal .cold-hot-col,
html.warm-site body.warm-portal .cold-hot-col h4,
html.warm-site body.warm-portal .more-section,
html.warm-site body.warm-portal .group-section,
html.warm-site body.warm-portal .more-section h4,
html.warm-site body.warm-portal .group-section h4,
html.warm-site body.warm-portal .more-row,
html.warm-site body.warm-portal .group-row,
html.warm-site body.warm-portal .group-label,
html.warm-site body.warm-portal .highlight-text,
html.warm-site body.warm-portal .footer-detail,
html.warm-site body.warm-portal .footer-detail p,
html.warm-site body.warm-portal .card-glass p {
    color: var(--w-on-surface) !important;
}

html.warm-site body.warm-portal .share-btn {
    color: var(--w-on-primary) !important;
}

html.warm-site body.warm-portal nav.portal-nav {
    max-width: var(--w-content-max) !important;
    margin: 0 auto !important;
    padding: 8px clamp(10px, 3vw, 14px) 0 !important;
    font-size: 13px !important;
}

html.warm-site body.warm-portal nav.portal-nav a {
    color: var(--w-ssq) !important;
    text-decoration: none !important;
}
