/* -------------------------------------------------------------
 * Barista Pro - Main Stylesheet
 * Includes CSS Grid layout, mobile tabs, 5 color themes,
 * glassmorphic visual system, custom range sliders & liquid animations.
 * ------------------------------------------------------------- */

/* Custom Fonts & Base Reset */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Inter', sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--bg-grad);
  color: var(--text-main);
  transition: background 0.5s ease, color 0.3s ease;
}

h1, h2, h3, h4, .font-heading {
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
}

/* -------------------------------------------------------------
 * THEME DEFINITIONS (CSS Variables)
 * ------------------------------------------------------------- */

/* 1. COFFEE HOUSE (Default) */
.theme-coffeehouse {
  --bg-grad: linear-gradient(135deg, #1e130c 0%, #2c1b10 50%, #3e2716 100%);
  --sidebar-bg: rgba(44, 27, 16, 0.45);
  --glass-bg: rgba(62, 39, 22, 0.25);
  --glass-border: rgba(212, 163, 115, 0.2);
  --glass-border-focus: rgba(212, 163, 115, 0.5);
  --text-main: #f5ebe0;
  --text-mute: #d4a373;
  --accent: #d4a373;
  --accent-glow: rgba(212, 163, 115, 0.3);
  --btn-primary: #a67c52;
  --btn-primary-hover: #bfa07a;
  --btn-secondary: rgba(245, 235, 224, 0.1);
  --btn-secondary-hover: rgba(245, 235, 224, 0.2);
  --card-shadow: 0 8px 32px 0 rgba(15, 8, 4, 0.37);
  --cup-reflection: rgba(255, 255, 255, 0.15);
}

/* 2. MOCHA DARK */
.theme-mocha {
  --bg-grad: linear-gradient(135deg, #0f0c08 0%, #1a1610 50%, #262118 100%);
  --sidebar-bg: rgba(20, 16, 12, 0.6);
  --glass-bg: rgba(30, 24, 18, 0.3);
  --glass-border: rgba(197, 160, 89, 0.15);
  --glass-border-focus: rgba(197, 160, 89, 0.4);
  --text-main: #fcfbf7;
  --text-mute: #c5a059;
  --accent: #c5a059;
  --accent-glow: rgba(197, 160, 89, 0.25);
  --btn-primary: #c5a059;
  --btn-primary-hover: #d9b878;
  --btn-secondary: rgba(252, 251, 247, 0.08);
  --btn-secondary-hover: rgba(252, 251, 247, 0.18);
  --card-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.6);
  --cup-reflection: rgba(255, 255, 255, 0.1);
}

/* 3. MATCHA MINT */
.theme-matcha {
  --bg-grad: linear-gradient(135deg, #1f2d24 0%, #2d3e33 50%, #3b4f42 100%);
  --sidebar-bg: rgba(45, 62, 51, 0.5);
  --glass-bg: rgba(59, 79, 66, 0.25);
  --glass-border: rgba(163, 196, 172, 0.2);
  --glass-border-focus: rgba(163, 196, 172, 0.5);
  --text-main: #ecefe6;
  --text-mute: #a3c4ac;
  --accent: #a3c4ac;
  --accent-glow: rgba(163, 196, 172, 0.3);
  --btn-primary: #588157;
  --btn-primary-hover: #a3c4ac;
  --btn-secondary: rgba(236, 239, 230, 0.08);
  --btn-secondary-hover: rgba(236, 239, 230, 0.18);
  --card-shadow: 0 8px 32px 0 rgba(14, 23, 17, 0.4);
  --cup-reflection: rgba(255, 255, 255, 0.15);
}

/* 4. STRAWBERRY CREMA */
.theme-strawberry {
  --bg-grad: linear-gradient(135deg, #2d181c 0%, #3e2227 50%, #4f2c33 100%);
  --sidebar-bg: rgba(62, 34, 39, 0.55);
  --glass-bg: rgba(79, 44, 51, 0.3);
  --glass-border: rgba(255, 180, 194, 0.2);
  --glass-border-focus: rgba(255, 180, 194, 0.5);
  --text-main: #fff0f3;
  --text-mute: #ffb4c2;
  --accent: #ffb4c2;
  --accent-glow: rgba(255, 180, 194, 0.3);
  --btn-primary: #c9184a;
  --btn-primary-hover: #ff758f;
  --btn-secondary: rgba(255, 240, 243, 0.08);
  --btn-secondary-hover: rgba(255, 240, 243, 0.18);
  --card-shadow: 0 8px 32px 0 rgba(29, 11, 14, 0.45);
  --cup-reflection: rgba(255, 255, 255, 0.2);
}

/* 5. CYBERPUNK BARISTA */
.theme-cyberpunk {
  --bg-grad: linear-gradient(135deg, #09090e 0%, #120e25 50%, #1e1335 100%);
  --sidebar-bg: rgba(18, 14, 37, 0.7);
  --glass-bg: rgba(30, 19, 53, 0.35);
  --glass-border: rgba(0, 242, 254, 0.3);
  --glass-border-focus: rgba(255, 0, 127, 0.7);
  --text-main: #f0f0ff;
  --text-mute: #00f2fe;
  --accent: #ff007f;
  --accent-glow: rgba(255, 0, 127, 0.4);
  --btn-primary: #ff007f;
  --btn-primary-hover: #00f2fe;
  --btn-secondary: rgba(0, 242, 254, 0.15);
  --btn-secondary-hover: rgba(255, 0, 127, 0.2);
  --card-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.7);
  --cup-reflection: rgba(0, 242, 254, 0.25);
}

/* LIQUID COLORS */
:root {
  --col-espresso: #2e1503;
  --col-crema: #d69854;
  --col-water: rgba(200, 230, 255, 0.35);
  --col-chocolate: #170b02;
  --col-milk: #f7ebd9;
  --col-foam: #ffffff;
  --col-whipped: #fff9f0;
}

/* -------------------------------------------------------------
 * GLASSMORPHISM UTILITIES
 * ------------------------------------------------------------- */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--card-shadow);
  border-radius: 16px;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.glass-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 16px;
}

.glass-pills {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--glass-border);
  border-radius: 30px;
  padding: 4px;
  display: flex;
}

.glass-select {
  background: rgba(0, 0, 0, 0.3);
  color: var(--text-main);
  border: 1px solid var(--glass-border);
  padding: 6px 12px;
  border-radius: 8px;
  outline: none;
  font-size: 14px;
  cursor: pointer;
  font-weight: 500;
  transition: border-color 0.2s ease;
}
.glass-select:focus {
  border-color: var(--glass-border-focus);
}

/* -------------------------------------------------------------
 * BUTTONS
 * ------------------------------------------------------------- */
.btn {
  border: none;
  padding: 10px 16px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
  user-select: none;
}

.btn-primary {
  background: var(--btn-primary);
  color: #fff;
  box-shadow: 0 4px 14px 0 var(--accent-glow);
}
.btn-primary:hover:not(:disabled) {
  background: var(--btn-primary-hover);
  transform: translateY(-1px);
}
.btn-primary:active:not(:disabled) {
  transform: translateY(1px);
}
.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--btn-secondary);
  color: var(--text-main);
  border: 1px solid var(--glass-border);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--btn-secondary-hover);
}

.btn-danger {
  background: rgba(220, 53, 69, 0.2);
  color: #ff6b6b;
  border: 1px solid rgba(220, 53, 69, 0.4);
}
.btn-danger:hover {
  background: rgba(220, 53, 69, 0.4);
}

.btn-success {
  background: rgba(40, 167, 69, 0.7);
  color: #fff;
  box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}
.btn-success:hover {
  background: rgba(40, 167, 69, 0.9);
}

.btn-large {
  padding: 14px 28px;
  font-size: 16px;
  border-radius: 12px;
}

.btn-full {
  width: 100%;
}

/* -------------------------------------------------------------
 * HEADER
 * ------------------------------------------------------------- */
.app-header {
  height: 64px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: 0;
  border-bottom: 1px solid var(--glass-border);
  z-index: 10;
  flex-shrink: 0;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.5px;
  font-family: 'Outfit', sans-serif;
  color: var(--text-main);
}
.logo-container {
  color: var(--accent);
  margin-bottom: 16px;
}
.game-logo-svg {
  width: 80px;
  height: 80px;
  filter: drop-shadow(0 0 10px var(--accent-glow));
}
.header-logo-svg {
  width: 32px;
  height: 32px;
  color: var(--accent);
}

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

.theme-selector-container {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-mute);
}

.volume-control-container {
  display: flex;
  align-items: center;
  gap: 8px;
}

.volume-slider-input {
  width: 80px;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

.volume-slider-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 5px var(--accent-glow);
  cursor: pointer;
  transition: transform 0.1s ease;
}

.volume-slider-input::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.volume-val {
  font-size: 11px;
  color: var(--text-main);
  min-width: 28px;
  text-align: right;
}


/* -------------------------------------------------------------
 * MAIN LAYOUT GRID (PC / Widescreen Mode)
 * ------------------------------------------------------------- */
.app-container {
  display: grid;
  grid-template-columns: 280px 1fr 340px;
  height: calc(100vh - 64px);
  padding: 16px;
  gap: 16px;
  flex-grow: 1;
}

.sidebar {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.sidebar-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.sidebar-header h2 {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: var(--accent);
}

.mobile-only-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-main);
  font-size: 24px;
  cursor: pointer;
}

/* -------------------------------------------------------------
 * RECIPE SIDEBAR (LEFT)
 * ------------------------------------------------------------- */
.recipe-selector {
  flex-grow: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.recipe-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 12px;
  cursor: pointer;
  text-align: left;
  color: var(--text-main);
  transition: all 0.2s ease;
}
.recipe-card:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--glass-border);
}
.recipe-card.active {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--accent);
  box-shadow: inset 0 0 8px var(--accent-glow);
}

.recipe-thumbnail {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  flex-shrink: 0;
  background-size: cover;
  background-position: center;
  position: relative;
}
/* Thumbnail representations */
.espresso-bg { background: linear-gradient(135deg, #1b0a00, #361702); }
.americano-bg { background: linear-gradient(135deg, #361702, #6f8fa8); }
.cappuccino-bg { background: linear-gradient(135deg, #361702, #fff); }
.latte-bg { background: linear-gradient(135deg, #d69854, #fff); }
.macchiato-bg { background: linear-gradient(135deg, #1b0a00, #fff 80%); }
.flatwhite-bg { background: linear-gradient(135deg, #7c4c1a, #fff); }
.mocha-bg { background: linear-gradient(135deg, #170b02, #7c4c1a 50%, #fff); }
.freeplay-bg { background: linear-gradient(135deg, #d4a373, #588157, #ff007f); }

.recipe-info h3 {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 2px;
}
.recipe-info p {
  font-size: 11px;
  color: var(--text-mute);
}

.active-recipe-details {
  margin: 12px;
  padding: 14px;
  flex-shrink: 0;
}
.active-recipe-details h3 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-mute);
  margin-bottom: 8px;
  border-bottom: 1px dashed var(--glass-border);
  padding-bottom: 4px;
}
#target-recipe-card h4 {
  font-size: 15px;
  color: var(--text-main);
  margin-bottom: 2px;
}
#target-recipe-card p {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 10px;
}
.recipe-checklist {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.recipe-checklist li {
  font-size: 12px;
  display: flex;
  justify-content: space-between;
  color: rgba(255, 255, 255, 0.7);
  padding: 2px 0;
}
.recipe-checklist li.checked {
  color: #75eb8b;
  text-decoration: line-through;
  text-decoration-color: rgba(117, 235, 139, 0.4);
}
.recipe-checklist li .val {
  font-weight: 600;
  color: var(--text-main);
}
.recipe-checklist li.checked .val {
  color: #75eb8b;
}

/* -------------------------------------------------------------
 * WORKSPACE (CENTER VIEWPORT)
 * ------------------------------------------------------------- */
.main-workspace {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: rgba(0, 0, 0, 0.15);
  border-radius: 20px;
  border: 1px solid var(--glass-border);
  padding: 16px;
  gap: 16px;
}

.view-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.hud-item {
  font-size: 13px;
  color: var(--text-mute);
}
.hud-item .value {
  color: var(--text-main);
  font-weight: 700;
  margin-left: 4px;
}

.view-toggle-container .pill {
  border: none;
  background: none;
  color: rgba(255, 255, 255, 0.6);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}
.view-toggle-container .pill.active {
  background: var(--btn-primary);
  color: #fff;
}

.cup-display-area {
  flex-grow: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  background: radial-gradient(circle, rgba(255,255,255,0.03) 0%, rgba(0,0,0,0) 80%);
}

.view-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
  gap: 16px;
}
.pour-instructions {
  font-size: 12px;
  color: var(--text-mute);
  text-align: center;
  max-width: 50%;
  font-style: italic;
}

/* -------------------------------------------------------------
 * THE VISUAL CUP & LIQUIDS (Side View & Top View)
 * ------------------------------------------------------------- */
.cup-wrapper {
  position: relative;
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Size scalings */
.small-cup { transform: scale(0.8); }
.standard-cup { transform: scale(1.0); }
.large-cup { transform: scale(1.2); }

/* SIDE VIEW DESIGN */
.cup-side-container {
  display: none;
  flex-direction: column;
  align-items: center;
  width: 200px;
  position: relative;
}
.cup-side-container.active {
  display: flex;
}

.glass-rim {
  width: 170px;
  height: 12px;
  border: 4px solid var(--cup-reflection);
  border-bottom: none;
  border-radius: 50% 50% 0 0;
  margin-bottom: -6px;
  z-index: 2;
}

.glass-body {
  width: 170px;
  height: 220px;
  border: 5px solid var(--cup-reflection);
  border-top: none;
  border-bottom: none;
  border-radius: 0 0 35px 35px;
  background: rgba(255, 255, 255, 0.05);
  box-shadow: inset 0 -20px 30px rgba(0,0,0,0.4), inset 15px 0 20px var(--cup-reflection);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column-reverse; /* Stack layers from bottom up */
  z-index: 1;
}

.glass-base {
  width: 130px;
  height: 16px;
  border: 4px solid var(--cup-reflection);
  border-radius: 0 0 50% 50%;
  background: rgba(255,255,255,0.08);
  margin-top: -2px;
  box-shadow: 0 10px 20px rgba(0,0,0,0.3);
}

/* Liquid Layer Common Styles */
.cup-layer {
  width: 100%;
  height: 0;
  position: relative;
  transition: height 0.4s cubic-bezier(0.1, 0.8, 0.3, 1);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.layer-label {
  position: absolute;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: rgba(255, 255, 255, 0.75);
  text-shadow: 1px 1px 3px rgba(0,0,0,0.8);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.cup-layer:hover .layer-label {
  opacity: 1;
}

/* Specific Layer Colors & Styles */
.layer-chocolate {
  background: linear-gradient(90deg, var(--col-chocolate) 0%, #2e1707 50%, var(--col-chocolate) 100%);
}
.layer-water {
  background: linear-gradient(90deg, rgba(200, 230, 255, 0.25) 0%, rgba(200, 230, 255, 0.4) 50%, rgba(200, 230, 255, 0.25) 100%);
}
.layer-coffee {
  background: linear-gradient(90deg, var(--col-espresso) 0%, #462005 50%, var(--col-espresso) 100%);
}
.layer-crema {
  background: linear-gradient(90deg, var(--col-crema) 0%, #e3af76 50%, var(--col-crema) 100%);
  /* Crema wave surface */
  border-radius: 50% 50% 0 0 / 10px 10px 0 0;
}
.layer-milk {
  background: linear-gradient(90deg, var(--col-milk) 0%, #fffbf5 50%, var(--col-milk) 100%);
}
.layer-foam {
  background: linear-gradient(90deg, #ffffff 0%, #f0f0f0 50%, #ffffff 100%);
  border-radius: 50% 50% 0 0 / 12px 12px 0 0;
}
.layer-whipped {
  background: radial-gradient(circle at 50% 0%, #ffffff 0%, #fff5e6 70%);
  border-radius: 50% 50% 0 0 / 25px 25px 0 0;
}

/* Wave animation effects for the top surface of liquids */
.cup-layer::after {
  content: '';
  position: absolute;
  top: -6px;
  left: -25%;
  width: 150%;
  height: 12px;
  background: inherit;
  border-radius: 50%;
  opacity: 0.95;
  animation: waveMotion 4s linear infinite alternate;
}

@keyframes waveMotion {
  0% { transform: translateX(0) scaleY(0.8); }
  100% { transform: translateX(10%) scaleY(1.2); }
}

/* TOP VIEW DESIGN */
.cup-top-container {
  display: none;
  width: 250px;
  height: 250px;
  position: relative;
}
.cup-top-container.active {
  display: block;
}

.cup-top-rim {
  width: 100%;
  height: 100%;
  border: 12px solid var(--cup-reflection);
  border-radius: 50%;
  background: rgba(255,255,255,0.03);
  box-shadow: 0 10px 30px rgba(0,0,0,0.5), inset 0 8px 16px rgba(0,0,0,0.6);
  padding: 8px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cup-top-liquid {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--col-espresso); /* Fallback */
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 10px 20px rgba(0,0,0,0.8);
}

#latte-art-canvas {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: block;
}

.cocoa-dust-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, rgba(62,39,22,0.7) 10%, rgba(62,39,22,0) 70%);
  opacity: 0;
  transition: opacity 0.5s ease;
  pointer-events: none;
}
.cocoa-dust-overlay.active {
  opacity: 1;
}

.whipped-cream-overlay {
  position: absolute;
  top: 15%;
  left: 15%;
  width: 70%;
  height: 70%;
  background: radial-gradient(circle, #ffffff 30%, #fff3e0 70%, rgba(255,255,255,0) 90%);
  border-radius: 50%;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
  opacity: 0;
  transform: scale(0.6);
  transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.2);
  pointer-events: none;
}
.whipped-cream-overlay.active {
  opacity: 1;
  transform: scale(1.0);
}

/* -------------------------------------------------------------
 * POURING STREAM EFFECT & STEAM EFFECT
 * ------------------------------------------------------------- */
.pouring-stream {
  position: absolute;
  top: -240px; /* starts far above the cup */
  left: 50%;
  width: 6px;
  background: #ffffff;
  border-radius: 3px;
  transform: translateX(-50%);
  z-index: 10;
  pointer-events: none;
  opacity: 0;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
  transition: opacity 0.15s ease;
}
.pouring-stream.active {
  opacity: 1;
  animation: pouringFlow 0.5s linear infinite;
}

@keyframes pouringFlow {
  0% { background-position-y: 0px; }
  100% { background-position-y: 40px; }
}

.steam-clouds {
  position: absolute;
  bottom: 20%;
  left: 50%;
  transform: translateX(-50%);
  width: 100px;
  height: 100px;
  pointer-events: none;
  z-index: 12;
  opacity: 0;
}
.steam-clouds.active {
  opacity: 0.6;
  background: radial-gradient(circle, rgba(255,255,255,0.4) 0%, rgba(255,255,255,0) 70%);
  filter: blur(10px);
  animation: steamRise 1.5s infinite linear;
}

@keyframes steamRise {
  0% { transform: translate(-50%, 0) scale(0.8); opacity: 0; }
  50% { opacity: 0.5; }
  100% { transform: translate(-50%, -60px) scale(1.4); opacity: 0; }
}

/* -------------------------------------------------------------
 * RIGHT PANEL: STATION LAYOUT
 * ------------------------------------------------------------- */
.station-sidebar {
  display: flex;
  flex-direction: column;
}

.station-nav {
  margin: 16px;
  flex-shrink: 0;
}
.station-tab {
  flex: 1;
  background: none;
  border: none;
  padding: 8px 4px;
  color: rgba(255,255,255,0.6);
  border-radius: 24px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease;
}
.station-tab .icon {
  font-size: 16px;
}
.station-tab .label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.station-tab.active {
  background: var(--btn-primary);
  color: #fff;
  box-shadow: 0 4px 10px var(--accent-glow);
}

.stations-container {
  flex-grow: 1;
  overflow: hidden;
  position: relative;
  padding: 0 16px 16px 16px;
}

.station-content {
  display: none;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
  gap: 16px;
}
.station-content.active {
  display: flex;
}
.station-content h2 {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-main);
  border-bottom: 1px solid var(--glass-border);
  padding-bottom: 6px;
}

.card-actions {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.control-group label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-mute);
  letter-spacing: 0.5px;
}

/* -------------------------------------------------------------
 * STATION 1: PREP (GRIND & TAMP) STYLING
 * ------------------------------------------------------------- */
.portafilter-wrapper {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 16px;
  background: rgba(0,0,0,0.15);
  padding: 16px;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
}

.prep-visualizer {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  height: 110px;
}

.portafilter-basket {
  width: 60px;
  height: 45px;
  border: 3px solid #b0b0b0;
  border-radius: 0 0 16px 16px;
  background: rgba(255,255,255,0.05);
  position: relative;
  overflow: hidden;
}
.portafilter-handle {
  width: 14px;
  height: 40px;
  background: linear-gradient(90deg, #111, #333, #111);
  border-radius: 4px;
}

.grounds-fill {
  width: 100%;
  position: absolute;
  bottom: 0;
  background: radial-gradient(circle, #543310 10%, #321e09 90%);
  transition: height 0.15s ease;
}

.tamp-line {
  position: absolute;
  left: 0;
  width: 100%;
  height: 3px;
  background: #ff6b6b;
  box-shadow: 0 0 5px #ff6b6b;
}

.prep-stats {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
}
.stat-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
}
.stat-row span:first-child {
  color: var(--text-mute);
}

/* Tamp Slider Control (Satisfying drag) */
.tamping-slider-container {
  height: 160px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  background: rgba(0,0,0,0.2);
  border-radius: 12px;
  border: 1px dashed var(--glass-border);
  padding: 10px;
}

.slider-hint {
  font-size: 11px;
  color: var(--text-mute);
  margin-bottom: 8px;
  pointer-events: none;
}

.vertical-slider {
  writing-mode: bt-lr; /* IE */
  appearance: slider-vertical; /* Webkit */
  width: 24px;
  height: 90px;
  outline: none;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 12px;
}

/* tamp sweet spot green line */
.tamp-target-zone {
  position: absolute;
  bottom: 38px; /* maps to value 35-50 approx */
  width: 40px;
  height: 15px;
  border: 2px solid #588157;
  border-radius: 4px;
  background: rgba(88, 129, 87, 0.2);
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tamp-target-zone::after {
  content: 'Tamp Target';
  font-size: 7px;
  color: #a3c4ac;
  text-transform: uppercase;
  font-weight: 800;
}

.tamp-verdict {
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  height: 20px;
}

/* -------------------------------------------------------------
 * STATION 2: BREW (ESPRESSO MACHINE) STYLING
 * ------------------------------------------------------------- */
.brew-machine-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.group-head-visual {
  width: 100%;
  height: 80px;
  background: radial-gradient(ellipse at center, #666 0%, #222 100%);
  border-radius: 8px;
  border: 2px solid #888;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 5px 15px rgba(0,0,0,0.8);
}
.shower-screen {
  width: 45px;
  height: 10px;
  background: #333;
  border-radius: 0 0 4px 4px;
  border-bottom: 2px dashed #ffb4c2;
  position: absolute;
  bottom: 0;
}
.portafilter-graphic-locked {
  font-size: 11px;
  color: #ff6b6b;
  font-weight: 700;
  text-transform: uppercase;
  text-align: center;
  padding: 6px 12px;
  border-radius: 4px;
  background: rgba(220, 53, 69, 0.1);
  border: 1px solid rgba(220, 53, 69, 0.2);
  transition: all 0.3s ease;
}
.portafilter-graphic-locked.locked {
  color: #75eb8b;
  background: rgba(40, 167, 69, 0.1);
  border-color: rgba(40, 167, 69, 0.3);
}

.cup-picker {
  width: 100%;
}
.cup-picker label {
  font-size: 12px;
  color: var(--text-mute);
  font-weight: 700;
  margin-bottom: 8px;
  display: block;
}
.cup-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.cup-btn {
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--glass-border);
  color: var(--text-main);
  padding: 8px 4px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}
.cup-btn:hover {
  background: rgba(255,255,255,0.06);
}
.cup-btn.active {
  border-color: var(--accent);
  background: rgba(255,255,255,0.1);
}

.cup-icon {
  border: 2px solid var(--text-main);
  border-top: none;
  border-radius: 0 0 8px 8px;
  background: rgba(255,255,255,0.05);
}
.size-s { width: 18px; height: 16px; border-radius: 0 0 4px 4px;}
.size-m { width: 22px; height: 24px; border-radius: 0 0 6px 6px;}
.size-l { width: 26px; height: 30px; border-radius: 0 0 8px 8px;}

.cup-btn.active .cup-icon {
  border-color: var(--accent);
  box-shadow: 0 0 5px var(--accent-glow);
}
.cup-btn span {
  font-size: 10px;
  font-weight: 600;
}

.extraction-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  background: rgba(0,0,0,0.1);
  padding: 8px;
  border-radius: 8px;
  text-align: center;
}
.extraction-metrics .metric .val {
  font-size: 14px;
  font-weight: 800;
}
.extraction-metrics .metric .lbl {
  font-size: 9px;
  color: var(--text-mute);
  text-transform: uppercase;
}

/* -------------------------------------------------------------
 * STATION 3: STEAM (STEAM WAND) STYLING
 * ------------------------------------------------------------- */
.steam-setup {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.milk-options {
  width: 100%;
}
.milk-options label {
  font-size: 11px;
  color: var(--text-mute);
  font-weight: 700;
  display: block;
  margin-bottom: 6px;
}
.milk-pills {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.milk-pill {
  background: rgba(0,0,0,0.2);
  border: 1px solid var(--glass-border);
  color: var(--text-main);
  border-radius: 20px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}
.milk-pill:hover {
  background: rgba(255,255,255,0.05);
}
.milk-pill.active {
  background: var(--text-main);
  color: #000;
  border-color: var(--text-main);
}

.pitcher-display {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  height: 120px;
  background: rgba(0,0,0,0.1);
  border-radius: 12px;
  overflow: hidden;
}

.wand-graphic {
  position: absolute;
  top: 10px;
  left: calc(50% - 2px);
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: transform 0.3s cubic-bezier(0.1, 0.8, 0.3, 1);
}
.wand-shaft {
  width: 6px;
  height: 50px;
  background: linear-gradient(90deg, #ccc, #aaa);
}
.wand-nozzle {
  width: 10px;
  height: 8px;
  background: #777;
  border-radius: 0 0 2px 2px;
}

/* Wand position animations based on depth state */
.depth-out { transform: translateY(-20px) rotate(-10deg); }
.depth-surface { transform: translateY(20px); }
.depth-deep { transform: translateY(45px); }

.milk-pitcher {
  width: 90px;
  height: 85px;
  border: 4px solid #777;
  border-radius: 0 0 16px 16px;
  background: rgba(255,255,255,0.02);
  position: relative;
  margin-top: 15px;
  box-shadow: inset 5px 0 10px rgba(0,0,0,0.2);
  overflow: hidden;
}
.pitcher-milk-level {
  width: 100%;
  position: absolute;
  bottom: 0;
  background: var(--col-milk);
  transition: height 0.3s ease;
}

.pitcher-foam-bubbles {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 10px;
  background: linear-gradient(180deg, rgba(255,255,255,0.8), rgba(255,255,255,0));
  opacity: 0;
  transition: opacity 0.3s ease;
}
.pitcher-foam-bubbles.steaming {
  opacity: 1;
  background-image: radial-gradient(circle at 10% 20%, white 2px, transparent 3px),
                    radial-gradient(circle at 30% 60%, white 3px, transparent 4px),
                    radial-gradient(circle at 50% 10%, white 2px, transparent 3px),
                    radial-gradient(circle at 70% 80%, white 4px, transparent 5px),
                    radial-gradient(circle at 90% 40%, white 2px, transparent 3px);
  background-size: 15px 15px;
  animation: bubbling 0.5s linear infinite;
}

@keyframes bubbling {
  0% { background-position: 0 0; }
  100% { background-position: 0 -15px; }
}

.steam-gauges {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.gauge-card {
  background: rgba(0,0,0,0.2);
  padding: 10px;
  border-radius: 8px;
  border: 1px solid var(--glass-border);
}
.gauge-card .label {
  font-size: 10px;
  color: var(--text-mute);
  font-weight: 700;
  text-transform: uppercase;
  display: block;
  margin-bottom: 4px;
}
.gauge-display-num {
  font-size: 16px;
  font-weight: 800;
  margin-bottom: 6px;
}

.gauge-bar-wrapper {
  height: 6px;
  background: rgba(255,255,255,0.08);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
  margin-bottom: 4px;
}
.gauge-bar {
  height: 100%;
  width: 0%;
  border-radius: 3px;
  transition: width 0.3s ease, background 0.3s ease;
}

.temp-cold { background: #6f8fa8; }
.temp-warm { background: #d69854; }
.temp-sweet { background: #75eb8b; }
.temp-burnt { background: #ff6b6b; }

.froth-none { background: rgba(255,255,255,0.2); }
.froth-micro { background: #ffe4c4; }
.froth-cap { background: #ffffff; }

/* Highlight sweet zones visually */
.gauge-sweet-zone {
  position: absolute;
  top: 0;
  height: 100%;
  pointer-events: none;
  border-left: 1px dashed rgba(255,255,255,0.4);
  border-right: 1px dashed rgba(255,255,255,0.4);
}
.gauge-sweet-zone.temp-sweet {
  left: 60%; /* 60C-70C */
  width: 15%;
  background: rgba(117, 235, 139, 0.15);
}
.gauge-sweet-zone.froth-sweet {
  left: 30%; /* microfoam sweet spot */
  width: 40%;
  background: rgba(255, 255, 255, 0.15);
}

.gauge-hint {
  font-size: 9px;
  color: var(--text-mute);
  display: block;
}

.wand-depth-control {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.wand-depth-control label {
  font-size: 11px;
  color: var(--text-mute);
  font-weight: 700;
  text-transform: uppercase;
}
.depth-buttons {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.depth-buttons .btn {
  padding: 6px 12px;
  font-size: 12px;
}
.depth-buttons .btn.active {
  background: rgba(255,255,255,0.15);
  border-color: var(--accent);
}

/* -------------------------------------------------------------
 * STATION 4: POURING & TOPPINGS
 * ------------------------------------------------------------- */
.pour-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.card-btn {
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 16px;
  cursor: pointer;
  text-align: left;
  color: var(--text-main);
  transition: all 0.2s ease;
  width: 100%;
}
.card-btn:hover {
  background: rgba(255,255,255,0.06);
}
.card-btn:active {
  transform: scale(0.98);
}
.card-btn .btn-icon {
  font-size: 24px;
  background: rgba(0,0,0,0.15);
  width: 48px;
  height: 48px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.card-btn .btn-text {
  display: flex;
  flex-direction: column;
}
.card-btn .btn-text strong {
  font-size: 14px;
  margin-bottom: 2px;
}
.card-btn .btn-text span {
  font-size: 11px;
  color: var(--text-mute);
}

.toppings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}
.topping-btn {
  background: rgba(0,0,0,0.2);
  border: 1px solid var(--glass-border);
  color: var(--text-main);
  padding: 8px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.topping-btn:hover {
  background: rgba(255,255,255,0.05);
}
.topping-btn.active {
  border-color: var(--accent);
  background: rgba(255,255,255,0.1);
}

/* -------------------------------------------------------------
 * MODALS (Audio Consent, Serving & Ratings)
 * ------------------------------------------------------------- */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.7);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.modal.active {
  display: flex;
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  width: 100%;
  max-width: 480px;
  padding: 32px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: modalPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.2) forwards;
}

@keyframes modalPop {
  0% { transform: scale(0.9); opacity: 0; }
  100% { transform: scale(1.0); opacity: 1; }
}

.modal h1 {
  font-size: 28px;
  color: var(--text-main);
  margin-bottom: 4px;
}
.modal h2 {
  font-size: 24px;
  color: var(--accent);
  margin-bottom: 8px;
}
.modal .subtitle {
  font-size: 14px;
  color: var(--text-mute);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 700;
  margin-bottom: 24px;
}
.modal-description {
  font-size: 13px;
  color: rgba(255,255,255,0.7);
  line-height: 1.5;
  margin-bottom: 24px;
}

/* Results Breakdown card */
.results-verdict-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--accent);
  margin-bottom: 16px;
  text-shadow: 0 0 10px var(--accent-glow);
}

.results-visual {
  height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  background: rgba(0,0,0,0.2);
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
}
.cup-mockup-wrapper {
  transform: scale(0.6);
}

.results-breakdown {
  width: 100%;
  background: rgba(0,0,0,0.15);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 24px;
  text-align: left;
}
.results-breakdown h3 {
  font-size: 12px;
  text-transform: uppercase;
  color: var(--text-mute);
  margin-bottom: 8px;
  border-bottom: 1px solid var(--glass-border);
  padding-bottom: 4px;
}
#results-checklist {
  list-style: none;
}
#results-checklist li {
  font-size: 12px;
  margin-bottom: 6px;
  display: flex;
  justify-content: space-between;
}
#results-checklist li.pass {
  color: #75eb8b;
}
#results-checklist li.fail {
  color: #ff6b6b;
}

.results-actions {
  display: flex;
  width: 100%;
  gap: 12px;
}
.results-actions .btn {
  flex: 1;
}

/* -------------------------------------------------------------
 * RESPONSIVE LAYOUTS (MOBILE STACKING / PORTRAIT SUPPORT)
 * ------------------------------------------------------------- */
@media (max-width: 900px) {
  .app-container {
    grid-template-columns: 1fr; /* Stack vertically */
    grid-template-rows: 1fr auto;
    padding: 0;
    gap: 0;
    overflow: hidden;
  }

  /* Headers / sidebars adjustments */
  .recipe-sidebar {
    position: fixed;
    top: 64px;
    left: -100%;
    width: 280px;
    height: calc(100vh - 64px);
    z-index: 80;
    transition: left 0.3s cubic-bezier(0.1, 0.8, 0.3, 1);
    border-radius: 0;
    box-shadow: 10px 0 30px rgba(0,0,0,0.5);
  }
  .recipe-sidebar.active {
    left: 0;
  }
  
  .mobile-only-btn {
    display: block;
  }
  
  .volume-slider-input {
    display: none;
  }

  /* Main cup viewer takes top half */
  .main-workspace {
    border-radius: 0;
    border: none;
    height: 48vh;
    padding: 12px;
  }

  .cup-display-area {
    transform: scale(0.85);
  }

  /* Sliding tabs takes bottom half */
  .station-sidebar {
    height: 52vh;
    border-radius: 20px 20px 0 0;
    border: none;
    border-top: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    z-index: 10;
  }
  
  .station-nav {
    margin: 8px 16px;
  }
  .station-nav .station-tab {
    padding: 6px 2px;
    flex-direction: row;
    justify-content: center;
    gap: 6px;
  }
  .station-nav .station-tab .label {
    display: inline-block;
  }
  
  .stations-container {
    padding: 0 16px 12px 16px;
    overflow-y: auto;
  }

  .station-content h2 {
    display: none; /* Hide header text to maximize space */
  }

  .portafilter-wrapper {
    padding: 10px;
  }
  .tamping-slider-container {
    height: 120px;
  }
  
  .view-footer {
    position: absolute;
    bottom: calc(52vh + 10px);
    width: calc(100% - 24px);
    left: 12px;
    z-index: 9;
  }
  .pour-instructions {
    display: none;
  }
}

/* Ultra short viewports */
@media (max-height: 600px) {
  .app-header {
    height: 50px;
  }
  .logo span {
    font-size: 16px;
  }
  .main-workspace {
    height: 40vh;
  }
  .station-sidebar {
    height: 60vh;
  }
  .view-footer {
    bottom: calc(60vh + 8px);
  }
}

.pour-action-btn.active-tool, .topping-btn.active-tool {
  border-color: var(--accent) !important;
  background: rgba(212, 163, 115, 0.15) !important;
  box-shadow: 0 0 10px var(--accent-glow) !important;
  transform: translateY(-2px);
}

.portafilter-graphic-locked.error {
  color: #ff6b6b !important;
  border-color: rgba(255, 107, 107, 0.3) !important;
  background: rgba(255, 107, 107, 0.1) !important;
  box-shadow: inset 0 0 10px rgba(255, 107, 107, 0.2) !important;
}

#tooltip-bubble {
  position: fixed;
  background: rgba(26, 17, 12, 0.95);
  border: 1px solid var(--accent);
  color: var(--text-main);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 11px;
  pointer-events: none;
  z-index: 9999;
  box-shadow: 0 4px 15px rgba(0,0,0,0.5);
  max-width: 200px;
  opacity: 0;
  transition: opacity 0.15s ease;
  line-height: 1.4;
}

@media (max-width: 900px) {
  .header-controls button span {
    display: none;
  }
}
