:root{color-scheme:dark;font-family:"Microsoft YaHei","Noto Sans CJK SC",sans-serif;--safe-l:max(12px,env(safe-area-inset-left));--safe-r:max(12px,env(safe-area-inset-right));--safe-b:max(10px,env(safe-area-inset-bottom))}
[hidden]{display:none!important}
*{box-sizing:border-box}html,body,#unity-container,#unity-canvas{width:100%;height:100%;margin:0;overflow:hidden;background:#182218}button,input{font:inherit}button{touch-action:manipulation;border:1px solid #dccb8d;border-radius:14px;background:rgba(35,48,30,.92);color:#fff;padding:.65rem .9rem}button:active{transform:scale(.96)}button:disabled{opacity:.42}input{min-width:0;border:1px solid #b8aa72;border-radius:10px;background:#fff;color:#172016;padding:.65rem}.card{position:fixed;z-index:20;background:rgba(25,35,22,.94);border:1px solid #b49c5d;border-radius:16px;box-shadow:0 8px 28px #0008;color:#fff}.top{top:max(8px,env(safe-area-inset-top));left:50%;transform:translateX(-50%);padding:.35rem .75rem;pointer-events:none}.coop{left:50%;top:50%;transform:translate(-50%,-50%);width:min(92vw,560px);padding:1rem}.row{display:flex;gap:.55rem;margin-top:.6rem}.row input{flex:1}.chat{right:var(--safe-r);top:max(10px,env(safe-area-inset-top));width:min(38vw,390px);padding:.55rem}.chat-log{height:7.5rem;overflow:auto;font-size:.84rem;overflow-wrap:anywhere}.touch{position:fixed;inset:0;z-index:10;pointer-events:none}.touch button,.joystick{pointer-events:auto;user-select:none;-webkit-user-select:none}.joystick{position:absolute;left:var(--safe-l);bottom:var(--safe-b);width:132px;height:132px;border-radius:50%;border:2px solid #e6daa777;background:radial-gradient(circle,#d9c98e55 0 20%,#22301ccc 22% 100%);touch-action:none}.actions{position:absolute;right:var(--safe-r);bottom:var(--safe-b);display:grid;grid-template-columns:repeat(3,minmax(54px,74px));gap:.45rem}.actions button{height:54px;padding:.25rem}.system-buttons{position:absolute;right:var(--safe-r);top:calc(max(10px,env(safe-area-inset-top)) + 10rem);display:flex;gap:.4rem}.rotate{display:none;position:fixed;inset:0;z-index:99;place-items:center;text-align:center;padding:2rem;background:#182218;color:white}.loading{position:fixed;inset:0;z-index:80;display:grid;place-items:center;background:#182218;color:white}.progress{width:min(70vw,420px);height:12px;border:1px solid #b8aa72;border-radius:8px;overflow:hidden}.progress>i{display:block;height:100%;width:0;background:#83bc62}.unsupported{font-size:.85rem;color:#eadba7}
@media (orientation:portrait) and (max-width:900px){.rotate{display:grid}}@media (max-width:820px){.chat{width:44vw}.chat-log{height:4.2rem}.coop{font-size:.9rem}.joystick{width:116px;height:116px}.actions{grid-template-columns:repeat(3,58px)}.actions button{height:48px;font-size:.82rem}.system-buttons{top:auto;bottom:calc(var(--safe-b) + 108px)}}
.chat-toggle{position:fixed;z-index:25;right:var(--safe-r);top:max(10px,env(safe-area-inset-top))}.chat{top:calc(max(10px,env(safe-area-inset-top)) + 3rem)}
.runtime-error{position:fixed;z-index:120;left:var(--safe-l);right:var(--safe-r);bottom:var(--safe-b);max-height:35vh;overflow:auto;padding:.8rem 1rem;border:2px solid #ff8a72;border-radius:12px;background:#3b1714f2;color:#fff;white-space:pre-wrap;overflow-wrap:anywhere}
/* Match the in-game parchment journal and wooden signs. */
.card{background:#e7d5ad url('parchment.png') center/100% 100%;color:#402b19;border:2px solid #7e613a;border-radius:7px;box-shadow:0 10px 32px #07100799,inset 0 0 0 3px #efdcb966}
button{background:#513a20 url('wood.png') center/100% 100%;border-color:#a78651;border-radius:7px;color:#fff0ca;text-shadow:0 1px #271c11;box-shadow:0 2px 0 #241a12}
input{background:#fff7e2;color:#402b19;border-color:#aa8b55;border-radius:5px;outline-offset:2px}.coop h2{margin:.15rem 0 .55rem;color:#3f2b1b;font-size:1.5rem}.coop p{line-height:1.6;margin:.5rem 0}.top{display:none}.chat-log{color:#3d2b1c}.chat-toggle{right:var(--safe-r)}
.loading>div{padding:2rem;background:#283820;border:1px solid #7b8850;border-radius:8px;max-width:92vw;text-align:center}.joystick{box-shadow:inset 0 0 0 6px #131e1699,0 3px 12px #0006;border-color:#c5b17f}.actions button[data-action="attack"]{border:2px solid #c9ab60;background-color:#6a4a26;font-weight:bold}.runtime-error{max-height:35vh;overflow:auto;white-space:pre-wrap;overflow-wrap:anywhere}
@media(max-height:450px){.coop{padding:.7rem .9rem}.coop h2{font-size:1.15rem}.coop p{font-size:.8rem;margin:.25rem 0}.coop button,.coop input{padding:.45rem .65rem}.row{margin-top:.4rem}.chat-log{height:4rem}}
.coop{padding:2.2rem 2rem 1.7rem}.coop h2{padding-left:8px}.coop-form .row{gap:.6rem}@media(max-height:450px){.coop{padding:1.2rem 1.5rem 1rem}.coop h2{padding-left:10px}}
@media(max-height:450px){.joystick{width:114px;height:114px}.actions{grid-template-columns:repeat(3,58px);gap:6px}.actions button{height:48px;font-size:13px}.system-buttons{top:auto;bottom:calc(var(--safe-b) + 164px)}.system-buttons button{padding:8px;font-size:12px}.chat-toggle{font-size:13px;padding:8px}.chat{top:48px}}

/* Keep the skill restore control beside the remaining system buttons. */
.system-buttons{top:auto;bottom:calc(var(--safe-b) + 124px);max-width:calc(100vw - var(--safe-l) - var(--safe-r));flex-wrap:wrap;justify-content:flex-end}
#skills-toggle{white-space:nowrap}
@media(max-height:450px){.system-buttons{bottom:calc(var(--safe-b) + 164px)}}
.touch.skills-hidden .system-buttons{top:auto;bottom:var(--safe-b)}

/* Reserve the right top for the Unity objective; chat occupies the left middle. */
.chat-toggle{left:var(--safe-l);right:auto;top:calc(max(8px,env(safe-area-inset-top)) + 164px)}
.chat{left:var(--safe-l);right:auto;top:calc(max(8px,env(safe-area-inset-top)) + 210px);width:min(330px,38vw);max-height:calc(100vh - 300px)}
.chat-log{height:min(110px,18vh)}
.chat-open .joystick{visibility:hidden}
.game-modal-open .touch,.game-modal-open .chat,.game-modal-open .chat-toggle{display:none!important}
.system-buttons{max-width:min(400px,58vw)}
@media(max-height:450px){.chat-toggle{top:96px}.chat{top:136px;width:39vw;max-height:calc(100vh - 148px)}.chat-log{height:60px}.chat input,.chat button{padding:6px}.system-buttons{max-width:290px}.chat-open .joystick{visibility:hidden}}
