.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  pointer-events: none;
}

.overlay--center {
  align-items: center;
  justify-content: center;
}

.loading {
  color: var(--ink-dim);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-size: 0.85rem;
}

/* The HUD layer itself never eats clicks; individual panels opt back in. */
.hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.hud__corner {
  position: absolute;
  left: 1rem;
  bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.7rem;
}

.hud__scheme {
  color: var(--accent);
  letter-spacing: 0.18em;
}

.hud__hint {
  color: var(--ink-dim);
  letter-spacing: 0.08em;
}

/* --- interaction prompt --------------------------------------------------- */

.prompt {
  position: absolute;
  left: 50%;
  bottom: 4.5rem;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.9rem;
  background: var(--panel);
  border: 2px solid var(--border);
  letter-spacing: 0.1em;
  font-size: 0.85rem;
}

.prompt__key {
  display: inline-grid;
  place-items: center;
  width: 1.4rem;
  height: 1.4rem;
  border: 2px solid var(--accent);
  color: var(--accent);
  font-weight: bold;
}

.prompt__verb {
  color: var(--ink-dim);
  text-transform: uppercase;
}

.prompt__label {
  color: var(--ink-bright);
}

.message {
  position: absolute;
  left: 50%;
  bottom: 1.5rem;
  transform: translateX(-50%);
  max-width: 44rem;
  padding: 0.6rem 1.1rem;
  background: var(--panel);
  border-left: 3px solid var(--accent);
  color: var(--ink-bright);
  font-size: 0.85rem;
  line-height: 1.5;
}

/* --- panels --------------------------------------------------------------- */

.panel {
  pointer-events: auto;
  background: var(--panel);
  border: 2px solid var(--border);
  color: var(--ink);
}

.panel--error {
  max-width: 30rem;
  padding: 1.25rem 1.5rem;
  border-color: var(--danger);
}

.panel--error h2 {
  margin: 0 0 0.5rem;
  color: var(--danger);
  font-size: 1rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.panel--error p {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.6;
  color: var(--ink-dim);
}

.panel--inventory {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(46rem, 90vw);
}

.panel__header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.6rem 1rem;
  border-bottom: 2px solid var(--border);
}

.panel__header h2 {
  margin: 0;
  flex: 1;
  font-size: 0.9rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-bright);
}

.panel__count {
  color: var(--ink-dim);
  font-size: 0.8rem;
}

.panel__close,
.inventory__combine {
  background: transparent;
  border: 2px solid var(--border);
  color: var(--ink-dim);
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  padding: 0.2rem 0.5rem;
  cursor: pointer;
}

.panel__close:hover,
.inventory__combine:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* --- inventory ------------------------------------------------------------ */

.inventory__body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 16rem;
}

.inventory__list {
  margin: 0;
  padding: 0.5rem;
  list-style: none;
  border-right: 2px solid var(--border);
}

.inventory__empty,
.inventory__hint {
  padding: 0.6rem;
  color: var(--ink-dim);
  font-size: 0.78rem;
}

.inventory__item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.45rem 0.6rem;
  background: transparent;
  border: 2px solid transparent;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.8rem;
  text-align: left;
  cursor: pointer;
}

.inventory__item:hover {
  border-color: var(--border);
}

.inventory__item--selected {
  border-color: var(--accent);
  color: var(--ink-bright);
}

.inventory__item--combining {
  border-color: var(--danger);
}

.inventory__icon {
  width: 0.9rem;
  height: 0.9rem;
  border: 1px solid rgba(0, 0, 0, 0.6);
  flex: none;
}

.inventory__name {
  flex: 1;
}

.inventory__qty {
  color: var(--ink-dim);
}

.inventory__key {
  color: var(--accent);
  font-size: 0.6rem;
  letter-spacing: 0.1em;
}

.inventory__detail {
  padding: 1rem;
}

.inventory__detail h3 {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  color: var(--ink-bright);
  text-transform: uppercase;
}

.inventory__detail p {
  margin: 0 0 1rem;
  font-size: 0.78rem;
  line-height: 1.65;
  color: var(--ink-dim);
}

.inventory__result {
  color: var(--accent);
}

/* --- debug ---------------------------------------------------------------- */

.debug {
  position: absolute;
  top: 1rem;
  right: 1rem;
  margin: 0;
  padding: 0.7rem 0.9rem;
  display: grid;
  grid-template-columns: auto auto;
  gap: 0.15rem 0.9rem;
  background: var(--panel);
  border: 2px solid var(--border);
  font-size: 0.7rem;
}

.debug dt {
  color: var(--ink-dim);
  letter-spacing: 0.08em;
}

.debug dd {
  margin: 0;
  color: var(--ink-bright);
  text-align: right;
}

/* --- multiplayer ---------------------------------------------------------- */

.hud__net-notice {
  position: absolute;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.4rem 0.9rem;
  background: var(--panel);
  border: 2px solid var(--danger);
  color: var(--danger);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
}

.panel--lobby {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(28rem, 92vw);
}

.lobby__error {
  margin: 0;
  padding: 0.6rem 1rem;
  color: var(--danger);
  font-size: 0.75rem;
  border-bottom: 2px solid var(--border);
}

.lobby__form,
.lobby__menu,
.lobby__room {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  padding: 1rem;
}

.lobby__form label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

.lobby__form input,
.lobby__join input {
  background: rgba(0, 0, 0, 0.4);
  border: 2px solid var(--border);
  color: var(--ink-bright);
  font-family: var(--mono);
  font-size: 0.85rem;
  padding: 0.4rem 0.6rem;
}

.lobby__form input:focus,
.lobby__join input:focus {
  outline: none;
  border-color: var(--accent);
}

.lobby__actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.lobby__actions button,
.lobby__menu > button,
.lobby__join button {
  background: transparent;
  border: 2px solid var(--border);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  padding: 0.4rem 0.8rem;
  cursor: pointer;
}

.lobby__actions button:hover:not(:disabled),
.lobby__menu > button:hover:not(:disabled),
.lobby__join button:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.lobby__actions button:disabled,
.lobby__menu > button:disabled,
.lobby__join button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.lobby__link {
  border: none !important;
  color: var(--ink-dim) !important;
  text-decoration: underline;
  padding: 0 !important;
}

.lobby__join {
  display: flex;
  gap: 0.6rem;
}

.lobby__join input {
  flex: 1;
  letter-spacing: 0.4em;
  text-align: center;
}

.lobby__code {
  margin: 0;
  font-size: 0.8rem;
  color: var(--ink-dim);
}

.lobby__code strong {
  color: var(--accent);
  font-size: 1.4rem;
  letter-spacing: 0.3em;
  display: block;
  margin-top: 0.3rem;
}

.lobby__players {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.lobby__players li {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.35rem 0.5rem;
  border: 2px solid var(--border);
  font-size: 0.78rem;
}

.lobby__swatch {
  width: 0.8rem;
  height: 0.8rem;
  border: 1px solid rgba(0, 0, 0, 0.6);
}

.lobby__name {
  flex: 1;
  color: var(--ink-bright);
}

.lobby__tag {
  color: var(--accent);
  font-size: 0.6rem;
  letter-spacing: 0.1em;
}

.lobby__ready {
  color: var(--ink-dim);
  font-size: 0.65rem;
  letter-spacing: 0.1em;
}

.lobby__ready--on {
  color: #7fa382;
}

.lobby__waiting,
.lobby__hint {
  color: var(--ink-dim);
  font-size: 0.72rem;
  line-height: 1.5;
}

.lobby__hint {
  margin: 0;
}
