:root {
  --bg: #000000;
  --surface: #111318;
  --surface2: #1c1f26;
  --text: #ffffff;
  --muted: #c7ccd6;
  --cyan: #35e6ff;
  --green: #6dff8f;
  --red: #ff4d5f;
  --gold: #ffd166;
  --focus: rgba(53, 230, 255, 0.65);
}

* { box-sizing: border-box; }

html,
body {
  width: 600px;
  height: 600px;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

#app {
  width: 600px;
  height: 600px;
  position: relative;
}

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: 24px;
}

.hidden { display: none !important; }

.home-panel,
.overlay {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  text-align: center;
}

.brand-mark {
  width: 106px;
  height: 106px;
  border-radius: 32px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #26313d, #171a21);
  color: var(--green);
  font-size: 72px;
  font-weight: 900;
  box-shadow: 0 0 34px rgba(109, 255, 143, 0.24), inset 0 0 18px rgba(255,255,255,0.06);
}

h1 {
  margin: 0;
  font-size: 44px;
  line-height: 1;
  letter-spacing: 0;
}

.tagline,
.caution,
.overlay p {
  margin: 0;
  font-size: 16px;
  color: var(--muted);
  line-height: 1.4;
}

.caution {
  max-width: 440px;
  padding: 12px 16px;
  border-radius: 8px;
  background: rgba(255, 209, 102, 0.13);
  color: var(--gold);
  font-weight: 700;
}

.best-pill {
  min-width: 150px;
  height: 54px;
  padding: 0 22px;
  border-radius: 27px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: var(--surface);
}

.best-pill span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.best-pill strong {
  color: var(--green);
  font-size: 24px;
}

.actions {
  width: 100%;
  max-width: 430px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.btn {
  height: 88px;
  border: 2px solid transparent;
  border-radius: 8px;
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  background: var(--surface2);
  opacity: 0.85;
  transition: transform 475ms cubic-bezier(0.6, 0, 0.4, 1), opacity 300ms, box-shadow 300ms, border-color 300ms;
}

.btn.primary {
  color: #07100a;
  background: var(--green);
}

.btn.secondary {
  background: var(--surface2);
}

.btn.danger {
  background: var(--red);
}

.focusable:focus {
  outline: none;
  opacity: 1;
  transform: scale(0.91);
  border-color: var(--cyan);
  box-shadow: 0 0 24px var(--focus);
}

.header {
  min-height: 64px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.header h1 {
  font-size: 28px;
}

.back-btn {
  width: 88px;
  height: 88px;
  border-radius: 8px;
  border: 2px solid transparent;
  background: var(--surface2);
  color: var(--text);
  font-size: 34px;
  font-weight: 900;
}

.content {
  position: relative;
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding-top: 16px;
  padding-bottom: 32px;
}

.content::after {
  content: "";
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 64px;
  pointer-events: none;
  background: linear-gradient(to top, var(--surface) 0%, rgba(17,19,24,0) 100%);
}

.help-row {
  display: flex;
  gap: 16px;
  text-align: left;
  padding: 16px;
  border-radius: 8px;
  background: var(--surface);
}

.help-icon {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(53, 230, 255, 0.16);
  color: var(--cyan);
  font-weight: 900;
}

.help-row b {
  font-size: 17px;
}

.help-row p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.35;
}

#game {
  padding: 0;
  background: #000;
}

#game-canvas {
  width: 600px;
  height: 600px;
  display: block;
}

.hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 92px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 18px 22px;
  pointer-events: none;
}

.score {
  font-size: 46px;
  line-height: 0.92;
  font-weight: 900;
  text-shadow: 0 0 18px rgba(255,255,255,0.45);
}

.combo {
  margin-top: 5px;
  color: var(--gold);
  font-size: 24px;
  font-weight: 900;
}

.hud-center {
  min-width: 132px;
  padding: 8px 14px;
  border-radius: 8px;
  background: rgba(17, 19, 24, 0.72);
  color: var(--cyan);
  font-size: 15px;
  font-weight: 900;
  text-align: center;
}

.lives {
  color: var(--red);
  font-size: 31px;
  font-weight: 900;
  letter-spacing: 2px;
}

.final-score {
  color: var(--green);
  font-size: 74px;
  line-height: 1;
  font-weight: 900;
  text-shadow: 0 0 22px rgba(109,255,143,0.38);
}

.new-best {
  padding: 8px 18px;
  border-radius: 24px;
  background: rgba(255, 209, 102, 0.16);
  color: var(--gold);
  font-size: 15px;
  font-weight: 900;
}

.toast {
  position: fixed;
  top: 24px;
  left: 50%;
  max-width: 536px;
  transform: translateX(-50%) translateY(-70px);
  padding: 12px 22px;
  border-radius: 24px;
  background: var(--surface2);
  border: 1px solid var(--cyan);
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  opacity: 0;
  transition: transform 250ms ease, opacity 250ms ease;
  pointer-events: none;
  z-index: 50;
}

.toast.visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}
