:root {
  --page: #070b18;
  --bar: rgba(12, 14, 20, 0.84);
  --text: #f4f4f5;
  --btn-bg: #f4f4f5;
  --btn-text: #16181d;
  --btn-dark: #2a2d36;
  --radius: 22px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  color: var(--text);
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", sans-serif;
  background: var(--page);
}
#view { display: block; width: 100%; height: 100%; }
.hidden { display: none !important; }

#overlay {
  position: fixed; inset: 0; z-index: 20;
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: 1.2rem; padding-bottom: calc(5.5rem + env(safe-area-inset-bottom));
  background: linear-gradient(transparent 35%, rgba(7, 11, 24, 0.72) 100%);
  pointer-events: none;
}
#overlay * { pointer-events: auto; }
#overlay h1 { font-size: 1.4rem; margin: 0 0 .6rem; }
#overlay p { font-size: 1.15rem; line-height: 1.5; margin: 0 0 1rem; }
#overlay input {
  width: 100%;
  background: var(--btn-bg);
  color: var(--btn-text);
  border: 0;
}
#overlay input, #overlay button, .hud button, .docs-bar button, .docs-bar select, .admin button, .admin input {
  font-size: 1.1rem; min-height: 44px; padding: .5rem 1rem; border-radius: var(--radius); border: 0;
}
#overlay button, .hud button, .docs-bar button, .admin button {
  background: var(--btn-bg);
  color: var(--btn-text);
  font-weight: 700;
}
.hud {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; justify-content: center;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  pointer-events: none;
}
.hud-inner {
  pointer-events: auto;
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  max-width: 52rem; width: 100%;
  padding: 10px 14px;
  background: var(--bar);
  border-radius: 999px;
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.35);
}
.hud .vol {
  display: flex; align-items: center; gap: 6px;
  font-size: 0.9rem; color: var(--text);
}
.hud .vol input[type="range"] { width: 88px; min-height: 24px; padding: 0; }
.count { margin-left: auto; font-size: 1.1rem; }
.docs {
  position: fixed; inset: 0 0 72px 0; z-index: 25;
  background: #11141c;
  display: flex; flex-direction: column;
}
.docs-bar {
  display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 12px;
  background: var(--bar);
  align-items: center; color: var(--text);
}
.docs-bar select {
  background: var(--btn-dark);
  color: var(--text);
  border-radius: var(--radius);
}
#doc-scroll { flex: 1; overflow: auto; touch-action: pinch-zoom pan-x pan-y; }
#doc-canvas { display: block; margin: 0 auto; }
.doc-hint {
  margin: 0; padding: 8px 12px; font-size: 0.95rem; color: #ddd;
  background: #1a1d26;
}
.joy {
  position: fixed; left: 16px; bottom: 96px; z-index: 32;
  width: 140px; height: 140px; touch-action: none;
}
.stick {
  width: 140px; height: 140px; border-radius: 50%;
  background: rgba(244, 244, 245, 0.18); border: 2px solid rgba(244, 244, 245, 0.35);
  position: relative; touch-action: none;
}
.stick::after {
  content: "";
  position: absolute; left: 50%; top: 50%; width: 52px; height: 52px;
  margin: -26px 0 0 -26px; border-radius: 50%;
  background: rgba(244, 244, 245, 0.55);
}
#btn-jump {
  position: absolute; left: 158px; bottom: 24px; z-index: 32;
  min-width: 64px;
}
.whitefade {
  position: fixed; inset: 0; z-index: 40; background: #070b18; pointer-events: none; opacity: 0;
}
.err { color: #ffb4b4; font-weight: 700; }
.admin {
  min-height: 100%;
  background: #070b18;
  color: var(--text);
}
.admin-box {
  max-width: 28rem; margin: 2rem auto; padding: 1.4rem 1.2rem;
  background: #1c1f28;
  border-radius: 24px;
}
.admin h1 { margin-top: 0; color: var(--text); }
.admin label { display: block; margin-bottom: 1rem; }
.admin input[type="password"], .admin input[type="file"] {
  width: 100%;
  margin-top: 0.35rem;
  background: var(--btn-dark);
  color: var(--text);
}
.admin a { color: #9ecbff; font-weight: 700; }
.nametag {
  position: fixed;
  transform: translate(-50%, -100%);
  margin-top: -4px;
  font-size: 18px;
  font-weight: 700;
  color: #111;
  background: rgba(244, 244, 245, 0.94);
  padding: 2px 12px;
  border-radius: 999px;
  pointer-events: none;
  z-index: 40;
  white-space: nowrap;
}
