* {
  box-sizing: border-box;
}

:root {
  --ink: #f8fafc;
  --muted: #9aa4b2;
  --panel: rgba(255, 255, 255, 0.08);
  --line: rgba(255, 255, 255, 0.16);
  --hot: #ff3f6e;
  --lime: #b5f25d;
  --cyan: #52d7ff;
  --amber: #ffca4d;
  --bg: #16171f;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
}

body {
  color: var(--ink);
  font-family: Inter, "Noto Sans JP", system-ui, sans-serif;
  background:
    radial-gradient(circle at 15% 12%, rgba(255, 63, 110, 0.28), transparent 28rem),
    radial-gradient(circle at 85% 18%, rgba(82, 215, 255, 0.22), transparent 26rem),
    linear-gradient(160deg, #171821 0%, #24252f 48%, #111217 100%);
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.app {
  width: min(720px, 100%);
  min-height: 100svh;
  margin: 0 auto;
  padding: 12px clamp(12px, 4vw, 26px) 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--lime);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

h1 {
  margin: 0;
  font-size: clamp(26px, 6vw, 42px);
  line-height: 1.04;
  letter-spacing: 0;
}

.hub-link,
button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.1);
  font: inherit;
  font-weight: 900;
  text-decoration: none;
  cursor: pointer;
}

.hub-link {
  display: inline-grid;
  place-items: center;
  width: 54px;
  flex: 0 0 auto;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.stats div {
  min-width: 0;
  padding: 8px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  text-align: center;
}

.stats span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.stats strong {
  display: block;
  margin-top: 2px;
  font-size: clamp(19px, 6vw, 28px);
  line-height: 1;
}

.board-wrap {
  flex: 1;
  display: grid;
  align-content: center;
  gap: 12px;
}

.message {
  min-height: 38px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #e8edf4;
  background: rgba(0, 0, 0, 0.18);
  font-size: 14px;
  font-weight: 800;
  text-align: center;
}

.board {
  --size: min(86vw, 340px, calc(100svh - 405px));
  min-width: 260px;
  min-height: 260px;
  width: var(--size);
  height: var(--size);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  grid-template-rows: repeat(6, 1fr);
  gap: 6px;
}

.cell {
  position: relative;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.18);
  overflow: hidden;
}

.tile {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  color: #111217;
  background: linear-gradient(135deg, var(--cyan), var(--lime));
  box-shadow: inset 0 -8px 16px rgba(0, 0, 0, 0.12), 0 8px 20px rgba(0, 0, 0, 0.24);
  font-size: clamp(22px, 8vw, 42px);
  transition: transform 160ms ease, opacity 160ms ease, filter 160ms ease;
}

.tile.blocked {
  filter: grayscale(0.45) brightness(0.72);
}

.tile.ready {
  outline: 3px solid rgba(255, 255, 255, 0.8);
  outline-offset: -5px;
}

.tile.hint {
  animation: hint 620ms ease-in-out 2;
}

.cell.bumper::after {
  content: "";
  width: 54%;
  height: 54%;
  border-radius: 50%;
  background: linear-gradient(135deg, #ffca4d, #ff7a45);
  box-shadow: inset 0 -8px 15px rgba(0, 0, 0, 0.2);
}

.controls {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 8px;
}

.support-strip {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 8px;
}

.support-strip a,
.patreon-cta {
  min-height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.09);
  font-size: 13px;
  font-weight: 900;
  text-align: center;
  text-decoration: none;
}

.support-strip a:first-child,
.patreon-cta {
  border-color: rgba(255, 202, 77, 0.55);
  color: #fff6d7;
  background: linear-gradient(135deg, rgba(255, 202, 77, 0.22), rgba(255, 63, 110, 0.2));
}

button {
  padding: 0 12px;
}

button.primary {
  border-color: rgba(255, 255, 255, 0.4);
  background: linear-gradient(135deg, var(--hot), #ff7a45);
  box-shadow: 0 12px 30px rgba(255, 63, 110, 0.28);
}

button:active {
  transform: translateY(1px) scale(0.99);
}

.result {
  position: fixed;
  inset: auto 12px 14px;
  max-width: 520px;
  margin: 0 auto;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  background: rgba(17, 18, 23, 0.94);
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.45);
  text-align: center;
}

.result-label {
  margin: 0;
  color: var(--lime);
  font-size: 12px;
  font-weight: 900;
}

.result strong {
  display: block;
  margin: 4px 0;
  font-size: 56px;
  line-height: 1;
}

.result p {
  color: var(--muted);
}

.patreon-cta {
  margin: 0 0 8px;
}

.result button {
  width: calc(50% - 5px);
  margin: 4px 2px 0;
}

@keyframes hint {
  50% {
    transform: scale(1.08);
    box-shadow: 0 0 0 8px rgba(255, 255, 255, 0.18);
  }
}

@media (max-width: 420px) {
  .app {
    gap: 10px;
    padding-top: 12px;
  }

  .board {
    --size: min(92vw, calc(100svh - 360px));
    min-width: 240px;
    min-height: 240px;
    gap: 4px;
  }

  .stats {
    gap: 5px;
  }

  .stats div {
    padding-inline: 4px;
  }

  .message {
    font-size: 12px;
  }

  .support-strip {
    grid-template-columns: 1fr;
  }
}
