:root {
  --bgTop: #08131f;
  --bgBottom: #12314a;
  --panel: rgba(9, 20, 29, 0.88);
  --panelEdge: rgba(255, 255, 255, 0.12);
  --text: #f3f7ef;
  --muted: #b6c8c5;
  --accentA: #ffbe0b;
  --accentB: #fb5607;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Verdana", "Trebuchet MS", sans-serif;
  color: var(--text);
  overscroll-behavior: none;
  background:
    radial-gradient(circle at 20% 0%, rgba(255, 190, 11, 0.2), transparent 34%),
    linear-gradient(180deg, var(--bgTop), var(--bgBottom));
}

.layout {
  width: min(1280px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 20px 0;
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.panel,
.stage {
  background: var(--panel);
  border: 1px solid var(--panelEdge);
  border-radius: 22px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.3);
}

.panel {
  padding: 22px;
}

.tag {
  margin: 0 0 8px;
  color: var(--accentA);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 0.72rem;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 12px;
  font-size: clamp(2rem, 4.4vw, 3.2rem);
  line-height: 0.95;
}

.intro,
.tips p {
  color: var(--muted);
  line-height: 1.55;
}

.tips {
  margin: 16px 0;
  padding: 14px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.miniHud {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
  padding: 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.05);
}

.label {
  display: block;
  margin-bottom: 3px;
  font-size: 0.75rem;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.buttonRow {
  display: grid;
  gap: 10px;
}

.button {
  width: 100%;
  border: 0;
  border-radius: 999px;
  padding: 13px 16px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 120ms ease, filter 120ms ease;
}

.button:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

.button.primary {
  color: #1c2227;
  background: linear-gradient(130deg, var(--accentA), var(--accentB));
}

.button.secondary {
  color: var(--text);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.16);
}

.stage {
  position: relative;
  overflow: hidden;
  min-height: 600px;
  display: grid;
  align-content: start;
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 10;
  background: linear-gradient(180deg, #8db7d6 0%, #d9e6ef 32%, #698a60 32%, #506b4a 100%);
}

.overlay {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(8, 18, 27, 0.52);
}

.overlay.visible {
  display: flex;
}

.overlayCard {
  width: min(420px, calc(100% - 28px));
  padding: 24px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(10, 20, 30, 0.93);
  text-align: center;
}

.touchControls {
  display: none;
  gap: 8px;
  padding: 10px;
  background: rgba(7, 17, 27, 0.68);
}

.touchButton {
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font: inherit;
  font-weight: 700;
  padding: 12px 8px;
  touch-action: none;
  user-select: none;
}

.touchButton.active {
  background: rgba(255, 190, 11, 0.25);
  border-color: rgba(255, 190, 11, 0.7);
}

@media (max-width: 980px) {
  .layout {
    grid-template-columns: 1fr;
    width: min(980px, calc(100vw - 18px));
    gap: 12px;
    padding: 10px 0;
  }

  .panel {
    padding: 16px;
  }

  .stage {
    min-height: 0;
    border-radius: 16px;
  }

  canvas {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }

  .touchControls {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .overlayCard {
    padding: 18px;
    border-radius: 16px;
  }

  .intro,
  .tips p {
    font-size: 0.95rem;
  }

  h1 {
    font-size: clamp(1.7rem, 9vw, 2.4rem);
  }
}
