.game-hud {
  position: absolute;
  inset: 0;
  z-index: 2;
  color: #f0f4f8;
  pointer-events: none;
}
.game-hud[hidden] { display: none; }
.game-hud__top,
.game-hud__bottom {
  position: absolute;
  left: 50%;
  width: min(100%, var(--game-canvas-width, 680px));
  transform: translateX(-50%);
}
.game-hud[data-rewind-preview="true"] .game-hud__bottom { display: none; }
.game-hud__top {
  top: calc(50% - var(--game-canvas-height, 0px) / 2);
  height: 96px;
  padding: 10px max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
}
.game-hud__bottom {
  top: calc(50% + var(--game-canvas-height, 0px) / 2 - 80px);
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-left: max(16px, env(safe-area-inset-left), calc((var(--game-canvas-width, 680px) - var(--game-grid-width, 504px)) / 2));
  padding-right: max(16px, env(safe-area-inset-right), calc((var(--game-canvas-width, 680px) - var(--game-grid-width, 504px)) / 2));
}
.game-hud__summary {
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 0;
  height: 100%;
  font: 700 13px ui-monospace, SFMono-Regular, Menlo, monospace;
}
.game-hud__score { margin-bottom: 5px; font-size: 24px; line-height: 1.1; color: #ffffff; }
.game-hud__records { margin-bottom: 3px; color: #62b0e8; font-size: 11px; white-space: nowrap; }
.game-hud__level { margin-top: 7px; color: #a0aec0; white-space: nowrap; }
.game-hud__turns { display: grid; justify-items: center; gap: 7px; color: #a0aec0; white-space: nowrap; }
.game-hud__pips {
  display: grid;
  justify-items: start;
  width: var(--game-grid-width, 504px);
  max-width: min(var(--game-grid-width, 504px), calc(100vw - 32px));
  padding-inline: 1px;
}
.game-hud__pip {
  flex: 0 0 auto;
  width: clamp(9px, calc(var(--game-grid-width, 504px) / 32), 16px);
  height: clamp(9px, calc(var(--game-grid-width, 504px) / 32), 16px);
  border: 1px solid #718096;
  border-radius: 50%;
}
.game-hud__pip--remaining { background: #f0f4f8; border-color: #f0f4f8; }
.game-hud__pip--placeholder { visibility: hidden; }
.game-hud__queue {
  display: flex;
  align-items: center;
  gap: 10px;
}
.game-hud__disc-slot { display: inline-flex; align-items: center; gap: 6px; color: #cbd5e1; font: 11px ui-monospace, SFMono-Regular, Menlo, monospace; }
.game-hud__disc-caption { text-transform: uppercase; }
.game-hud__disc {
  position: relative;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  overflow: hidden;
  border: 1px solid rgba(0,0,0,.35);
  border-radius: 50%;
  color: #fff;
  font: 700 15px system-ui, sans-serif;
  box-shadow: 0 2px 5px rgba(0,0,0,.35);
}
.game-hud__disc[data-kind="numbered"][data-value="1"] { background: radial-gradient(circle at 35% 35%, rgb(255,165,149), #e74c3c); }
.game-hud__disc[data-kind="numbered"][data-value="2"] { background: radial-gradient(circle at 35% 35%, rgb(255,215,123), #e67e22); }
.game-hud__disc[data-kind="numbered"][data-value="3"] { background: radial-gradient(circle at 35% 35%, rgb(255,255,104), #f1c40f); }
.game-hud__disc[data-kind="numbered"][data-value="4"] { background: radial-gradient(circle at 35% 35%, rgb(135,255,202), #2ecc71); }
.game-hud__disc[data-kind="numbered"][data-value="5"] { background: radial-gradient(circle at 35% 35%, rgb(141,241,255), #3498db); }
.game-hud__disc[data-kind="numbered"][data-value="6"] { background: radial-gradient(circle at 35% 35%, rgb(244,178,255), #9b59b6); }
.game-hud__disc[data-kind="numbered"][data-value="7"] { background: radial-gradient(circle at 35% 35%, rgb(115,255,245), #1abc9c); }
.game-hud__disc[data-kind="single-cracked"],
.game-hud__disc[data-kind="double-cracked"] {
  background: radial-gradient(circle at 37.5% 37.5%, #4a5568, #2d3748);
}
.game-hud__disc-crack {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.game-hud__disc-crack i {
  position: absolute;
  display: block;
  height: 2px;
  border-radius: 999px;
  background: #e2e8f0;
  transform-origin: left center;
}
.game-hud__disc-crack--primary i:first-child { left: 40%; top: 22.5%; width: 24%; transform: rotate(69deg); }
.game-hud__disc-crack--primary i:last-child { left: 48.5%; top: 45%; width: 37.5%; transform: rotate(65deg); }
.game-hud__disc-crack--secondary i:first-child { left: 69%; top: 26%; width: 27%; transform: rotate(127deg); }
.game-hud__disc-crack--secondary i:last-child { left: 53%; top: 47.5%; width: 34.5%; transform: rotate(124deg); }
.game-hud__gravity {
  position: absolute;
  top: max(6px, env(safe-area-inset-top));
  right: max(6px, env(safe-area-inset-right), calc((var(--game-canvas-width, 680px) - var(--game-grid-width, 504px)) / 2));
  width: 48px;
  height: 48px;
}
.game-hud__gravity[hidden] { display: none; }
.game-hud__instability {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  left: max(16px, env(safe-area-inset-left), calc((var(--game-canvas-width, 680px) - var(--game-grid-width, 504px)) / 2));
  border: 1px solid #a855f7;
  border-radius: 999px;
  padding: 5px 8px;
  background: rgba(59, 29, 92, .88);
  color: #e9d5ff;
  font: 800 10px ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .06em;
}
.game-hud__instability[hidden] { display: none; }
.game-hud__instability--critical {
  border-color: #f472b6;
  color: #fbcfe8;
  box-shadow: 0 0 14px rgba(244, 114, 182, .4);
}
.game-hud__gravity-dial { display: block; width: 100%; height: 100%; overflow: visible; }
.game-hud__gravity-attention-ring { opacity: 0; }
.game-hud__gravity--attention .game-hud__gravity-attention-ring {
  opacity: 1;
  animation: gravity-attention-ring 1s ease-in-out infinite;
}
@keyframes gravity-attention-ring {
  0%, 100% { opacity: 0.25; }
  50% { opacity: 1; }
}
.game-hud__gravity-sr {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.game-hud__status {
  display: grid;
  justify-items: end;
  gap: 4px;
  max-width: 58%;
  text-align: right;
}
.game-hud[data-stack-mode="true"] .game-hud__status {
  align-self: flex-start;
  padding-top: 2px;
}
@media (min-width: 721px) and (pointer: fine) {
  .game-hud[data-rewind-mode="true"] .game-hud__status { max-width: 70%; }
}
.game-hud__stack-receipt {
  display: grid;
  justify-items: end;
  gap: 1px;
  color: #ffd700;
  font: 700 10px ui-monospace, SFMono-Regular, Menlo, monospace;
  line-height: 1.25;
}
.game-hud__stack-receipt-breakdown { color: #cbd5e1; }
.game-hud__stack-receipt[hidden] { display: none; }
.game-hud__hint { color: #a0aec0; font-size: 10px; text-align: right; }
.game-hud__hint--controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 6px 12px;
}
.game-hud__hint-action {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  color: #94a3b8;
  font: 700 9px ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.game-hud__hint-action kbd {
  display: inline-flex;
  min-height: 20px;
  align-items: center;
  padding: 2px 5px;
  border: 1px solid #486581;
  border-bottom-color: #243b53;
  border-radius: 4px;
  background: rgba(11, 32, 52, .9);
  box-shadow: 0 1px 0 #071523;
  color: #e2e8f0;
  font: 700 10px ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0;
  text-transform: none;
}
.game-hud__hint--attention {
  color: #9ecdf0;
  animation: hint-attention 1s ease-in-out infinite;
}
.game-hud__hint--ready {
  color: #81e6b3;
  font-weight: 700;
}
@keyframes hint-attention {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}
@media (prefers-reduced-motion: reduce) {
  .game-hud__hint--attention,
  .game-hud__gravity--attention .game-hud__gravity-attention-ring {
    animation: none;
  }
  .game-hud__gravity--attention .game-hud__gravity-attention-ring { opacity: 0.7; }
}
@media (max-width: 720px), (pointer: coarse) {
  .game-hud__summary {
    font-size: 12px;
  }
  .game-hud__score {
    font-size: 22px;
  }
  .game-hud__status { max-width: 58%; }
  .game-hud__instability {
    right: max(16px, env(safe-area-inset-right), calc((var(--game-canvas-width, 680px) - var(--game-grid-width, 504px)) / 2));
    left: auto;
  }
}
@media (max-width: 420px) {
  .game-hud__top { height: 96px; }
  .game-hud__bottom { height: 80px; }
  .game-hud__disc { width: 27px; height: 27px; font-size: 14px; }
  .game-hud__disc-slot { gap: 4px; font-size: 9px; }
  .game-hud__status { max-width: 54%; }
  .game-hud__hint,
  .game-hud__stack-receipt { font-size: 9px; }
  .game-hud__gravity { width: 40px; height: 40px; }
  .game-hud__instability { top: max(10px, env(safe-area-inset-top)); font-size: 9px; }
}
