:root {
  --bg1: #10131f;
  --bg2: #1b2a41;
  --ink: #f6f7fb;
  --accent: #ffb703;
  --danger: #ef476f;
  --ok: #06d6a0;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at 20% 20%, #263859, var(--bg1) 60%),
    linear-gradient(140deg, var(--bg1), var(--bg2));
  overflow: hidden;
}

.wrap {
  width: 100vw;
  height: 100dvh;
  padding: calc(8px + env(safe-area-inset-top)) 10px calc(8px + env(safe-area-inset-bottom));
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 8px;
}

.topbar {
  display: grid;
  gap: 4px;
}

h1 {
  margin: 0 0 6px;
  font-size: clamp(22px, 3vw, 34px);
}

.hint {
  margin: 0;
  opacity: 0.9;
  font-size: 14px;
}

canvas {
  width: min(100%, 960px);
  max-width: 100%;
  max-height: 100%;
  justify-self: center;
  align-self: center;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  background: #0d1b2a;
  image-rendering: pixelated;
}

.touch {
  display: none;
  margin: 0;
  gap: 10px;
}

.touch button {
  flex: 1;
  border: none;
  border-radius: 10px;
  padding: 14px 10px;
  font-size: 18px;
  background: rgba(255, 255, 255, 0.14);
  color: var(--ink);
}

.touch button:active {
  background: rgba(255, 183, 3, 0.5);
}

@media (max-width: 900px) {
  .topbar p,
  .hint {
    font-size: 13px;
  }

  h1 {
    font-size: clamp(18px, 5vw, 26px);
    margin-bottom: 2px;
  }

  .touch {
    display: flex;
  }
}
