html, body { margin: 0; height: 100%; overflow: hidden; background: #8ec5ee; font-family: system-ui, sans-serif; }
#game { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; }
#game.dragging { cursor: grabbing; }
#hud {
  position: fixed; top: 12px; left: 12px; padding: 6px 12px; border-radius: 8px;
  background: rgba(255, 255, 255, .85); color: #234; font-size: 14px; display: flex; gap: 12px;
}
#login[hidden] { display: none; }
#login {
  position: fixed; inset: 0; margin: auto; width: min(320px, 90vw); height: fit-content; padding: 20px;
  display: flex; flex-direction: column; gap: 10px; border-radius: 12px; background: #fff; color: #234;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .25);
}
#login h1 { margin: 0; font-size: 22px; }
#login input { padding: 8px; font-size: 16px; }
#login button { padding: 8px; font-size: 16px; cursor: pointer; }
#login-error { margin: 0; min-height: 1.2em; color: #b00; font-size: 13px; }
#labels { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.label {
  position: absolute; left: 0; top: 0; padding: 1px 7px; border-radius: 10px; white-space: nowrap;
  background: rgba(255, 255, 255, .85); color: #234; font-size: 13px; will-change: transform;
}
#labels.no-names.no-bars { display: none; }
#labels.no-names .label .name { display: none; }
#labels.no-bars .label .bars { display: none; }
#hud .hint { opacity: .6; font-size: 12px; align-self: center; }
.dialog[hidden] { display: none; }
.dialog {
  position: fixed; inset: 0; margin: auto; width: min(300px, 90vw); height: fit-content; padding: 16px;
  display: flex; flex-direction: column; gap: 10px; border-radius: 12px; background: #fff; color: #234;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .25);
}
.dialog input { padding: 8px; font-size: 16px; }
.dialog .row { display: flex; gap: 8px; }
.dialog button { padding: 8px 12px; font-size: 15px; cursor: pointer; }
#clock {
  position: fixed; top: 12px; right: 12px; padding: 4px; border-radius: 50%; line-height: 0; cursor: pointer;
  background: rgba(255, 255, 255, .85); box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
}
#clock[hidden], #help[hidden] { display: none; }
#help {
  position: fixed; inset: 0; margin: auto; width: min(420px, 92vw); height: fit-content; padding: 18px 22px;
  border-radius: 12px; background: rgba(255, 255, 255, .95); color: #234; box-shadow: 0 8px 30px rgba(0, 0, 0, .3);
}
#help h2 { margin: 0 0 10px; font-size: 20px; }
#help dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; font-size: 14px; }
#help dt { font-weight: 600; }
#help dd { margin: 0; }
#help p { margin: 12px 0 0; font-size: 12px; opacity: .6; }
#ctx[hidden], #toast[hidden] { display: none; }
#ctx {
  position: fixed; display: flex; flex-direction: column; min-width: 170px; padding: 4px; border-radius: 8px;
  background: #fff; color: #234; box-shadow: 0 6px 20px rgba(0, 0, 0, .3); z-index: 5;
}
#ctx button { text-align: left; padding: 8px 10px; border: 0; background: none; font: inherit; cursor: pointer; border-radius: 6px; }
#ctx button:hover { background: #eef3f8; }
#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); padding: 8px 16px; border-radius: 8px;
  background: rgba(30, 40, 60, .9); color: #fff; font-size: 14px; max-width: 90vw;
}
#ctx button[hidden] { display: none; }

.label { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.label .bars { display: flex; flex-direction: column; gap: 2px; width: 54px; }
.label .bar { display: block; height: 5px; border-radius: 3px; background: rgba(0, 0, 0, .35); overflow: hidden; }
.label .bar i { display: block; height: 100%; width: 100%; }
