/* ============================================================
   깨알도구
   우주 슈팅게임
   ============================================================ */

.tool-page {
  --tool-page-max-width: 880px;
}

/* ============================================================
   GAME
   ============================================================ */

.space-game {
  width: 100%;
}

/* ============================================================
   HUD
   ============================================================ */

.space-hud {
  display: grid;

  grid-template-columns: repeat(5, minmax(0, 1fr));

  gap: 6px;

  margin-bottom: 7px;
}

.space-hud > div {
  min-width: 0;

  padding: 8px 5px;

  border: 1px solid var(--line);

  border-radius: 10px;

  background: #fff;

  text-align: center;
}

.space-hud span {
  display: block;

  color: var(--text-soft);

  font-size: 12px;

  font-weight: 800;
}

.space-hud strong {
  display: block;

  margin-top: 2px;

  color: var(--text);

  font-size: 12px;

  font-weight: 900;

  font-variant-numeric: tabular-nums;
}

.space-life {
  color: #b75e63 !important;

  letter-spacing: 1px;
}

/* ============================================================
   ACTION BUTTONS
   ============================================================ */

.space-game-actions {
  display: flex;

  justify-content: flex-end;

  gap: 6px;

  margin-bottom: 7px;
}

.space-game-actions button {
  min-height: 31px;

  padding: 0 10px;

  border: 1px solid var(--line);

  border-radius: 8px;

  background: #fff;

  color: var(--text-soft);

  font-size: 12px;

  font-weight: 800;

  cursor: pointer;
}

.space-game-actions button:hover:not(:disabled) {
  background: var(--surface-soft);
}

.space-game-actions button:disabled {
  opacity: 0.35;

  cursor: default;
}

/* ============================================================
   STAGE
   ============================================================ */

.space-stage {
  position: relative;

  width: 100%;

  max-width: 720px;

  margin: 0 auto;

  overflow: hidden;

  border-radius: 18px;

  background: #09111f;

  border: 1px solid rgba(255, 255, 255, 0.08);

  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.12);
}

#gameCanvas {
  display: block;

  width: 100%;
  height: auto;

  aspect-ratio: 720 / 560;

  background: #09111f;

  user-select: none;

  -webkit-user-select: none;
}

/* ============================================================
   OVERLAY
   ============================================================ */

.space-overlay {
  position: absolute;

  inset: 0;

  display: flex;

  align-items: center;
  justify-content: center;

  padding: 20px;

  background: rgba(5, 11, 21, 0.82);

  backdrop-filter: blur(3px);

  color: #fff;

  text-align: center;
}

.space-overlay[hidden] {
  display: none;
}

.space-overlay-content {
  width: min(520px, 100%);

  display: flex;

  flex-direction: column;
  align-items: center;
}

.space-main-icon {
  font-size: 49px;

  line-height: 1;
}

.space-mini-label {
  margin-top: 10px;

  padding: 4px 8px;

  border: 1px solid rgba(255, 255, 255, 0.16);

  border-radius: 999px;

  color: rgba(255, 255, 255, 0.7);

  font-size: 12px;

  font-weight: 900;

  letter-spacing: 1px;
}

.space-overlay h2 {
  margin: 12px 0 0;

  color: #fff;

  font-size: 24px;

  font-weight: 900;

  letter-spacing: -1px;
}

.space-overlay p {
  margin: 8px 0 0;

  color: rgba(255, 255, 255, 0.68);

  font-size: 12px;

  line-height: 1.65;
}

/* ============================================================
   INTRO INFO
   ============================================================ */

.space-intro-info {
  width: min(430px, 100%);

  display: grid;

  grid-template-columns: repeat(3, minmax(0, 1fr));

  gap: 6px;

  margin-top: 18px;
}

.space-intro-info > div {
  min-width: 0;

  padding: 9px 5px;

  border: 1px solid rgba(255, 255, 255, 0.12);

  border-radius: 10px;

  background: rgba(255, 255, 255, 0.05);
}

.space-intro-info span {
  display: block;

  color: rgba(255, 255, 255, 0.5);

  font-size: 12px;

  font-weight: 800;
}

.space-intro-info strong {
  display: block;

  margin-top: 3px;

  color: #fff;

  font-size: 12px;

  font-weight: 900;
}

.space-intro-info small {
  display: block;

  margin-top: 2px;

  color: rgba(255, 255, 255, 0.55);

  font-size: 12px;
}

/* ============================================================
   PRIMARY / SECONDARY
   ============================================================ */

.space-primary-button,
.space-secondary-button {
  min-height: 46px;

  border-radius: 11px;

  font-size: 12px;

  font-weight: 900;

  cursor: pointer;
}

.space-primary-button {
  min-width: 180px;

  margin-top: 18px;

  border: 0;

  background: #fff;

  color: #111827;
}

.space-primary-button:hover {
  background: #f0f1f3;
}

.space-secondary-button {
  min-width: 125px;

  border: 1px solid rgba(255, 255, 255, 0.18);

  background: rgba(255, 255, 255, 0.06);

  color: #fff;
}

.space-secondary-button:hover {
  background: rgba(255, 255, 255, 0.11);
}

.space-enter-guide {
  margin-top: 7px;

  color: rgba(255, 255, 255, 0.46);

  font-size: 12px;
}

/* ============================================================
   BEST
   ============================================================ */

.space-best-record {
  margin-top: 12px;
}

.space-best-record span {
  display: block;

  color: rgba(255, 255, 255, 0.55);

  font-size: 12px;
}

.space-best-record strong {
  display: block;

  margin-top: 2px;

  color: #fff;

  font-size: 12px;

  font-weight: 900;
}

/* ============================================================
   PAUSE
   ============================================================ */

.space-overlay-actions {
  display: flex;

  flex-wrap: wrap;

  align-items: center;
  justify-content: center;

  gap: 7px;

  margin-top: 17px;
}

.space-overlay-actions .space-primary-button {
  margin-top: 0;
}

/* ============================================================
   RESULT
   ============================================================ */

.space-result-score {
  margin-top: 14px;
}

.space-result-score span {
  display: block;

  color: rgba(255, 255, 255, 0.56);

  font-size: 12px;
}

.space-result-score strong {
  display: block;

  margin-top: 3px;

  color: #fff;

  font-size: 32px;

  font-weight: 900;
}

.space-result-grid {
  width: min(430px, 100%);

  display: grid;

  grid-template-columns: repeat(3, minmax(0, 1fr));

  gap: 6px;

  margin-top: 13px;
}

.space-result-grid > div {
  min-width: 0;

  padding: 9px 5px;

  border-radius: 9px;

  background: rgba(255, 255, 255, 0.06);
}

.space-result-grid span {
  display: block;

  color: rgba(255, 255, 255, 0.5);

  font-size: 12px;
}

.space-result-grid strong {
  display: block;

  margin-top: 3px;

  color: #fff;

  font-size: 12px;

  font-weight: 900;
}

.space-new-record {
  margin-top: 10px;

  padding: 5px 9px;

  border-radius: 999px;

  background: rgba(255, 225, 120, 0.16);

  color: #ffe58e;

  font-size: 12px;

  font-weight: 900;

  animation: space-pop 0.55s ease;
}

.space-result-actions {
  display: flex;

  flex-wrap: wrap;

  align-items: center;
  justify-content: center;

  gap: 7px;

  margin-top: 15px;
}

.space-result-actions .space-primary-button {
  margin-top: 0;
}

.space-share-status {
  min-height: 15px;

  margin-top: 5px;

  color: rgba(255, 255, 255, 0.58);

  font-size: 12px;
}

/* ============================================================
   TOUCH CONTROL
   ============================================================ */

.space-touch-controls {
  width: min(520px, 100%);

  display: grid;

  grid-template-columns:
    1fr
    1.25fr
    1fr;

  gap: 8px;

  margin: 12px auto 0;
}

.space-touch-controls button {
  min-height: 58px;

  border: 1px solid var(--line);

  border-radius: 14px;

  background: #fff;

  color: var(--text);

  font-weight: 900;

  cursor: pointer;

  touch-action: none;

  user-select: none;

  -webkit-user-select: none;

  transition:
    transform 0.06s ease,
    background 0.1s ease;
}

.space-touch-controls button.pressed {
  transform: scale(0.96);

  background: var(--surface-soft);
}

.space-move-button {
  font-size: 20px;
}

.space-fire-button {
  display: flex;

  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.space-fire-button span {
  font-size: 18px;
}

.space-fire-button strong {
  margin-top: 1px;

  font-size: 12px;
}

.space-pc-guide {
  margin-top: 8px;

  color: var(--text-soft);

  font-size: 12px;

  text-align: center;
}

/* ============================================================
   GUIDE
   ============================================================ */

.space-guide-grid {
  display: grid;

  grid-template-columns: repeat(3, minmax(0, 1fr));

  gap: 8px;

  margin-top: 12px;
}

.space-item-guide {
  display: grid;

  grid-template-columns: repeat(3, minmax(0, 1fr));

  gap: 7px;

  margin-top: 12px;
}

.space-item-guide > div {
  padding: 10px 7px;

  border-radius: 10px;

  background: var(--surface-soft);

  text-align: center;
}

.space-item-guide strong {
  display: flex;

  align-items: center;
  justify-content: center;

  width: 28px;
  height: 28px;

  margin: 0 auto;

  border-radius: 50%;

  background: #fff;

  color: var(--text);

  font-size: 12px;

  font-weight: 900;
}

.space-item-guide span {
  display: block;

  margin-top: 5px;

  color: var(--text);

  font-size: 12px;

  font-weight: 900;
}

.space-item-guide p {
  margin: 2px 0 0;

  color: var(--text-soft);

  font-size: 12px;
}

.space-info-note {
  margin-top: 12px;

  padding: 11px 12px;

  border-radius: 10px;

  background: var(--surface-soft);
}

.space-info-note strong {
  color: var(--text);

  font-size: 12px;

  font-weight: 900;
}

.space-info-note p {
  margin: 5px 0 0;

  color: var(--text-soft);

  font-size: 12px;

  line-height: 1.6;
}

/* ============================================================
   ANIMATION
   ============================================================ */

@keyframes space-pop {
  0% {
    opacity: 0;

    transform: scale(0.7);
  }

  70% {
    opacity: 1;

    transform: scale(1.08);
  }

  100% {
    transform: scale(1);
  }
}

/* ============================================================
   MOBILE
   ============================================================ */

@media (max-width: 560px) {
  .space-hud {
    grid-template-columns: repeat(5, minmax(0, 1fr));

    gap: 3px;
  }

  .space-hud > div {
    padding: 6px 2px;
  }

  .space-hud span {
    font-size: 12px;
  }

  .space-hud strong {
    font-size: 12px;
  }

  .space-game-actions {
    justify-content: center;

    gap: 4px;
  }

  .space-game-actions button {
    min-height: 29px;

    padding: 0 7px;

    font-size: 12px;
  }

  .space-stage {
    border-radius: 13px;
  }

  .space-overlay {
    padding: 13px;
  }

  .space-main-icon {
    font-size: 39px;
  }

  .space-overlay h2 {
    font-size: 19px;
  }

  .space-overlay p {
    font-size: 12px;
  }

  .space-intro-info {
    margin-top: 12px;
  }

  .space-primary-button,
  .space-secondary-button {
    min-height: 42px;
  }

  .space-result-score strong {
    font-size: 27px;
  }

  .space-result-actions {
    gap: 5px;
  }

  .space-touch-controls button {
    min-height: 62px;
  }

  .space-pc-guide {
    display: none;
  }

  .space-guide-grid {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   VERY SMALL MOBILE
   ============================================================ */

@media (max-width: 380px) {
  .space-hud {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .space-hud > div:nth-child(4),
  .space-hud > div:nth-child(5) {
    grid-column: span 1;
  }

  .space-intro-info {
    grid-template-columns: 1fr 1fr;
  }

  .space-intro-info > div:last-child {
    grid-column: 1 / -1;
  }

  .space-overlay h2 {
    font-size: 17px;
  }

  .space-result-grid {
    gap: 4px;
  }
}
