:root {
  --bg: #06080b;
  --text: #e6eee8;
  --muted: #8e9a93;
  --phos: #8dffb0;
  --line: rgba(141, 255, 176, 0.22);
  --glass: rgba(10, 16, 13, 0.72);
}
* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Plus Jakarta Sans", system-ui, sans-serif;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
#gl { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: manipulation; }
a { color: inherit; }

.top {
  position: fixed; top: 0; left: 0; right: 0; z-index: 2;
  display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
  padding: max(18px, env(safe-area-inset-top)) 22px 0;
  pointer-events: none;
}
.top > * { pointer-events: auto; }
.who { font-size: 1.05rem; color: var(--muted); line-height: 1.4; }
.who strong { color: var(--text); font-weight: 800; }
.role {
  color: var(--phos); font-weight: 700; display: inline-block;
  text-shadow: 0 0 12px rgba(109, 255, 138, 0.55);
  transition: opacity 0.35s, transform 0.35s;
}
.role.out { opacity: 0; transform: translateY(6px); }
.top-actions { display: flex; gap: 8px; flex-shrink: 0; }
.chip {
  font: inherit; font-size: 0.85rem; font-weight: 700; color: var(--text); text-decoration: none;
  background: var(--glass); border: 1px solid var(--line); border-radius: 999px;
  padding: 8px 14px; cursor: pointer; backdrop-filter: blur(8px);
}
.chip:hover { border-color: var(--phos); }
.chip.icon { padding: 8px 11px; line-height: 1; }

.hint {
  position: fixed; left: 50%; bottom: max(28px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  z-index: 2; color: var(--muted); font-size: 0.95rem; text-align: center; width: max-content; max-width: calc(100% - 32px);
  animation: pulse 2.2s ease-in-out infinite;
}
.hint b { color: #ff7a63; }
.hint-touch { display: none; }
@media (hover: none) { .hint-desk { display: none; } .hint-touch { display: inline; } }
@keyframes pulse { 50% { opacity: 0.45; } }

.dock {
  position: fixed; left: 50%; bottom: max(16px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  z-index: 2; width: min(760px, calc(100% - 32px));
  background: var(--glass); border: 1px solid var(--line); border-radius: 18px;
  padding: 12px 16px; backdrop-filter: blur(10px);
  display: flex; flex-direction: column; gap: 8px;
}
.dock[hidden] { display: none; }
.dock-info { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-height: 32px; }
.dock-ch {
  font-family: "VT323", monospace; font-size: 1.15rem; padding: 0 8px; border-radius: 6px;
  color: #071009; background: var(--ch, var(--phos));
}
.dock-title { font-weight: 700; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dock-links { display: flex; gap: 8px; flex-wrap: wrap; }
.dock-links a {
  font-size: 0.85rem; font-weight: 700; text-decoration: none; padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--ch, var(--phos)); color: var(--ch, var(--phos));
}
.dock-links a:hover { background: color-mix(in srgb, var(--ch, var(--phos)) 16%, transparent); }
.keys { font-size: 0.8rem; color: var(--muted); }
kbd {
  font-family: inherit; font-size: 0.72rem; padding: 1px 6px; margin: 0 1px; border-radius: 5px;
  border: 1px solid var(--line); color: var(--text);
}
.pad { display: none; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.pad button {
  font: inherit; font-weight: 800; font-size: 0.9rem; color: var(--text); padding: 10px 0;
  background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line); border-radius: 10px; cursor: pointer;
}
.pad button:active { background: rgba(141, 255, 176, 0.2); }
.pad .ok { color: var(--phos); }

@media (hover: none), (max-width: 760px) and (orientation: portrait) {
  .keys { display: none; }
  .pad { display: grid; }
}
@media (max-width: 560px) {
  .top { padding-left: 16px; padding-right: 16px; flex-direction: column; }
  .who { font-size: 0.95rem; }
  .dock { padding: 10px 12px; }
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.noscript { position: fixed; inset: auto 16px 16px; text-align: center; color: var(--text); }
