:root {
  color-scheme: light;
  --bg: #f6fbff;
  --card: rgba(255, 255, 255, 0.92);
  --ink: #19304a;
  --muted: #62738a;
  --blue: #2f80ed;
  --green: #19a974;
  --yellow: #ffd166;
  --red: #f05d5e;
  --shadow: 0 18px 50px rgba(31, 75, 120, 0.14);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, #d9f1ff 0, transparent 32rem),
    linear-gradient(135deg, #f9fcff, #eef7ff 55%, #fff7dc);
}

button, select, input { font: inherit; }
button {
  border: 0;
  border-radius: 14px;
  padding: 0.75rem 1rem;
  background: #eaf2ff;
  color: var(--ink);
  cursor: pointer;
  font-weight: 700;
  box-shadow: inset 0 -2px 0 rgba(25, 48, 74, 0.08);
}
button:hover { transform: translateY(-1px); }
button.primary { background: var(--blue); color: white; }
button.danger { background: #ffe3e3; color: #a51d2d; }

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

.hero-card, .panel, .game-card {
  background: var(--card);
  border: 1px solid rgba(47, 128, 237, 0.12);
  border-radius: 28px;
  box-shadow: var(--shadow);
}

.hero-card {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  padding: 24px 28px;
  margin-bottom: 20px;
}

.eyebrow {
  color: var(--blue);
  font-weight: 800;
  letter-spacing: 0.08em;
  margin: 0 0 6px;
}

h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 10px; font-size: clamp(1.8rem, 4vw, 3rem); }
.subtitle, .prompt, .tip-box p, .controls p { color: var(--muted); line-height: 1.65; }
.score-card {
  min-width: 138px;
  text-align: center;
  border-radius: 22px;
  padding: 16px;
  background: #fff8df;
}
.score-card strong { display: block; font-size: 2rem; color: #b06b00; }
.layout { display: grid; grid-template-columns: 340px 1fr; gap: 20px; }
.panel, .game-card { padding: 22px; }
.label { display: block; margin-bottom: 8px; color: var(--muted); font-weight: 700; }
select, input {
  width: 100%;
  border: 1px solid #d7e5f5;
  border-radius: 14px;
  padding: 0.75rem 0.9rem;
  background: white;
}
.tip-box, .message, .completion {
  border-radius: 18px;
  padding: 14px 16px;
  margin: 14px 0;
}
.tip-box { background: #f0f8ff; }
.message { min-height: 72px; background: #eefaf5; color: #0f6246; line-height: 1.5; }
.completion { background: #fff2c9; font-weight: 800; color: #8a5600; }
.stars { display: grid; gap: 8px; margin: 16px 0; }
.star {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 14px;
  background: #f4f7fb;
  color: var(--muted);
}
.star.done { background: #fff5c4; color: #8a5600; font-weight: 800; }
.map-toolbar, .phone-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.phone-row { grid-template-columns: 140px 1fr auto; align-items: center; }
.game-map {
  position: relative;
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 5px;
  padding: 12px;
  min-height: 600px;
  border-radius: 26px;
  background: linear-gradient(160deg, #dff0ff, #ffffff 48%, #fff2bf);
  border: 2px solid white;
  overflow: hidden;
}
.cell {
  position: relative;
  min-height: 52px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px dashed rgba(98, 115, 138, 0.18);
}
.cell.unsafe { background: #ffe8e8; border-color: rgba(240, 93, 94, 0.35); }
.cell.help { outline: 3px solid rgba(25, 169, 116, 0.35); background: #e9fff6; }
.cell::after {
  content: attr(data-label);
  position: absolute;
  inset: auto 4px 4px;
  font-size: 0.68rem;
  color: rgba(25, 48, 74, 0.62);
}
.sprite {
  position: absolute;
  transform: translate(-50%, -50%);
  z-index: 3;
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 18px;
  background: white;
  border: 3px solid #dcecff;
  font-size: 1.8rem;
  box-shadow: 0 10px 22px rgba(31, 75, 120, 0.18);
}
.sprite.player { border-color: var(--blue); background: #eaf4ff; }
.sprite.staff { border-color: var(--green); }
.sprite.backup { border-color: #9b72ff; }
.sprite.stranger { border-color: var(--red); background: #fff0f0; }
.sprite span {
  position: absolute;
  left: 50%;
  top: 58px;
  transform: translateX(-50%);
  width: max-content;
  max-width: 132px;
  padding: 4px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--ink);
}
.controls { display: grid; place-items: center; gap: 8px; margin-top: 14px; }
.controls div { display: flex; gap: 8px; }
.controls button { min-width: 58px; background: #eef6ff; }
.controls p { text-align: center; margin-bottom: 0; }

@media (max-width: 900px) {
  .layout, .hero-card { grid-template-columns: 1fr; display: grid; }
  .map-toolbar, .phone-row { grid-template-columns: 1fr; }
  .game-map { min-height: 520px; }
}
