/* -------------------------------------------------------------
   SYSTEM DESIGN SYSTEM & COLOR TOKENS
   Inspired by CenTTech & Century Metals identity
------------------------------------------------------------- */
:root {
  /* Corporate Colors */
  --primary-navy: #001e4e;       /* Corporate Deep Navy Blue */
  --primary-navy-rgb: 0, 30, 78;
  --accent-gold: #e3a11a;        /* Vibrant Corporate Gold */
  --accent-gold-hover: #c48710;
  --accent-gold-light: rgba(227, 161, 26, 0.15);
  
  /* Neutral Palette */
  --bg-slate: #0b1120;           /* Premium dark background */
  --card-glass: rgba(15, 23, 42, 0.55);
  --card-border: rgba(255, 255, 255, 0.08);
  --text-primary: #f8fafc;       /* Off-white */
  --text-secondary: #94a3b8;     /* Slate-400 */
  --text-dark: #0f172a;          /* Slate-900 */
  
  /* Feedback Colors */
  --color-success: #10b981;      /* Emerald Green */
  --color-error: #ef4444;        /* Rose Red */
  
  /* Fonts */
  --font-header: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  
  /* Shadows */
  --shadow-premium: 0 20px 40px -15px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 25px rgba(227, 161, 26, 0.35);
  
  /* Animations */
  --transition-smooth: all 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-quick: all 0.2s ease;
}

/* -------------------------------------------------------------
   BASE RESET & LAYOUT
------------------------------------------------------------- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

html, body {
  background-color: var(--bg-slate);
  color: var(--text-primary);
  font-family: var(--font-body);
  height: 100%;
  width: 100%;
  overflow: hidden;
  position: fixed; /* Prevents bounce scroll in mobile Safari */
}

/* -------------------------------------------------------------
   APP CONTAINER
------------------------------------------------------------- */
.app-container {
  display: flex;
  flex-direction: column;
  height: 100dvh; /* Dynamic viewport height for modern browsers */
  width: 100%;
  max-width: 480px; /* Constrained to mobile-portrait aspect on desktop */
  margin: 0 auto;
  position: relative;
  background-color: #040814;
  box-shadow: 0 0 100px rgba(0, 0, 0, 0.8);
  overflow: hidden;
}

/* -------------------------------------------------------------
   PROGRESS BAR SEGMENTS
------------------------------------------------------------- */
.progress-bar-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: absolute;
  top: 12px;
  left: 0;
  right: 0;
  height: 4px;
  padding: 0 16px;
  z-index: 100;
  gap: 6px;
}

.progress-bar-segment {
  flex-grow: 1;
  height: 4px;
  background-color: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background-color: var(--accent-gold);
  border-radius: 2px;
  transition: width 0.1s linear;
}

.progress-bar-segment.completed .progress-bar-fill {
  width: 100%;
  background-color: var(--text-primary);
}

.progress-bar-segment.active .progress-bar-fill {
  background-color: var(--accent-gold);
  box-shadow: 0 0 8px var(--accent-gold);
}

/* -------------------------------------------------------------
   APP HEADER
------------------------------------------------------------- */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: absolute;
  top: 24px;
  left: 0;
  right: 0;
  height: 50px;
  padding: 0 20px;
  z-index: 90;
  pointer-events: none;
}

.brand {
  height: 100%;
  display: flex;
  align-items: center;
}

.logo-svg {
  height: 32px;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.5));
}

.header-controls {
  display: flex;
  gap: 10px;
  pointer-events: auto; /* Re-enable pointer events for buttons */
}

.header-icon-btn {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--card-border);
  color: var(--text-primary);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: var(--transition-quick);
}

.header-icon-btn:hover {
  background: rgba(227, 161, 26, 0.2);
  border-color: var(--accent-gold);
}

.header-icon-btn .icon {
  width: 18px;
  height: 18px;
}

/* -------------------------------------------------------------
   STORIES CONTAINER & CARD ARCHITECTURE
------------------------------------------------------------- */
.stories-container {
  flex-grow: 1;
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.card {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transform: translateX(100%) scale(0.95);
  pointer-events: none;
  transition: var(--transition-smooth);
  z-index: 10;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  background-color: var(--bg-slate);
}

.card.active {
  opacity: 1;
  transform: translateX(0) scale(1);
  pointer-events: auto;
  z-index: 20;
}

.card.prev {
  opacity: 0;
  transform: translateX(-100%) scale(0.95);
  pointer-events: none;
}

.card-bg-gradient {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle at 50% 30%, #002d75 0%, #001235 60%, #030818 100%);
  opacity: 0.85;
  z-index: 1;
}

.card-content {
  position: relative;
  z-index: 5;
  width: 100%;
  height: 100%;
  padding: 85px 24px 30px;
  display: flex;
  flex-direction: column;
  overflow-y: auto; /* Scrollable content inside the story card */
  scrollbar-width: none; /* Hide scrollbar Firefox */
}

.card-content::-webkit-scrollbar {
  display: none; /* Hide scrollbar Chrome/Safari */
}

/* -------------------------------------------------------------
   TYPOGRAPHY & CONTENT STYLING
------------------------------------------------------------- */
.welcome-badge {
  background: var(--accent-gold-light);
  border: 1px solid var(--accent-gold);
  color: var(--accent-gold);
  font-family: var(--font-header);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 2px;
  padding: 6px 14px;
  border-radius: 20px;
  display: inline-block;
  align-self: flex-start;
  margin-bottom: 20px;
  animation: pulse-glow 2s infinite alternate;
}

.welcome-title {
  font-family: var(--font-header);
  font-weight: 800;
  font-size: 38px;
  line-height: 1.15;
  color: var(--text-primary);
  margin-bottom: 18px;
}

.welcome-title .highlight {
  color: var(--accent-gold);
  background: linear-gradient(135deg, var(--accent-gold) 0%, #ffd066 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.welcome-desc {
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-secondary);
  margin-bottom: 30px;
}

.step-num {
  font-family: var(--font-header);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 3px;
  color: var(--accent-gold);
  margin-bottom: 6px;
  display: block;
}

.card-title {
  font-family: var(--font-header);
  font-weight: 800;
  font-size: 26px;
  line-height: 1.2;
  margin-bottom: 4px;
  color: var(--text-primary);
}

.card-subtitle {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 15px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.card-desc {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.card-desc strong {
  color: var(--text-primary);
  font-weight: 600;
}

/* -------------------------------------------------------------
   SIMULATOR LAYOUT & PREMIUM DECORATIONS
------------------------------------------------------------- */
.simulator-box {
  background: var(--card-glass);
  border: 1px solid var(--card-border);
  border-radius: 18px;
  padding: 16px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-premium);
  display: flex;
  flex-direction: column;
  gap: 16px;
  backdrop-filter: blur(16px);
  position: relative;
  overflow: hidden;
}

.sim-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 8px;
}

.sim-badge {
  background: var(--color-error);
  color: white;
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 4px;
  font-weight: 700;
  transition: var(--transition-quick);
  letter-spacing: 0.5px;
}

.sim-badge.success {
  background: var(--color-success);
}

.sim-controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sim-controls label {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* -------------------------------------------------------------
   INTERACTIVE COMPONENT: STEP 1 LEVEL SIMULATOR
------------------------------------------------------------- */
.level-vial-container {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 8px 0;
}

.level-vial {
  background: linear-gradient(180deg, #10b981 0%, #059669 100%);
  border: 2px solid #34d399;
  width: 180px;
  height: 36px;
  border-radius: 18px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.level-vial::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 0;
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.4);
  border-radius: 4px;
  filter: blur(1px);
}

.level-bubble {
  background: radial-gradient(circle at 35% 35%, #fffbeb 0%, #fef3c7 40%, #fbbf24 100%);
  width: 32px;
  height: 24px;
  border-radius: 50%;
  position: absolute;
  top: 4px;
  left: 5px; /* Moves between 5px and 143px */
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  transition: left 0.1s ease-out;
}

.level-lines {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 44px;
  height: 100%;
  border-left: 2px solid rgba(255, 255, 255, 0.6);
  border-right: 2px solid rgba(255, 255, 255, 0.6);
  z-index: 5;
  pointer-events: none;
}

.purlin-visualizer {
  height: 90px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 12px;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.03);
}

.purlin-line {
  position: absolute;
  top: 50px;
  left: 20px;
  right: 20px;
  height: 8px;
  background-color: #64748b;
  border-radius: 4px;
  transform-origin: left center;
  transition: transform 0.1s ease-out;
  z-index: 2;
}

.roof-sheet-demo {
  position: absolute;
  top: 38px;
  left: 20px;
  right: 20px;
  height: 12px;
  background: repeating-linear-gradient(90deg, #94a3b8, #94a3b8 6px, #475569 6px, #475569 12px);
  border-radius: 4px;
  transform-origin: left center;
  transition: transform 0.1s ease-out;
  z-index: 3;
  opacity: 0.9;
}

.purlin-support {
  position: absolute;
  background: #334155;
  border: 1px solid #475569;
  width: 24px;
  height: 35px;
  bottom: 0;
  border-radius: 4px 4px 0 0;
  z-index: 1;
}

.purlin-support.support-a {
  left: 24px;
  height: 40px;
}

.purlin-support.support-b {
  right: 24px;
  height: 20px; /* Dynamically updated via JS or CSS from 10px to 60px */
  transition: height 0.1s ease-out;
}

/* -------------------------------------------------------------
   INTERACTIVE COMPONENT: STEP 2 SLOPE CALCULATOR
------------------------------------------------------------- */
.slope-canvas-container {
  height: 160px;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 12px;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.03);
}

.roof-diagram {
  position: absolute;
  bottom: 20px;
  left: 20px;
  right: 20px;
  height: 120px;
}

.roof-horizontal-line {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background-color: rgba(255, 255, 255, 0.2);
}

.roof-slope-line {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 6px;
  background: linear-gradient(90deg, var(--accent-gold) 0%, #ffd066 100%);
  border-radius: 3px;
  transform-origin: left bottom;
  z-index: 4;
}

.roof-height-line {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 2px;
  height: 80px; /* Dynamically adjusted */
  background-color: rgba(255, 255, 255, 0.3);
  border-left: 1px dashed rgba(255, 255, 255, 0.5);
  z-index: 2;
}

.label-base {
  position: absolute;
  bottom: -20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  color: var(--text-secondary);
}

.label-height {
  position: absolute;
  right: -5px;
  bottom: 40px;
  transform: rotate(270deg) translateY(-10px);
  transform-origin: right bottom;
  font-size: 10px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.label-angle {
  position: absolute;
  left: 15px;
  bottom: 6px;
  font-size: 10px;
  color: var(--accent-gold);
  font-weight: 700;
}

.water-drop-flow {
  position: absolute;
  width: 6px;
  height: 6px;
  background: #38bdf8;
  border-radius: 50%;
  top: -1px;
  right: 0;
  animation: flow-downward 2s infinite linear;
}

.water-drop-flow-2 {
  position: absolute;
  width: 6px;
  height: 6px;
  background: #38bdf8;
  border-radius: 50%;
  top: -1px;
  right: 50%;
  animation: flow-downward 2s infinite linear;
  animation-delay: 1s;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.input-unit {
  position: relative;
  display: flex;
  align-items: center;
}

.input-unit input {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--card-border);
  color: white;
  border-radius: 8px;
  padding: 8px 45px 8px 12px;
  width: 100%;
  font-size: 13px;
  outline: none;
  font-weight: 600;
  transition: var(--transition-quick);
}

.input-unit input:focus {
  border-color: var(--accent-gold);
  box-shadow: 0 0 10px rgba(227, 161, 26, 0.2);
}

.input-unit span {
  position: absolute;
  right: 12px;
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 500;
  pointer-events: none;
}

.slider-control-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
}

/* Sliders global */
.slider {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.1);
  outline: none;
  margin: 10px 0;
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent-gold);
  cursor: pointer;
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.5);
  transition: var(--transition-quick);
}

.slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  background: #ffbe33;
}

/* -------------------------------------------------------------
   INTERACTIVE COMPONENT: STEP 3 PLACEMENT SEQUENCE
------------------------------------------------------------- */
.placement-board {
  height: 170px;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 12px;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.03);
}

.purlin-background-grid {
  position: absolute;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  padding: 10px 0;
  z-index: 1;
}

.purlin-row-bar {
  height: 6px;
  background: #334155;
  width: 100%;
  opacity: 0.6;
}

.sheet-layer {
  position: absolute;
  left: 20%;
  width: 60%;
  height: 50px;
  border-radius: 6px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-family: var(--font-header);
  font-weight: 700;
  font-size: 11px;
  color: white;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
  z-index: 10;
  opacity: 0;
  transform: translateY(30px) scale(0.9);
  transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 10px 20px rgba(0,0,0,0.4);
}

.sheet-layer.placed {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.sheet-layer::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: repeating-linear-gradient(90deg, rgba(255,255,255,0.08), rgba(255,255,255,0.08) 5px, transparent 5px, transparent 10px);
  border-radius: 6px;
}

.sheet-layer.sheet-1 {
  background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%);
  border: 1.5px solid #3b82f6;
  bottom: 12px;
  z-index: 10;
}

.sheet-layer.sheet-2 {
  background: linear-gradient(135deg, #111827 0%, #1f2937 100%);
  border: 1.5px solid #4b5563;
  bottom: 45px; /* Overlaps sheet 1 slightly */
  z-index: 9;
}

.sheet-layer.sheet-3 {
  background: linear-gradient(135deg, #1e3a8a 0%, #172554 100%);
  border: 1.5px solid #2563eb;
  bottom: 78px; /* Overlaps sheet 2 */
  z-index: 8;
}

.sheet-layer.highlight-placement {
  animation: pulse-border 1.5s infinite alternate;
}

.rain-simulator-flow {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 15;
  background: linear-gradient(180deg, rgba(56, 189, 248, 0) 0%, rgba(56, 189, 248, 0.15) 100%);
  opacity: 0;
  transition: opacity 0.5s ease;
}

.rain-simulator-flow.raining {
  opacity: 1;
}

/* -------------------------------------------------------------
   INTERACTIVE COMPONENT: STEP 4 WIND OVERLAPS
------------------------------------------------------------- */
.wind-visualizer-container {
  height: 130px;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 12px;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.03);
  display: flex;
  justify-content: center;
  align-items: center;
}

.wind-lines-container {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  z-index: 2;
}

.wind-line {
  position: absolute;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  border-radius: 1px;
  animation: wind-blow 1.5s infinite linear;
}

.sheet-overlap-profile {
  display: flex;
  width: 80%;
  height: 50px;
  position: relative;
  z-index: 5;
}

.sheet-profile {
  height: 16px;
  width: 55%;
  position: absolute;
  background: repeating-linear-gradient(45deg, #1e4e8c, #1e4e8c 8px, #10315e 8px, #10315e 16px);
  border: 1.5px solid #3b82f6;
  border-radius: 8px;
  display: flex;
  align-items: center;
  padding: 0 10px;
  font-size: 8px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.7);
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
  transition: all 0.4s ease;
}

.sheet-profile.profile-left {
  left: 0;
  top: 10px;
}

.sheet-profile.profile-right {
  right: 0;
  top: 15px; /* Toggled height to simulate over/under overlaps */
}

.leak-indicator {
  position: absolute;
  top: -24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-error);
  color: white;
  font-size: 9px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  box-shadow: 0 4px 10px rgba(239, 68, 68, 0.4);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.leak-indicator.show {
  opacity: 1;
  animation: shake 0.5s ease-in-out;
}

.wind-controls-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.wind-direction-selector {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-secondary);
}

.btn-toggle {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--card-border);
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-quick);
}

.btn-toggle.active {
  background: var(--accent-gold);
  border-color: var(--accent-gold);
  color: var(--text-dark);
  box-shadow: 0 0 10px rgba(227, 161, 26, 0.3);
}

/* -------------------------------------------------------------
   INTERACTIVE COMPONENT: STEP 5 SCREW TORQUE SIMULATOR
------------------------------------------------------------- */
.screw-adjust-container {
  height: 170px;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 12px;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.03);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px;
}

.screw-svg {
  width: 100%;
  height: 110px;
}

.leak-water-drop-screw {
  position: absolute;
  width: 8px;
  height: 14px;
  background: #38bdf8;
  clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  opacity: 0;
  pointer-events: none;
  z-index: 15;
}

.leak-water-drop-screw.leaking {
  opacity: 1;
  animation: drip 1.2s infinite ease-in;
}

/* Specific styling for drawer and technical spec table */
.tech-drawer-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 190;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
  backdrop-filter: blur(4px);
}

.tech-drawer-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.tech-drawer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 78%;
  background: linear-gradient(180deg, #020c22 0%, #001235 100%);
  border-top: 2px solid var(--accent-gold);
  border-radius: 20px 20px 0 0;
  z-index: 200;
  transform: translateY(100%);
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.8);
}

.tech-drawer.open {
  transform: translateY(0);
}

.drawer-handle {
  width: 40px;
  height: 4px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 2px;
  margin: 12px auto 6px;
  flex-shrink: 0;
}

.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.drawer-title {
  font-family: var(--font-header);
  font-weight: 800;
  font-size: 18px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.drawer-title span {
  color: var(--accent-gold);
}

.drawer-close-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: var(--transition-quick);
}

.drawer-close-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  color: white;
  border-color: rgba(239, 68, 68, 0.4);
}

.drawer-tabs {
  display: flex;
  overflow-x: auto;
  gap: 6px;
  padding: 8px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(0, 0, 0, 0.2);
  scrollbar-width: none;
  flex-shrink: 0;
}

.drawer-tabs::-webkit-scrollbar {
  display: none;
}

.drawer-tab-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 6px 14px;
  font-family: var(--font-header);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  border-radius: 20px;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition-quick);
}

.drawer-tab-btn.active {
  background: var(--accent-gold);
  color: var(--text-dark);
}

.drawer-content {
  flex-grow: 1;
  overflow-y: auto;
  padding: 16px 20px;
}

.drawer-tab-panel {
  display: none;
  animation: fade-in 0.3s ease-out;
}

.drawer-tab-panel.active {
  display: block;
}

.tech-intro-text {
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.tech-table-container {
  overflow-x: auto;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  margin-bottom: 16px;
}

.tech-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11.5px;
  text-align: left;
}

.tech-table th {
  background: rgba(0, 30, 78, 0.8);
  color: var(--accent-gold);
  font-weight: 700;
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.5px;
}

.tech-table td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
  white-space: nowrap;
}

.tech-table tr:last-child td {
  border-bottom: none;
}

.tech-table tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.01);
}

.tech-badge-container {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.tech-badge {
  background: rgba(255,255,255,0.06);
  color: var(--text-secondary);
  font-size: 9.5px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
}

.tech-badge.gold {
  background: var(--accent-gold-light);
  color: var(--accent-gold);
  border: 1px solid rgba(227, 161, 26, 0.3);
}

.tech-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tech-list-item {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 12px;
}

.tech-list-title {
  font-family: var(--font-header);
  font-weight: 700;
  font-size: 13px;
  color: var(--accent-gold);
  margin-bottom: 4px;
}

.tech-list-desc {
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--text-secondary);
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.screw-counter {
  font-size: 13px;
  color: var(--text-secondary);
}

.screw-counter strong {
  color: var(--accent-gold);
  font-size: 15px;
}

/* -------------------------------------------------------------
   STEP TIP BOXES
------------------------------------------------------------- */
.step-tip {
  background: rgba(255, 255, 255, 0.04);
  border-left: 3px solid var(--accent-gold);
  border-radius: 0 12px 12px 0;
  padding: 12px 16px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.step-tip.danger {
  border-left-color: var(--color-error);
  background: rgba(239, 68, 68, 0.05);
}

.tip-icon {
  font-size: 16px;
  line-height: 1;
}

.tip-text {
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-secondary);
}

.tip-text strong {
  color: var(--text-primary);
}

/* -------------------------------------------------------------
   BUTTON STYLES (PREMIUM)
------------------------------------------------------------- */
.btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  padding: 14px 28px;
  border-radius: 12px;
  font-family: var(--font-header);
  font-weight: 700;
  font-size: 15px;
  text-decoration: none;
  cursor: pointer;
  border: none;
  outline: none;
  transition: var(--transition-quick);
  width: auto;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-gold) 0%, #f5b025 100%);
  color: var(--text-dark);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #ffc244 0%, var(--accent-gold) 100%);
  box-shadow: var(--shadow-glow);
  transform: translateY(-2px);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.25);
}

.btn-text {
  background: transparent;
  color: var(--text-secondary);
  box-shadow: none;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
}

.btn-text:hover {
  color: var(--text-primary);
}

.btn-icon {
  width: 18px;
  height: 18px;
}

.btn-block {
  width: 100%;
}

.btn-sm {
  padding: 8px 16px;
  font-size: 12px;
  border-radius: 8px;
  box-shadow: none;
}

.flex-center {
  display: flex;
  justify-content: center;
  gap: 12px;
}

.flex-space {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* -------------------------------------------------------------
   WELCOME CARD EXTRA DECORATIONS
------------------------------------------------------------- */
.welcome-content {
  justify-content: center;
  padding-top: 100px;
}

.preview-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 35px;
}

.preview-item {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 12px 6px;
  text-align: center;
}

.preview-number {
  display: block;
  font-family: var(--font-header);
  font-weight: 800;
  font-size: 20px;
  color: var(--accent-gold);
  margin-bottom: 2px;
}

.preview-label {
  font-size: 9px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.welcome-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  opacity: 0.8;
  padding-top: 20px;
}

.swipe-indicator-text {
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.chevron-indicator {
  width: 10px;
  height: 10px;
  border-right: 2px solid var(--accent-gold);
  border-bottom: 2px solid var(--accent-gold);
  transform: rotate(45deg);
  animation: bounce-vertical 1.5s infinite;
}

/* -------------------------------------------------------------
   OUTRO CARD EXTRA DECORATIONS (QR & FINAL ACTIONS)
------------------------------------------------------------- */
.outro-content {
  justify-content: center;
  align-items: center;
  text-align: center;
  padding-top: 100px;
}

.outro-icon-container {
  width: 68px;
  height: 68px;
  background: rgba(16, 185, 129, 0.15);
  border: 2px solid var(--color-success);
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  color: var(--color-success);
  margin-bottom: 20px;
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.25);
  animation: scale-up 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.success-icon {
  width: 36px;
  height: 36px;
}

.outro-title {
  font-family: var(--font-header);
  font-weight: 800;
  font-size: 32px;
  color: white;
  margin-bottom: 10px;
}

.outro-desc {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-secondary);
  margin-bottom: 30px;
  max-width: 320px;
}

.outro-desc strong {
  color: var(--accent-gold);
}

.qr-box {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 30px;
  width: 100%;
  text-align: left;
}

.qr-container {
  width: 80px;
  height: 80px;
  background: white;
  border-radius: 10px;
  padding: 4px;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.qr-code-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.qr-spinner {
  position: absolute;
  width: 24px;
  height: 24px;
  border: 3px solid rgba(0,0,0,0.1);
  border-top-color: var(--primary-navy);
  border-radius: 50%;
  animation: rotate 0.8s infinite linear;
}

.qr-info h4 {
  font-family: var(--font-header);
  font-size: 14px;
  color: white;
  margin-bottom: 4px;
}

.qr-info p {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.outro-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

/* -------------------------------------------------------------
   NAVIGATION GESTURES (TAP TARGET OVERLAYS)
------------------------------------------------------------- */
.nav-overlay {
  position: absolute;
  top: 60px; /* Below the progress bar and header */
  bottom: 0;
  width: 20%; /* Outer 20% on each side triggers next/prev slide */
  z-index: 50;
  cursor: pointer;
}

.nav-overlay.nav-left {
  left: 0;
}

.nav-overlay.nav-right {
  right: 0;
}

/* -------------------------------------------------------------
   KEYFRAMES & MICRO-ANIMATIONS
------------------------------------------------------------- */
@keyframes pulse-glow {
  0% {
    box-shadow: 0 0 5px rgba(227, 161, 26, 0.2);
    border-color: rgba(227, 161, 26, 0.5);
  }
  100% {
    box-shadow: 0 0 15px rgba(227, 161, 26, 0.4);
    border-color: rgba(227, 161, 26, 1);
  }
}

@keyframes bounce-vertical {
  0%, 100% {
    transform: translateY(0) rotate(45deg);
  }
  50% {
    transform: translateY(6px) rotate(45deg);
  }
}

@keyframes flow-downward {
  0% {
    transform: translate(0, 0);
    opacity: 1;
  }
  80% {
    opacity: 1;
  }
  100% {
    transform: translate(-100px, 35px); /* Matches typical slate angles */
    opacity: 0;
  }
}

@keyframes wind-blow {
  0% {
    transform: translateX(-150px);
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  90% {
    opacity: 1;
  }
  100% {
    transform: translateX(350px);
    opacity: 0;
  }
}

@keyframes drip {
  0% {
    transform: translateY(0);
    opacity: 1;
  }
  100% {
    transform: translateY(80px);
    opacity: 0;
  }
}

@keyframes spark-flash {
  0% {
    transform: scale(0);
    opacity: 1;
  }
  100% {
    transform: scale(3);
    opacity: 0;
  }
}

@keyframes shake {
  0%, 100% { transform: translateX(-50%) rotate(0deg); }
  20%, 60% { transform: translateX(-52%) rotate(-2deg); }
  40%, 80% { transform: translateX(-48%) rotate(2deg); }
}

@keyframes shake-target {
  0%, 100% { transform: translate(0,0); }
  25% { transform: translate(-4px, -2px); }
  75% { transform: translate(4px, 2px); }
}

@keyframes pop-in {
  0% { transform: scale(0); }
  80% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

@keyframes scale-up {
  0% { transform: scale(0.6); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes rotate {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes pulse-border {
  0% { border-color: rgba(59, 130, 246, 0.4); box-shadow: 0 0 5px rgba(59, 130, 246, 0.3); }
  100% { border-color: rgba(59, 130, 246, 1); box-shadow: 0 0 15px rgba(59, 130, 246, 0.7); }
}

/* -------------------------------------------------------------
   NEW HISTORIES: EXPANSION TO COMPREHENSIVE SPEC SHEETS
------------------------------------------------------------- */

/* Card 1: ¿Qué es CenTTech? Selector */
.material-selector-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.material-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 8px 4px;
  font-family: var(--font-header);
  font-weight: 700;
  font-size: 11px;
  color: var(--text-secondary);
  cursor: pointer;
  text-align: center;
  text-transform: uppercase;
  transition: var(--transition-quick);
}

.material-btn.active {
  background: var(--accent-gold-light);
  border-color: var(--accent-gold);
  color: var(--accent-gold);
  box-shadow: 0 0 10px rgba(227, 161, 26, 0.15);
}

.material-detail-box {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 14px;
  padding: 14px;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.material-detail-title {
  font-family: var(--font-header);
  font-weight: 700;
  font-size: 14px;
  color: white;
  margin-bottom: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.material-detail-desc {
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-secondary);
}

/* Card 2: Colores Interactivos */
.color-catalog-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.color-circles-grid {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  padding: 6px 0;
}

.color-circle-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
  transition: var(--transition-quick);
  box-shadow: 0 4px 8px rgba(0,0,0,0.3);
  position: relative;
}

.color-circle-btn:hover {
  transform: scale(1.15);
}

.color-circle-btn.active {
  border-color: var(--accent-gold);
  box-shadow: 0 0 12px var(--accent-gold);
  transform: scale(1.15);
}

.sheet-color-preview-box {
  height: 90px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 12px;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.03);
  display: flex;
  align-items: center;
  justify-content: center;
}

.virtual-sheet-svg {
  width: 90%;
  height: 70px;
  transition: filter 0.5s ease;
}

.color-spec-card {
  background: rgba(227, 161, 26, 0.05);
  border: 1px dashed rgba(227, 161, 26, 0.2);
  border-radius: 12px;
  padding: 12px;
  min-height: 80px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.color-spec-title {
  font-family: var(--font-header);
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-gold);
  margin-bottom: 4px;
  text-transform: uppercase;
}

.color-spec-text {
  font-size: 11.5px;
  line-height: 1.4;
  color: var(--text-secondary);
}

/* Card 3: Medidas y Geometría */
.geo-visualizer-container {
  height: 130px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 12px;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.03);
  display: flex;
  align-items: center;
  justify-content: center;
}

.geo-svg {
  width: 95%;
  height: 95%;
}

.dimension-line {
  stroke: var(--text-secondary);
  stroke-width: 0.8;
  stroke-dasharray: 2,2;
}

.dimension-arrow {
  fill: var(--accent-gold);
}

.dimension-text {
  font-family: var(--font-header);
  font-size: 9px;
  font-weight: 700;
  fill: var(--accent-gold);
}

.geo-table-summary {
  font-size: 11px;
  line-height: 1.4;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 10px;
  padding: 8px 12px;
}

/* Card 4: Minijuego Acopio */
.acopio-game-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.acopio-option {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: var(--transition-quick);
}

.acopio-option:hover {
  background: rgba(255, 255, 255, 0.06);
}

.acopio-option.correct {
  border-color: var(--color-success);
  background: rgba(16, 185, 129, 0.08);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.15);
}

.acopio-option.incorrect {
  border-color: var(--color-error);
  background: rgba(239, 68, 68, 0.08);
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.15);
}

.acopio-text {
  font-size: 11.5px;
  line-height: 1.4;
  color: var(--text-secondary);
  font-weight: 500;
}

.acopio-option.correct .acopio-text {
  color: var(--text-primary);
}

.acopio-option.incorrect .acopio-text {
  color: var(--text-primary);
}

.acopio-result-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
}

.acopio-result-badge.correct {
  background: var(--color-success);
  color: white;
}

.acopio-result-badge.incorrect {
  background: var(--color-error);
  color: white;
}

/* Card 10: Trazabilidad Interactiva */
.grabado-container {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border: 1px solid rgba(227, 161, 26, 0.25);
  border-radius: 12px;
  padding: 16px;
  box-shadow: var(--shadow-premium);
  position: relative;
  overflow: hidden;
  margin-bottom: 12px;
}

.grabado-plate {
  font-family: 'Courier New', Courier, monospace;
  font-weight: 700;
  font-size: 10px;
  line-height: 1.8;
  color: #94a3b8;
  letter-spacing: 0.5px;
  text-align: center;
}

.grabado-line {
  display: block;
  padding: 4px 0;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.05);
}

.grabado-token {
  display: inline-block;
  cursor: pointer;
  padding: 1px 3px;
  border-radius: 3px;
  color: var(--accent-gold);
  border-bottom: 1px dashed var(--accent-gold);
  transition: var(--transition-quick);
}

.grabado-token:hover {
  background: var(--accent-gold-light);
  color: white;
}

.grabado-token.active {
  background: var(--accent-gold);
  color: var(--text-dark);
  border-bottom-style: solid;
}

.grabado-tooltip-container {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 12px;
  padding: 12px;
  min-height: 70px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.grabado-tooltip-title {
  font-family: var(--font-header);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--accent-gold);
  margin-bottom: 4px;
}

.grabado-tooltip-desc {
  font-size: 11.5px;
  line-height: 1.4;
  color: var(--text-secondary);
}

/* -------------------------------------------------------------
   MEDIA QUERIES FOR SCREEN ADAPTATION
------------------------------------------------------------- */
@media (min-width: 480px) {
  body {
    background: radial-gradient(circle at center, #0f1c3f 0%, #060b18 100%);
    display: flex;
    justify-content: center;
    align-items: center;
  }
  
  .app-container {
    height: 92vh;
    border-radius: 28px;
    border: 4px solid rgba(255, 255, 255, 0.05);
  }
  
  .progress-bar-container {
    top: 20px;
  }
  
  .app-header {
    top: 32px;
  }
  
  .card-content {
    padding-top: 100px;
  }
}

@media (max-height: 650px) {
  /* Ultra-small vertical viewports */
  .welcome-title { font-size: 30px; }
  .welcome-desc { font-size: 13px; margin-bottom: 15px; }
  .preview-grid { margin-bottom: 20px; }
  .card-title { font-size: 22px; }
  .simulator-box { padding: 12px; margin-bottom: 12px; gap: 12px; }
  .slope-canvas-container { height: 110px; }
  .placement-board { height: 120px; }
  .sheet-layer { height: 35px; }
  .sheet-layer.sheet-2 { bottom: 35px; }
  .sheet-layer.sheet-3 { bottom: 58px; }
  .corrugation-profile { height: 90px; }
}
