:root {
  --bg: #0b0d12; --card: #141820; --border: #2a3140; --fg: #d5dbe6;
  --muted: #8b949e; --cyan: #00F5FF; --violet: #A855F7; --pink: #fb7185;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; min-height: 100%; background: var(--bg); color: var(--fg);
  font-family: ui-sans-serif, "Segoe UI", system-ui, sans-serif;
}
body { padding: 16px 16px 32px; }
header { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
header h1 { flex: 1; min-width: 0; }
#viewer {
  position: fixed; inset: 0; z-index: 40; background: #000;
  display: flex; flex-direction: column; touch-action: none;
}
#viewer[hidden] { display: none !important; }
#vbar {
  position: relative; z-index: 2; flex: 0 0 auto;
  display: flex; align-items: center; gap: 8px;
  padding: calc(8px + env(safe-area-inset-top)) 10px 8px;
  background: #000c; color: #fff;
}
#vtitle { flex: 1; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#vstage { flex: 1 1 auto; position: relative; overflow: hidden; min-height: 0; }
#vimg {
  position: absolute; left: 0; top: 0; transform-origin: 50% 50%;
  max-width: none; max-height: none; user-select: none; -webkit-user-drag: none;
  touch-action: none; will-change: transform;
}
.gear {
  width: 40px; height: 40px; border-radius: 10px; flex: 0 0 auto;
  background: #21262d; color: var(--fg); border: 1px solid var(--border);
  font-size: 18px; cursor: pointer;
}
.gear.on { border-color: var(--cyan); color: var(--cyan); }
#settings[hidden] { display: none; }
#tok-in, input[type="password"] {
  width: 100%; margin: 8px 0; padding: 10px; border-radius: 8px;
  border: 1px solid var(--border); background: #0d1117; color: var(--fg); font-size: 16px;
}
header img { width: 36px; height: 36px; border-radius: 8px; }
h1 { font-size: 18px; margin: 0; }
h2 { font-size: 13px; color: var(--muted); font-weight: 600; margin: 0 0 10px; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile {
  display: flex; flex-direction: column; gap: 6px; text-decoration: none;
  color: var(--fg); background: var(--card); border: 1px solid var(--border);
  border-radius: 14px; padding: 16px 14px; min-height: 96px;
}
.tile strong { font-size: 15px; }
.tile span { font-size: 11px; color: var(--muted); line-height: 1.35; }
.tile.stub { opacity: 0.55; }
.tile.stub em { font-style: normal; color: #e3b341; font-size: 10px; }
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  padding: 14px; margin-bottom: 12px;
}
.pills { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.pill { font-size: 11px; padding: 4px 10px; border-radius: 999px; background: #21262d; color: var(--muted); }
.pill.on { color: #3fb950; border: 1px solid #3fb950; }
.pill.off { color: #f85149; border: 1px solid #f85149; }
.pill.warn { color: #e3b341; border: 1px solid #d29922; }
dl { display: grid; grid-template-columns: 38% 1fr; gap: 6px 8px; margin: 0; font-size: 13px; }
dt { color: var(--muted); }
dd { margin: 0; }
.bar { height: 8px; background: #0d1117; border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; width: 0; background: var(--cyan); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
button {
  background: #21262d; color: var(--fg); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 12px; font: inherit; cursor: pointer;
}
button.primary { border-color: var(--cyan); color: var(--cyan); }
button:disabled { opacity: 0.4; }
.hint { font-size: 12px; color: var(--muted); line-height: 1.45; }
.back { color: var(--cyan); text-decoration: none; font-size: 13px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--border);
  background: #21262d; color: var(--fg); font-size: 16px; display: flex;
  align-items: center; justify-content: center; text-decoration: none; cursor: pointer;
  flex: 0 0 auto;
}
.err { color: #f85149; font-size: 13px; }
