:root {
  --ink: #f7fbff;
  --muted: rgba(247, 251, 255, .72);
  --panel: rgba(9, 14, 28, .78);
  --line: rgba(255, 255, 255, .16);
  --yellow: #ffe44d;
  --cyan: #64f3ff;
  --blue: #101b42;
}

* { box-sizing: border-box; }

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  background: #050712;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  overflow-x: hidden;
}

.app-shell {
  min-height: 100vh;
  padding: 20px;
  display: grid;
  grid-template-columns: minmax(320px, 430px) minmax(520px, 1fr) minmax(260px, 330px);
  gap: 18px;
  background:
    radial-gradient(ellipse at 50% 24%, rgba(100, 243, 255, .18), transparent 35rem),
    linear-gradient(135deg, #070b1b, #101531 56%, #050712);
}

.hero-panel,
.game-stage,
.camera-panel,
.debug-panel,
.learn-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: 0 22px 70px rgba(0, 0, 0, .32);
  backdrop-filter: blur(18px);
}

.hero-panel {
  align-self: start;
  padding: 24px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--cyan);
  font-size: .76rem;
  font-weight: 900;
  letter-spacing: .14em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 14px;
  font-size: clamp(2.4rem, 5vw, 4.7rem);
  line-height: .95;
  color: var(--yellow);
  text-shadow: 0 0 24px rgba(255, 228, 77, .36);
}

.summary,
.status,
.keyboard-note,
.learn-card p {
  color: var(--muted);
  line-height: 1.55;
}

.actions {
  display: grid;
  gap: 10px;
  margin: 22px 0 16px;
}

button,
a {
  min-height: 44px;
  padding: 10px 15px;
  border: 1px solid rgba(100, 243, 255, .32);
  border-radius: 10px;
  color: var(--ink);
  background: rgba(255, 255, 255, .08);
  font: inherit;
  font-weight: 900;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

button:first-child {
  color: #11131c;
  background: linear-gradient(135deg, var(--yellow), #77f7ff);
}

button[aria-pressed="false"] {
  color: rgba(247, 251, 255, .62);
  background: rgba(255, 255, 255, .04);
}

.game-stage {
  position: relative;
  min-height: 620px;
  overflow: hidden;
}

#effectCanvas {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 620px;
}

.direction-card {
  position: absolute;
  top: 18px;
  left: 18px;
  width: 150px;
  text-align: center;
  pointer-events: none;
}

.direction-card span {
  color: var(--cyan);
  font-size: .85rem;
  font-weight: 900;
  letter-spacing: .18em;
}

.direction-card strong {
  display: block;
  margin: 2px 0;
  color: var(--yellow);
  font-size: clamp(3.2rem, 8vw, 5.4rem);
  line-height: .85;
  text-shadow: 0 0 32px rgba(255, 228, 77, .7);
}

.direction-card p {
  margin: 0;
  color: #fff;
  font-size: .95rem;
  font-weight: 900;
  letter-spacing: .12em;
}

.keyboard-note {
  position: absolute;
  left: 20px;
  right: 20px;
  bottom: 18px;
  text-align: center;
  font-size: .9rem;
}

.camera-panel {
  position: relative;
  align-self: start;
  overflow: hidden;
}

.camera-panel[hidden] {
  display: none;
}

#cameraVideo,
#landmarkCanvas {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
}

#cameraVideo {
  object-fit: cover;
  transform: scaleX(-1);
  background: #111;
}

#landmarkCanvas {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.camera-data {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 800;
}

.camera-data strong {
  color: var(--cyan);
}

.debug-panel {
  grid-column: 3;
  align-self: end;
  padding: 18px;
}

.debug-panel[hidden] {
  display: none;
}

.debug-panel h2 {
  margin-bottom: 12px;
}

.debug-panel dl {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 8px 12px;
  margin: 0;
  color: var(--muted);
  font-size: .88rem;
}

.debug-panel dd {
  margin: 0;
  color: #d9fbff;
  font-weight: 800;
}

.learn-panel {
  position: fixed;
  z-index: 10;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(2, 4, 11, .76);
}

.learn-panel[hidden] {
  display: none;
}

.learn-card {
  width: min(840px, 100%);
  padding: 28px;
}

code {
  color: #aafaff;
}

@media (max-width: 1080px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .debug-panel {
    grid-column: auto;
    align-self: start;
  }

  .game-stage {
    min-height: 520px;
  }

  #effectCanvas {
    min-height: 520px;
  }
}
