:root {
  color-scheme: dark;
  --panel: rgba(8, 16, 22, 0.86);
  --ink: #eafdf8;
  --muted: #98bdb6;
  --line: rgba(123, 255, 196, 0.14);
  --primary: #3ddc97;
  --primary-deep: #149b6e;
  --accent: #ff5b5b;
  --accent-deep: #c32f59;
  --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(61, 220, 151, 0.16), transparent 26%),
    radial-gradient(circle at bottom right, rgba(255, 91, 91, 0.18), transparent 30%),
    linear-gradient(160deg, #071116 0%, #0d1f26 48%, #150c18 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(123, 255, 196, 0.16);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
  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, #0b1520 0%, #090d14 100%);
  background-size: 24px 24px, 24px 24px, auto;
  touch-action: none;
}

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

.burst {
  position: absolute;
  left: 50%;
  top: 30%;
  transform: translate(-50%, 0);
  padding: 10px 12px;
  border-radius: 999px;
  background: rgba(12, 22, 28, 0.74);
  border: 1px solid rgba(123, 255, 196, 0.22);
  color: #dcfff2;
  font-weight: 800;
  letter-spacing: 0.04em;
  animation: burst-fade 1s 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(123, 255, 196, 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: #04110c;
  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);
  }
}
