/* Elephanto — layout & HUD styling. No external assets. */
* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: #14161a;
  font-family: "Comic Sans MS", "Chalkboard SE", "Segoe UI", sans-serif;
  color: #e8ecf4;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

#game {
  position: fixed; inset: 0;
  width: 100vw; height: 100vh;
  display: block;
  touch-action: none;
}

.hidden { display: none !important; }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; }

#vignette {
  position: fixed; inset: 0; pointer-events: none; z-index: 3;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,.42) 100%);
}

.metal-panel, #health-wrap, .boss, #hud-top-right div, #quest, #objective, #controls-chip {
  background: linear-gradient(180deg, #4b525b, #2b2f35 55%, #22252a);
  border: 2px solid #6a7078;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.18), 0 3px 8px rgba(0,0,0,.45);
}

#hud-top-left { position: absolute; top: 10px; left: 10px; max-width: 44vw; }

#health-wrap {
  position: relative; width: 210px; height: 24px;
  border-radius: 12px; overflow: hidden;
}
#health-bar {
  height: 100%; width: 100%;
  background: linear-gradient(180deg, #8ff09a, #3da34a);
  border-radius: 10px;
  transition: width .15s;
}
#health-wrap.low #health-bar {
  background: linear-gradient(180deg, #ff8a7a, #c0392b);
  animation: hp-pulse .7s ease-in-out infinite;
}
@keyframes hp-pulse { 50% { filter: brightness(1.5); } }
#health-num {
  position: absolute; inset: 0; text-align: center;
  font-size: 13px; line-height: 22px; font-weight: bold;
  color: #fff; text-shadow: 0 1px 2px #000;
}
#quest {
  margin-top: 8px; padding: 7px 11px;
  border-radius: 10px;
  font-size: 13px; color: #ffe9a8;
}

#hud-bosses {
  position: absolute; top: 10px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 14px;
}
.boss {
  border-radius: 10px; padding: 5px 12px;
  text-align: center; min-width: 140px;
}
.boss b { font-size: 13px; letter-spacing: .5px; }
.boss .lives { display: block; font-size: 12px; letter-spacing: 2px; color: #ff6b6b; }
.boss-hp {
  height: 6px; margin-top: 3px;
  background: rgba(0,0,0,.5); border-radius: 3px; overflow: hidden;
}
.boss-hp div { height: 100%; width: 100%; background: linear-gradient(180deg,#ffc26b,#ff9f43); border-radius: 3px; }
.boss.defeated { opacity: .45; }
.boss.defeated b { text-decoration: line-through; }

#objective {
  position: absolute; top: 66px; left: 50%; transform: translateX(-50%);
  border-radius: 10px; padding: 5px 14px;
  font-size: 13px; color: #ffd9a8; text-align: center;
  max-width: 86vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

#guide-arrow {
  position: absolute; top: 108px; left: 50%;
  font-size: 30px; color: #ffd23a;
  text-shadow: 0 0 8px rgba(255,210,58,.8), 0 2px 3px #000;
  transform: translateX(-50%);
  transition: transform .08s linear;
}

#lava-arrow {
  position: absolute; top: 152px; left: 50%;
  font-size: 34px; color: #ff6b1a;
  text-shadow: 0 0 10px rgba(255,107,26,.9), 0 2px 3px #000;
  transform: translateX(-50%);
  transition: transform .08s linear;
  animation: hint-pulse .5s ease-in-out infinite;
}

#hud-top-right {
  position: absolute; top: 10px; right: 10px; text-align: right;
  font-size: 13px;
}
#hud-top-right div {
  border-radius: 8px;
  padding: 4px 9px; margin-bottom: 4px; display: inline-block;
  clear: both; float: right;
}

#toast {
  position: absolute; top: 22%; left: 50%; transform: translateX(-50%);
  background: rgba(0,0,0,.65); border: 2px solid rgba(255,233,168,.5);
  border-radius: 12px; padding: 8px 18px;
  font-size: 16px; color: #ffe9a8; text-align: center;
  white-space: nowrap;
}

#look-hint {
  position: absolute; bottom: 130px; left: 50%; transform: translateX(-50%);
  background: rgba(20,40,80,.75); border: 2px solid rgba(140,190,255,.6);
  border-radius: 12px; padding: 8px 16px;
  font-size: 15px; color: #cfe4ff; text-align: center;
  max-width: 90vw;
  animation: hint-pulse 1.6s ease-in-out infinite;
}
@keyframes hint-pulse { 50% { transform: translateX(-50%) scale(1.04); } }

#turn-buttons {
  position: absolute; left: 50%; bottom: 24px; transform: translateX(-50%);
  display: flex; gap: 18px;
  pointer-events: auto;
}

#controls-chip {
  position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%);
  border-radius: 10px; padding: 5px 14px;
  font-size: 13px; color: #cfd6de; white-space: nowrap;
}
#controls-chip b { color: #ffe9a8; }

/* ---------- Touch controls ---------- */
#touch-ui { position: fixed; inset: 0; pointer-events: none; z-index: 10; }

#stick {
  position: absolute; left: 26px; bottom: 30px;
  width: 120px; height: 120px; border-radius: 50%;
  background: rgba(255,255,255,.08); border: 2px solid rgba(255,255,255,.25);
}
#stick-knob {
  position: absolute; left: 50%; top: 50%;
  width: 52px; height: 52px; border-radius: 50%;
  background: rgba(255,255,255,.28); border: 2px solid rgba(255,255,255,.4);
  transform: translate(-50%, -50%);
}

#touch-buttons {
  position: absolute; right: 18px; bottom: 24px;
  display: flex; align-items: flex-end; gap: 12px;
  pointer-events: auto;
}
.tbtn {
  width: 66px; height: 66px; border-radius: 50%;
  background: rgba(255,255,255,.12); border: 2px solid rgba(255,255,255,.35);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 22px; touch-action: none;
}
.tbtn span { font-size: 10px; color: #cfd6de; }
.tbtn.big { width: 84px; height: 84px; font-size: 30px; }
.tbtn:active { background: rgba(255,233,168,.3); }

/* ---------- Overlays ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 20;
  background: linear-gradient(160deg, #26292f, #14161a 55%, #1d2026);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px; text-align: center; padding: 24px;
}
.overlay h1 { font-size: 42px; color: #ffe9a8; text-shadow: 0 3px 0 rgba(0,0,0,.5); }

#logo {
  width: min(80vw, 500px); height: auto;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,.6));
}
/* visually hidden but still announced by screen readers (logo fallback) */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
.overlay p { font-size: 16px; line-height: 1.5; color: #cfd6de; max-width: 560px; }

.brief {
  border-radius: 14px; padding: 12px 22px;
  display: flex; flex-direction: column; gap: 4px;
}
.brief p { font-size: 16px; color: #ffe9a8; }
.brief b { color: #fff; }
#win-buddies { display: flex; gap: 18px; align-items: flex-end; }
#win-buddies img { height: 130px; filter: drop-shadow(0 4px 8px rgba(0,0,0,.5)); }

#role-buttons { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; }
.big-btn {
  font-family: inherit; font-size: 20px; cursor: pointer;
  padding: 16px 26px; border-radius: 16px;
  background: rgba(255,255,255,.1); color: #fff;
  border: 3px solid rgba(255,255,255,.25);
  touch-action: manipulation;
}
.big-btn small { font-size: 13px; color: #b7c2cd; }
.big-btn:hover, .big-btn:active { border-color: #ffe9a8; background: rgba(255,233,168,.15); }
.controls-help { font-size: 13px !important; color: #7d8aa5 !important; }

#death-overlay {
  position: fixed; inset: 0; z-index: 15;
  background: rgba(120,10,10,.45);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  pointer-events: none;
}
#death-overlay div { font-size: 44px; color: #fff; text-shadow: 0 3px 6px #000; }
#death-overlay p { margin-top: 8px; font-size: 16px; color: #ffd9d9; }

@media (max-width: 700px) {
  #health-wrap { width: 140px; }
  .boss { min-width: 104px; }
  .boss b { font-size: 11px; }
  #quest { font-size: 11px; max-width: 40vw; }
  #objective { font-size: 11px; top: 60px; }
  #guide-arrow { top: 96px; font-size: 24px; }
}
