:root {
  color-scheme: dark;
  --ink: #0d0f12;
  --panel: rgba(18, 20, 23, 0.76);
  --panel-strong: rgba(22, 24, 28, 0.9);
  --text: #f4f0e7;
  --muted: #c7c0b0;
  --line: rgba(244, 240, 231, 0.18);
  --accent: #56d4bf;
  --amber: #f5c961;
  --coral: #ff7a66;
  --violet: #b596ff;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  min-width: 320px;
  overflow: hidden;
  background:
    linear-gradient(135deg, #0d0f12 0%, #171516 44%, #121717 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button {
  font: inherit;
}

.game-shell {
  width: 100vw;
  height: 100vh;
}

.stage {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 520px;
  overflow: hidden;
  background: #0d0f12;
  touch-action: none;
}

#gameCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: crosshair;
}

.hud {
  position: absolute;
  z-index: 2;
  display: flex;
  gap: 16px;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(18px);
}

.hud-top {
  top: 18px;
  left: 18px;
  right: 18px;
  min-height: 86px;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-radius: 8px;
}

.title-block {
  min-width: 0;
}

h1 {
  margin: 0 0 6px;
  color: #fff9ec;
  font-size: clamp(1.6rem, 2.6vw, 2.6rem);
  line-height: 1;
  letter-spacing: 0;
}

p {
  margin: 0;
}

.title-block p {
  max-width: 840px;
  color: var(--muted);
  font-size: clamp(0.95rem, 1.4vw, 1.08rem);
  line-height: 1.42;
}

.title-block strong {
  color: #fff3c0;
  font-weight: 700;
}

.restart-button {
  flex: 0 0 auto;
  min-width: 112px;
  min-height: 46px;
  border: 1px solid rgba(86, 212, 191, 0.52);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(86, 212, 191, 0.22), rgba(86, 212, 191, 0.08));
  color: #ecfffb;
  font-weight: 800;
  letter-spacing: 0;
  cursor: pointer;
}

.restart-button:hover,
.restart-button:focus-visible {
  border-color: rgba(245, 201, 97, 0.75);
  color: #fff6ce;
  outline: none;
}

.hud-bottom {
  left: 18px;
  right: 18px;
  bottom: 18px;
  flex-direction: column;
  padding: 14px 16px 16px;
  border-radius: 8px;
}

.status-line {
  min-height: 24px;
  color: #fff9ec;
  font-size: 1rem;
  font-weight: 750;
}

.bloom-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.bloom-meter {
  position: relative;
  min-height: 42px;
  overflow: hidden;
  border: 1px solid rgba(244, 240, 231, 0.16);
  border-radius: 8px;
  background: var(--panel-strong);
}

.bloom-meter::before {
  content: "";
  position: absolute;
  inset: 0;
  width: var(--fill, 0%);
  background:
    linear-gradient(90deg, var(--meter-color), rgba(255, 255, 255, 0.16));
  opacity: 0.72;
  transition: width 140ms linear;
}

.bloom-meter span {
  position: relative;
  display: flex;
  min-height: 42px;
  align-items: center;
  justify-content: space-between;
  padding: 0 11px;
  color: #fffaf0;
  font-size: 0.88rem;
  font-weight: 800;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.64);
}

@media (max-width: 720px) {
  body {
    overflow: auto;
  }

  .game-shell {
    min-height: 100vh;
  }

  .stage {
    min-height: 680px;
  }

  .hud-top {
    top: 10px;
    left: 10px;
    right: 10px;
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
    padding: 14px;
  }

  .restart-button {
    width: 100%;
  }

  .hud-bottom {
    left: 10px;
    right: 10px;
    bottom: 10px;
    padding: 12px;
  }

  .bloom-strip {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .bloom-meter,
  .bloom-meter span {
    min-height: 34px;
  }
}
