/* Travessia dos Três Fios — identidade pôr do sol urbano */
:root {
  --eq-ink: #071a24;
  --eq-panel: rgba(7, 26, 36, .88);
  --eq-line: rgba(255, 255, 255, .16);
  --eq-coral: #ff6b57;
  --eq-orange: #ffad32;
  --eq-sun: #ffe36e;
  --eq-mint: #5ce1c3;
  --eq-sky: #4e3c91;
  --eq-white: #fffaf0;
  --eq-muted: #b7c9d0;
  --eq-display: "Barlow Condensed", sans-serif;
  --eq-body: "Barlow", sans-serif;
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; }
body {
  overflow: hidden;
  background: #07131d;
  color: var(--eq-white);
  font-family: var(--eq-body);
  user-select: none;
}
button, a { font: inherit; }
button { color: inherit; }

.eq-wrapper {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  min-height: 520px;
  overflow: hidden;
  background: #07131d;
  isolation: isolate;
}

#gameCanvas {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: block;
  cursor: crosshair;
  touch-action: none;
}

.eq-topbar {
  position: absolute;
  z-index: 20;
  top: 14px;
  left: 18px;
  right: 18px;
  min-height: 52px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 8px 10px;
  border: 1px solid var(--eq-line);
  border-radius: 17px;
  background: rgba(7, 26, 36, .78);
  box-shadow: 0 14px 35px rgba(1, 10, 16, .28);
  backdrop-filter: blur(14px);
}

.eq-back-btn,
.eq-btn-icon {
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.08);
  color: #fff;
  text-decoration: none;
  transition: transform .18s ease, background .18s ease, border-color .18s ease;
}
.eq-back-btn {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
  border-radius: 11px;
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .02em;
}
.eq-back-btn:hover,
.eq-btn-icon:hover { transform: translateY(-2px); background: rgba(255,255,255,.16); border-color: rgba(255,255,255,.36); }
.eq-back-btn:focus-visible,
.eq-btn-icon:focus-visible,
.eq-btn-play:focus-visible,
.eq-btn-share:focus-visible,
.eq-btn-secondary:focus-visible,
.eq-btn-exit:focus-visible { outline: 3px solid var(--eq-sun); outline-offset: 3px; }

.eq-top-title { min-width: 0; text-align: center; }
.eq-top-title > span:first-child {
  display: block;
  font-family: var(--eq-display);
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: .045em;
  text-transform: uppercase;
}
.eq-top-badge {
  display: inline-flex;
  margin-top: 2px;
  color: var(--eq-mint);
  font-size: .62rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.eq-top-controls { display: flex; gap: 7px; }
.eq-btn-icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 11px;
  cursor: pointer;
}
.eq-btn-icon svg { width: 17px; height: 17px; }

.eq-hud {
  position: absolute;
  z-index: 12;
  top: 78px;
  left: 50%;
  width: min(740px, calc(100% - 36px));
  min-height: 70px;
  display: grid;
  grid-template-columns: 90px minmax(170px, 1fr) minmax(190px, 1.2fr) 78px;
  gap: 9px;
  padding: 8px;
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 18px;
  background: rgba(7,26,36,.77);
  box-shadow: 0 14px 34px rgba(3,13,20,.28);
  backdrop-filter: blur(12px);
  transform: translateX(-50%);
}
.eq-stat-box,
.eq-balance-meter,
.eq-world-progress {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 7px 10px;
  border-radius: 12px;
  background: rgba(255,255,255,.065);
}
.eq-stat-label {
  color: var(--eq-muted);
  font-size: .58rem;
  font-weight: 800;
  letter-spacing: .09em;
  text-transform: uppercase;
}
.eq-stat-val {
  margin-top: 1px;
  color: #fff;
  font-family: var(--eq-display);
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1;
}
.eq-stat-stars .eq-stat-val { color: var(--eq-sun); }
.eq-balance-meter { align-items: center; gap: 5px; }
.eq-meter-track {
  position: relative;
  width: 100%;
  height: 11px;
  overflow: visible;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 99px;
  background: linear-gradient(90deg, #ff6155 0 15%, #ffc94a 32%, #5ce1c3 48% 52%, #ffc94a 68%, #ff6155 85%);
  box-shadow: inset 0 2px 4px rgba(0,0,0,.35);
}
.eq-meter-center { position: absolute; inset: -4px auto -4px 50%; width: 2px; background: #fff; opacity: .9; }
.eq-meter-bubble {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 18px;
  height: 18px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--eq-mint);
  box-shadow: 0 0 13px rgba(92,225,195,.8);
  transform: translate(-50%, -50%);
  transition: background .12s ease, box-shadow .12s ease;
}
.eq-meter-bubble.danger { background: var(--eq-coral); box-shadow: 0 0 17px rgba(255,107,87,.9); }
.eq-world-progress strong {
  overflow: hidden;
  margin: 2px 0 5px;
  color: #fff;
  font-size: .78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.eq-progress-track { height: 7px; overflow: hidden; border-radius: 99px; background: rgba(255,255,255,.13); }
.eq-progress-track i { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--eq-coral), var(--eq-sun), var(--eq-mint)); transition: width .25s ease; }

.eq-mouse-hint,
.eq-lane-alert {
  position: absolute;
  z-index: 14;
  left: 50%;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(7,26,36,.82);
  box-shadow: 0 12px 28px rgba(1,10,16,.3);
  backdrop-filter: blur(11px);
  transform: translateX(-50%);
}
.eq-mouse-hint {
  bottom: 18px;
  display: none;
  align-items: center;
  gap: 5px;
  max-width: calc(100% - 30px);
  padding: 10px 15px;
  border-radius: 13px;
  color: #dce9ed;
  font-size: .76rem;
  white-space: nowrap;
}
.eq-mouse-hint span { color: var(--eq-sun); font-weight: 800; }
.eq-mouse-hint b { font-weight: 600; }
.eq-lane-alert {
  top: 158px;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 10px;
  padding: 8px 14px;
  border-color: rgba(255,227,110,.55);
  border-radius: 14px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -10px) scale(.94);
  transition: opacity .2s ease, transform .2s ease;
}
.eq-lane-alert.show { opacity: 1; transform: translate(-50%, 0) scale(1); }
.eq-lane-alert > span { grid-row: 1 / 3; align-self: center; font-size: 1.55rem; }
.eq-lane-alert strong { color: var(--eq-sun); font-size: .72rem; }
.eq-lane-alert small { color: #fff; font-size: .66rem; }

.eq-overlay {
  position: absolute;
  z-index: 40;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: auto;
  padding: 84px 18px 18px;
  background: radial-gradient(circle at 50% 25%, rgba(255,120,87,.16), transparent 38%), rgba(3,13,20,.78);
  backdrop-filter: blur(9px);
  scrollbar-width: none;
  transition: opacity .28s ease, visibility .28s ease;
}
.eq-overlay::-webkit-scrollbar { display: none; }
.eq-overlay.hidden { visibility: hidden; opacity: 0; pointer-events: none; }
.eq-card {
  width: min(560px, 100%);
  max-height: calc(100dvh - 104px);
  overflow: auto;
  padding: 25px;
  border: 1px solid rgba(255,227,110,.4);
  border-radius: 26px;
  background: linear-gradient(145deg, rgba(255,255,255,.08), transparent 40%), rgba(7,26,36,.96);
  box-shadow: 0 28px 70px rgba(0,0,0,.5), inset 0 1px rgba(255,255,255,.12);
  text-align: center;
  scrollbar-width: none;
}
.eq-card::-webkit-scrollbar { display: none; }
.eq-card-icon {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  margin: 0 auto 9px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 17px;
  background: linear-gradient(145deg, rgba(255,173,50,.25), rgba(255,107,87,.12));
  box-shadow: 0 12px 24px rgba(255,107,87,.14);
  font-size: 1.65rem;
}
.eq-eyebrow {
  display: block;
  color: var(--eq-mint);
  font-size: .66rem;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.eq-title {
  margin: 5px 0 8px;
  color: #fff;
  font-family: var(--eq-display);
  font-size: clamp(2rem, 6vw, 2.8rem);
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: .95;
  text-transform: uppercase;
}
.eq-title span { color: var(--eq-sun); }
.eq-desc,
.eq-result-message {
  max-width: 470px;
  margin: 0 auto 16px;
  color: var(--eq-muted);
  font-size: .9rem;
  line-height: 1.5;
}
.eq-instructions { display: grid; gap: 8px; margin: 17px 0; text-align: left; }
.eq-instruction-item {
  display: grid;
  grid-template-columns: 36px 1fr;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 13px;
  background: rgba(255,255,255,.05);
  color: #c8d7dc;
  font-size: .76rem;
  line-height: 1.35;
}
.eq-instruction-item strong { color: #fff; }
.eq-inst-icon { font-size: 1.25rem; text-align: center; }

.eq-btn-play,
.eq-btn-share,
.eq-btn-secondary,
.eq-btn-exit {
  min-height: 48px;
  border-radius: 14px;
  font-weight: 800;
  cursor: pointer;
  transition: transform .18s ease, filter .18s ease, box-shadow .18s ease;
}
.eq-btn-play {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 0;
  background: linear-gradient(135deg, var(--eq-sun), var(--eq-orange));
  box-shadow: 0 12px 26px rgba(255,173,50,.28), inset 0 1px rgba(255,255,255,.65);
  color: #311800;
  font-size: .9rem;
  text-transform: uppercase;
}
.eq-btn-play:hover { transform: translateY(-2px); filter: brightness(1.06); box-shadow: 0 16px 32px rgba(255,173,50,.38); }
.eq-actions { display: grid; gap: 14px; margin-top: 16px; }
.eq-share-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding-top: 15px; border-top: 1px solid rgba(255,255,255,.1); }
.eq-btn-share,
.eq-btn-secondary,
.eq-btn-exit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid rgba(255,255,255,.15);
  background: rgba(255,255,255,.06);
  color: #dce9ed;
  text-decoration: none;
  font-size: .76rem;
}
.eq-btn-share { border-color: rgba(92,225,195,.42); color: var(--eq-mint); }
.eq-btn-exit { min-height: 42px; color: #fff; }
.eq-btn-share:hover,
.eq-btn-secondary:hover,
.eq-btn-exit:hover { transform: translateY(-2px); background: rgba(255,255,255,.12); }

.eq-record-badge {
  display: none;
  width: fit-content;
  margin: 0 auto 12px;
  padding: 6px 12px;
  border: 1px solid rgba(255,227,110,.55);
  border-radius: 99px;
  background: rgba(255,227,110,.12);
  color: var(--eq-sun);
  font-size: .66rem;
  font-weight: 900;
  letter-spacing: .08em;
}
.eq-gameover-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.eq-go-stat { padding: 10px 7px; border: 1px solid rgba(255,255,255,.1); border-radius: 13px; background: rgba(255,255,255,.05); }
.eq-go-label { display: block; color: var(--eq-muted); font-size: .57rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.eq-go-val { display: block; margin-top: 3px; color: #fff; font-family: var(--eq-display); font-size: 1.35rem; font-weight: 800; }
.eq-go-val.highlight { color: var(--eq-mint); }
.eq-result-progress { margin-top: 10px; padding: 10px 12px; border-radius: 13px; background: rgba(255,255,255,.05); text-align: left; }
.eq-result-progress span { display: block; margin-bottom: 7px; color: #fff; font-size: .68rem; font-weight: 800; }

.eq-toast {
  position: absolute;
  z-index: 80;
  left: 50%;
  bottom: 22px;
  padding: 10px 16px;
  border: 1px solid rgba(92,225,195,.5);
  border-radius: 12px;
  background: #0b332f;
  color: #fff;
  font-size: .75rem;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 20px);
  transition: opacity .22s ease, transform .22s ease;
}
.eq-toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 720px) {
  .eq-wrapper { min-height: 480px; }
  .eq-topbar { top: 8px; left: 8px; right: 8px; min-height: 46px; gap: 8px; border-radius: 14px; }
  .eq-back-btn { min-height: 32px; padding: 0 10px; font-size: .68rem; }
  .eq-top-title > span:first-child { font-size: .82rem; }
  .eq-top-badge { font-size: .52rem; }
  .eq-btn-icon { width: 32px; height: 32px; }
  .eq-hud { top: 63px; width: calc(100% - 16px); grid-template-columns: 66px 1fr 62px; gap: 6px; min-height: 61px; padding: 6px; border-radius: 14px; }
  .eq-hud .eq-world-progress { display: none; }
  .eq-stat-box, .eq-balance-meter { padding: 6px 8px; }
  .eq-stat-label { font-size: .49rem; }
  .eq-stat-val { font-size: 1.08rem; }
  .eq-lane-alert { top: 134px; }
  .eq-mouse-hint { bottom: 10px; padding: 8px 11px; font-size: .66rem; }
  .eq-overlay { padding: 66px 10px 10px; }
  .eq-card { max-height: calc(100dvh - 78px); padding: 18px 14px; border-radius: 20px; }
  .eq-card-icon { width: 44px; height: 44px; margin-bottom: 6px; font-size: 1.4rem; }
  .eq-title { font-size: 2rem; }
  .eq-desc, .eq-result-message { margin-bottom: 11px; font-size: .78rem; }
  .eq-instructions { gap: 6px; margin: 11px 0; }
  .eq-instruction-item { grid-template-columns: 30px 1fr; padding: 8px 9px; font-size: .68rem; }
  .eq-btn-play { min-height: 44px; }
}

@media (max-height: 650px) and (min-width: 721px) {
  .eq-topbar { top: 8px; min-height: 44px; }
  .eq-hud { top: 60px; min-height: 60px; }
  .eq-lane-alert { top: 128px; }
  .eq-card { padding: 16px 22px; }
  .eq-card-icon { width: 42px; height: 42px; margin-bottom: 5px; }
  .eq-title { font-size: 2rem; }
  .eq-desc { margin-bottom: 9px; }
  .eq-instructions { grid-template-columns: repeat(3, 1fr); gap: 7px; margin: 10px 0; }
  .eq-instruction-item { display: block; padding: 8px; text-align: center; }
  .eq-inst-icon { display: block; margin-bottom: 3px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
