* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font: 14px -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #1e1f22; color: #e6e6e6;
}
button, select, input {
  font: inherit; color: inherit; background: #2c2e33; border: 1px solid #3c3f45;
  border-radius: 6px; padding: 5px 10px;
}
button { cursor: pointer; }
button:hover { background: #363940; }
.hidden { display: none !important; }

/* login */
.login-page { display: flex; align-items: center; justify-content: center; }
.login-box { width: 300px; padding: 28px; background: #26282c; border-radius: 10px; }
.login-box h1 { margin: 0 0 18px; font-size: 20px; }
.login-box label { display: block; margin-bottom: 6px; color: #aaa; }
.login-box input { width: 100%; padding: 9px; }
.login-box button { width: 100%; margin-top: 14px; padding: 9px; background: #3d6df2; border-color: #3d6df2; }
.error { color: #ff7b72; min-height: 1.2em; }

/* app */
.app { display: flex; flex-direction: column; overflow: hidden; }
.toolbar { display: flex; align-items: center; gap: 6px; padding: 6px 8px; background: #26282c; border-bottom: 1px solid #33363b; flex-wrap: wrap; }
.toolbar.secondary { padding-top: 4px; padding-bottom: 4px; font-size: 13px; }
.toolbar.secondary button, .toolbar.secondary select { padding: 3px 8px; }
.toolbar button#back, .toolbar button#forward, .toolbar button#reload, .toolbar button#newTab { width: 34px; padding: 5px 0; font-size: 16px; }
.url-form { flex: 1; min-width: 160px; display: flex; }
.url-form input { flex: 1; width: 100%; }
#tabs { max-width: 220px; }
.spacer { flex: 1; }
.stats { color: #8a8f98; font-size: 12px; font-variant-numeric: tabular-nums; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: #c0392b; display: inline-block; }
.dot.ok { background: #2ecc71; }
.dot.warn { background: #f1c40f; }

#stage { position: relative; flex: 1; overflow: hidden; display: flex; align-items: center; justify-content: center; background: #111; }
#screen { display: block; background: #000; touch-action: none; cursor: default; outline: none; image-rendering: auto; }
#kb {
  position: absolute; left: 0; top: 0; width: 2px; height: 1em;
  opacity: 0; border: 0; padding: 0; resize: none; overflow: hidden;
  font-size: 16px; /* prevents iOS zoom on focus */
  pointer-events: none; caret-color: transparent; color: transparent; background: transparent;
}

.overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.55); }
.overlay-box { max-width: 460px; padding: 20px 24px; background: #26282c; border-radius: 10px; text-align: center; line-height: 1.6; }
.overlay-box button { margin-top: 10px; background: #3d6df2; border-color: #3d6df2; }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; z-index: 10; }
.modal-box { width: min(640px, 92vw); background: #26282c; border-radius: 10px; padding: 16px; }
.modal-box textarea { width: 100%; height: 260px; background: #1e1f22; color: inherit; border: 1px solid #3c3f45; border-radius: 6px; padding: 8px; font: 13px/1.5 ui-monospace, Menlo, monospace; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #2c2e33; border: 1px solid #3c3f45; padding: 8px 16px; border-radius: 8px; z-index: 20; }
