/* Motel Halls — premium first-person corridor horror UI */

* { box-sizing: border-box; }

html, body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #050308;
  color: #d8d2c4;
  font-family: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.mh-app {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(ellipse at top, #1a1208 0%, #050308 70%);
}

/* ── Top bar ───────────────────────────────────────────────── */
.mh-topbar {
  position: relative;
  z-index: 10;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 18px;
  background:
    linear-gradient(180deg, rgba(14,10,6,0.95) 0%, rgba(10,7,4,0.85) 100%);
  border-bottom: 1px solid rgba(201, 168, 108, 0.18);
  box-shadow: 0 4px 18px rgba(0,0,0,0.55);
}

.mh-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mh-brand-mark {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #ffd070 0%, #c9912d 45%, #5a3712 100%);
  box-shadow:
    0 0 12px rgba(255, 180, 80, 0.55),
    inset 0 0 4px rgba(0, 0, 0, 0.6);
  animation: mh-pulse 2.4s ease-in-out infinite;
}

@keyframes mh-pulse {
  0%, 100% { box-shadow: 0 0 12px rgba(255, 180, 80, 0.55), inset 0 0 4px rgba(0,0,0,0.6); }
  50%      { box-shadow: 0 0 20px rgba(255, 200, 120, 0.85), inset 0 0 4px rgba(0,0,0,0.6); }
}

.mh-title {
  margin: 0;
  font-family: 'Cinzel', Georgia, serif;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  color: #e8c98a;
  text-shadow: 0 0 14px rgba(201, 144, 60, 0.45);
}

.mh-brand-sub {
  font-size: 0.65rem;
  letter-spacing: 0.32em;
  color: rgba(216, 210, 196, 0.45);
  text-transform: uppercase;
  border-left: 1px solid rgba(255,255,255,0.08);
  padding-left: 12px;
}

.mh-exit {
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  color: #b8b0a0;
  text-decoration: none;
  padding: 7px 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  background: rgba(255,255,255,0.02);
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.mh-exit:hover,
.mh-exit:focus-visible {
  color: #f5ecd6;
  background: rgba(201, 168, 108, 0.12);
  border-color: rgba(201, 168, 108, 0.55);
  outline: none;
}

/* ── Canvas + game viewport ────────────────────────────────── */
.mh-canvas-wrap {
  flex: 1;
  position: relative;
  min-height: 0;
  overflow: hidden;
}

#mh-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  touch-action: none;
  image-rendering: optimizeQuality;
}

#mh-canvas.mh-locked {
  cursor: none;
}

/* ── HUD chips ─────────────────────────────────────────────── */
.mh-hud {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  padding: 16px 22px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  pointer-events: none;
  z-index: 5;
}

.mh-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  font-size: 0.74rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(232, 224, 204, 0.7);
  background: rgba(14, 10, 8, 0.55);
  backdrop-filter: blur(8px) saturate(140%);
  -webkit-backdrop-filter: blur(8px) saturate(140%);
  border: 1px solid rgba(201, 168, 108, 0.2);
  border-radius: 999px;
  box-shadow:
    0 4px 14px rgba(0,0,0,0.45),
    inset 0 1px 0 rgba(255,255,255,0.05);
}

.mh-chip strong {
  color: #f5ecd6;
  font-weight: 600;
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
  font-size: 0.86rem;
  letter-spacing: 0.08em;
}

.mh-chip-label {
  color: rgba(201, 168, 108, 0.7);
  font-size: 0.66rem;
}

.mh-chip-keys {
  border-color: rgba(212, 175, 55, 0.4);
  color: #d4af37;
}
.mh-chip-keys strong { color: #ffe07a; text-shadow: 0 0 10px rgba(255, 200, 80, 0.45); }
.mh-chip-icon { display: inline-flex; color: #ffd070; filter: drop-shadow(0 0 4px rgba(255,200,80,0.55)); }

.mh-chip-lives {
  letter-spacing: 0.32em;
  color: #ff4f5a;
  text-shadow: 0 0 8px rgba(255, 60, 70, 0.45);
  font-size: 0.95rem;
  padding: 5px 14px;
}

.mh-bar-wrap {
  position: relative;
  flex: 1 1 200px;
  max-width: 260px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-left: auto;
}

.mh-bar {
  height: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(201, 168, 108, 0.15);
  border-radius: 999px;
  overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.6);
}

.mh-bar-fill {
  height: 100%;
  width: 0%;
  background:
    linear-gradient(90deg, #5a3712 0%, #c9912d 60%, #ffd070 100%);
  box-shadow:
    0 0 8px rgba(255, 200, 100, 0.55),
    inset 0 0 4px rgba(255, 255, 255, 0.18);
  transition: width 0.12s linear;
}

.mh-bar-label {
  font-size: 0.6rem;
  letter-spacing: 0.32em;
  color: rgba(201, 168, 108, 0.55);
  text-align: right;
}

/* ── Banner (in-game notifications) ────────────────────────── */
.mh-banner {
  position: absolute;
  left: 50%;
  top: 32%;
  transform: translate(-50%, -50%) scale(0.96);
  padding: 20px 32px;
  text-align: center;
  background: rgba(10, 7, 6, 0.92);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(201, 168, 108, 0.4);
  border-radius: 10px;
  max-width: min(90vw, 420px);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.35s ease, transform 0.35s ease;
  box-shadow:
    0 18px 40px rgba(0,0,0,0.7),
    inset 0 1px 0 rgba(255,255,255,0.04);
  z-index: 6;
}

.mh-banner.mh-visible {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.mh-banner h2 {
  margin: 0 0 8px;
  font-family: 'Cinzel', Georgia, serif;
  font-size: 1.1rem;
  letter-spacing: 0.16em;
  color: #f5ecd6;
  text-transform: uppercase;
  text-shadow: 0 0 14px rgba(201, 168, 108, 0.4);
}

.mh-banner p {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.5;
  color: #a8a090;
}

/* ── Interaction prompt (door / pickup) ───────────────────── */
.mh-prompt {
  position: absolute;
  left: 50%;
  bottom: 14%;
  transform: translate(-50%, 12px);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  min-width: 220px;
  max-width: min(86vw, 320px);
  padding: 12px 16px 10px;
  background: rgba(8, 6, 4, 0.78);
  backdrop-filter: blur(10px) saturate(140%);
  -webkit-backdrop-filter: blur(10px) saturate(140%);
  border: 1px solid rgba(201, 168, 108, 0.45);
  border-radius: 12px;
  box-shadow:
    0 12px 30px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  opacity: 0;
  pointer-events: none;
  z-index: 7;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.mh-prompt.mh-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.mh-prompt.mh-locked {
  border-color: rgba(255, 90, 90, 0.5);
  box-shadow:
    0 12px 30px rgba(0, 0, 0, 0.55),
    0 0 28px rgba(255, 60, 60, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.mh-prompt-row {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: center;
}

.mh-prompt-key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  font-family: 'Cinzel', Georgia, serif;
  font-size: 1rem;
  font-weight: 700;
  color: #fff7e4;
  background: linear-gradient(180deg, #3a2a18 0%, #1a1108 100%);
  border: 1px solid rgba(255, 200, 120, 0.65);
  border-bottom-width: 3px;
  border-radius: 7px;
  box-shadow:
    inset 0 1px 0 rgba(255, 220, 160, 0.25),
    0 0 14px rgba(255, 180, 80, 0.45);
  animation: mh-key-pulse 1.4s ease-in-out infinite;
}

.mh-prompt.mh-locked .mh-prompt-key {
  background: linear-gradient(180deg, #3a1818 0%, #1a0a0a 100%);
  border-color: rgba(255, 100, 100, 0.65);
  box-shadow:
    inset 0 1px 0 rgba(255, 160, 160, 0.25),
    0 0 14px rgba(255, 60, 60, 0.45);
}

@keyframes mh-key-pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.08); }
}

.mh-prompt-text {
  font-size: 0.88rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #f5ecd6;
}

.mh-prompt.mh-locked .mh-prompt-text {
  color: #ffb8b8;
}

.mh-prompt-bar {
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.12s ease;
}

.mh-prompt.mh-opening .mh-prompt-bar {
  opacity: 1;
}

.mh-prompt-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #c9912d 0%, #ffd070 100%);
  box-shadow: 0 0 8px rgba(255, 200, 100, 0.55);
  transition: width 0.05s linear;
}

/* ── Game over overlay ────────────────────────────────────── */
.mh-gameover {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, rgba(40, 0, 0, 0.6) 0%, rgba(0, 0, 0, 0.96) 70%);
  z-index: 30;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.7s ease, visibility 0s 0.7s;
}

.mh-gameover.mh-visible {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.7s ease;
}

.mh-gameover-text {
  margin: 0;
  font-family: 'Cinzel', Georgia, serif;
  font-weight: 700;
  font-size: clamp(2rem, 6vw, 3.6rem);
  letter-spacing: 0.14em;
  color: #ff5454;
  text-shadow:
    0 0 22px rgba(255, 50, 50, 0.65),
    0 0 50px rgba(180, 0, 0, 0.4);
  animation: mh-caught-pulse 2.4s ease-in-out infinite;
}

@keyframes mh-caught-pulse {
  0%, 100% { transform: scale(1);    opacity: 0.92; }
  50%      { transform: scale(1.03); opacity: 1; }
}

/* ── Screen shake on hurt ─────────────────────────────────── */
.mh-canvas-wrap.mh-shake #mh-canvas {
  animation: mh-shake 0.42s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes mh-shake {
  0%   { transform: translate(0, 0); }
  15%  { transform: translate(-16px, 8px); }
  30%  { transform: translate(16px, -7px); }
  45%  { transform: translate(-11px, 6px); }
  60%  { transform: translate(11px, -5px); }
  75%  { transform: translate(-6px, 3px); }
  100% { transform: translate(0, 0); }
}

/* ── Title / start screen ──────────────────────────────────── */
.mh-title-screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 28px;
  z-index: 20;
  background:
    radial-gradient(ellipse at center, rgba(20,12,6,0.55) 0%, rgba(0,0,0,0.92) 75%);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  text-align: center;
  padding: 24px;
  transition: opacity 0.5s ease, visibility 0s 0.5s;
}

.mh-title-screen.mh-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.mh-sign {
  position: relative;
  padding: 28px 50px 24px;
  border: 2px solid rgba(201, 168, 108, 0.55);
  border-radius: 6px;
  background:
    linear-gradient(180deg, rgba(36, 18, 8, 0.7) 0%, rgba(14, 8, 6, 0.7) 100%);
  box-shadow:
    inset 0 0 30px rgba(255, 150, 60, 0.12),
    0 12px 36px rgba(0,0,0,0.7),
    0 0 60px rgba(255, 130, 50, 0.18);
  max-width: min(90vw, 540px);
}

.mh-sign-glow {
  position: absolute;
  inset: -6px;
  border-radius: 10px;
  box-shadow: 0 0 36px 6px rgba(255, 140, 50, 0.22);
  pointer-events: none;
  animation: mh-flicker 5s linear infinite;
}

@keyframes mh-flicker {
  0%, 100%   { opacity: 1; }
  47%        { opacity: 1; }
  48%        { opacity: 0.4; }
  49%        { opacity: 1; }
  84%        { opacity: 1; }
  85%        { opacity: 0.7; }
  86%        { opacity: 1; }
}

.mh-sign-top {
  font-size: 0.7rem;
  letter-spacing: 0.5em;
  color: #ff7a3a;
  text-shadow: 0 0 10px rgba(255, 120, 50, 0.75);
  margin-bottom: 10px;
}

.mh-sign-title {
  margin: 0;
  font-family: 'Cinzel', Georgia, serif;
  font-weight: 700;
  font-size: clamp(2.2rem, 6vw, 3.6rem);
  letter-spacing: 0.16em;
  color: #ffe1a6;
  text-shadow:
    0 0 18px rgba(255, 180, 100, 0.6),
    0 0 36px rgba(255, 120, 50, 0.35);
  line-height: 1;
}

.mh-sign-title span {
  color: #ff9344;
  text-shadow:
    0 0 18px rgba(255, 140, 60, 0.85),
    0 0 36px rgba(255, 100, 30, 0.5);
}

.mh-sign-sub {
  margin-top: 12px;
  font-size: 0.78rem;
  letter-spacing: 0.22em;
  color: rgba(232, 224, 204, 0.62);
  text-transform: uppercase;
}

.mh-enter-btn {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 0.95rem;
  letter-spacing: 0.32em;
  padding: 14px 30px;
  color: #f5ecd6;
  background: rgba(40, 24, 12, 0.65);
  border: 1px solid rgba(201, 168, 108, 0.55);
  border-radius: 999px;
  cursor: pointer;
  box-shadow:
    0 6px 22px rgba(0,0,0,0.55),
    inset 0 1px 0 rgba(255,255,255,0.06);
  transition: transform 0.15s ease, background 0.18s ease, color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.mh-enter-btn:hover,
.mh-enter-btn:focus-visible {
  background: rgba(201, 168, 108, 0.22);
  color: #fff7e4;
  border-color: rgba(255, 200, 120, 0.85);
  box-shadow:
    0 8px 26px rgba(0,0,0,0.6),
    0 0 30px rgba(255, 160, 60, 0.35);
  transform: translateY(-1px);
  outline: none;
}

.mh-help-inline {
  margin: 0;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: rgba(216, 210, 196, 0.62);
  max-width: 600px;
  line-height: 1.7;
}

.mh-help-inline kbd {
  display: inline-block;
  padding: 2px 8px;
  margin: 0 3px;
  font-size: 0.7rem;
  font-family: ui-monospace, "SF Mono", monospace;
  color: #f5ecd6;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.16);
  border-bottom-width: 2px;
  border-radius: 4px;
}

@media (max-width: 540px) {
  .mh-hud { padding: 10px 12px; gap: 6px; }
  .mh-chip { font-size: 0.68rem; padding: 5px 10px; }
  .mh-bar-wrap { max-width: 100%; flex-basis: 100%; margin-left: 0; }
  .mh-brand-sub { display: none; }
}
