:root {
  --bg: #081120;
  --bg-card: rgba(15, 31, 54, 0.82);
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #eff6ff;
  --muted: #9fb2cd;
  --accent: #7c3aed;
  --accent-2: #06b6d4;
  --warning: #f59e0b;
  --success: #22c55e;
  --danger: #ef4444;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(124, 58, 237, 0.26), transparent 28%),
    radial-gradient(circle at top right, rgba(6, 182, 212, 0.2), transparent 24%),
    linear-gradient(160deg, #081120 0%, #0c172b 45%, #111e38 100%);
}

body {
  padding: 24px;
}

button {
  border: 0;
  font: inherit;
  cursor: pointer;
}

.app-shell {
  max-width: 1360px;
  margin: 0 auto;
}

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

.eyebrow {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 12px;
  color: #8ab4ff;
}

.hero h1 {
  margin: 0;
  font-size: clamp(30px, 4.6vw, 52px);
}

.hero-copy {
  margin: 12px 0 0;
  max-width: 760px;
  color: var(--muted);
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.layout {
  display: grid;
  grid-template-columns: minmax(320px, 390px) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.sidebar {
  display: grid;
  gap: 18px;
}

.card,
.board-frame {
  background: var(--bg-card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  border-radius: 24px;
  backdrop-filter: blur(18px);
}

.card {
  padding: 20px;
}

.section-title {
  margin: 0 0 10px;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #8ab4ff;
}

.level-line {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.level-line h2,
.level-line h3 {
  margin: 0;
}

.level-pill,
.map-badge {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.06);
  color: #dbeafe;
  font-size: 13px;
  white-space: nowrap;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.stat-item {
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.stat-label {
  display: block;
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--muted);
}

.stat-item strong {
  font-size: 28px;
}

.goal-track {
  margin-top: 18px;
}

.goal-meta,
.star-line {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.goal-meta {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 14px;
}

.star-line {
  margin-top: 16px;
}

.star-line strong {
  font-size: 24px;
  letter-spacing: 0.16em;
  color: #facc15;
}

.progress-bar {
  width: 100%;
  height: 14px;
  background: rgba(255, 255, 255, 0.07);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 18px rgba(124, 58, 237, 0.45);
  transition: width 220ms ease;
}

.goal-summary {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.goal-mode,
.goal-detail {
  margin: 0;
  line-height: 1.6;
}

.goal-mode {
  color: #dbeafe;
  font-weight: 700;
}

.goal-detail {
  margin-top: 6px;
  color: var(--muted);
  font-size: 14px;
}

.goal-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.goal-chip {
  padding: 7px 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #dbeafe;
  font-size: 13px;
}

.feedback-card {
  display: grid;
  gap: 16px;
}

.status-text {
  margin: 0;
  line-height: 1.7;
}

.combo-text {
  min-height: 40px;
  font-size: 28px;
  font-weight: 800;
  color: #facc15;
  text-shadow: 0 0 24px rgba(250, 204, 21, 0.55);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 240ms ease, transform 240ms ease;
}

.combo-text.active {
  opacity: 1;
  transform: translateY(0);
}

.tension-text {
  min-height: 24px;
  color: #fda4af;
  font-weight: 600;
}

.legend {
  display: grid;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
}

.legend span {
  display: flex;
  align-items: center;
  gap: 10px;
}

.legend-chip {
  width: 22px;
  height: 22px;
  display: inline-flex;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.legend-chip.striped-row {
  background: linear-gradient(135deg, #f472b6, #fb7185);
}

.legend-chip.striped-col {
  background: linear-gradient(135deg, #38bdf8, #818cf8);
}

.legend-chip.bomb {
  background: linear-gradient(135deg, #f59e0b, #ef4444);
}

.legend-chip.rainbow {
  background: linear-gradient(135deg, #f472b6, #facc15, #22c55e, #38bdf8);
}

.legend-chip.obstacle {
  background: linear-gradient(135deg, #cbd5e1, #94a3b8);
}

.button-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.primary-btn,
.ghost-btn {
  min-width: 96px;
  padding: 12px 16px;
  border-radius: 14px;
  color: var(--text);
  transition:
    transform 120ms ease,
    background 120ms ease,
    border-color 120ms ease,
    opacity 120ms ease;
}

.primary-btn {
  background: linear-gradient(135deg, var(--accent), #4f46e5);
  box-shadow: 0 12px 24px rgba(79, 70, 229, 0.3);
}

.ghost-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.primary-btn:hover,
.ghost-btn:hover {
  transform: translateY(-1px);
}

.primary-btn:disabled,
.ghost-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.tips-list {
  margin: 16px 0 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.7;
}

.map-track {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.map-node {
  position: relative;
  padding: 12px 8px;
  border-radius: 18px;
  text-align: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #dbeafe;
  min-height: 74px;
}

.map-node.current {
  border-color: rgba(125, 211, 252, 0.6);
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.16);
}

.map-node.completed {
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.3);
}

.map-node.locked {
  opacity: 0.42;
}

.map-node.celebration::after {
  content: "爽";
  position: absolute;
  top: -8px;
  right: -6px;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 12px;
  background: linear-gradient(135deg, #facc15, #f97316);
  color: #111827;
  font-weight: 900;
  box-shadow: 0 10px 18px rgba(249, 115, 22, 0.35);
}

.map-level {
  font-size: 18px;
  font-weight: 800;
}

.map-stars {
  margin-top: 6px;
  font-size: 13px;
  color: #facc15;
}

.compare-text {
  margin-top: 10px;
  color: #dbeafe;
  line-height: 1.6;
}

.leaderboard {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.leaderboard-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.leaderboard-row.player {
  border-color: rgba(125, 211, 252, 0.4);
  background: rgba(56, 189, 248, 0.12);
}

.leader-rank {
  font-weight: 800;
  color: #c4b5fd;
}

.leader-meta {
  min-width: 0;
}

.leader-name {
  font-weight: 700;
}

.leader-detail {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.leader-score {
  text-align: right;
  font-weight: 700;
}

.board-panel {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 16px;
}

.board-header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-end;
}

.board-header h2 {
  margin: 0;
  font-size: 34px;
}

.board-subtitle {
  margin: 0;
  max-width: 380px;
  color: var(--muted);
  line-height: 1.6;
}

.board-frame {
  position: relative;
  padding: 20px;
  min-height: 760px;
  overflow: hidden;
}

.board-aura {
  position: absolute;
  inset: -10%;
  background:
    radial-gradient(circle at 20% 20%, rgba(56, 189, 248, 0.16), transparent 22%),
    radial-gradient(circle at 80% 20%, rgba(244, 114, 182, 0.14), transparent 24%),
    radial-gradient(circle at 50% 85%, rgba(124, 58, 237, 0.18), transparent 28%);
  filter: blur(22px);
  pointer-events: none;
}

.board {
  --size: 8;
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--size), minmax(0, 1fr));
  gap: 10px;
  user-select: none;
}

.board.locked {
  pointer-events: none;
}

.tile {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.26),
    inset 0 -12px 24px rgba(255, 255, 255, 0.03),
    0 16px 30px rgba(0, 0, 0, 0.18);
  display: grid;
  place-items: center;
  font-size: clamp(24px, 1.8vw, 34px);
  color: white;
  overflow: hidden;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.06)),
    rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(12px) saturate(150%);
  -webkit-backdrop-filter: blur(12px) saturate(150%);
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    opacity 160ms ease,
    filter 160ms ease;
}

.tile:hover {
  transform: translateY(-2px) scale(1.02);
}

.tile::before {
  content: "";
  position: absolute;
  inset: 8% 10% auto;
  height: 28%;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.3);
  filter: blur(8px);
}

.tile::after {
  content: "";
  position: absolute;
  inset: auto 10% 8%;
  height: 24%;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  filter: blur(10px);
}

.tile.drag-source {
  transform: translateY(-3px) scale(1.05);
  box-shadow:
    0 0 0 3px rgba(255, 255, 255, 0.26),
    0 0 0 7px rgba(6, 182, 212, 0.2),
    0 24px 36px rgba(0, 0, 0, 0.26);
}

.tile.drag-preview {
  box-shadow:
    0 0 0 2px rgba(250, 204, 21, 0.32),
    0 14px 26px rgba(0, 0, 0, 0.24);
}

.tile-core,
.obstacle-core {
  position: relative;
  z-index: 2;
  font-weight: 800;
  text-shadow: 0 6px 18px rgba(0, 0, 0, 0.24);
}

.tile.ingredient .tile-core,
.tile.special-rainbow .tile-core,
.type-violet .tile-core,
.type-candy .tile-core,
.type-mint .tile-core {
  font-size: 0;
}

.tile.ingredient .tile-core::before,
.tile.special-rainbow .tile-core::before,
.type-violet .tile-core::before,
.type-candy .tile-core::before,
.type-mint .tile-core::before {
  display: inline-block;
  font-size: clamp(24px, 1.8vw, 34px);
}

.tile.ingredient .tile-core::before {
  content: "◉";
}

.tile.special-rainbow .tile-core::before {
  content: "✺";
}

.type-violet .tile-core::before {
  content: "✦";
}

.type-candy .tile-core::before {
  content: "⬢";
}

.type-mint .tile-core::before {
  content: "✳";
}

.obstacle-core {
  font-size: clamp(18px, 1.5vw, 24px);
}

.tile.selected {
  transform: translateY(-2px) scale(1.04);
  box-shadow:
    0 0 0 3px rgba(255, 255, 255, 0.22),
    0 0 0 6px rgba(124, 58, 237, 0.25),
    0 20px 32px rgba(0, 0, 0, 0.22);
}

.tile.hint {
  animation: hintPulse 1s ease-in-out infinite;
}

.tile.clearing {
  animation: popOut 260ms ease forwards;
}

.tile.shake {
  animation: shake 320ms ease;
}

.tile.special-row::after,
.tile.special-col::after,
.tile.special-bomb::after,
.tile.special-rainbow::after {
  position: absolute;
  bottom: 8px;
  right: 10px;
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  background: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(8px);
  z-index: 3;
}

.tile.special-row::after {
  content: "ROW";
}

.tile.special-col::after {
  content: "COL";
}

.tile.special-bomb::after {
  content: "BOMB";
}

.tile.special-rainbow::after {
  content: "ALL";
}

.tile.has-jelly {
  box-shadow:
    inset 0 0 0 2px rgba(236, 72, 153, 0.36),
    0 12px 24px rgba(0, 0, 0, 0.18);
}

.tile.has-jelly::after {
  content: "";
  position: absolute;
  inset: auto 8px 8px;
  height: 18px;
  border-radius: 999px;
  background: rgba(236, 72, 153, 0.26);
  filter: blur(2px);
}

.tile.has-ice {
  background-blend-mode: screen;
}

.tile.has-ice .overlay-badge,
.tile.has-chain .overlay-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 3;
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  color: #0f172a;
}

.tile.has-ice .overlay-badge {
  background: rgba(191, 219, 254, 0.95);
}

.tile.has-chain .overlay-badge {
  background: rgba(254, 215, 170, 0.95);
}

.tile.has-ice .overlay-mask,
.tile.has-chain .overlay-mask {
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
}

.tile.has-ice .overlay-mask {
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.26), transparent 58%),
    rgba(191, 219, 254, 0.18);
  border: 2px solid rgba(191, 219, 254, 0.48);
}

.tile.has-chain .overlay-mask {
  background:
    repeating-linear-gradient(
      45deg,
      rgba(251, 191, 36, 0.18) 0,
      rgba(251, 191, 36, 0.18) 7px,
      rgba(255, 255, 255, 0.02) 7px,
      rgba(255, 255, 255, 0.02) 14px
    ),
    rgba(250, 204, 21, 0.12);
  border: 2px solid rgba(251, 191, 36, 0.28);
}

.tile.obstacle-stone {
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.14), transparent),
    linear-gradient(145deg, rgba(100, 116, 139, 0.92), rgba(51, 65, 85, 0.96));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 14px 26px rgba(0, 0, 0, 0.28);
}

.type-ruby {
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.24), rgba(255, 255, 255, 0.04)),
    linear-gradient(145deg, rgba(251, 113, 133, 0.82), rgba(244, 63, 94, 0.5));
}

.type-sun {
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.24), rgba(255, 255, 255, 0.04)),
    linear-gradient(145deg, rgba(251, 191, 36, 0.82), rgba(245, 158, 11, 0.52));
}

.type-lime {
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.24), rgba(255, 255, 255, 0.04)),
    linear-gradient(145deg, rgba(74, 222, 128, 0.8), rgba(34, 197, 94, 0.5));
}

.type-wave {
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.24), rgba(255, 255, 255, 0.04)),
    linear-gradient(145deg, rgba(56, 189, 248, 0.8), rgba(14, 165, 233, 0.5));
}

.type-violet {
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.24), rgba(255, 255, 255, 0.04)),
    linear-gradient(145deg, rgba(167, 139, 250, 0.82), rgba(139, 92, 246, 0.48));
}

.type-candy {
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.24), rgba(255, 255, 255, 0.04)),
    linear-gradient(145deg, rgba(244, 114, 182, 0.8), rgba(236, 72, 153, 0.48));
}

.type-mint {
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.24), rgba(255, 255, 255, 0.04)),
    linear-gradient(145deg, rgba(45, 212, 191, 0.82), rgba(20, 184, 166, 0.5));
}

.type-rainbow {
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.32), transparent),
    linear-gradient(135deg, rgba(244, 114, 182, 0.78), rgba(250, 204, 21, 0.72), rgba(34, 197, 94, 0.66), rgba(56, 189, 248, 0.72), rgba(167, 139, 250, 0.76));
}

.tile.ingredient {
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0.1)),
    linear-gradient(145deg, rgba(255, 255, 255, 0.18), rgba(56, 189, 248, 0.18));
}

.tile.ingredient::after {
  content: "DROP";
  position: absolute;
  bottom: 8px;
  left: 10px;
  z-index: 3;
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  color: #082f49;
  background: rgba(186, 230, 253, 0.92);
}

.tile.drop-exit {
  box-shadow:
    inset 0 -10px 0 rgba(34, 197, 94, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.26),
    0 16px 30px rgba(0, 0, 0, 0.18);
}

.tile.drop-exit .exit-badge {
  position: absolute;
  bottom: 8px;
  right: 10px;
  z-index: 3;
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  color: #052e16;
  background: rgba(187, 247, 208, 0.92);
}

.effects-layer {
  position: absolute;
  inset: 20px;
  pointer-events: none;
}

.fx-burst {
  position: absolute;
  width: 18px;
  height: 18px;
  margin-left: -9px;
  margin-top: -9px;
  border-radius: 50%;
  animation: burst 520ms ease-out forwards;
}

.fx-burst.normal {
  background: radial-gradient(circle, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0));
}

.fx-burst.row,
.fx-burst.col {
  background: radial-gradient(circle, rgba(56, 189, 248, 0.95), rgba(56, 189, 248, 0));
}

.fx-burst.bomb {
  background: radial-gradient(circle, rgba(245, 158, 11, 0.96), rgba(239, 68, 68, 0));
}

.fx-burst.rainbow {
  background: radial-gradient(circle, rgba(250, 204, 21, 0.96), rgba(56, 189, 248, 0));
}

.fx-burst.unlock {
  background: radial-gradient(circle, rgba(226, 232, 240, 0.95), rgba(148, 163, 184, 0));
}

.floating-score {
  position: fixed;
  z-index: 99;
  padding: 6px 10px;
  border-radius: 999px;
  font-weight: 900;
  pointer-events: none;
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #fef3c7;
  box-shadow: 0 14px 24px rgba(0, 0, 0, 0.24);
}

.floating-score.obstacle {
  color: #bfdbfe;
}

.floating-score.combo {
  color: #fbcfe8;
}

@keyframes popOut {
  0% {
    transform: scale(1);
    opacity: 1;
    filter: brightness(1);
  }
  100% {
    transform: scale(0.38);
    opacity: 0;
    filter: brightness(1.5);
  }
}

@keyframes hintPulse {
  0%,
  100% {
    box-shadow:
      0 0 0 0 rgba(6, 182, 212, 0.34),
      0 12px 24px rgba(0, 0, 0, 0.18);
  }
  50% {
    box-shadow:
      0 0 0 8px rgba(6, 182, 212, 0),
      0 12px 24px rgba(0, 0, 0, 0.18);
  }
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-6px);
  }
  40% {
    transform: translateX(6px);
  }
  60% {
    transform: translateX(-4px);
  }
  80% {
    transform: translateX(4px);
  }
}

@keyframes burst {
  0% {
    transform: scale(0.4);
    opacity: 0.95;
    box-shadow: 0 0 0 0 currentColor;
  }
  100% {
    transform: scale(7.8);
    opacity: 0;
    box-shadow: 0 0 0 24px rgba(255, 255, 255, 0);
  }
}

@media (max-width: 1120px) {
  body {
    padding: 16px;
  }

  .layout {
    grid-template-columns: 1fr;
  }

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

  .board-frame {
    min-height: auto;
  }
}

@media (max-width: 720px) {
  .hero {
    flex-direction: column;
  }

  .hero-actions {
    justify-content: flex-start;
  }

  .map-track {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .board {
    gap: 8px;
  }

  .tile {
    border-radius: 16px;
  }
}
