:root {
  color-scheme: dark;
  --panel: rgba(14, 18, 35, 0.86);
  --ink: #f4f8ff;
  --muted: #a2b1d4;
  --line: rgba(133, 170, 255, 0.18);
  --primary: #7db5ff;
  --primary-deep: #4c73ff;
  --accent: #ffb25b;
  --accent-deep: #db7c37;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  min-height: 100%;
  overscroll-behavior: none;
}

body {
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  color: var(--ink);
  overflow: hidden;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-text-size-adjust: 100%;
  background:
    radial-gradient(circle at top left, rgba(125, 181, 255, 0.18), transparent 25%),
    radial-gradient(circle at bottom right, rgba(255, 178, 91, 0.18), transparent 28%),
    linear-gradient(160deg, #0a1221 0%, #17294b 52%, #27172b 100%);
}

.app-shell {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.game-panel {
  width: min(100vw, 460px);
  min-height: 100dvh;
  padding: max(8px, env(safe-area-inset-top)) 8px max(10px, env(safe-area-inset-bottom)) 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.heading,
.action-row,
.hud-strip {
  width: 100%;
  display: flex;
}

.heading {
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}

.hub-link {
  flex: 0 0 auto;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  text-decoration: none;
  color: var(--ink);
  font-weight: 700;
}

.eyebrow,
.label {
  display: block;
  font-size: 0.54rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

h1 {
  margin: 1px 0 0;
  font-size: 1.06rem;
  line-height: 1;
}

.play-area {
  width: 100%;
  display: flex;
  justify-content: center;
}

.board-wrap {
  position: relative;
}

#game {
  display: block;
  width: min(100%, 340px);
  max-height: calc(100dvh - 264px);
  height: auto;
  border-radius: 22px;
  border: 1px solid rgba(125, 181, 255, 0.18);
  background:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(180deg, #121c34 0%, #0d1220 100%);
  background-size: 24px 24px, 24px 24px, auto;
  touch-action: none;
}

.effect-layer {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  border-radius: 22px;
}

.burst {
  position: absolute;
  left: 50%;
  top: 28%;
  transform: translate(-50%, 0);
  padding: 10px 12px;
  border-radius: 999px;
  background: rgba(14, 22, 40, 0.8);
  border: 1px solid rgba(125, 181, 255, 0.22);
  font-weight: 800;
  animation: burst-fade 900ms ease forwards;
}

.action-row {
  gap: 8px;
  justify-content: center;
  margin-top: 4px;
}

.status-line {
  width: 100%;
  margin: 2px 0 0;
  min-height: 1em;
  color: var(--muted);
  text-align: center;
  font-size: 0.58rem;
}

.hud-strip {
  gap: 4px;
  margin-top: 2px;
}

.hud-chip {
  flex: 1 1 0;
  min-width: 0;
  padding: 4px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(125, 181, 255, 0.1);
  text-align: center;
}

strong {
  display: block;
  margin-top: 2px;
  font-size: 0.72rem;
}

button {
  border: none;
  border-radius: 999px;
  min-height: 42px;
  min-width: 124px;
  padding: 9px 12px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.primary-button {
  color: #09111f;
  background: linear-gradient(135deg, var(--primary), var(--primary-deep));
}

.ghost-button {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.08);
}

@keyframes burst-fade {
  0% {
    opacity: 0;
    transform: translate(-50%, 12px) scale(0.92);
  }
  18% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -16px) scale(1.03);
  }
}

@media (min-width: 461px) {
  .game-panel {
    min-height: auto;
    border-radius: 28px;
    padding: 10px;
  }
}

@media (max-height: 760px) {
  #game {
    max-height: calc(100dvh - 248px);
  }
}
