/* All existing touch and narrow layouts keep their original rules. */
@media (min-width:769px) and (hover:hover) and (pointer:fine) {
    .cg-nav-group { position:relative;display:flex;align-items:stretch; }
    .cg-desktop-sections .cg-nav-group > a { padding-right:6px; }
    .cg-nav-toggle { padding:0 7px;border:0;background:transparent;color:inherit;font:inherit;min-width:24px;cursor:pointer; }
    .cg-nav-dropdown { position:absolute;top:100%;left:0;min-width:180px;max-width:calc(100vw - 16px);padding:6px;background:#fff;color:#1d1d1f;border:1px solid #d8ddda;border-radius:0 0 8px 8px;z-index:1; }
    .cg-nav-dropdown[hidden] { display:none !important; }
    .cg-desktop-sections .cg-nav-dropdown a { justify-content:flex-start;min-height:44px;padding:9px 14px;border:0;border-radius:4px;white-space:normal; }
    .cg-desktop-sections .cg-nav-dropdown a[aria-current=page] { background:#edf3ee;color:#27563d; }
    [data-theme=dark] .cg-nav-dropdown { background:#1e1e3a;color:#e8e8ed;border-color:#4c4c64; }
    [data-theme=dark] .cg-desktop-sections .cg-nav-dropdown a[aria-current=page] { background:#244639;color:#9fe6b8; }
    @media (max-width:1100px) {
        .cg-desktop-header .cg-desktop-main { padding:0 12px;gap:12px; }
        .cg-desktop-brand span { display:none; }
        .cg-desktop-header .cg-desktop-sections { gap:0; }
        .cg-desktop-header .cg-desktop-sections > a,.cg-desktop-sections .cg-nav-group > a { padding:12px 9px; }
        .cg-desktop-sections .cg-nav-group > a { padding-right:2px; }
        .cg-desktop-header .cg-desktop-actions { gap:6px; }
        .cg-desktop-header .cg-settings-entry span { display:none; }
        .cg-desktop-header .cg-settings-entry { padding:9px; }
        .cg-desktop-header .cg-desktop-account summary { max-width:88px; }
    }
}
@media (min-width:769px) and (hover:hover) and (pointer:fine) {
    [data-desktop-hidden] { display:none !important; }
    .cg-desktop-header { color:#1d1d1f; background:#fff; border-bottom:1px solid #e5e5e7; font:600 14px/1.5 -apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif; position:relative; z-index:20; }
    .cg-desktop-header *,.cg-desktop-intro * { box-sizing:border-box; }
    .cg-desktop-main { max-width:1440px; margin:auto; min-height:68px; padding:0 28px; display:flex; align-items:center; gap:24px; }
    .cg-desktop-header a { color:inherit; text-decoration:none; }
    .cg-desktop-brand { display:flex; align-items:center; gap:10px; font-weight:800; white-space:nowrap; }
    .cg-desktop-brand img { width:34px; height:34px; object-fit:contain; }
    .cg-desktop-sections { display:flex; align-items:stretch; align-self:stretch; gap:8px; flex:1; }
    .cg-desktop-sections a { display:flex; align-items:center; justify-content:center; padding:12px 18px; border-bottom:3px solid transparent; white-space:nowrap; }
    .cg-desktop-sections a[aria-current=page] { color:#32664c; border-color:#32664c; font-weight:800; background:#f4f8f5; }
    .cg-desktop-header a:hover,.cg-desktop-header button:hover { color:#32664c; background:#f4f8f5; }
    .cg-desktop-header a:focus-visible,.cg-desktop-header button:focus-visible,.cg-desktop-account summary:focus-visible,.cg-desktop-shortcuts a:focus-visible,.cg-desktop-shortcuts button:focus-visible { outline:2px solid #32664c; outline-offset:3px; }
    .cg-desktop-actions { display:flex; align-items:center; gap:12px; }
    .cg-desktop-actions button,.cg-desktop-menu button { font:inherit; padding:8px 12px; border:1px solid #d8ddda; border-radius:8px; background:#fff; cursor:pointer; white-space:nowrap; }
    .cg-desktop-account { position:relative; }
    .cg-desktop-account summary { cursor:pointer; max-width:150px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; padding:10px 8px; }
    .cg-desktop-menu { position:absolute; top:100%; right:0; min-width:170px; display:flex; flex-direction:column; gap:4px; padding:8px; background:#fff; border:1px solid #e5e5e7; border-radius:10px; box-shadow:0 8px 20px #00000014; }
    .cg-desktop-menu a,.cg-desktop-menu button { display:block; text-align:left; padding:9px 12px; border:0; border-radius:6px; }
    .cg-desktop-sub { max-width:1440px; margin:auto; padding:9px 28px; border-top:1px solid #f0f1f0; display:flex; align-items:center; justify-content:space-between; gap:16px; }
    .cg-desktop-breadcrumb { font-size:12px; color:#646a67; white-space:nowrap; }
    .cg-desktop-sub nav { display:flex; flex-wrap:wrap; gap:6px 16px; font-size:13px; }
    .cg-desktop-intro { display:flex; align-items:center; justify-content:space-between; gap:24px; margin-bottom:24px; color:#1d1d1f; }
    .cg-desktop-intro h1 { font-size:25px; margin:0 0 6px; line-height:1.35; }
    .cg-desktop-intro p { color:#646a67; font-size:14px; margin:0; line-height:1.6; }
    .cg-desktop-shortcuts { display:flex; gap:8px; flex-wrap:wrap; }
    .cg-desktop-shortcuts a,.cg-desktop-shortcuts button { display:inline-block; color:#32664c; background:#fff; border:1px solid #cfdad2; border-radius:8px; padding:9px 14px; text-decoration:none; font:600 13px/1.5 -apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif; cursor:pointer; }
    .cg-desktop-shortcuts a:first-child { background:#32664c; color:#fff; border-color:#32664c; }
    body.puzzle-playing .cg-desktop-main { min-height:56px; }
    body.puzzle-playing .cg-desktop-sub { display:none; }
    @media (max-width:1050px) {
        .cg-desktop-main { padding:0 16px; gap:14px; }
        .cg-desktop-sections { gap:0; }
        .cg-desktop-sections a { padding:12px 12px; }
        .cg-desktop-intro { align-items:flex-start; flex-direction:column; gap:14px; }
    }
}

@media (min-width:769px) and (hover:hover) and (pointer:fine) {
    .cg-settings-entry { display:inline-flex;align-items:center;gap:7px; }
    .cg-settings-entry svg { width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.5; }
    .cg-personal-summary { color:var(--cr-text,#1d1d1f);text-align:left; }
    .cg-personal-identity { display:flex;align-items:center;gap:20px; }
    .cg-personal-avatar { width:64px;height:64px;flex-shrink:0;display:grid;place-items:center;border-radius:50%;background:#edf3ee;color:#32664c;font-size:26px;font-weight:700; }
    .cg-personal-identity > div:nth-child(2) { flex:1;min-width:0; }
    .cg-personal-role { margin:0 0 4px;font-size:12px;color:var(--cr-text-muted,#646a67); }
    .cg-personal-summary h1 { margin:0 0 5px;font-size:25px;line-height:1.4;overflow-wrap:anywhere; }
    .cg-personal-description { margin:0;font-size:14px;color:var(--cr-text-muted,#646a67); }
    .cg-edit-profile { flex-shrink:0;font:600 13px/1.5 -apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;padding:9px 14px;min-height:40px;border:1px solid #cfdad2;border-radius:8px;color:#32664c;background:#fff;cursor:pointer; }
    .cg-personal-links { display:flex;gap:24px;margin-top:26px;padding-top:20px;border-top:1px solid var(--cr-border,#e5e5e7); }
    .cg-personal-links a,.cg-personal-coach a { color:#32664c;font-size:14px;text-decoration:none;font-weight:600; }
    .cg-personal-links a span { margin-left:6px; }
    .cg-personal-coach { padding-top:24px;font-size:14px; }
    .cg-personal-coach p { color:var(--cr-text-muted,#646a67); }
    .cg-desktop #profileContent.profile-card { max-width:900px;padding:28px;margin-bottom:32px; }
    .cg-settings-dialog.cr-modal-box { width:760px;max-width:calc(100vw - 64px);max-height:calc(100dvh - 64px);padding:0;overflow:hidden;background:var(--cr-bg-card,#fff);color:var(--cr-text,#1d1d1f);border-radius:12px; }
    .cg-settings-dialog .cr-modal-title { padding:20px 24px;margin:0;border-bottom:1px solid var(--cr-border,#e5e5e7);font-size:21px;text-align:left; }
    .cg-settings-content { display:grid;grid-template-columns:154px minmax(0,1fr);height:530px;max-height:calc(100dvh - 210px);min-height:200px; }
    .cg-settings-tabs { padding:16px 12px;background:var(--cr-bg,#f5f6f5);border-right:1px solid var(--cr-border,#e5e5e7);display:flex;flex-direction:column;gap:5px; }
    .cg-settings-tabs button { padding:12px 10px;min-height:44px;white-space:nowrap;text-align:left;border:0;border-radius:6px;background:transparent;color:var(--cr-text,#1d1d1f);font:600 14px/1.5 -apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;cursor:pointer; }
    .cg-settings-tabs button[aria-selected=true] { background:#e8f0ea;color:#27563d; }
    .cg-settings-panels { overflow-y:auto;overscroll-behavior:contain;padding:22px 24px;min-width:0; }
    .cg-settings-panels [hidden] { display:none !important; }
    .cg-settings-dialog #cr-skin-grid { max-height:180px !important; }
    .cg-settings-dialog > div:last-child { margin:0 !important;padding:12px 24px;border-top:1px solid var(--cr-border,#e5e5e7);text-align:right !important; }
    .cg-settings-description { color:var(--cr-text-muted,#646a67);font-size:13px;line-height:1.7;margin:0 0 18px; }
    .cg-account-section { margin:0 0 24px;padding-bottom:22px;border-bottom:1px solid var(--cr-border,#e5e5e7); }
    .cg-account-section:last-child { border:0;margin-bottom:0;padding-bottom:0; }
    .cg-account-section h3 { margin:0 0 14px;font-size:16px; }
    .cg-account-section label { display:block;font-size:13px;margin:14px 0 7px; }
    .cg-account-row { display:flex;align-items:center;gap:10px; }
    .cg-account-row input { flex:1;min-width:0;width:100%;padding:10px 12px;border:1px solid var(--cr-border,#d8ddda);border-radius:6px;color:var(--cr-text,#1d1d1f);background:var(--cr-bg-card,#fff);font-size:14px;min-height:42px; }
    .cg-settings-panels button { min-height:42px;border:1px solid #cfdad2;border-radius:6px;background:var(--cr-bg-card,#fff);color:#32664c;padding:8px 12px;font:600 13px/1.5 -apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;white-space:nowrap;cursor:pointer; }
    .cg-settings-panels button:disabled { opacity:.55;cursor:default; }
    .cg-account-status { font-size:13px;line-height:1.6;margin:8px 0 0;overflow-wrap:anywhere; }
    .cg-account-status:empty { display:none; }
    .cg-account-status.is-error { color:#bc3232; }
    .cg-account-status.is-success,.cg-account-verified { color:#32664c; }
    .cg-account-verified { font-size:13px; }
    .cg-account-value { overflow-wrap:anywhere; }
    .cg-account-phone-value { flex:1; }
    .cg-settings-dialog :focus-visible,.cg-edit-profile:focus-visible,.cg-personal-links a:focus-visible { outline:2px solid #32664c;outline-offset:3px; }
    .cg-settings-dialog .cr-toggle-switch:focus-within { outline:2px solid #32664c;outline-offset:3px; }
    html[data-theme=dark] .cg-settings-dialog #cg-settings-sound div { color:inherit !important; }
    html[data-theme=dark] .cg-settings-tabs button[aria-selected=true] { background:#253e30;color:#a7d9b7; }
    html[data-theme=dark] .cg-personal-links a,html[data-theme=dark] .cg-personal-coach a,html[data-theme=dark] .cg-settings-panels button,html[data-theme=dark] .cg-account-verified,html[data-theme=dark] .cg-account-status.is-success { color:#a7d9b7; }
    html[data-theme=dark] .cg-account-status.is-error { color:#ffaba3; }
}

/* Public news shell belongs to the main site; independent news releases fill the frame. */
@media (min-width:769px) and (hover:hover) and (pointer:fine) {

}

/* Explain why a guest has reached authentication and keep the selected section. */
@media (min-width:769px) and (hover:hover) and (pointer:fine) {
    #cg-login-context { margin:0 0 22px;padding:0 0 18px;border-bottom:1px solid #e5e5e7;color:#1d1d1f; }
    #cg-login-context h2 { font-size:20px;line-height:1.5;margin:0 0 8px; }
    #cg-login-context p { font-size:13px;line-height:1.7;color:#646a67;margin:0 0 10px; }
    #cg-login-context div { font-size:13px;line-height:1.7; }
    #cg-login-context button { border:0;background:transparent;color:#0071e3;padding:3px 6px;font-family:inherit;font-size:13px;font-weight:600;line-height:1.7;cursor:pointer; }
    #cg-login-context button:focus-visible { outline:2px solid #0071e3;outline-offset:2px;border-radius:3px; }
}

/* Keep the news reader and its return route on every device (news-return1). */
    body.cg-news-page { height:100dvh; display:flex; flex-direction:column; overflow:hidden; background:#f8f9f5; }
    .cg-news-page #cr-nav-root { flex-shrink:0; }
    .cg-news-page .account-wrap { display:none; }
    #cg-news-view { flex:1; min-height:0; display:flex; }
    #cg-news-frame { display:block; flex:1; width:100%; min-width:0; height:100%; border:0; background:#f8f9f5; }
.cg-news-mobile-header { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:8px; padding:8px 12px; min-height:60px; color:var(--cr-text,#1d1d1f); background:var(--cr-bg-card,#fff); border-bottom:1px solid var(--cr-border,#e5e5e7); font:600 14px/1.4 -apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif; }
.cg-news-mobile-header a { display:inline-flex; align-items:center; min-height:44px; color:inherit; text-decoration:none; white-space:nowrap; }
.cg-news-mobile-header a:focus-visible { outline:3px solid #32664c; outline-offset:2px; }
.cg-news-mobile-header strong { font-size:16px; }

/* Personal content actions live inside the profile, across device layouts. */
.cg-personal-summary .cg-personal-links.cg-personal-buttons {
    display:flex; flex-direction:row; flex-wrap:wrap; gap:10px;
    margin-top:20px; padding-top:0; border-top:0;
}
.cg-personal-summary .cg-personal-links.cg-personal-buttons a {
    display:inline-flex; align-items:center; justify-content:center; gap:7px;
    min-height:44px; padding:0 13px; box-sizing:border-box; white-space:nowrap;
    border:1px solid var(--cr-border,#d8ddda); border-radius:8px;
    background:var(--cr-bg-card,#fff); color:var(--cr-text,#1d1d1f);
    font:600 13px/1.5 -apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
    text-decoration:none;
}
.cg-personal-buttons svg { width:16px; height:16px; flex-shrink:0; fill:none; stroke:currentColor; stroke-width:1.6; stroke-linecap:round; stroke-linejoin:round; }
.cg-personal-summary .cg-personal-links.cg-personal-buttons a:hover {
    background:var(--cr-bg,#f4f8f5); border-color:#668b72;
}
.cg-personal-summary .cg-personal-links.cg-personal-buttons a:active { background:var(--cr-bg,#edf3ee); }
.cg-personal-summary .cg-personal-links.cg-personal-buttons a:focus-visible { outline:2px solid #32664c; outline-offset:3px; }
html[data-theme=dark] .cg-personal-summary .cg-personal-links.cg-personal-buttons a:focus-visible { outline-color:#a7d9b7; }


/* Desktop navigation follows the existing saved display theme (nav-theme1). */
@media (min-width:769px) and (hover:hover) and (pointer:fine) {
    html[data-theme=dark] .cg-desktop-header {
        --cr-bg-card:#1e1e3a; --cr-text:#e8e8ed; --cr-border:#2a2a44; color-scheme:dark;
        background:var(--cr-bg-card,#1e1e3a); color:var(--cr-text,#e8e8ed); border-color:var(--cr-border,#2a2a44);
    }
    html[data-theme=dark] .cg-desktop-actions button,html[data-theme=dark] .cg-desktop-menu button {
        background:var(--cr-bg-card,#1e1e3a); color:var(--cr-text,#e8e8ed); border-color:var(--cr-border,#2a2a44);
    }
    html[data-theme=dark] .cg-desktop-menu {
        background:var(--cr-bg-card,#1e1e3a); border-color:var(--cr-border,#2a2a44); box-shadow:0 8px 20px #00000040;
    }
    html[data-theme=dark] .cg-desktop-sections a[aria-current=page] {
        background:#253e30; color:#a7d9b7; border-color:#a7d9b7;
    }
    html[data-theme=dark] .cg-desktop-header a:hover,html[data-theme=dark] .cg-desktop-header button:hover {
        background:#253e30; color:#a7d9b7;
    }
    html[data-theme=dark] .cg-desktop-header a:focus-visible,html[data-theme=dark] .cg-desktop-header button:focus-visible,html[data-theme=dark] .cg-desktop-account summary:focus-visible {
        outline-color:#a7d9b7;
    }
    html[data-theme=dark] .cg-desktop-sub { border-color:var(--cr-border,#2a2a44); }
    html[data-theme=dark] .cg-desktop-breadcrumb { color:#b7c0bb; }
}
