* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { font-family: system-ui, "Noto Sans TC", sans-serif; background: #111; color: #eee; }

/* 登入頁 */
.login-body { display: flex; align-items: center; justify-content: center; }
.login-card { background: #1c1c22; padding: 32px; border-radius: 14px; width: min(92vw, 380px); box-shadow: 0 8px 30px rgba(0,0,0,.5); }
.login-card h1 { font-size: 1.5rem; margin-bottom: 14px; }
.login-card .hint { color: #aab; font-size: .9rem; line-height: 1.5; margin: 8px 0; }
.login-card code { background: #333; padding: 1px 6px; border-radius: 4px; }
.login-card hr { border: none; border-top: 1px solid #333; margin: 14px 0; }
.login-card input { width: 100%; margin: 6px 0; padding: 10px; border-radius: 8px; border: 1px solid #444; background: #26262e; color: #eee; }
.login-card button { width: 100%; margin-top: 10px; padding: 10px; border: none; border-radius: 8px; background: #3a7afe; color: #fff; font-size: 1rem; cursor: pointer; }
.err { color: #ff7070; font-size: .85rem; margin-top: 10px; min-height: 1.2em; }

/* 主介面 */
.app-body { display: flex; flex-direction: column; height: 100dvh; overflow: hidden; }
#topbar, #navbar { display: flex; align-items: center; gap: 6px; padding: 6px 10px; background: #1a1a20; flex: none; }
.brand { font-weight: 600; margin-right: 4px; white-space: nowrap; }
.spacer { flex: 1; }
.stat { color: #8a9; font-size: .72rem; white-space: nowrap; overflow: hidden; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.dot.on { background: #35d07f; } .dot.off { background: #777; } .dot.busy { background: #f5a623; }
#topbar button, #navbar button { background: #2a2a33; border: 1px solid #3a3a46; color: #eee; border-radius: 8px; padding: 6px 10px; font-size: 1rem; cursor: pointer; flex: none; }
#topbar button:active, #navbar button:active { background: #3a7afe; }

#stage { flex: 1; position: relative; display: flex; align-items: center; justify-content: center; background: #000; min-height: 0; }
#screen { max-width: 100%; max-height: 100%; touch-action: none; cursor: crosshair; }
#overlay { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 14px; align-items: center; justify-content: center; background: rgba(0,0,0,.72); z-index: 5; text-align: center; padding: 20px; }
#overlay[hidden] { display: none; }
#overlayBtn { padding: 10px 26px; font-size: 1rem; border: none; border-radius: 10px; background: #3a7afe; color: #fff; cursor: pointer; }

#navbar #textInput { flex: 1; padding: 8px 10px; border-radius: 8px; border: 1px solid #3a3a46; background: #26262e; color: #eee; min-width: 0; }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; z-index: 20; }
.modal[hidden] { display: none; }
.modal-box { background: #1c1c22; border-radius: 12px; padding: 18px; width: min(92vw, 420px); max-height: 80vh; overflow: auto; }
.modal-box h3 { margin-bottom: 10px; }
.app-row { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px solid #2a2a33; font-size: .85rem; }
.app-row .pkg { flex: 1; word-break: break-all; }
.app-row button { padding: 4px 10px; font-size: .8rem; border-radius: 6px; border: none; cursor: pointer; }
.app-row .launch { background: #2e6b4f; color: #fff; }
.app-row .remove { background: #6b2e2e; color: #fff; }
.modal-actions { margin-top: 12px; text-align: right; }
.modal-actions button { padding: 7px 18px; border-radius: 8px; border: none; background: #3a3a46; color: #eee; cursor: pointer; }

#toast { position: fixed; bottom: 70px; left: 50%; transform: translateX(-50%); background: #333a; color: #fff; padding: 10px 18px; border-radius: 10px; font-size: .85rem; z-index: 30; backdrop-filter: blur(6px); max-width: 90vw; }
