:root {
  --bg-top: #0f2027;
  --bg-mid: #203a43;
  --bg-bot: #2c5364;
  --glass-bg: rgba(255, 255, 255, 0.05);
  --glass-border: rgba(255, 255, 255, 0.1);
  --accent: #00d2ff;
  --text-primary: #ffffff;
  --text-muted: rgba(255, 255, 255, 0.7);
  --cup-border: rgba(255, 255, 255, 0.3);
  --cup-bg: rgba(255, 255, 255, 0.02);
  
  --color-rocks: #7f8c8d;
  --color-sand: #f39c12;
  --color-soil: #8e44ad;
  --color-grass: #2ecc71;
  --color-water: rgba(52, 152, 219, 0.8);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Outfit', sans-serif;
  background: linear-gradient(135deg, var(--bg-top), var(--bg-mid), var(--bg-bot));
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

.app-container {
  width: 95%;
  max-width: 1200px;
  height: 90vh;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.app-header {
  text-align: center;
  margin-bottom: 0.5rem;
}

.app-header h1 {
  font-size: 3rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 2px;
  background: linear-gradient(to right, #00d2ff, #3a7bd5);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0px 4px 20px rgba(0, 210, 255, 0.3);
}

.app-header p {
  font-size: 1.1rem;
  color: var(--text-muted);
}

.main-content {
  display: grid;
  grid-template-columns: 250px 1fr 300px;
  gap: 1.5rem;
  flex: 1;
}

/* Glass Panels */
.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  padding: 1.5rem;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
}

.glass-panel h2 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

/* Materials Panel */
.materials-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.material-item {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  padding: 1rem;
  border-radius: 12px;
  cursor: grab;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 1.1rem;
  transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
  position: relative;
  overflow: hidden;
}

.material-item::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--base-color);
  opacity: 0.2;
  z-index: -1;
  transition: opacity 0.2s;
}

.material-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.material-item:hover::before {
  opacity: 0.4;
}

.material-item:active {
  cursor: grabbing;
}

/* Simulator Panel */
.simulator-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.controls {
  width: 100%;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
}

button {
  border: none;
  border-radius: 12px;
  padding: 0.8rem 1.5rem;
  font-size: 1rem;
  font-weight: 800;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.3s;
}

.primary-btn {
  background: linear-gradient(135deg, #00d2ff, #3a7bd5);
  color: white;
  box-shadow: 0 4px 15px rgba(0, 210, 255, 0.4);
}

.primary-btn:hover {
  filter: brightness(1.2);
  transform: scale(1.05);
}

.primary-btn:disabled {
  background: grey;
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
  filter: none;
}

.pulse-glow {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(0, 210, 255, 0.4); }
  70% { box-shadow: 0 0 0 10px rgba(0, 210, 255, 0); }
  100% { box-shadow: 0 0 0 0 rgba(0, 210, 255, 0); }
}

.secondary-btn {
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.secondary-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Cup Area */
.cup-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  position: relative;
  width: 100%;
}

.cup {
  width: 250px;
  height: 400px;
  border: 4px solid var(--cup-border);
  border-top: none;
  border-radius: 0 0 30px 30px;
  background: var(--cup-bg);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  box-shadow: inset 0 0 20px rgba(255, 255, 255, 0.05), 0 20px 40px rgba(0, 0, 0, 0.5);
  transition: border-color 0.3s, background 0.3s;
}

.cup.drag-over {
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.05);
}

.layers-container {
  width: 100%;
  display: flex;
  flex-direction: column-reverse; /* Bottom to up stacking visually inside container */
  position: relative;
  z-index: 2;
}

.empty-state {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  color: var(--text-muted);
  pointer-events: none;
}

/* Added Layer item */
.cup-layer {
  width: 100%;
  height: 100px; /* Example fixed height per layer, maybe dynamic? up to 3 layers = 300px + 100px empty space */
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: bold;
  font-size: 1.5rem;
  color: #fff;
  text-shadow: 1px 1px 3px rgba(0,0,0,0.5);
  box-shadow: inset 0 2px 10px rgba(0,0,0,0.3);
  position: relative;
  border-bottom: 2px solid rgba(0,0,0,0.2);
  animation: dropIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
  opacity: 0;
  transform: translateY(-50px);
}

@keyframes dropIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.layer-rocks { background: url('data:image/svg+xml;utf8,<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><circle cx="10" cy="10" r="8" fill="%237f8c8d" opacity="0.8"/></svg>') repeat, #95a5a6; }
.layer-sand { background: url('data:image/svg+xml;utf8,<svg width="4" height="4" viewBox="0 0 4 4" xmlns="http://www.w3.org/2000/svg"><rect x="0" y="0" width="2" height="2" fill="%23d35400" opacity="0.3"/></svg>') repeat, #f1c40f; }
.layer-soil { background: url('data:image/svg+xml;utf8,<svg width="10" height="10" viewBox="0 0 10 10" xmlns="http://www.w3.org/2000/svg"><path d="M0,5 Q2.5,0 5,5 T10,5" fill="none" stroke="%2334495e" stroke-width="1" opacity="0.4"/></svg>') repeat, #8e44ad; }
.layer-grass { background: url('data:image/svg+xml;utf8,<svg width="10" height="20" viewBox="0 0 10 20" xmlns="http://www.w3.org/2000/svg"><path d="M5,20 Q0,10 5,0 Q10,10 5,20" fill="%2327ae60" opacity="0.6"/></svg>') repeat, #2ecc71; }

.remove-layer-btn {
  position: absolute;
  right: 10px;
  background: rgba(0,0,0,0.3);
  border: none;
  color: white;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0.5;
  transition: opacity 0.2s;
}

.remove-layer-btn:hover {
  opacity: 1;
  background: rgba(231, 76, 60, 0.8);
}

/* Water Pouring Animation */
.water-pour {
  position: absolute;
  top: -400px; /* Start above */
  left: 0;
  width: 100%;
  height: 500px;
  background: var(--color-water);
  z-index: 1; /* Below the text, above the background? Actually we want it to tint the layers */
  mix-blend-mode: multiply;
  transition: transform 3s ease-in-out, background-color 3s ease;
  transform: translateY(0);
}

.pour-active .water-pour {
  transform: translateY(500px); /* Move down */
}

/* Tint animation utility for JS */
.water-muddy { background-color: rgba(139, 69, 19, 0.8) !important; }
.water-clear { background-color: rgba(0, 255, 255, 0.6) !important; }

/* Filter output at bottom */
.filter-output {
  margin-top: 10px;
  width: 250px;
  height: 60px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-top: none;
  border-radius: 0 0 15px 15px;
  position: relative;
  display: flex;
  justify-content: center;
}

.output-water {
  position: absolute;
  top: 0;
  width: 100%;
  height: 0;
  background: var(--color-water);
  border-radius: 0 0 15px 15px;
  transition: height 2s ease, background-color 1s ease;
}

/* Results Panel */
.results-panel {
  align-items: center;
  text-align: center;
}

.score-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  margin: 2rem 0;
}

.score-circle {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 4px solid var(--glass-border);
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 3rem;
  font-weight: 800;
  background: rgba(0, 0, 0, 0.2);
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.5);
  transition: all 0.5s;
}

.score-excellent {
  border-color: #2ecc71;
  color: #2ecc71;
  box-shadow: 0 0 30px rgba(46, 204, 113, 0.4), inset 0 0 20px rgba(0, 0, 0, 0.5);
}

.score-good {
  border-color: #f1c40f;
  color: #f1c40f;
}

.score-poor {
  border-color: #e74c3c;
  color: #e74c3c;
}

.hint-box {
  background: rgba(0, 0, 0, 0.2);
  padding: 1rem;
  border-radius: 12px;
  font-size: 0.9rem;
  color: #bdc3c7;
  border-left: 4px solid var(--accent);
}
