:root {
  --bg: #FFF8F3;
  --primary: #FF6B9D;
  --primary-light: #FF8FB3;
  --primary-dark: #E85585;
  --accent: #FFD93D;
  --secondary: #5EC9F2;
  --card: #FFFFFF;
  --text: #2D3142;
  --text-light: #6C7293;
  --border: #F0E6DD;
  --shadow: 0 8px 24px rgba(45, 49, 66, 0.12);

  --tube-glass: rgba(255, 255, 255, 0.7);
  --tube-border: #FFB3A0;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Nunito', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

#game-container {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  padding: 64px 12px 12px;
}

#ui-overlay {
  position: absolute;
  top: 12px; left: 12px; right: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  z-index: 5;
}
.ui-row { display: flex; gap: 8px; align-items: center; }
.ui-pill {
  background: rgba(255, 255, 255, 0.92);
  padding: 6px 14px;
  border-radius: 999px;
  font-weight: 800;
  box-shadow: 0 2px 8px rgba(45,49,66,0.08);
  font-size: 0.9rem;
}
.ui-label { font-weight: 600; color: var(--text-light); margin-right: 4px; font-size: 0.8rem; }

#pause-btn,
#mute-btn,
#undo-btn {
  background: rgba(255,255,255,0.92);
  border: 0;
  width: 40px; height: 40px;
  border-radius: 50%;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(45,49,66,0.08);
  transition: transform 0.12s ease, background 0.12s ease;
}
#undo-btn:disabled { opacity: 0.4; cursor: not-allowed; }

#board-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
}
#tubes {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 12px;
  justify-content: center;
  align-items: flex-end;
  padding: 8px;
  max-width: 100%;
}

.tube {
  position: relative;
  width: 46px;
  height: 180px;
  background: var(--tube-glass);
  border: 3px solid var(--tube-border);
  border-top: 0;
  border-radius: 0 0 22px 22px;
  display: flex;
  flex-direction: column-reverse;
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(45,49,66,0.08), inset 0 0 0 1px rgba(255,255,255,0.4);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.tube::before {
  content: '';
  position: absolute;
  top: -3px; left: -3px; right: -3px;
  height: 8px;
  background: var(--tube-border);
  border-radius: 4px 4px 0 0;
}
.tube--selected {
  transform: translateY(-14px);
  box-shadow: 0 12px 24px rgba(255, 107, 157, 0.35), inset 0 0 0 1px rgba(255,255,255,0.6);
}
.tube--complete::after {
  content: '✓';
  position: absolute;
  top: -22px;
  left: 50%;
  transform: translateX(-50%);
  width: 22px; height: 22px;
  background: #6BCB77;
  color: #fff;
  border-radius: 50%;
  font-size: 0.85rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(107, 203, 119, 0.5);
}

.layer {
  width: 100%;
  height: 25%;
  flex: 0 0 25%;
  transition: height 0.22s ease, background 0.18s ease, opacity 0.22s ease;
}
.layer--pouring {
  animation: pour 0.32s ease-out;
}
@keyframes pour {
  0%   { transform: translateY(-8px); opacity: 0; }
  100% { transform: translateY(0);    opacity: 1; }
}

/* 颜色映射 */
.c-pink   { background: linear-gradient(180deg, #FF8FB3, #FF6B9D); }
.c-blue   { background: linear-gradient(180deg, #8FDAF7, #5EC9F2); }
.c-yellow { background: linear-gradient(180deg, #FFE375, #FFD93D); }
.c-green  { background: linear-gradient(180deg, #8FDDA0, #6BCB77); }
.c-orange { background: linear-gradient(180deg, #FFB876, #FF9F45); }
.c-purple { background: linear-gradient(180deg, #C3AEFC, #A78BFA); }
.c-red    { background: linear-gradient(180deg, #FF9999, #FF6B6B); }
.c-teal   { background: linear-gradient(180deg, #8FE0D8, #5EC9BD); }
.c-coral  { background: linear-gradient(180deg, #FFB39A, #FF8966); }

.modal {
  position: absolute;
  inset: 0;
  background: rgba(45, 49, 66, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  padding: 20px;
}
.modal.hidden { display: none; }
.modal__inner {
  background: var(--card);
  border-radius: 24px;
  padding: 28px 24px;
  text-align: center;
  max-width: 320px;
  width: 100%;
  box-shadow: var(--shadow);
}
.modal__inner h2 { margin: 0 0 8px; font-size: 1.6rem; }
.modal__inner p { margin: 0 0 16px; color: var(--text-light); }
.big-score { font-size: 1.4rem !important; color: var(--text) !important; font-weight: 800; margin: 4px 0 !important; }
.sub-score { font-size: 0.95rem; }

.btn {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  border: 0;
  padding: 12px 28px;
  border-radius: 999px;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(255, 107, 157, 0.4);
  transition: transform 0.15s ease, background 0.15s ease;
  font-family: inherit;
}
.btn:hover { background: var(--primary-dark); transform: translateY(-1px); }

.ad-slot {
  margin-top: 16px;
  min-height: 100px;
}
