:root {
  color-scheme: only light;
  --ink: #1d1b1f;
  --muted: #5d5a67;
  --bg: #fff7ee;
  --panel: #ffffff;
  --accent: #ff9f6e;
  --accent-2: #86b7ff;
  --good: #4caf50;
  --bad: #ff6b6b;
  --shadow: rgba(20, 12, 30, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  background:
    radial-gradient(circle at 10% 15%, rgba(255, 159, 110, 0.2), transparent 40%),
    radial-gradient(circle at 85% 20%, rgba(134, 183, 255, 0.2), transparent 40%),
    linear-gradient(160deg, #fff6ec, #f8f3ff);
  color: var(--ink);
  min-height: 100vh;
  padding: 28px 6vw 48px;
}

h1 {
  margin: 0 0 8px;
  font-weight: 600;
  font-size: clamp(28px, 4vw, 44px);
}

p {
  margin: 0;
  color: var(--muted);
}

a {
  color: inherit;
  text-decoration: none;
}

.page-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 32px;
}

.header-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.panel {
  background: rgba(255, 255, 255, 0.8);
  border-radius: 24px;
  padding: 24px;
  box-shadow: 0 18px 40px var(--shadow);
  display: grid;
  gap: 24px;
}

.gallery-view .section-title {
  margin-bottom: 18px;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
}

.gallery-card {
  border-radius: 18px;
  overflow: hidden;
  border: 2px solid transparent;
  background: #fff;
  box-shadow: 0 12px 24px rgba(29, 27, 31, 0.12);
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease;
  text-align: left;
  padding: 0;
}

.gallery-card img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  display: block;
}

.gallery-card span {
  display: block;
  padding: 10px 12px;
  font-size: 13px;
  color: var(--muted);
}

.gallery-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 159, 110, 0.6);
}

.game-view.is-hidden {
  display: none;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
}

.controls label {
  display: grid;
  gap: 6px;
  font-size: 14px;
  color: var(--muted);
}

.toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
}

select {
  border-radius: 999px;
  border: 1px solid rgba(29, 27, 31, 0.15);
  padding: 8px 14px;
  font-size: 14px;
}

.hint {
  flex: 1;
  min-width: 200px;
  font-size: 13px;
  color: var(--muted);
}

.btn {
  border: none;
  border-radius: 999px;
  padding: 10px 18px;
  background: linear-gradient(135deg, var(--accent), #ffd59f);
  color: var(--ink);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn.ghost {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(29, 27, 31, 0.1);
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(29, 27, 31, 0.18);
}

.board {
  display: grid;
}

.stage {
  position: relative;
  width: min(900px, 100%);
  margin: 0 auto;
}

.stage img {
  width: 100%;
  display: block;
  border-radius: 18px;
  box-shadow: 0 16px 30px rgba(29, 27, 31, 0.18);
}

.regions {
  position: absolute;
  inset: 0;
}

.region {
  position: absolute;
  border-radius: 12px;
  border: 2px dashed transparent;
  background: transparent;
  transition: transform 0.2s ease;
  touch-action: none;
}

.region:hover {
  transform: scale(1.01);
}

.stage.show-regions .region {
  border-color: rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.08);
}

.feedback {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: grid;
  place-items: center;
  font-size: clamp(28px, 5vw, 56px);
  font-weight: 700;
  color: var(--good);
  opacity: 0;
  text-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  background: rgba(255, 255, 255, 0.65);
  backdrop-filter: blur(2px);
}

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

.feedback.show {
  animation: pop 3s ease;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: rgba(29, 27, 31, 0.9);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
  font-size: 13px;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, -6px);
}

@keyframes pop {
  0% {
    opacity: 0;
    transform: scale(0.6);
  }
  15% {
    opacity: 1;
    transform: scale(1.05);
  }
  80% {
    opacity: 1;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(1);
  }
}

@media (max-width: 720px) {
  .panel {
    padding: 18px;
  }

  .controls {
    flex-direction: column;
    align-items: flex-start;
  }

  .header-actions {
    width: 100%;
    justify-content: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}
