/* The character controller's overlay (js/3d/controller.js): the interact
   prompt, the thumb joystick and the mouse hint; and the Controls help card
   (js/controls-help.js). Classes are prefixed ctl-. */

.ctl-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
  overflow: hidden;
}

/* "E  Inspect": floats over what is in front of you. */
.ctl-prompt {
  position: absolute;
  inset-block-start: 0;
  left: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-inline-size: min(320px, 70vw);
  padding: 6px 12px 6px 6px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  background: rgba(16, 25, 34, 0.86);
  color: var(--chalk, #e9eef2);
  font: 700 0.9rem/1.2 var(--font, sans-serif);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  pointer-events: auto;
  white-space: nowrap;
  will-change: transform;
}
[dir='rtl'] .ctl-prompt {
  padding: 6px 6px 6px 12px;
}
.ctl-prompt[hidden] {
  display: none;
}
.ctl-prompt span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
}
.ctl-prompt kbd {
  margin: 0;
  min-width: 1.9em;
  background: var(--gold, #d9a21b);
  border-color: #8a6410;
  color: #1b1405;
}
.ctl-prompt:hover,
.ctl-prompt:focus-visible {
  background: rgba(23, 128, 122, 0.95);
  outline: 2px solid var(--gold, #d9a21b);
  outline-offset: 2px;
}
@media (prefers-reduced-motion: no-preference) {
  .ctl-prompt:not([hidden]) {
    animation: ctl-pop 0.18s ease-out;
  }
}
@keyframes ctl-pop {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* On touch screens the prompt is a big button under the right thumb. */
.ctl-prompt.is-dock {
  inset-block-start: auto;
  left: auto;
  right: 16px;
  bottom: calc(var(--ctl-safe-bottom, 24px) + 8px);
  transform: none !important;
  min-block-size: 64px;
  padding: 10px 20px;
  font-size: 1.05rem;
  border-radius: 32px;
  background: rgba(23, 128, 122, 0.95);
  white-space: normal;
  max-inline-size: 52vw;
}

/* Gamepad button glyphs (Xbox layout colours). */
.ctl-pad {
  display: inline-grid;
  place-items: center;
  min-inline-size: 1.9em;
  block-size: 1.9em;
  padding: 0 5px;
  border-radius: 999px;
  background: #3a4552;
  color: #fff;
  font: 800 0.78rem/1 var(--font, sans-serif);
}
.ctl-pad-a {
  background: #2f8f3a;
}
.ctl-pad-b {
  background: #b4302c;
}
.ctl-pad-y {
  background: #b88a12;
}

/* The thumb joystick: faint at rest (bottom left), under the thumb when used. */
.ctl-joy {
  position: absolute;
  left: 28px;
  bottom: var(--ctl-safe-bottom, 24px);
  inline-size: 112px;
  block-size: 112px;
  margin: 0;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.45);
  background: radial-gradient(circle, rgba(16, 25, 34, 0.18), rgba(16, 25, 34, 0.32));
  opacity: 0.55;
  display: grid;
  place-items: center;
}
.ctl-joy[hidden] {
  display: none;
}
.ctl-joy.is-on {
  translate: -50% -50%;
  opacity: 0.95;
}
.ctl-joy-knob {
  inline-size: 50px;
  block-size: 50px;
  border-radius: 50%;
  background: rgba(233, 238, 242, 0.85);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
}

/* "Click to look around": the mouse hint. */
.ctl-hint {
  position: absolute;
  left: 50%;
  translate: -50% 0;
  bottom: calc(var(--ctl-safe-bottom, 24px) + 6px);
  margin: 0;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(16, 25, 34, 0.7);
  color: var(--chalk, #e9eef2);
  font: 600 0.8rem/1.3 var(--font, sans-serif);
  white-space: nowrap;
}
.ctl-hint[hidden] {
  display: none;
}

/* Settings dialog: the small labels in the Camera row. */
.ek-set-label {
  margin: 10px 0 4px;
  font-size: 0.85rem;
  color: var(--chalk-2, #a9b6c2);
}

/* ---------- The Controls help card ---------- */
.ctl-help {
  inline-size: min(560px, calc(100vw - 32px));
  max-block-size: calc(100dvh - 32px);
  padding: 0;
  border: 1px solid var(--slate-3, #22344a);
  border-radius: var(--radius-m, 6px);
  background: var(--slate, #101922);
  color: var(--chalk, #e9eef2);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}
.ctl-help::backdrop {
  background: rgba(5, 10, 16, 0.55);
}
.ctl-help-in {
  padding: 18px 20px 20px;
}
.ctl-help-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.ctl-help-head h2 {
  margin: 0;
  font-size: var(--step-2, 1.5rem);
}
.ctl-help-x {
  inline-size: 40px;
  block-size: 40px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  font-size: 1.6rem;
  cursor: pointer;
}
.ctl-help-x:focus-visible {
  outline: 2px solid var(--gold, #d9a21b);
}
.ctl-help-tabs {
  margin-block: 12px 4px;
  flex-wrap: wrap;
}
.ctl-help-now,
.ctl-help-note {
  margin: 6px 0;
  font-size: 0.85rem;
  color: var(--chalk-2, #a9b6c2);
}
.ctl-help-list {
  margin: 10px 0;
  display: grid;
  gap: 6px;
}
.ctl-help-row {
  display: grid;
  grid-template-columns: minmax(150px, 40%) 1fr;
  gap: 12px;
  align-items: center;
  padding: 6px 0;
  border-block-end: 1px solid var(--slate-3, #22344a);
}
.ctl-help-row dt {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  font-weight: 700;
}
.ctl-help-row dd {
  margin: 0;
}
.ctl-help-row svg {
  inline-size: 24px;
  block-size: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ctl-help-or {
  font-weight: 400;
  color: var(--chalk-2, #a9b6c2);
  margin-inline: 2px;
}
.ctl-help-big {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--teal, #17807a);
}
@media (max-width: 480px) {
  .ctl-help-row {
    grid-template-columns: 1fr;
    gap: 2px;
  }
}
