/* Isolated treehole UI. No original game selector is restyled. */
#treeholeEntry{color:#4d765c;background:#f4f7eb;border-color:#dce5d3;min-height:52px}
#treeholeEntry svg{stroke:#52775c}
#treeholeEntry span{font-size:11px;letter-spacing:0}
#treeholeEntry[data-waiting=true] svg{opacity:.7}
.nw-entry-hint{position:fixed;z-index:180;box-sizing:border-box;padding:11px 14px;border-radius:14px;background:#f6f8ef;color:#45664f;border:1px solid #dbe4d3;box-shadow:0 5px 18px #314a3620;font-size:12px;line-height:1.5;pointer-events:none}
.th-overlay,.th-overlay *{box-sizing:border-box}
.th-overlay{position:fixed;inset:0;z-index:2147483600;display:flex;align-items:center;justify-content:center;padding:14px;background:rgba(34,46,38,.38);font-family:system-ui,-apple-system,'Microsoft YaHei',sans-serif;color:#394d40;touch-action:auto}
.th-overlay[hidden],.th-overlay [hidden]{display:none!important}
.th-dialog{position:relative;display:flex;flex-direction:column;width:min(100%,530px);height:min(88vh,780px);height:min(88dvh,780px);border-radius:26px;background:#faf9f2;box-shadow:0 16px 65px #1d342433;overflow:hidden;animation:th-open .23s cubic-bezier(.18,.7,.3,1)}
.th-head{display:flex;align-items:center;gap:11px;padding:18px 18px 13px;flex:none;border-bottom:1px solid #e4e9dd;background:#f7f8ed}
.th-brand{display:grid;place-items:center;flex:none;width:44px;height:44px;border-radius:15px;background:#edf2e4;border:1px solid #dde6d4;color:#5a7c61;box-shadow:inset 0 1px 0 #fff}
.th-brand svg{display:block;width:29px;height:29px;fill:none;stroke:currentColor;stroke-width:1.45;stroke-linecap:round;stroke-linejoin:round}
.th-heading{min-width:0}.th-heading h2{white-space:nowrap}
.th-head h2{font-size:18px;line-height:1.3;margin:0 0 4px;font-weight:750;letter-spacing:.3px}
.th-status{font-size:12px;color:#7d8c7c;margin:0;line-height:1.4}
.th-tools{display:flex;gap:3px;margin-left:auto}
.th-icon{display:grid;place-items:center;flex:none;border:0;width:44px;height:44px;border-radius:13px;background:transparent;color:#526953;cursor:pointer;touch-action:manipulation}
.th-icon svg{width:21px;height:21px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
.th-icon:hover{background:#e9eddf}.th-icon:active{transform:scale(.94)}
.th-overlay button,.th-overlay input,.th-overlay textarea{font:inherit}
.th-overlay button{cursor:pointer;-webkit-tap-highlight-color:transparent;touch-action:manipulation}
.th-overlay button:disabled{cursor:default;opacity:.5}
.th-overlay button:focus-visible,.th-overlay input:focus-visible,.th-overlay textarea:focus-visible{outline:3px solid #91bfa4;outline-offset:2px}
.th-notice{margin:0;padding:10px 18px;flex:none;background:#f0f3e7;font-size:12px;line-height:1.6;color:#687d66}
.th-main{min-height:0;display:flex;flex:1;flex-direction:column;overflow:hidden;position:relative}
.th-gate{flex:1;overflow:auto;padding:30px 25px 20px;text-align:center;overscroll-behavior:contain}
.th-gate .th-tree{width:82px;height:82px;display:block;margin:0 auto 17px;color:#739267;fill:#e2ebd6;stroke:currentColor;stroke-width:2.3;stroke-linecap:round;stroke-linejoin:round}
.th-gate h3{font-size:21px;line-height:1.5;margin:0 0 8px;font-weight:730}
.th-gate p{font-size:14px;line-height:1.75;margin:0;color:#7d8d7a}
.th-feature-row{display:flex;justify-content:center;gap:8px;flex-wrap:wrap;margin:17px 0 19px}
.th-feature-row span{font-size:12px;line-height:1.5;padding:6px 10px;border:1px solid #dfe7d5;background:#f1f5e9;border-radius:12px;color:#6d8364}
.th-size{font-size:13px;color:#6e8168;line-height:1.7;padding:12px 16px;margin:0 auto 18px;border-radius:16px;background:#f0f2e6;text-align:left;max-width:380px}
.th-size b{color:#3f624e;display:block;font-size:14px;margin-bottom:3px}
.th-primary{display:block;width:100%;min-height:48px;border:0;border-radius:15px;padding:12px 16px;background:#567d60;color:#fff;font-size:15px;font-weight:650}
.th-primary:active{transform:scale(.99);background:#43694e}
.th-secondary{display:block;margin:8px auto 0;min-height:44px;border:0;border-radius:13px;padding:10px 16px;color:#84907c;background:transparent;font-size:14px}
.th-caption{font-size:11px!important;line-height:1.6!important;margin:15px auto 0!important;max-width:370px}
.th-progress{margin:21px auto 12px;max-width:360px;height:7px;background:#e4e9db;overflow:hidden;border-radius:10px}
.th-progress i{display:block;width:0;height:100%;border-radius:inherit;background:#749469;transition:width .15s linear}
.th-progress-info{min-height:24px;margin-bottom:16px!important;font-size:13px!important}
.th-log{flex:1;min-height:0;overflow-y:auto;overscroll-behavior:contain;padding:21px 18px 12px;scroll-behavior:smooth;-webkit-overflow-scrolling:touch}
.th-welcome{text-align:center;padding:12px 18px 24px;color:#95a18d;font-size:12px}
.th-welcome b{display:block;color:#6b8269;font-size:15px;margin-bottom:5px}
.th-message{display:flex;gap:8px;align-items:flex-start;margin:0 0 18px;animation:th-message .18s ease-out}
.th-message.user{justify-content:flex-end}
.th-bubble-wrap{max-width:88%;min-width:0}
.th-name{font-size:11px;color:#90a08c;margin:0 3px 5px;line-height:1.5}
.th-message.user .th-name{text-align:right}
.th-bubble{background:#fff;border:1px solid #e5e9df;border-radius:4px 17px 17px 17px;padding:12px 14px;font-size:15px;line-height:1.75;white-space:pre-wrap;overflow-wrap:anywhere;color:#465a47;box-shadow:0 2px 5px #63785305}
.th-message.user .th-bubble{background:#e8efdb;border-color:#e0e9d4;border-radius:17px 4px 17px 17px;color:#46604a}
.th-bubble.loading{color:#899783}
.th-message.pending .th-bubble:after{content:'';display:inline-block;width:4px;height:15px;background:#90a686;border-radius:2px;vertical-align:-2px;margin-left:3px;animation:th-cursor 1s infinite}
.th-message-actions{display:flex;align-items:center;gap:4px;margin-top:3px}
.th-replay{border:0;background:transparent;color:#718769;display:flex;gap:5px;align-items:center;padding:6px 8px;min-height:44px;font-size:12px!important;border-radius:10px;transition:background .16s,color .16s,transform .16s}
.th-replay[aria-pressed=true]{background:#e8efde;color:#45664d}.th-replay:active{transform:scale(.97)}
.th-replay svg{width:15px;height:15px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.th-suggestions{display:flex;gap:7px;flex-wrap:wrap;margin-top:10px}
.th-suggestions button{border:1px solid #dfe7d5;background:#f6f8ef;color:#75916c;font-size:12px;line-height:1.4;border-radius:14px;padding:10px 12px;min-height:40px}
.th-compose{flex:none;padding:10px 14px 12px;background:#faf9f2;border-top:1px solid #e6eade}
.th-input-row{display:flex;align-items:flex-end;gap:8px;background:#fff;border:1px solid #dde4d5;border-radius:18px;padding:8px 9px 8px 12px}
.th-input-row:focus-within{border-color:#96b68a;box-shadow:0 0 0 2px #94b98916}
.th-compose textarea{min-height:32px;max-height:96px;resize:none;flex:1;width:0;border:0;outline:none!important;background:transparent;color:#415a43;font-size:16px;line-height:1.5;padding:5px 0}
.th-send{display:grid;place-items:center;width:42px;height:42px;min-height:42px;flex:none;background:#597f63;color:white;border:0;border-radius:13px}
.th-send svg{width:21px;height:21px;stroke:currentColor;stroke-width:1.8;fill:none;stroke-linecap:round;stroke-linejoin:round}
.th-footnote{font-size:11px;color:#9aa28f;margin:6px 2px 0;line-height:1.4;display:flex;justify-content:space-between;gap:8px}
.th-error{border-radius:12px;background:#fbede3;color:#a76c4c;font-size:13px;line-height:1.6;padding:11px 13px;margin:12px 0}
.th-settings{flex:none;height:0;overflow:hidden;background:#f1f4e9;transition:height .22s ease;color:#627b5c}
.th-settings-inner{padding:14px 18px;border-bottom:1px solid #e3e8db;max-height:min(42dvh,360px);overflow:auto;overscroll-behavior:contain}
.th-settings h3{margin:0 0 7px;font-size:14px;color:#506d51}
.th-settings p{font-size:12px;line-height:1.65;margin:5px 0 12px;color:#829379}
.th-check{display:flex;align-items:center;gap:8px;min-height:40px;font-size:13px;cursor:pointer}
.th-check input{accent-color:#5c805d;width:17px;height:17px;flex:none}
.th-setting-actions{display:flex;gap:8px;flex-wrap:wrap;margin-top:9px}
.th-setting-actions button{font-size:12px;min-height:44px;padding:8px 10px;border:1px solid #d7e0cd;border-radius:11px;background:#fafbf6;color:#6b8063}
.th-confirm{margin:10px 0 0;padding:10px;background:#fff7ed;border-radius:12px}
.th-confirm p{margin:0 0 6px;color:#9b7655}
.th-toast{position:absolute;bottom:100px;left:50%;transform:translateX(-50%);max-width:90%;background:#42553ee6;color:#fff;padding:10px 14px;border-radius:14px;font-size:12px;line-height:1.5;text-align:center;z-index:2;pointer-events:none}
.th-speaking .th-brand{animation:th-speaking 1s ease-in-out infinite}
.th-link{border:0;background:transparent;text-decoration:underline;text-underline-offset:3px;color:#607b5c;font-size:12px!important;min-height:44px;padding:6px 0}
.th-storage-note{padding-top:10px;border-top:1px solid #dfe7d7}
.th-message.failed .th-bubble{background:#f4f3ea;border-color:#e3e2d8;color:#7e826f}
.th-dialog{animation:none}.th-primary,.th-secondary,.th-send,.th-icon{transition:background .16s,transform .16s}
.th-send:active{transform:scale(.92)}.th-icon[aria-expanded=true]{background:#e9eddf;color:#3e694e}
@keyframes th-open{from{opacity:0;transform:translateY(14px) scale(.985)}to{opacity:1;transform:none}}
@keyframes th-message{from{opacity:0;transform:translateY(5px)}to{opacity:1;transform:none}}
@keyframes th-cursor{50%{opacity:.2}}
@keyframes th-speaking{50%{transform:translateY(-2px)}}
@media(max-width:600px){.th-overlay{padding:0;align-items:stretch;background:#faf9f2}.th-dialog{width:100%;height:100%;max-height:100%;border-radius:0;box-shadow:none;padding-top:env(safe-area-inset-top,0px)}.th-head{padding-top:12px}.th-compose{padding-bottom:calc(10px + env(safe-area-inset-bottom,0px))}.th-gate{padding-top:30px}.th-log{padding-left:14px;padding-right:14px}}
@media(max-height:560px){.th-gate{padding-top:12px}.th-gate .th-tree{height:48px;margin-bottom:6px}.th-dialog{height:100%;max-height:100%}.th-gate h3{font-size:18px}.th-gate .th-feature-row{margin:10px 0}.th-size{margin-bottom:10px}.th-settings-inner{max-height:35vh}}
@media(prefers-reduced-motion:reduce){.th-dialog,.th-message,.th-speaking .th-brand,.th-message.pending .th-bubble:after{animation:none}.th-log{scroll-behavior:auto}.th-settings,.th-progress i,.th-overlay button{transition:none}}

/* Compact home entry points; original buttons live inside this accessible menu. */
.side-tools.nw-side-compact{gap:9px}
#homeMore{color:#64775c;background:#f4f5e8;border-color:#e0e5d6}
#homeMore[aria-expanded=true]{background:#e5edda}
#homeMoreDot{position:absolute;right:4px;top:4px;width:8px;height:8px;border-radius:50%;background:#db9e60;border:2px solid #faf9f1}
.nw-menu-backdrop{position:fixed;inset:0;background:rgba(43,58,42,.16);z-index:2000;touch-action:none}
.nw-menu{position:fixed;z-index:2001;box-sizing:border-box;width:300px;padding:16px;background:#fcfcf6;border:1px solid #e4e8db;border-radius:23px;box-shadow:0 12px 40px #354a3524;color:#4d654b;transform-origin:top right}
.nw-menu[hidden],.nw-menu-backdrop[hidden],.nw-menu .round-tool[hidden]{display:none!important}
.nw-menu header{display:flex;align-items:center;gap:6px;margin:0 0 12px}
.nw-menu header div{flex:1;min-width:0}.nw-menu header b{display:block;font-size:16px;line-height:1.5}.nw-menu header small{display:block;font-size:11px;color:#95a089;line-height:1.6}
.nw-menu-close{display:grid;place-items:center;flex:none;width:44px;height:44px;background:#f0f3e8;border:0;border-radius:15px;color:#75866b;touch-action:manipulation}
.nw-menu-close svg{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round}
.nw-menu-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:9px}
.nw-menu-grid .round-tool{position:relative!important;display:flex!important;flex-direction:column!important;align-items:center!important;justify-content:center!important;gap:6px!important;min-width:0!important;width:100%!important;height:88px!important;padding:10px!important;border-radius:17px!important;border:1px solid #e4e9dc!important;background:#f4f6ec!important;box-shadow:none!important;color:#617a59!important;transform:none!important;animation:none!important;line-height:1.4!important;touch-action:manipulation}
.nw-menu-grid .round-tool:active{background:#e8efdd!important;transform:scale(.97)!important}
.nw-menu-grid .round-tool{inset:auto!important;top:auto!important;right:auto!important;bottom:auto!important;left:auto!important;margin:0!important;z-index:auto!important}
.nw-menu-grid .round-tool[hidden]{display:none!important}
.nw-menu-grid .round-tool svg,.nw-menu-grid .round-tool img{position:static!important;width:26px!important;height:26px!important;flex:none;fill:none;stroke:currentColor;stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round}
.nw-menu-grid .round-tool span{font-size:13px!important;position:static!important;line-height:1.4!important;display:block!important}
.nw-menu-grid .round-tool span b{font-size:13px!important;display:inline!important;font-weight:600}.nw-menu-grid .round-tool span small{font-size:10px!important;display:block!important;color:#94a185}
.nw-menu button:focus-visible{outline:3px solid #91bfa4;outline-offset:2px}
.nw-menu-grid .round-tool i{position:absolute;right:10px;top:9px}

/* Page-level download capsule: outside game panels and never a blocking modal. */
.th-play-first{margin-top:12px;background:#557d60}
.th-companion{position:relative;flex:0 0 clamp(160px,28dvh,245px);min-height:120px;overflow:hidden;background:#e9eedf;border-bottom:1px solid #e1e7da}
.th-companion #scene{position:absolute!important;inset:0!important;display:block!important;width:100%!important;height:100%!important;min-height:0!important;border-radius:0!important;touch-action:none;pointer-events:none}
.th-companion-note{position:absolute;bottom:9px;left:50%;transform:translateX(-50%);max-width:90%;white-space:nowrap;padding:5px 11px;background:#fafcf1df;color:#6d8065;border:1px solid #e4ead9;border-radius:20px;font-size:11px;line-height:1.5;pointer-events:none}
.th-settings-open .th-companion{flex-basis:120px}
.th-companion[data-ready=false]{display:none}
.th-gate{padding-top:18px}.th-gate .th-tree{display:none}.th-gate h3{font-size:19px}.th-gate .th-feature-row{display:none}.th-gate .th-size{margin-top:14px;margin-bottom:10px}.th-caption{margin-top:10px!important}
.th-log{padding-top:12px}.th-welcome{padding-top:0;padding-bottom:16px}
@media(max-height:560px){.th-companion{flex-basis:120px;min-height:90px}.th-settings-open .th-companion{display:none}}
#thDownloadIsland,#thDownloadIsland *{box-sizing:border-box}
#thDownloadIsland{position:fixed;top:calc(env(safe-area-inset-top,0px) + 8px);left:50%;transform:translateX(-50%);z-index:2147483590;max-width:calc(100vw - 24px);font-family:system-ui,-apple-system,'Microsoft YaHei',sans-serif;pointer-events:none}
#thDownloadIsland[hidden]{display:none!important}
#thDownloadIsland .th-island-button{width:170px;max-width:calc(100vw - 24px);height:44px;min-height:44px;display:flex;align-items:center;gap:9px;padding:6px 11px 6px 8px;border-radius:28px;background:#26372f;color:#f9fff4;border:1px solid #425448;box-shadow:0 5px 16px #102c222b;cursor:pointer;pointer-events:auto;touch-action:manipulation;-webkit-tap-highlight-color:transparent;text-align:left;font:inherit;transition:width .42s cubic-bezier(.22,1,.36,1),height .42s cubic-bezier(.22,1,.36,1),background .2s,box-shadow .2s}
#thDownloadIsland .th-island-button:active{background:#3c5547}
#thDownloadIsland .th-island-button:focus-visible{outline:3px solid #9ed4b2;outline-offset:3px}
#thDownloadIsland.is-expanded .th-island-button{width:304px;height:64px;border-radius:34px;box-shadow:0 8px 26px #102c223b}
.th-island-mark{width:30px;height:30px;flex:none;display:grid;place-items:center}
.th-island-mark svg{display:block;width:30px;height:30px;fill:none;stroke:#bdddab;stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round}
.th-island-track{opacity:.18}.th-island-progress{stroke-dasharray:100;stroke-dashoffset:calc(100 - var(--th-download-percent,0));transform:rotate(-90deg);transform-origin:center;transition:stroke-dashoffset .18s linear}
.th-island-leaf{stroke-width:1.5}
.th-island-copy{display:block;min-width:0;flex:1}
.th-island-copy b{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:12px;font-weight:650;line-height:1.5;letter-spacing:0}
.th-island-copy small{display:block;max-height:0;overflow:hidden;opacity:0;color:#b8ccba;font-size:11px;line-height:1.6;white-space:nowrap;transition:max-height .3s,opacity .24s}
.is-expanded .th-island-copy small{max-height:22px;opacity:1}
.is-expanded .th-island-copy b{font-size:14px}
.th-island-percent{flex:none;min-width:21px;text-align:right;font-size:11px;color:#c1dfa9;font-variant-numeric:tabular-nums}
#thDownloadIsland[data-status=ready] .th-island-percent{font-size:17px}
#thDownloadIsland[data-status=error] .th-island-percent{color:#f2c6a0}
.th-island-announcement{position:absolute;width:1px;height:1px;padding:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
@media(prefers-reduced-motion:reduce){#thDownloadIsland .th-island-button,.th-island-copy small,.th-island-progress{transition:none}}
