html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #000;
  color: #f4f7fb;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button {
  font: inherit;
}

#game-root,
#game-canvas {
  width: 100%;
  height: 100%;
}

#game-canvas {
  display: block;
}

.loading-screen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  background: #000;
  color: #f4f7fb;
  font-size: 18px;
  font-weight: 800;
}

body:not(.is-loading) .loading-screen {
  display: none;
}

body.is-loading #hud,
body.is-loading #start-panel,
body.is-loading #message-panel {
  visibility: hidden;
  pointer-events: none;
}

#hud {
  position: fixed;
  top: 14px;
  left: 14px;
  right: 14px;
  display: grid;
  gap: 8px;
  pointer-events: none;
}

.hud-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.hud-row span,
.mode-actions button {
  min-height: 34px;
  padding: 7px 12px;
  border: 1px solid rgba(220, 194, 121, 0.26);
  border-radius: 8px;
  box-sizing: border-box;
  background: rgba(10, 15, 18, 0.74);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(10px);
}

.hud-row.secondary span {
  color: #d8e2ec;
}

#state-label {
  display: none;
  max-width: min(520px, calc(100vw - 28px));
}

.mode-actions button {
  color: #f4f7fb;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.mode-actions button:hover {
  border-color: rgba(142, 241, 220, 0.62);
  background: rgba(22, 38, 41, 0.82);
}

.mode-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

#start-panel,
#message-panel {
  position: fixed;
  left: 50%;
  top: 50%;
  width: min(390px, calc(100vw - 36px));
  max-height: calc(100vh - 36px);
  max-height: calc(100svh - 36px);
  max-height: calc(100dvh - 36px);
  transform: translate(-50%, -50%);
  padding: 22px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  box-sizing: border-box;
  background: rgba(14, 19, 24, 0.86);
  box-shadow: 0 18px 58px rgba(0, 0, 0, 0.38);
  text-align: center;
  backdrop-filter: blur(14px);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

#start-panel {
  z-index: 4;
}

#message-panel {
  z-index: 3;
}

#start-panel h1,
#message-panel h1 {
  margin: 0 0 8px;
  max-width: 100%;
  font-size: clamp(2rem, 7.2vw, 3rem);
  letter-spacing: 0;
  line-height: 1;
  white-space: nowrap;
}

#start-panel p {
  margin: 0 0 16px;
  color: #d8e2ec;
  line-height: 1.45;
}

.start-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.start-controls div {
  min-width: 0;
  padding: 7px 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
}

.start-controls dt {
  color: #99d9ff;
  font-size: 0.75rem;
  font-weight: 800;
}

.start-controls dd {
  margin: 3px 0 0;
  color: #edf5ff;
  font-size: 0.8rem;
}

#message-panel p {
  margin: 0;
  color: #d8e2ec;
}

.mode-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 18px;
}

.mode-actions button {
  min-height: 46px;
  background: rgba(17, 32, 36, 0.82);
}

#start-panel .gameblocks-credit {
  margin: 18px 0 0;
  color: rgba(216, 226, 236, 0.72);
  font-size: 12px;
  line-height: 1.2;
}

.gameblocks-credit a {
  color: inherit;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 2px;
}

@media (max-width: 560px) {
  #hud {
    font-size: 0.88rem;
  }

  body .control-indicator.control-indicator--bottom-left {
    bottom: 70px !important;
    left: 14px !important;
    max-width: min(220px, calc(100vw - 28px)) !important;
  }
}
