:root {
  color-scheme: dark;
  --panel: rgba(18, 11, 33, 0.88);
  --ink: #fff4fb;
  --muted: #d4b6d5;
  --line: rgba(255, 105, 180, 0.16);
  --primary: #ff87d0;
  --primary-deep: #9b59ff;
  --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(255,135,208,0.18), transparent 25%),
    radial-gradient(circle at bottom right, rgba(125,181,255,0.16), transparent 28%),
    linear-gradient(160deg, #120d23 0%, #24163b 50%, #10233f 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 {
  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(255, 135, 208, 0.18);
  background: linear-gradient(180deg, #1a1230 0%, #0d1020 100%);
  touch-action: none;
}

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

.burst {
  position: absolute;
  left: 50%;
  top: 30%;
  transform: translate(-50%, 0);
  padding: 10px 12px;
  border-radius: 999px;
  background: rgba(25, 14, 43, 0.84);
  border: 1px solid rgba(255, 135, 208, 0.24);
  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(255, 135, 208, 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: #170f23;
  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);
  }
}
