/* 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}
.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-avatar{position:relative;flex:none;width:44px;height:48px;border-radius:48% 48% 37% 37%;background:#efd275;box-shadow:inset -3px -3px 0 #dbb65026}
.th-avatar:before,.th-avatar:after{content:'';position:absolute;top:13px;width:12px;height:13px;border:3px solid #9bad66;border-radius:50%;background:#253d30}
.th-avatar:before{left:8px}.th-avatar:after{right:8px}
.th-avatar i{position:absolute;width:13px;height:5px;border-bottom:2px solid #765941;border-radius:0 0 50% 50%;top:30px;left:15px}
.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:#82937a;display:flex;gap:5px;align-items:center;padding:5px 8px;min-height:36px;font-size:11px!important;border-radius:10px}
.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:45vh;overflow:auto}
.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:38px;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-avatar{animation:th-speaking 1s ease-in-out infinite}
@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-avatar,.th-message.pending .th-bubble:after{animation:none}.th-log{scroll-behavior:auto}.th-settings,.th-progress i{transition:none}}
