:root {
  --bg: #eef6ff;
  --panel: #ffffff;
  --line: #cddcf3;
  --ink: #0f172a;
  --muted: #64748b;
  --ok: #10b981;
  --bad: #ef4444;
  --accent: #0ea5e9;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "SF Pro Display", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at top, #dbeafe 0%, var(--bg) 60%);
}

.app {
  max-width: 980px;
  margin: 0 auto;
  padding: 18px;
}

.topbar {
  background: var(--panel);
  border: 1.5px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.08);
  padding: 14px;
}

.topbar-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}

h1 {
  margin: 0;
  font-size: clamp(28px, 4vw, 38px);
}

.subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.topbar-tools {
  display: flex;
  flex-wrap: wrap;
  justify-content: end;
  gap: 6px;
}

.mini-btn,
.btn {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  color: #0f172a;
  border-radius: 10px;
  padding: 8px 10px;
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
}

.top-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.hud {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f5f9ff;
  text-align: center;
  padding: 7px 8px;
  font-weight: 800;
  font-size: 13px;
}

.target-panel {
  margin-top: 12px;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #f6fbff 100%);
  padding: 12px;
}

.target-title {
  font-size: 13px;
  color: #334155;
  font-weight: 900;
  margin-bottom: 8px;
}

.targets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.target-item {
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  padding: 6px 10px;
  background: #eff6ff;
  font-weight: 800;
  font-size: 14px;
  color: #1e3a8a;
}

.target-item.done {
  opacity: 0.55;
  text-decoration: line-through;
}

.feedback {
  margin-top: 8px;
  min-height: 20px;
  color: #334155;
  font-weight: 700;
}

.feedback.ok { color: var(--ok); }
.feedback.bad { color: var(--bad); }

.board-wrap {
  margin-top: 12px;
  position: relative;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #f0f8ff 100%);
  min-height: 500px;
  overflow: hidden;
}

.board {
  position: relative;
  min-height: 500px;
}

.item {
  position: absolute;
  width: 84px;
  height: 84px;
  border-radius: 16px;
  border: 1.5px solid #c7d8f7;
  background: linear-gradient(180deg, #ffffff 0%, #eef6ff 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.2s ease;
}

.item:hover {
  transform: scale(1.04);
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.22);
}

.item .emoji {
  font-size: 30px;
  line-height: 1;
}

.item .name {
  font-size: 12px;
  font-weight: 800;
  color: #334155;
}

.item.target-hit {
  border-color: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

.item.found {
  opacity: 0;
  transform: scale(0.92);
  pointer-events: none;
}

.board.shake {
  animation: shake 0.22s ease;
}

@keyframes shake {
  0% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  50% { transform: translateX(4px); }
  75% { transform: translateX(-3px); }
  100% { transform: translateX(0); }
}

.done-layer {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.16);
}

.done-layer.show {
  display: flex;
}

.done-card {
  background: #ffffff;
  border: 1.5px solid #bae6fd;
  box-shadow: 0 16px 40px rgba(2, 132, 199, 0.25);
  border-radius: 16px;
  padding: 16px;
  text-align: center;
  min-width: 240px;
}

.done-title {
  font-size: 22px;
  font-weight: 900;
  color: #0369a1;
  margin-bottom: 10px;
}

.play-again {
  border: none;
  border-radius: 10px;
  padding: 10px 14px;
  background: linear-gradient(135deg, #0ea5e9, #10b981);
  color: #fff;
  font-size: 14px;
  font-weight: 900;
  cursor: pointer;
}

.controls {
  margin-top: 10px;
  display: flex;
  gap: 8px;
}

.btn.ghost {
  background: #e2e8f0;
}

@media (max-width: 760px) {
  .topbar-head { grid-template-columns: 1fr; }
  .topbar-tools { justify-content: start; }
  .hud { grid-template-columns: 1fr; }
  .board,
  .board-wrap { min-height: 560px; }
}
