:root {
  color-scheme: dark;
  --ink: #050c14;
  --gold: #c9a25a;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background:
    radial-gradient(1200px 800px at 50% 20%, #0b2233 0%, #050c14 55%, #02060b 100%);
  color: #f5eadd;
  font-family: "Courier New", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", ui-monospace, monospace;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

#stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

canvas {
  display: block;
  border-radius: 6px;
  background: #050c14;
  box-shadow:
    0 0 0 1px rgba(201, 162, 90, 0.28),
    0 0 42px rgba(30, 110, 160, 0.22),
    0 28px 60px rgba(0, 0, 0, 0.55);
  touch-action: none;
}

.hint {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.06em;
  color: rgba(201, 162, 90, 0.55);
  text-align: center;
}

@media (max-height: 720px), (hover: none) {
  .hint {
    display: none;
  }
}

#boot-error {
  position: fixed;
  inset: 0;
  background: rgba(3, 8, 14, 0.95);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  color: #f5eadd;
}

#boot-error[hidden] {
  display: none;
}

#boot-error pre {
  max-width: 90vw;
  white-space: pre-wrap;
  color: #f07ab0;
  font-size: 12px;
}


/* touch pad — phones only */
.touch {
  display: none;
  position: fixed;
  left: 50%;
  bottom: max(14px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  grid-template-columns: repeat(3, 48px);
  grid-template-rows: repeat(3, 48px);
  gap: 5px;
  z-index: 5;
}

.touch .pad {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid rgba(201, 162, 90, 0.45);
  background: rgba(8, 20, 34, 0.72);
  color: rgba(245, 234, 221, 0.9);
  font-size: 18px;
  font-family: inherit;
  display: grid;
  place-items: center;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  backdrop-filter: blur(4px);
}

.touch .pad:active {
  background: rgba(42, 63, 134, 0.9);
  border-color: rgba(106, 212, 240, 0.8);
}

.touch .up { grid-area: 1 / 2; }
.touch .left { grid-area: 2 / 1; }
.touch .sing { grid-area: 2 / 2; font-size: 20px; color: #6ad4f0; }
.touch .right { grid-area: 2 / 3; }
.touch .down { grid-area: 3 / 2; }

@media (hover: none) and (pointer: coarse) {
  body {
    padding-bottom: 176px;
  }
  .touch {
    display: grid;
  }
}


/* share sheet */
.share {
  position: fixed;
  left: 50%;
  bottom: 24%;
  transform: translateX(-50%);
  z-index: 20;
  padding: 10px 14px 12px;
  border-radius: 12px;
  background: rgba(6, 14, 24, 0.95);
  border: 1px solid rgba(201, 162, 90, 0.5);
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.55);
  text-align: center;
}

.share-title {
  margin: 0 0 9px;
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--gold);
}

.share-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.share-btn {
  display: inline-block;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(201, 162, 90, 0.45);
  background: rgba(14, 30, 50, 0.9);
  color: #f5eadd;
  font: inherit;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-decoration: none;
  cursor: pointer;
}

.share-btn:hover {
  border-color: #6ad4f0;
  color: #6ad4f0;
}

.share[hidden] {
  display: none;
}

body.sharing .touch {
  display: none !important;
}
