:root {
  color-scheme: dark;
  --bg: #040706;
  --panel: rgba(5, 18, 18, 0.9);
  --green: #36ff83;
  --green-soft: rgba(54, 255, 131, 0.42);
  --blue: #33bfff;
  --purple: #8a5cff;
  --text: #e9fff1;
  --muted: #88b99c;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  width: 100vw;
  height: 100vh;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 22% 12%, rgba(54, 255, 131, 0.16), transparent 28%),
    radial-gradient(circle at 78% 20%, rgba(91, 91, 255, 0.18), transparent 30%),
    linear-gradient(135deg, #020403 0%, #061413 44%, #080616 100%);
  overflow: hidden;
}

.shell {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

.hud {
  position: absolute;
  top: 18px;
  left: 50%;
  z-index: 10;
  width: min(960px, calc(100vw - 48px));
  min-height: 56px;
  display: grid;
  grid-template-columns: 1fr 0.85fr 1fr;
  gap: 12px;
  transform: translateX(-50%);
  pointer-events: none;
}

.game-hint {
  position: absolute;
  left: 50%;
  bottom: 18px;
  z-index: 10;
  transform: translateX(-50%);
  padding: 9px 16px;
  border: 1px solid rgba(54, 255, 131, 0.28);
  border-radius: 8px;
  color: #d7ffe2;
  background: rgba(5, 18, 18, 0.56);
  box-shadow: 0 0 18px rgba(54, 255, 131, 0.12);
  font-size: 14px;
  font-weight: 800;
  pointer-events: none;
}

.hud-item {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 10px 14px;
  border: 1px solid rgba(54, 255, 131, 0.38);
  border-radius: 8px;
  background: rgba(5, 18, 18, 0.62);
  box-shadow: 0 0 18px rgba(54, 255, 131, 0.11), inset 0 0 20px rgba(54, 255, 131, 0.05);
  color: var(--text);
  font-weight: 800;
  letter-spacing: 0;
}

.hud-item img {
  width: 30px;
  height: 30px;
  object-fit: contain;
  background: transparent;
}

.hud-timer {
  color: var(--green);
  text-shadow: 0 0 10px var(--green-soft);
}

.boost.active {
  border-color: rgba(51, 191, 255, 0.8);
  box-shadow: 0 0 24px rgba(51, 191, 255, 0.28), inset 0 0 18px rgba(54, 255, 131, 0.14);
}

.canvas-wrap {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: #020706;
}

canvas {
  display: block;
  width: 100vw;
  height: 100vh;
}

.player-monkey {
  position: absolute;
  z-index: 7;
  display: block;
  object-fit: contain;
  pointer-events: none;
  background: transparent;
  filter: drop-shadow(0 0 16px rgba(54, 255, 131, 0.32));
  transform: translateZ(0);
  will-change: left, top, opacity;
}

.finish-gate-mask {
  position: absolute;
  z-index: 8;
  pointer-events: none;
  filter: drop-shadow(0 0 18px rgba(54, 255, 131, 0.55));
}

.gate-glow,
.gate-top,
.gate-left,
.gate-right,
.gate-threshold {
  position: absolute;
  border: 1px solid rgba(54, 255, 131, 0.7);
  background: rgba(3, 18, 15, 0.72);
  box-shadow: inset 0 0 18px rgba(54, 255, 131, 0.16), 0 0 18px rgba(51, 191, 255, 0.26);
}

.gate-glow {
  inset: 20% 31% 12% 31%;
  border-color: rgba(54, 255, 131, 0.32);
  background: rgba(0, 0, 0, 0.34);
}

.gate-top {
  left: 12%;
  top: 6%;
  width: 76%;
  height: 17%;
  border-radius: 8px 8px 3px 3px;
}

.gate-left,
.gate-right {
  top: 18%;
  width: 28%;
  height: 76%;
}

.gate-left {
  left: 6%;
  border-radius: 5px 2px 2px 5px;
}

.gate-right {
  right: 6%;
  border-radius: 2px 5px 5px 2px;
}

.gate-threshold {
  left: 25%;
  bottom: 0;
  width: 50%;
  height: 12%;
  border-radius: 3px;
}

.screen {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 36px;
  background: linear-gradient(180deg, rgba(2, 7, 6, 0.62), rgba(2, 7, 6, 0.88));
}

.pause-overlay {
  position: absolute;
  inset: 0;
  z-index: 9;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(1, 7, 6, 0.46);
  text-align: center;
}

.pause-overlay h2 {
  color: var(--green);
  font-size: 72px;
  letter-spacing: 0;
  text-shadow: 0 0 18px rgba(54, 255, 131, 0.82), 0 0 42px rgba(51, 191, 255, 0.42);
}

.pause-overlay p {
  color: #d7ffe2;
  font-size: 22px;
  font-weight: 800;
}

.event-overlay {
  position: absolute;
  inset: 0;
  z-index: 11;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 36px;
  background: radial-gradient(circle at 50% 42%, rgba(54, 255, 131, 0.16), rgba(1, 7, 6, 0.74) 54%, rgba(1, 7, 6, 0.9));
}

.event-panel {
  width: min(720px, calc(100vw - 72px));
  min-height: 420px;
  border: 1px solid rgba(54, 255, 131, 0.7);
  border-radius: 8px;
  padding: 22px;
  background: linear-gradient(180deg, rgba(4, 18, 16, 0.94), rgba(2, 8, 12, 0.96));
  box-shadow: 0 0 30px rgba(54, 255, 131, 0.26), inset 0 0 28px rgba(51, 191, 255, 0.08);
  text-align: center;
}

.event-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 900;
}

.event-header strong {
  color: var(--green);
  text-shadow: 0 0 12px rgba(54, 255, 131, 0.65);
}

.event-bar {
  height: 8px;
  margin: 12px 0 18px;
  overflow: hidden;
  border: 1px solid rgba(54, 255, 131, 0.34);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.46);
}

.event-bar span {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--blue));
  box-shadow: 0 0 16px rgba(54, 255, 131, 0.72);
  transform-origin: left center;
}

.event-panel h2 {
  font-size: 42px;
}

.event-panel p {
  margin: 8px 0 0;
  color: #d7ffe2;
  font-size: 18px;
  font-weight: 800;
}

.event-body {
  display: grid;
  place-items: center;
  min-height: 190px;
  margin-top: 20px;
}

.event-options,
.event-nodes,
.event-keys {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
}

.event-option,
.event-node,
.event-key {
  min-width: 108px;
  border: 1px solid rgba(54, 255, 131, 0.62);
  border-radius: 8px;
  padding: 16px 18px;
  color: var(--text);
  background: rgba(4, 22, 18, 0.86);
  box-shadow: 0 0 16px rgba(54, 255, 131, 0.12), inset 0 0 18px rgba(54, 255, 131, 0.06);
  font-size: 24px;
  font-weight: 900;
}

.event-option.done,
.event-key.done {
  color: #06140e;
  background: var(--green);
}

.event-node {
  width: 118px;
  height: 118px;
  border-radius: 50%;
  display: grid;
  place-items: center;
}

.event-node.active,
.event-node.done {
  border-color: rgba(116, 247, 255, 0.95);
  background: rgba(54, 255, 131, 0.22);
  box-shadow: 0 0 30px rgba(54, 255, 131, 0.48), inset 0 0 24px rgba(51, 191, 255, 0.16);
}

.coffee-progress {
  display: grid;
  justify-items: center;
  gap: 12px;
  width: 100%;
}

.energy-text {
  margin: 0 !important;
  color: var(--green) !important;
  font-size: 22px !important;
  text-shadow: 0 0 14px rgba(54, 255, 131, 0.62);
}

.energy-meter,
.gate-meter {
  position: relative;
  width: min(560px, 86%);
  height: 34px;
  border: 1px solid rgba(54, 255, 131, 0.64);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.52);
  overflow: hidden;
}

.energy-fill {
  display: block;
  width: 0%;
  height: 100%;
  min-width: 3px;
  background: linear-gradient(90deg, #36ff83, #9dffc4);
  box-shadow: 0 0 18px rgba(54, 255, 131, 0.86);
}

.gate-zone {
  position: absolute;
  top: 0;
  height: 100%;
  background: rgba(54, 255, 131, 0.36);
  box-shadow: 0 0 18px rgba(54, 255, 131, 0.54);
}

.gate-cursor {
  position: absolute;
  top: -8px;
  width: 5px;
  height: 50px;
  background: #dffff0;
  box-shadow: 0 0 16px rgba(116, 247, 255, 0.9);
}

.event-feedback {
  min-height: 28px;
  color: var(--green) !important;
  text-shadow: 0 0 12px rgba(54, 255, 131, 0.5);
}

.hidden {
  display: none;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(48px, 7vw, 84px);
  line-height: 0.95;
  color: var(--green);
  text-shadow: 0 0 10px rgba(54, 255, 131, 0.9), 0 0 34px rgba(51, 191, 255, 0.42);
}

.subtitle {
  margin-top: 8px;
  font-size: 30px;
  color: #d7ffe2;
  text-shadow: 0 0 16px rgba(51, 191, 255, 0.42);
}

h2 {
  font-size: 52px;
  color: var(--green);
  text-shadow: 0 0 18px rgba(54, 255, 131, 0.65);
}

.cover-art {
  width: min(720px, 70vw);
  height: min(360px, 42vh);
  object-fit: cover;
  margin: 18px 0 8px;
  border: 1px solid rgba(54, 255, 131, 0.42);
  border-radius: 8px;
  box-shadow: 0 0 28px rgba(54, 255, 131, 0.2), 0 0 56px rgba(51, 191, 255, 0.16);
}

.result-art {
  width: min(640px, 66vw);
  height: min(320px, 38vh);
  object-fit: cover;
  margin-bottom: 18px;
  border: 1px solid rgba(54, 255, 131, 0.38);
  border-radius: 8px;
  box-shadow: 0 0 24px rgba(54, 255, 131, 0.18), 0 0 48px rgba(51, 191, 255, 0.13);
}

.screen p {
  margin-top: 10px;
  color: #d7ffe2;
  font-size: 22px;
  font-weight: 700;
}

.screen span {
  margin-top: 14px;
  color: var(--muted);
  font-weight: 700;
}

button {
  margin-top: 22px;
  min-width: 176px;
  border: 1px solid rgba(54, 255, 131, 0.9);
  border-radius: 8px;
  padding: 13px 22px;
  color: #02100a;
  background: linear-gradient(135deg, var(--green), #74f7ff);
  font: inherit;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 0 20px rgba(54, 255, 131, 0.45);
}

button:focus-visible,
button:hover {
  outline: 2px solid #dffff0;
  outline-offset: 3px;
}

.results {
  display: grid;
  grid-template-columns: repeat(2, minmax(170px, 1fr));
  gap: 12px;
  width: min(460px, 100%);
  margin: 24px 0 0;
}

.results div {
  border: 1px solid rgba(54, 255, 131, 0.32);
  border-radius: 8px;
  padding: 12px;
  background: rgba(2, 11, 10, 0.82);
}

dt {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

dd {
  margin: 5px 0 0;
  color: var(--text);
  font-size: 22px;
  font-weight: 900;
}
