:root {
  color-scheme: dark;
  --bg0: #120f1c;
  --bg1: #221734;
  --panel: rgba(16, 18, 30, 0.82);
  --panel-border: rgba(255, 255, 255, 0.12);
  --text: #f8f5ff;
  --muted: #cbbde0;
  --gold: #ffd56a;
  --accent: #ff6f61;
  --accent-2: #73f0ff;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", "Hiragino Sans", "Yu Gothic UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top, rgba(255, 140, 102, 0.28), transparent 32%),
    radial-gradient(circle at bottom right, rgba(115, 240, 255, 0.2), transparent 30%),
    linear-gradient(160deg, var(--bg0), var(--bg1));
}

.app {
  width: min(100%, 980px);
  margin: 0 auto;
  padding: 18px 16px 32px;
}

.hero,
.stats,
.panel,
.board-shell,
.actions,
.support-strip,
.result {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  padding: 20px;
  border-radius: 28px;
}

.eyebrow,
.subtitle,
.message,
.result-label,
.support-strip a,
.stats span {
  color: var(--muted);
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 0.82rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3.8rem);
  line-height: 0.98;
}

.subtitle {
  margin: 10px 0 0;
  max-width: 38rem;
  line-height: 1.6;
}

.hub-link,
button,
.support-strip a {
  border-radius: 999px;
  text-decoration: none;
}

.hub-link {
  flex: 0 0 auto;
  padding: 12px 18px;
  color: #0d1020;
  font-weight: 800;
  background: linear-gradient(135deg, var(--gold), #ff9f68);
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
  padding: 12px;
  border-radius: 22px;
}

.stats div {
  padding: 12px 10px;
  border-radius: 18px;
  text-align: center;
  background: rgba(255, 255, 255, 0.05);
}

.stats span {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
}

.stats strong {
  display: block;
  margin-top: 5px;
  font-size: 1.55rem;
}

.panel {
  margin-top: 16px;
  padding: 16px;
  border-radius: 22px;
}

.message {
  margin: 0 0 14px;
  line-height: 1.55;
}

.tray-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
}

.tray {
  min-height: 86px;
  padding: 12px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.tray.is-complete {
  box-shadow: 0 0 0 2px rgba(255, 213, 106, 0.4);
}

.tray-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
  font-size: 0.82rem;
}

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

.tray-slot {
  aspect-ratio: 1;
  border-radius: 50%;
  border: 2px dashed rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.03);
}

.tray-slot.filled {
  border-style: solid;
}

.board-shell {
  position: relative;
  margin-top: 16px;
  min-height: 500px;
  padding: 18px;
  overflow: hidden;
  border-radius: 30px;
}

.board-shell::before {
  content: "";
  position: absolute;
  inset: 12px;
  border-radius: 24px;
  background:
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 34px 34px;
}

.board {
  position: relative;
  z-index: 1;
  min-height: 460px;
}

.board-glow {
  position: absolute;
  inset: auto -10% -28% auto;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 213, 106, 0.28), transparent 65%);
  filter: blur(10px);
}

.plate {
  position: absolute;
  width: clamp(180px, 28vw, 250px);
  height: clamp(120px, 18vw, 168px);
  border-radius: 32px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.28);
  border: 3px solid rgba(255, 255, 255, 0.22);
  transition: transform 180ms ease, opacity 240ms ease, filter 180ms ease;
}

.plate::before,
.plate::after {
  content: "";
  position: absolute;
  inset: 12px;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.plate::after {
  inset: 26px;
  border-style: dashed;
}

.plate.cleared {
  opacity: 0;
  transform: translateY(44px) rotate(8deg) scale(0.92);
  filter: saturate(0.4);
}

.plate-label {
  position: absolute;
  top: 14px;
  left: 18px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  background: rgba(10, 12, 22, 0.32);
}

.bolt {
  position: absolute;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.28);
  transition: transform 120ms ease, box-shadow 120ms ease, opacity 160ms ease;
}

.bolt::before,
.bolt::after {
  content: "";
  position: absolute;
  inset: 50% auto auto 50%;
  width: 18px;
  height: 3px;
  margin-left: -9px;
  margin-top: -1.5px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.9);
}

.bolt::after {
  transform: rotate(90deg);
}

.bolt:hover,
.bolt:active {
  transform: scale(1.08);
}

.bolt.hidden {
  opacity: 0.32;
  pointer-events: none;
  filter: grayscale(0.55);
}

.bolt.removed {
  opacity: 0;
  transform: scale(0.2);
  pointer-events: none;
}

.bolt.hinting {
  animation: pulse 0.9s ease-in-out 2;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.18); box-shadow: 0 0 0 10px rgba(255, 213, 106, 0.16); }
}

.actions {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
  padding: 12px;
  border-radius: 22px;
}

button {
  appearance: none;
  min-height: 50px;
  border: 0;
  color: var(--text);
  font-weight: 800;
  letter-spacing: 0.06em;
  background: rgba(255, 255, 255, 0.06);
}

button.primary {
  color: #111319;
  background: linear-gradient(135deg, var(--gold), #ff9560);
}

button.ghost {
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.support-strip {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
  padding: 14px;
  border-radius: 22px;
}

.support-strip a {
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.05);
}

.result {
  margin-top: 16px;
  padding: 18px;
  text-align: center;
  border-radius: 24px;
}

.result strong {
  display: block;
  margin: 8px 0;
  font-size: clamp(2rem, 8vw, 3.6rem);
}

@media (max-width: 720px) {
  .app {
    padding: 14px 12px 28px;
  }

  .hero {
    flex-direction: column;
  }

  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .board-shell {
    min-height: 440px;
    padding: 14px;
  }

  .board {
    min-height: 400px;
  }

  .plate {
    width: clamp(160px, 44vw, 210px);
    height: clamp(110px, 30vw, 150px);
    border-radius: 26px;
  }

  .plate::before {
    inset: 10px;
  }

  .plate::after {
    inset: 20px;
  }

  .actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .actions .primary {
    grid-column: 1 / -1;
  }

  .bolt {
    width: 38px;
    height: 38px;
  }
}
