/* fallback */
@font-face {
  font-family: 'Material Symbols Rounded';
  font-style: normal;
  font-weight: 100 700;
  src: url(sykg-zNym6YjUruM-QrEh7-nyTnjDwKNJ_190FjzaqkNCeE.woff2) format('woff2');
}

.material-symbols-rounded {
  font-family: 'Material Symbols Rounded';
  font-weight: normal;
  font-style: normal;
  font-size: 24px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  -webkit-font-feature-settings: 'liga';
  -webkit-font-smoothing: antialiased;

}

/* --- Material 3 Expressive Fast Scroller --- */
.fast-scroll-track {
  position: fixed;
  top: 70px;
  /* Below top app bar */
  bottom: 10px;
  right: 4px;
  width: 20px;
  z-index: 900;
  /* Above content, below modals */
  pointer-events: none;
  /* Let clicks pass through the track area */
  opacity: 0;
  /* Hidden by default until scroll */
  transition: opacity 0.3s ease;
}

.fast-scroll-track.visible,
.fast-scroll-track:hover {
  opacity: 1;
  pointer-events: auto;
}

.fast-scroll-thumb {
  position: absolute;
  top: 0;
  right: 0;
  width: 40px;
  /* Hit area width */
  height: 60px;
  /* Thumb height */
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
  border-radius: var(--radius-xl);
  /* Pill shape */
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  pointer-events: auto;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  transform: translateX(10px);
  /* Partially hide off-screen initially */
  transition: transform 0.2s ease, background-color 0.2s;
  touch-action: none;
  /* Prevent browser scrolling while dragging */
}

/* Icon styling */
.fast-scroll-thumb .material-symbols-outlined {
  font-size: 20px;
  pointer-events: none;
  /* Ignore clicks on icon */
  font-variation-settings: 'wght' 600;
}

/* Hover State */
.fast-scroll-thumb:hover {
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
  transform: translateX(0);
  /* Slide fully into view */
}

/* Active/Dragging State */
.fast-scroll-thumb.dragging {
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
  transform: translateX(0) scale(1.1);
  cursor: grabbing;
}

/* --- Theme Picker Styles --- */
.theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 16px;
  margin: 20px 0;
  max-height: 60vh;
  overflow-y: auto;
  padding: 4px;
  /* Space for focus rings */
}

.theme-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  padding: 12px;
  border-radius: var(--radius-l);
  background: var(--md-sys-color-surface);
  border: 1px solid var(--md-sys-color-outline-variant);
  transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
  position: relative;
}

.theme-option:hover {
  background: var(--md-sys-color-surface-variant);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.theme-option.active {
  background: var(--md-sys-color-secondary-container);
  border-color: var(--md-sys-color-primary);
  border-width: 2px;
}

/* Checkmark badge for active theme */
.theme-option.active::after {
  content: '';
  font-family: 'Material Symbols Outlined';
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 18px;
  color: var(--md-sys-color-on-secondary-container);
  background: var(--md-sys-color-secondary);
  color: var(--md-sys-color-on-secondary);
  border-radius: var(--radius-full);
  padding: 2px;
}

/* Android-style Preview Circle */
.theme-preview-circle {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-full);
  margin-bottom: 12px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
  /* Conic gradient creates the pie-chart look */
  background: conic-gradient(
  var(--preview-primary) 0deg 90deg,
  var(--preview-secondary) 90deg 180deg,
  var(--preview-tertiary) 180deg 270deg,
  var(--preview-surface) 270deg 360deg
  );
  border: 4px solid var(--md-sys-color-surface);
  /* Inner ring effect */
  outline: 1px solid var(--md-sys-color-outline-variant);
  /* Outer definition */
}

.theme-label {
  font-size: 0.9em;
  font-weight: 500;
  color: var(--md-sys-color-on-surface);
  text-align: center;
  line-height: 1.2;
}

/* Responsive adjust for smaller screens */
@media (max-width: 400px) {
  .theme-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}


:root {
  /* Material 3 Expressive Baseline (Light Theme) */
  --md-sys-color-primary: #6750A4;
  --md-sys-color-on-primary: #FFFFFF;
  --md-sys-color-primary-container: #EADDFF;
  --md-sys-color-on-primary-container: #21005D;
  --md-sys-color-secondary: #625B71;
  --md-sys-color-on-secondary: #FFFFFF;
  --md-sys-color-secondary-container: #E8DEF8;
  --md-sys-color-on-secondary-container: #1D192B;
  --md-sys-color-tertiary: #7D5260;
  --md-sys-color-on-tertiary: #FFFFFF;
  --md-sys-color-tertiary-container: #FFD8E4;
  --md-sys-color-on-tertiary-container: #31111D;
  --md-sys-color-error: #B3261E;
  --md-sys-color-on-error: #FFFFFF;
  --md-sys-color-error-container: #F9DEDC;
  --md-sys-color-on-error-container: #410E0B;
  --md-sys-color-background: #F7F2FA;
  --md-sys-color-on-background: #1C1B1F;
  --md-sys-color-surface: #FEFBFF;
  --md-sys-color-on-surface: #1C1B1F;
  --md-sys-color-surface-variant: #E7E0EC;
  --md-sys-color-on-surface-variant: #49454F;
  --md-sys-color-outline: #79747E;
  --md-sys-color-surface-container: #F3EDF7;
  --md-sys-color-surface-container-high: #ECE6F0;
  --radius-xl: 1.75rem;
  --radius-l: 1rem;
  --radius-m: 0.75rem;
  --radius-s: 0.5rem;
  --radius-xs: 0.25rem;
  --radius-full: 50%;
  --radius-20-percent: 20%;
  
}
/* ================= DARK THEME ================= */
.dark-theme {
  /* Expressive Dark Baseline Palette (Corrected) */
  --md-sys-color-primary: #D0BCFF;
  --md-sys-color-on-primary: #381E72;
  --md-sys-color-primary-container: #4F378B;
  --md-sys-color-on-primary-container: #EADDFF;
  --md-sys-color-secondary: #CCC2DC;
  --md-sys-color-on-secondary: #332D41;
  --md-sys-color-secondary-container: #4A4458;
  --md-sys-color-on-secondary-container: #E8DEF8;
  --md-sys-color-tertiary: #EFB8C8;
  --md-sys-color-on-tertiary: #492532;
  --md-sys-color-tertiary-container: #633B48;
  --md-sys-color-on-tertiary-container: #FFD8E4;
  --md-sys-color-error: #F2B8B5;
  --md-sys-color-on-error: #601410;
  --md-sys-color-error-container: #8C1D18;
  --md-sys-color-on-error-container: #F9DEDC;
  --md-sys-color-background: #1C1B1F;
  --md-sys-color-on-background: #E6E1E5;
  --md-sys-color-surface: #1C1B1F;
  --md-sys-color-on-surface: #E6E1E5;
  --md-sys-color-surface-variant: #49454F;
  --md-sys-color-on-surface-variant: #CAC4D0;
  --md-sys-color-outline: #938F99;
  --md-sys-color-surface-container: #211F26;
  --md-sys-color-surface-container-high: #2B2930;
    /* --- 📐 Border Radius (Based on M3) --- */
  /* Using rem for better scaling/accessibility */
  --radius-sm: 0.25rem;         /* 4px */
  --radius-md: var(--radius-md);          /* 8px */
  --radius-lg: var(--radius-lg);         /* 12px */
  --radius-xl: 1.75rem;         /* 28px (Extra Large) */
  --radius-full: 50%;           /* For pills/circles */
}
/* ================= BASE BODY STYLING ================= */
body {
  font-family: 'Roboto', sans-serif;
  margin: 0;
  padding: 20px 15px;
  background: var(--md-sys-color-background);
  color: var(--md-sys-color-on-background);
  line-height: 1.6;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100vh;
  box-sizing: border-box;
}
.container {
  align-self: center;
  width: 100%;
  max-width: 900px;
  background: var(--md-sys-color-surface-container);
  padding: 10px;
  border-radius: var(--radius-xl);
  /* Material 3 large radius */
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  /* Subtle shadow */
  margin-bottom: 10px;
  /* Space for sticky elements if any */
  box-sizing: border-box;
}
h1, h2, h3 {
  color: var(--md-sys-color-on-surface);
  font-weight: 500;
  /* Medium weight */
}
h1 {
  font-size: 1.51em;
  color: var(--md-sys-color-primary);
  text-shadow: 0 0 3px rgba(0,0,0,0.3);
}
h2 {
  font-size: 1.5em;
}
h3 {
  font-size: 1.2em;
  cursor: pointer;
  margin-left: 4px;
  display: flex;
  /* Use flexbox for alignment */
  align-items: center;
  flex-wrap: wrap;
  /* Allow content to wrap */
}
h3 .component-title {
  flex-grow: 1;
  /* Allow the title to take available space */
  /* Allow the title to take available space */
  word-break: break-word;
  /* Break long words */
  /* Ensure wrapping for long words */
  overflow-wrap: break-word;
  /* Ensure wrapping for long words */
}
h3 .toggle-icon {
  font-size: 0.8em;
  transition: transform 0.2s ease-out;
  color: var(--md-sys-color-primary);
  flex-shrink: 0;
  /* Prevent icon from shrinking */
  transform: rotate(45deg);
}
h3.collapsed .toggle-icon {
  transform: rotate(135deg);
}
h3.collapsed .material-symbols-rounded {
  margin-right: 15px;
  transform: rotate(-90deg);
  font-size: 25px;
  font-variation-settings: 'FILL' 0, 'wght' 500, 'GRAD' 1, 'opsz' 20;
}
h3 .material-symbols-rounded {
  transform: rotate(0deg);
  margin-right: 15px;
  font-size: 25px;
  font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 24;
}
.component-section {
  border: none;
  padding: 5px;
  margin-bottom: 4px;
  margin: 3px;
  border-radius: var(--radius-xs);
  /* Material 3 medium radius */
  background: var(--md-sys-color-surface);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  /* Lighter shadow for components */
  box-sizing: border-box;
}
.component-section.end {
  margin-bottom: 16px;
  border-bottom-right-radius: var(--radius-l);
  border-bottom-left-radius: var(--radius-l);
}
.component-section.single {
  border-radius: var(--radius-l);
  margin-top: 16px;
  margin-bottom: 16px;
}
/*.component-section.invalid {
  background: var(--md-sys-color-on-tertiary);
  color: var(--md-sys-color-tertiary);
  border: 1px solid var(--md-sys-color-tertiary-container);
}*/
.component-section.start {
  margin-top: 16px;
  border-top-right-radius: var(--radius-l);
  border-top-left-radius: var(--radius-l);
}
.component-content {
  margin-top: 5px;
  margin: 5px;
  display: none;
  border-top: none;
  border-top-color: var(--md-sys-color-secondary-container);
}
.component-content.expanded {
  display: block;
}
label {
  display: block;
  /* Default for labels */
  margin-bottom: 5px;
  font-weight: 500;
  color: var(--md-sys-color-on-surface-variant);
  font-size: 0.95em;
}
input[type="text"],
input[type="number"],
textarea,
select {
  width: 75%;
  /* Take full width of parent */
  padding: 6px;
  height: 50px;
  margin-bottom: 10px;
  border: 1px solid var(--md-sys-color-outline);
  border-radius: var(--radius-s);
  /* Material 3 small radius */
  border-width: 2px;
  box-sizing: border-box;
  /* Ensure padding is included in width */
  font-size: 1em;
  background: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
input[type="text"]:focus,
input[type="number"]:focus,
textarea:focus,
select:focus {
  border-color: var(--md-sys-color-primary);
  box-shadow: 0 0 0 3px var(--md-sys-color-primary-container);
  outline: none;
}
.form-group {
  margin-bottom: 20px;
  box-sizing: border-box;
}
.form-group.inline label {
  display: inline-block;
  margin-right: 15px;
}
/* Material Symbols icon styling */
.material-symbols-rounded {
  font-variation-settings:
  'FILL' 0,
  'wght' 400,
  'GRAD' 0,
  'opsz' 24;
  transition: font-variation-settings 0.3s ease;
}
/* General button styling */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius-xl);
  /* Material 3's common pill/rounded shape */
  font-family: 'Roboto', sans-serif;
  /* Recommended Material 3 font */
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease, font-variation-settings 0.3s ease;
  /* Smooth transitions */
  gap: 8px;
  /* Space between icon and text */
  min-width: 120px;
  box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.2);
  /* Default elevation for elevated buttons */
  letter-spacing: 0.25px;
  /* Material 3 typography subtle spacing */
  position: relative;
  /* For ripple effect */
  overflow: hidden;
  /* For ripple effect */
}
/* Ripple effect */
.button .ripple {
  position: absolute;
  border-radius: var(--radius-full);
  background-color: rgba(255, 255, 255, 0.7);
  /* White ripple */
  animation: ripple-animation 0.6s linear;
  transform: scale(0);
  opacity: 1;
  pointer-events: none;
  /* Ensure clicks pass through */
}
/* Download Button specific styles */
.download-button {
  background: var(--md-sys-color-primary);
  /* Primary color from M3 */
  color: var(--md-sys-color-on-primary);
}
.download-button:hover {
  background-color: color-mix(in srgb, var(--md-sys-color-primary) 90%, black);
  /* Slightly darker on hover */
  box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.3);
}
.download-button:active {
  background-color: color-mix(in srgb, var(--md-sys-color-primary) 80%, black);
  box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.2);
}
.download-button:hover .material-symbols-rounded {
  font-variation-settings: 'FILL' 0, 'wght' 600, 'GRAD' 200, 'opsz' 24;
}
/* Copy Button specific styles */
.copy-button {
  background: var(--md-sys-color-primary-container);
  /* Tonal background from M3 */
  color: var(--md-sys-color-on-primary-container);
  /* Tonal foreground from M3 */
  box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.1);
  /* Lighter shadow for tonal */
}
.copy-button:hover {
  background-color: color-mix(in srgb, var(--md-sys-color-primary-container) 90%, black);
  box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.2);
}
.copy-button:active {
  background-color: color-mix(in srgb, var(--md-sys-color-primary-container) 80%, black);
  box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.1);
}
.copy-button:hover .material-symbols-rounded {
  font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}
/* Expressive Styles for Generate Code Button */
.generate-code-button {
  margin: 4px;
  background: var(--md-sys-color-primary);
  /* Primary color for main action */
  color: var(--md-sys-color-on-primary);
  border-radius: var(--radius-l);
  /* Slightly less rounded than pill, more structured */
  font-family: 'Roboto', sans-serif;
  /* Keep Roboto for consistency, not Mono */
  box-shadow: 0px 3px 6px rgba(0, 0, 0, 0.25);
  min-width: 180px;
  /* Make it a bit wider */
}
.generate-code-button:hover {
  background-color: color-mix(in srgb, var(--md-sys-color-primary) 90%, black);
  box-shadow: 0px 5px 10px rgba(0, 0, 0, 0.35);
}
.generate-code-button:active {
  background-color: color-mix(in srgb, var(--md-sys-color-primary) 80%, black);
  box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.2);
}
.generate-code-button .material-symbols-rounded {
  color: var(--md-sys-color-on-primary);
  font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 24;
}
.generate-code-button:hover .material-symbols-rounded {
  font-variation-settings: 'FILL' 1, 'wght' 700, 'GRAD' 0, 'opsz' 24;
}
/* Add/Remove buttons for dynamic lists */
.add-button {
  background: var(--md-sys-color-secondary);
  color: var(--md-sys-color-on-secondary);
  border-radius: var(--radius-l);
  /* Smaller radius for these */
  min-width: unset;
  /* Override min-width from general button */
  padding: 8px 16px;
  font-size: 0.9em;
  box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.1);
}
.add-button:hover {
  background-color: color-mix(in srgb, var(--md-sys-color-secondary) 90%, black);
  box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.15);
}
.add-button:active {
  background-color: color-mix(in srgb, var(--md-sys-color-secondary) 80%, black);
  box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.08);
}
.add-button .material-symbols-rounded {
  color: var(--md-sys-color-on-secondary);
  font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 20;
  /* Smaller icons */
}
.add-button:hover .material-symbols-rounded {
  font-variation-settings: 'FILL' 1, 'wght' 600, 'GRAD' 0, 'opsz' 20;
}
.remove-button {
  background: var(--md-sys-color-error);
  color: var(--md-sys-color-on-error);
  border-radius: var(--radius-l);
  min-width: unset;
  padding: 8px 16px;
  font-size: 0.9em;
  box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.1);
}
.remove-button:hover {
  background-color: color-mix(in srgb, var(--md-sys-color-error) 90%, black);
  box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.15);
}
.remove-button:active {
  background-color: color-mix(in srgb, var(--md-sys-color-error) 80%, black);
  box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.08);
}
.remove-button .material-symbols-rounded {
  color: var(--md-sys-color-on-error);
  font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 20;
}
.remove-button:hover .material-symbols-rounded {
  font-variation-settings: 'FILL' 1, 'wght' 600, 'GRAD' 0, 'opsz' 20;
}
.json-output {
  background: var(--md-sys-color-surface-variant);
  border: 1px solid var(--md-sys-color-outline);
  padding: 20px;
  border-radius: var(--radius-l);
  white-space: pre-wrap;
  font-family: 'Roboto Mono', monospace;
  /* Monospace for code */
  font-size: 0.9em;
  margin-top: 30px;
  word-break: break-all;
  color: var(--md-sys-color-on-surface-variant);
  box-sizing: border-box;
}
.sub-group {
  margin-left: 20px;
  border-left: 2px solid var(--md-sys-color-surface-variant);
  padding-left: 15px;
  margin-bottom: 15px;
  box-sizing: border-box;
}
.required-field::after {
  content: " *";
  color: var(--md-sys-color-error);
  margin-left: 2px;
}
.tooltip {
  position: relative;
  display: inline-block;
  color: var(--md-sys-color-primary-container);
  background: var(--md-sys-color-primary);
  cursor: help;
  border: solid;
  border-radius: var(--radius-s);
  border-top-right-radius: var(--radius-l);
  border-bottom-right-radius: var(--radius-l);
  flex-shrink: 0;
  /* Prevent icon from shrinking */
}
.tooltip .tooltiptext {
  visibility: hidden;
  width: 250px;
  background: var(--md-sys-color-on-surface);
  color: var(--md-sys-color-surface);
  text-align: center;
  border-radius: var(--radius-s);
  padding: 8px 12px;
  position: absolute;
  z-index: 1;
  bottom: -125%;
  right: -300%;
  margin-left: -125px;
  opacity: 0;
  transition: opacity 0.3s ease-in-out;
  box-shadow: 0 2px 8px var(--md-sys-color-on-primary);
  font-size: 0.85em;
}
.tooltip:hover .tooltiptext {
  visibility: visible;
  opacity: 0.67;
}
/* Material 3 Switch Styles (for components and optional inputs) */
/* --- Material 3 Expressive Switch Styles --- */
.switch-container {
  display: flex;
  align-items: center;
  margin-bottom: 15px;
  gap: 10px;
  flex-wrap: wrap;
  box-sizing: border-box;
}

.switch-container label:not(.switch) {
  display: flex;
  align-items: center;
  flex-grow: 1;
  margin-bottom: 0;
  word-break: break-word;
  overflow-wrap: break-word;
}

.switch {
  position: relative;
  display: inline-block;
  width: 52px;  /* Standard M3 width */
  height: 32px; /* Standard M3 height */
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

/* --- Material 3 Expressive Switch Styles --- */
/* (Containers and basic structure remain the same) */

/* --- Core Styles (Unchanged) --- */
/* The Track */
.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--md-sys-color-surface-variant);
    border: 2px solid var(--md-sys-color-outline);
    border-radius: var(--radius-l);
    box-sizing: border-box;
    /* Increased transition to 0.25s for noticeable bounce */
    transition: all 0.2s cubic-bezier(0.2, 0.0, 0, 1.0); 
}

/* The Thumb (Handle) */
.slider:before {
    position: absolute;
    content: "";
    /* OFF State: Smaller Thumb (16px) */
    height: 16px;
    width: 16px;
    left: 6px;
    bottom: 6px;
    background: var(--md-sys-color-outline);
    border-radius: var(--radius-full);
    /* Transition applied to transform for the 'hit' animation */
    transition: transform 0.2s cubic-bezier(0.2, 0.8, 0, 1.0),
                width 0.25s cubic-bezier(0.2, 0.0, 0, 1.0),
                height 0.25s cubic-bezier(0.2, 0.0, 0, 1.0),
                left 0.25s cubic-bezier(0.2, 0.0, 0, 1.0),
                bottom 0.25s cubic-bezier(0.2, 0.0, 0, 1.0); 
}

/* --- Checked (ON) State --- */
input:checked + .slider {
    background: var(--md-sys-color-primary);
    border-color: var(--md-sys-color-primary);
}

input:checked + .slider:before {
    background: var(--md-sys-color-on-primary);
    /* 1. KEY FIX: Size change now happens here (16px -> 24px) for the ON state */
    width: 24px;
    height: 24px;
    transform: translateX(18px); /* Move to the right */
    left: 4px; /* Adjust left for the 24px size to be centered */
    bottom: 2px; /* Adjust bottom for the 24px size to be centered */
}


/* --- Active/Press State (The 'Ripple' Feedback) --- */
/* This handles the momentary size change (28px) while the user presses down */

.switch:active .slider:before {
    /* Active in OFF state (expands from 16px to 28px) */
    width: 28px;
    height: 28px;
    left: 0px; 
    bottom: 0px;
}

input:checked:active + .slider:before {
    /* Active in ON state (expands from 24px to 28px) */
    width: 28px;
    height: 28px;
    /* Position adjustment for the 28px size at the ON side */
    transform: translateX(px); 
    left: 0px; 
    bottom: 0px;
}


        /* Custom Tag Styling */
        .tag-list {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
            margin-top: 10px;
        }

.tag-item {
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
  padding: 6px 12px;
  border-radius: var(--radius-l);
  font-size: 0.9em;
  margin: 2px;/*no more display: flex; now margin*/
  align-items: center;
  gap: 5px;
}
.tag-item .remove-tag-button {
  margin: 2px;
  background: none;
  border: none;
  color: var(--md-sys-color-on-primary-container);
  font-size: 1.1em;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  opacity: 0.7;
  transition: opacity 0.2s;
}
.tag-item .remove-tag-button:hover {
  opacity: 1;
}
/* Material 3 Radio Button Styles */
.radio-group {
  margin-bottom: 15px;
}
.radio-container {
  display: block;
  position: relative;
  padding-left: 35px;
  /* Space for the custom radio button */
  margin-bottom: 12px;
  cursor: pointer;
  font-size: 1em;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  color: var(--md-sys-color-on-surface-variant);
}
/* Hide the browser's default radio button */
.radio-container input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
}
/* Create a custom radio button (the outer circle) */
.radio-checkmark {
  position: absolute;
  top: 0;
  left: 0;
  height: 20px;
  width: 20px;
  background: var(--md-sys-color-surface);
  /* Unchecked background */
  border: 2px solid var(--md-sys-color-outline);
  /* Unchecked border */
  border-radius: var(--radius-full);
  transition: all 0.2s ease-in-out;
}
/* On hover, add a light background color */
.radio-container:hover input ~ .radio-checkmark {
  background: var(--md-sys-color-surface-variant);
}
/* When the radio button is checked, change background and border color */
.radio-container input:checked ~ .radio-checkmark {
  background: var(--md-sys-color-primary-container);
  border-color: var(--md-sys-color-primary);
}
/* Create the inner circle (dot) when checked */
.radio-checkmark:after {
  content: "";
  position: absolute;
  display: none;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 10px;
  height: 10px;
  border-radius: var(--radius-full);
  background: var(--md-sys-color-primary);
  /* Checked dot color */
}
/* Show the inner circle when checked */
.radio-container input:checked ~ .radio-checkmark:after {
  display: block;
}
/* Custom Message Box & Modal Styles */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}
.modal-box {
  background: var(--md-sys-color-surface);
  padding: 25px;
  border-radius: var(--radius-l);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  max-width: 400px;
  width: 90%;
  text-align: center;
  color: var(--md-sys-color-on-surface);
}
.modal-box h4 {
  margin-top: 0;
  color: var(--md-sys-color-primary);
  font-size: 1.3em;
  border-bottom: none;
  padding-bottom: 0;
}
.modal-box p {
  margin-bottom: 20px;
  font-size: 1em;
}
.modal-box .modal-input {
  width: 100%;
  margin-bottom: 20px;
}
.modal-box .modal-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.modal-box button {
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-l);
  cursor: pointer;
  font-size: 0.95em;
  font-weight: 500;
  transition: background 0.2s ease;
}
.modal-box button.secondary {
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
}
.modal-box button:hover {
  background-color: color-mix(in srgb, var(--md-sys-color-primary) 90%, black);
}
.modal-box button.secondary:hover {
  background-color: color-mix(in srgb, var(--md-sys-color-secondary-container) 90%, black);
}
@keyframes ripple-animation {
  from {
    transform: scale(0);
    opacity: 1;
  }
  to {
    transform: scale(4);
    /* Increased scale for better visibility */
    opacity: 0;
  }
}
/* Snackbar/Toast Bar Styles */
.snackbar {
  visibility: hidden;
  /* Hidden by default. */
  min-width: 250px;
  background: var(--md-sys-color-on-surface);
  /* Dark background */
  color: var(--md-sys-color-surface);
  /* White text */
  text-align: center;
  border-radius: var(--radius-s);
  padding: 16px;
  position: fixed;
  z-index: 1001;
  /* Above message box overlay */
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  /* Start off-screen below */
  bottom: 30px;
  /* Distance from bottom */
  font-size: 1em;
  opacity: 0;
  transition: visibility 0s, opacity 0.5s ease-in-out, transform 0.5s ease-in-out;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}
.snackbar.show {
  visibility: visible;
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  /* Move to screen */
}
/* Custom Color Input Styles */
.color-input-group {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 15px;
}
.color-input-group .color-input-text {
  flex-grow: 1;
  /* Allow text input to take most space */
  margin-bottom: 0;
  /* Remove default margin */
}
/* The actual color input is now the swatch */
.color-input-picker {
  width: 40px;
  height: 40px;
  padding: 0;
  border: 2px solid var(--md-sys-color-outline);
  /* Add border to the picker itself */
  background: none;
  cursor: pointer;
  border-radius: var(--radius-m);
  overflow: hidden;
  flex-shrink: 0;
  transition: border-color 0.2s ease;
}
/* Focus style for the color picker */
.color-input-picker:focus {
  border-color: var(--md-sys-color-primary);
  box-shadow: 0 0 0 3px var(--md-sys-color-primary-container);
  outline: none;
}
/* Hide the default color picker's inner elements, show only the color */
.color-input-picker::-webkit-color-swatch-wrapper {
  padding: 0;
}
.color-input-picker::-webkit-color-swatch {
  border: none;
  border-radius: var(--radius-xs);
  /* Ensure inner swatch is also rounded */
}
.color-input-picker::-moz-color-swatch-wrapper {
  padding: 0;
}
.color-input-picker::-moz-color-swatch {
  border: none;
  border-radius: var(--radius-m);
}
/* Styles for the new Preset section */
.preset-management {
  background: var(--md-sys-color-surface-variant);
  padding: 15px;
  border-radius: var(--radius-l);
  margin-bottom: 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 15px;
}
.preset-management .form-group {
  flex-grow: 1;
  margin-bottom: 0;
}
.preset-management select {
  margin-bottom: 0;
}
.preset-management .button {
  flex-shrink: 0;
  padding: 8px 16px;
  font-size: 0.9em;
}
/* Styles for Multi-Export Modal */
.preset-checkbox-item {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
}
.preset-checkbox-item input {
  margin-right: 10px;
  width: auto;
  /* override default */
  margin-bottom: 0;
}
.preset-checkbox-item label {
  margin-bottom: 0;
  font-weight: normal;
  color: var(--md-sys-color-on-surface);
}
/* Base checkbox */
input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  border: 2px solid var(--md-sys-color-outline);
  border-radius: var(--radius-xs);
  background: var(--md-sys-color-surface);
  cursor: pointer;
  position: relative;
  transition: background 0.25s, border-color 0.25s, box-shadow 0.25s;
  vertical-align: middle;
}
/* Checked state */
input[type="checkbox"]:checked {
  border-color: var(--md-sys-color-primary);
  background: var(--md-sys-color-primary);
}
/* Checkmark */
input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  left: 7px;
  top: 2px;
  width: 6px;
  height: 12px;
  border-right: 2px solid var(--md-sys-color-on-primary);
  border-bottom: 2px solid var(--md-sys-color-on-primary);
  transform: rotate(45deg);
  transition: all 0.2s ease-in-out;
}
/* Active ripple */
input[type="checkbox"]:active::before {
  opacity: 1;
  transform: scale(2.1);
}
/* Focus ring */
input[type="checkbox"]:focus-visible {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--md-sys-color-primary) 35%, transparent);
}
/* Hover + Focus */
input[type="checkbox"]:hover {
  border-color: var(--md-sys-color-primary);
  background: var(--md-sys-color-secondary-container);
}
.preset-management {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  /* centers buttons horizontally */
  gap: 12px;
  /* space between buttons */
  max-width: 90%;
  /* optional limit */
}

/* Target both specific classes for size, shape, and transitions */
.copy-button,
.download-button {
  /* Material 3 'Small' size: 40px x 40px */
  --m3-size: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  /* Size and initial circular shape */
  width: var(--m3-size);
  height: var(--m3-size);
  border-radius: var(--radius-20-percent);
  border: none;
  padding: 0;
  overflow: hidden;
  /* Expressive Transitions: Shape morph and press feedback */
  transition:
  background-color 0.2s,
  border-radius 0.3s cubic-bezier(0.2, 0, 0, 1), /* Shape morph */
  transform 0.1s;
  /* Quick response on press */
}
/* Base icon styling using Material Symbols */
.copy-button,
.download-button {
  font-family: 'Material Symbols Rounded';
  font-size: 24px;
  line-height: 1;
  /* Unselected: Outline (FILL 0) and lighter weight */
  font-variation-settings:
  'FILL' 0,
  'wght' 400,
  'GRAD' 0,
  'opsz' 24;
  transition: font-variation-settings 0.25s ease-in-out;
}
/* --- Interaction States --- */
/* Hover state (subtle lift) */
.copy-button:hover,
.download-button:hover {
  transform: scale(1.04);
}
/* Pressed state (snappy scale down) */
.copy-button:active,
.download-button:active {
  transform: scale(0.96);
  transition-duration: 0.05s;
}
/* --- Selected (Toggle ON) State --- */
/* 1. Expressive Shape Morph: Circle to Rounded Square */
.copy-button.selected,
.download-button.selected {
  border-radius: var(--radius-m);
}
/* 2. Icon Fill and Weight Change: Outline to Filled */
.copy-button.selected .icon,
.download-button.selected .icon {
  /* Selected: Filled (FILL 1) and bold weight */
  font-variation-settings:
  'FILL' 1,
  'wght' 600,
  'GRAD' 0,
  'opsz' 24;
}
::selection {
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-primary);
}
::-moz-selection {
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-primary);
}
/* Universal focus styling for all interactive elements */
:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--md-sys-color-primary) 40%, transparent);
  transition: box-shadow 0.25s ease;
  border-radius: var(--radius-s);
  /* adds a smoother look */
}
/* Optional: ensure it applies to interactive elements */
input, button, textarea, select, a, [tabindex]:not([tabindex="-1"]) {
  transition: box-shadow 0.25s ease, border-color 0.25s ease;
}
/* Remove default outlines for all focus states */
*:focus {
  outline: none;
}
* {
  -webkit-tap-highlight-color: transparent;
}

/* --- Multi-Export Accordion Styles --- */
.preset-item-container {
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
  margin-bottom: 5px;
}
.preset-header {
  display: flex;
  align-items: center;
  padding: 8px 0;
  width: 100%;
}
.preset-header label {
  flex-grow: 1;
  margin-left: 10px;
  font-weight: 500;
  cursor: pointer;
}
.preset-expand-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--md-sys-color-primary);
  transition: transform 0.3s ease;
  padding: 5px;
  border-radius: var(--radius-full);
}
.preset-expand-btn:hover {
  background: var(--md-sys-color-secondary-container);
}
.preset-expand-btn.expanded {
  transform: rotate(180deg);
}
.preset-details {
  display: none;
  padding: 5px 0 15px 34px;
  /* Indent to align with text */
  background: var(--md-sys-color-surface-container-low);
  border-radius: var(--radius-s);
  margin-bottom: 8px;
}
.sub-file-option {
  display: flex;
  align-items: center;
  margin-bottom: 6px;
  font-size: 0.9em;
  color: var(--md-sys-color-on-surface-variant);
}
.sub-file-option input {
  margin-right: 8px;
  transform: scale(0.9);
  /* Slightly smaller checkboxes */
}
.badge {
  font-size: 0.75em;
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  margin-left: 8px;
  background: var(--md-sys-color-surface-variant);
}

/* --- Material 3 Expressive Multi-Select UI --- */

/* The Trigger (replaces the native select box) */
.m3-select-trigger {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 75%;
  /* Matches your inputs */
  height: 50px;
  padding: 0 16px;
  margin-bottom: 10px;
  background: var(--md-sys-color-surface);
  border: 1px solid var(--md-sys-color-outline);
  border-radius: var(--radius-s);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  user-select: none;
}

.m3-select-trigger:hover {
  border-color: var(--md-sys-color-on-surface-variant);
  background-color: color-mix(in srgb, var(--md-sys-color-surface) 95%, var(--md-sys-color-on-surface));
}

.m3-select-trigger.active {
  border-color: var(--md-sys-color-primary);
  border-width: 2px;
  padding: 0 15px;
  /* Adjust for border width change */
}

.m3-select-trigger .selection-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--md-sys-color-on-surface);
  font-size: 1em;
}

.m3-select-trigger .selection-text.placeholder {
  color: var(--md-sys-color-on-surface-variant);
}

/* The Modal Overlay */
.m3-select-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  /* Scrim */
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s;
  backdrop-filter: blur(2px);
}

.m3-select-overlay.open {
  opacity: 1;
  visibility: visible;
}

/* The Modal Dialog */
.m3-select-modal {
  background: var(--md-sys-color-surface-container);
  width: 90%;
  max-width: 400px;
  max-height: 85vh;
  border-radius: var(--radius-xl);
  /* Expressive large rounding */
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  transform: scale(0.9);
  transition: transform 0.3s cubic-bezier(0.2, 0.0, 0, 1.0);
  overflow: hidden;
}

.m3-select-overlay.open .m3-select-modal {
  transform: scale(1);
}

/* Header */
.m3-modal-header {
  padding: 24px 24px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.m3-modal-header h3 {
  margin: 0;
  font-size: 1.5rem;
  color: var(--md-sys-color-on-surface);
}

/* Search and Select All Bar */
.m3-modal-controls {
  padding: 0 24px 12px;
  display: flex;
  gap: 12px;
  align-items: center;
}

.m3-search-input {
  flex-grow: 1;
  background: var(--md-sys-color-surface-variant);
  border: none;
  border-radius: var(--radius-l);
  height: 40px;
  padding: 0 16px;
  color: var(--md-sys-color-on-surface-variant);
  font-family: 'Roboto', sans-serif;
}

.m3-search-input:focus {
  outline: 2px solid var(--md-sys-color-primary);
}

.m3-toggle-all-btn {
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
  border: none;
  border-radius: var(--radius-l);
  height: 40px;
  width: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s;
}

.m3-toggle-all-btn:hover {
  background-color: color-mix(in srgb, var(--md-sys-color-secondary-container) 80%, black);
}

/* Options List */
.m3-modal-list {
  overflow-y: auto;
  padding: 8px 16px;
  flex-grow: 1;
  border-top: 1px solid var(--md-sys-color-outline-variant);
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

/* Individual Option Item */
.m3-option-item {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  cursor: pointer;
  border-radius: var(--radius-m);
  margin-bottom: 4px;
  transition: background 0.2s;
}

.m3-option-item:hover {
  background: var(--md-sys-color-surface-variant);
}

.m3-option-item.hidden {
  display: none;
}

.m3-option-checkbox {
  width: 20px;
  height: 20px;
  border: 2px solid var(--md-sys-color-outline);
  border-radius: var(--radius-xs);
  margin-right: 16px;
  position: relative;
  transition: all 0.2s;
  flex-shrink: 0;
  /* --- ADDED THIS LINE --- */
}

.m3-option-item.selected .m3-option-checkbox {
  background: var(--md-sys-color-primary);
  border-color: var(--md-sys-color-primary);
}

.m3-option-item.selected .m3-option-checkbox::after {
  content: '';
  position: absolute;
  left: 6px;
  top: 2px;
  width: 5px;
  height: 10px;
  border: solid var(--md-sys-color-on-primary);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.m3-option-label {
  color: var(--md-sys-color-on-surface);
  font-weight: 500;
}

/* Footer */
.m3-modal-footer {
  padding: 16px 24px;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.m3-modal-btn {
  padding: 10px 24px;
  border-radius: var(--radius-l);
  border: none;
  font-weight: 500;
  cursor: pointer;
  font-family: 'Roboto', sans-serif;
  font-size: 0.95rem;
}

.m3-btn-text {
  background: transparent;
  color: var(--md-sys-color-primary);
}

.m3-btn-text:hover {
  background-color: color-mix(in srgb, var(--md-sys-color-primary) 8%, transparent);
}

.m3-btn-filled {
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
}

.m3-btn-filled:hover {
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  background-color: color-mix(in srgb, var(--md-sys-color-primary) 90%, black);
}


/* --- Glassmorphism / Backdrop Blur System --- */

/* Apply blur to main overlay surfaces */
.top-app-bar,
.bottom-sheet,
.modal-box,
.m3-select-modal,
.about-dialog,
.fab-container,
.dropdown-menu,
.snackbar {
  /* Apply the blur variable. Default to 0 (no blur) if not set by theme. */
  backdrop-filter: blur(var(--custom-sys-blur, 0px));
  -webkit-backdrop-filter: blur(var(--custom-sys-blur, 0px));

  /* Ensure background transitions smoothly when switching themes */
  transition: background 0.3s ease, backdrop-filter 0.3s ease;
}

/* Optional: Make the top bar slightly more transparent on scroll if desired,
   but for now, it relies on the theme's defined alpha color. */


.pre-like {
  align-self: center;
  margin-top: 12px;
  margin-left: 24px;
  margin-right: 24px;
  width: 80%;
  height: 200px;
  /* fixed height */
  resize: none;
  /* disable resize handle */
  overflow: auto;
  /* allow scrolling if long text */
  white-space: pre-wrap;
  /* preserve spaces and line breaks */
  font-family: monospace;
  /* pre-like font */
  border-radius: var(--radius-s);
}

/*
			* M3 Expressive Styles for the Suggestion Box
			* - Uses provided Material 3 color tokens.
			* - Applies a subtle, rounded shape.
			* - Ensures the background is opaque to prevent content overlap.
			* - Enhances interactivity with hover states.
			* - Uses expressive typography and spacing.
			*/
.suggestions {
  position: absolute;
  /* Use a dedicated surface color for the suggestion box to avoid transparency issues.
			`--md-sys-color-surface-container` is a great choice for this kind of pop-up. */
  background: var(--md-sys-color-surface);
  border: 1px solid var(--md-sys-color-outline);
  /* Add a subtle border */
  border-radius: var(--radius-l);
  /* Material 3 large radius for an expressive, soft feel */
  z-index: 1000;
  max-height: 200px;
  overflow-y: auto;
  /* A more pronounced shadow for a sense of depth (elevation) */
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15), 0 2px 4px rgba(0, 0, 0, 0.1);
  padding: 8px;
  /* Inner padding for spacing around items */
}
/* M3 Expressive suggestions item style */
.suggestion-item {
  color: var(--md-sys-color-on-surface-variant);
  /* Text color from the provided theme */
  font-size: 1em;
  /* Use a standard size */
  font-family: 'Roboto', sans-serif;
  font-weight: 400;
  padding: 12px 16px;
  /* Generous padding for touch targets and visual separation */
  cursor: pointer;
  border-radius: var(--radius-m);
  /* A slightly smaller radius for the individual items */
  transition: background 0.2s ease, color 0.2s ease;
}
/* M3 Expressive hover state */
.suggestion-item:hover {
  /* Use a light secondary container color for a soft, tonal highlight */
  background: var(--md-sys-color-secondary-container);
  /* Ensure text color adapts for readability */
  color: var(--md-sys-color-on-secondary-container);
}

:root {
  font-family: "Roboto", sans-serif;
  box-sizing: border-box;
}
*, *::before, *::after {
  box-sizing: inherit;
}
/* Global */
body {
  margin: 0;
  background: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
/* --- EXPRESSIVE GUIDANCE TOGGLE BUTTONS --- */
/* FAB container */
.fab-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  background: var(--md-sys-color-primary);
  border-radius: var(--radius-l);
  padding: 8px;
  gap: 8px;
  box-shadow: 0 6px 16px rgba(0,0,0,0.25);
  z-index: 10;
  transition:
  transform 0.45s cubic-bezier(0.4, 0, 0.2, 1),
  opacity 0.35s ease;
}
/* Hiding animation */
.fab-container.hide {
  transform: translate(-50%, 100px);
  opacity: 0;
  pointer-events: none;
}
/* Icon toggle button */
.m3-icon-toggle {
  width: 56px;
  height: 56px;
  border: none;
  border-radius: var(--radius-m);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: transparent;
  color: var(--md-sys-color-on-primary);
  font-size: 24px;
  transition:
  background-color 0.25s ease,
  color 0.25s ease,
  transform 0.25s ease;
}
.m3-icon-toggle:hover {
  background-color: rgba(255, 255, 255, 0.15);
  transform: scale(1.05);
}
.m3-icon-toggle.active {
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
}
.material-symbols-rounded {
  font-variation-settings: 'FILL' 0, 'wght' 500, 'GRAD' 0, 'opsz' 24;
}
.m3-icon-toggle.active .material-symbols-rounded {
  font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 24;
}
/* --- Bottom sheet (drawer) CSS --- */
.bottom-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  transform: translateY(100%);
  background: var(--md-sys-color-surface-container-high);
  border-top-left-radius: var(--radius-xl);
  border-top-right-radius: var(--radius-xl);
  box-shadow: 0 -4px 20px rgba(0,0,0,0.2);
  transition: transform 0.4s cubic-bezier(0.25, 0.1, 0.25, 1.0);
  max-height: 85vh;
  z-index: 15;
  display: flex;
  flex-direction: column;
}
.bottom-sheet.active {
  transform: translateY(0);
}
/* Drag Handle container - FIXED position inside the sheet */
.drag-handle-container {
  padding: 16px 0 24px;
  display: flex;
  justify-content: center;
  flex-shrink: 0;
}
.drag-handle {
  width: 32px;
  height: 4px;
  background: var(--md-sys-color-outline);
  border-radius: var(--radius-xs);
  cursor: grab;
  touch-action: none;
}
/* Scrollable Content Area */
.bottom-sheet-content {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: 0 24px 24px 24px;
  overflow-y: auto;
  flex-grow: 1;
}
.tool-container {
  padding: 12px 0 8px;
  margin-top: 8px;
  display: flex;
  justify-content: center;
  flex-shrink: 0;
}
.tool-management {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  /* centers buttons horizontally */
  gap: 12px;
  /* space between buttons */
  max-width: 100%;
  /* optional limit */
  border: solid;
  border-left: dotted;
  border-right: dotted;
  border-width: 3px;
  border-color: var(--md-sys-color-outline);
  border-radius: var(--radius-m);
  padding: 3px;
}
.tool-management.select {
  border: none;
}

/* CSS will go here */
/* --- MATERIAL 3 EXPRESSIVE BASELINE PALETTE (DARK) --- */
/* Defined in the :root scope and overridden by .dark-theme */
/* DARK THEME OVERRIDE */

/* --- BASE STYLES --- */
body {
  font-family: 'Roboto', sans-serif;
  margin: 0;
  /* Apply M3 theme colors to the body */
  background: var(--md-sys-color-background);
  color: var(--md-sys-color-on-background);
  transition: background 0.3s, color 0.3s;
}
/* Material Symbols Icon Style */
.material-symbols-rounded {
  font-size: 24px;
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}
body {
  padding-top: 64px;
  /* equal to the bar height */
}
/* --- TOP APP BAR --- */
.top-app-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  /* ensures full width even if page scrolls horizontally */
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  padding: 0 24px;
  background: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface);
  border-bottom-left-radius: var(--radius-l);
  border-bottom-right-radius: var(--radius-l);
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--md-sys-color-primary);
}
/* --- VERTICAL OVAL BUTTON --- */
.m3-expressive-tonal-icon-button {
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
  border: 2.5px solid;
  cursor: pointer;
  /* Vertical Oval Shape Dimensions (Flipped from previous) */
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: var(--radius-xl);
  /* Half of the width (40px) */
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}
.m3-expressive-tonal-icon-button:active {
  border-radius: var(--radius-m);
}
/* Ensure the bold icon is colored correctly */
.m3-expressive-tonal-icon-button .material-symbols-rounded {
  color: var(--md-sys-color-on-primary-container);
}
.m3-expressive-tonal-icon-button:hover {
  transform: rotate(180deg);
  background-color: color-mix(in srgb, var(--md-sys-color-primary) 90%, black);
  color: var(--md-sys-color-on-primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  
  border-radius: var(--radius-m);
}
:hover.m3-expressive-tonal-icon-button .material-symbols-rounded {
  color: var(--md-sys-color-on-primary);
}
/* --- DROPDOWN MENU --- */
.more-options{
  position: fixed;
  top: 0;
  margin-right: 16px;
  right: 0;
  /* ensures full width even if page scrolls horizontally */
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  background: var(--md-sys-color-surface);
  box-shadow: 0 6px 10px rgba(0, 0, 0, 0.2);
  /* Stronger shadow for contrast */
  border: 1px solid var(--md-sys-color-surface-variant);
  border-radius: var(--radius-m);
  min-width: 250px;
  margin-top: 10px;
  padding: 8px 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-5px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
  z-index: 2000;
}
.dropdown-menu.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.list-item {
  display: flex;
  align-items: center;
  height: 48px;
  padding: 0 16px;
  text-decoration: none;
  color: var(--md-sys-color-on-surface);
  font-size: 0.95rem;
  font-weight: 500;
  transition: background 0.1s ease;
  cursor: pointer;
}
.list-item:hover {
  background-color: color-mix(in srgb, var(--md-sys-color-surface) 90%, var(--md-sys-color-surface-variant));
}
.leading-icon {
  margin-right: 16px;
  color: var(--md-sys-color-on-surface-variant);
}
.list-label {
  flex-grow: 1;
}
.menu-divider {
  height: 1px;
  background: var(--md-sys-color-surface-variant);
  margin: 8px 0;
}
/* --- Trailing Icon Button (Toggle Simulation) --- */
.trailing-icon-button {
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-full);
  margin: 0 -8px 0 8px;
  transition: background 0.1s;
}
.trailing-icon-button:hover {
  background-color: color-mix(in srgb, var(--md-sys-color-on-surface) 8%, transparent);
}
.trailing-icon-button .material-symbols-rounded {
  color: var(--md-sys-color-on-surface-variant);
}
/* Custom styles applied by JavaScript for ON state */
[data-toggled="on"] .material-symbols-rounded {
  color: var(--md-sys-color-primary) !important;
  font-variation-settings: 'FILL' 1, 'wght' 600, 'GRAD' 0, 'opsz' 24 !important;
}
/* --- ABOUT DIALOG UI --- */
.about-dialog-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease;
  z-index: 3000;
}
.about-dialog-backdrop.visible {
  opacity: 1;
  visibility: visible;
}
.about-dialog {
  background: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
  border-radius: var(--radius-xl);
  /* M3 large container shape */
  padding: 24px;
  max-width: 400px;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
  transform: scale(0.95);
  transition: transform 0.2s ease;
}
.about-dialog-backdrop.visible .about-dialog {
  transform: scale(1);
}
.dialog-header {
  display: flex;
  align-items: center;
  margin-bottom: 16px;
}
.dialog-header .material-symbols-rounded {
  margin-right: 12px;
  font-size: 32px;
}
.dialog-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
  color: var(--md-sys-color-on-surface);
}
.about-dialog p {
  font-size: 1rem;
  line-height: 1.5;
  color: var(--md-sys-color-on-surface-variant);
  margin-bottom: 24px;
}
.dialog-actions {
  display: flex;
  justify-content: flex-end;
}
.m3-text-button {
  background: none;
  border: none;
  color: var(--md-sys-color-primary);
  padding: 10px 16px;
  margin-left: 8px;
  cursor: pointer;
  font-weight: 500;
  border-radius: var(--radius-l);
  transition: background 0.1s;
}
.m3-text-button:hover {
  background-color: color-mix(in srgb, var(--md-sys-color-primary) 8%, transparent);
}

/* Initially hide the container */
#hidden-container {
  display: none;
}

/* --- Custom Expressive Slider Styles --- */
:root {
  --slider-handle-width: 8px;
  --slider-handle-height: 42px;
  --slider-track-height: 32px;
  --slider-radius-outer: 8px;
  --slider-radius-inner: 4px;
  --slider-dot-size: 4px;
  --slider-dot-offset: 8px;
}

.custom-slider-replacement {
  margin: 15px 0;
  padding: 0 4px; /* Slight padding to prevent handle clip */
  width: 100%;
  box-sizing: border-box;
  font-family: 'Roboto', sans-serif;
}

.color-bars-container {
  width: 100%;
  display: flex;
  align-items: center;
  position: relative;
  height: var(--slider-track-height);
  touch-action: none; /* Critical for mobile drag */
}

.color-bar {
  height: 100%;
  transition: width 0.05s linear, opacity 0.2s ease;
  position: relative;
}

/* Active Track (Left) */
#left-bar {
  background-color: var(--md-sys-color-primary);
  border-top-left-radius: var(--slider-radius-outer);
  border-bottom-left-radius: var(--slider-radius-outer);
  border-top-right-radius: var(--slider-radius-inner);
  border-bottom-right-radius: var(--slider-radius-inner);
  margin-right: -2px; /* Pull handle flush */
}

/* Inactive Track (Right) */
#right-bar {
  background-color: var(--md-sys-color-surface-variant);
  border-top-right-radius: var(--slider-radius-outer);
  border-bottom-right-radius: var(--slider-radius-outer);
  border-top-left-radius: var(--slider-radius-inner);
  border-bottom-left-radius: var(--slider-radius-inner);
  margin-left: -2px; /* Pull handle flush */
}

/* Aesthetic Dot */
#right-bar::after {
  content: '';
  display: block;
  width: var(--slider-dot-size);
  height: var(--slider-dot-size);
  background-color: var(--md-sys-color-on-surface);
  opacity: 0.2;
  border-radius: 50%;
  position: absolute;
  top: 50%;
  right: var(--slider-dot-offset);
  transform: translateY(-50%);
  transition: opacity 0.2s;
}

#right-bar.hide-dot::after {
  opacity: 0;
}

/* Handle */
#separator-handle {
  width: var(--slider-handle-width);
  height: var(--slider-handle-height);
  margin: 4px;
  background-color: var(--md-sys-color-primary);
  
  border-radius: var(--radius-s);
  cursor: grab;
  z-index: 5;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

#separator-handle:active {
  cursor: grabbing;
  transform: scale(1.5);
}

.slider-info {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 0.9em;
  font-weight: 500;
  color: var(--md-sys-color-primary);
}

/* --- New CSS for Fog Creator --- */

/* Small Icon Button */
.m3-icon-btn-small {
    width: 40px;
    height: 40px;
    border: 1px solid var(--md-sys-color-outline);
    background: var(--md-sys-color-surface);
    color: var(--md-sys-color-primary);
    border-radius: var(--radius-m);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.m3-icon-btn-small:hover {
    background: var(--md-sys-color-secondary-container);
    border-color: var(--md-sys-color-primary);
}

/* Code Editor Textarea */
.code-editor {
    width: 100%;
    height: 100%;
    flex-grow: 1;
    background: var(--md-sys-color-surface-variant);
    color: var(--md-sys-color-on-surface-variant);
    border: 1px solid var(--md-sys-color-outline);
    border-radius: var(--radius-m);
    padding: 10px;
    font-family: 'Roboto Mono', monospace;
    font-size: 13px;
    line-height: 1.4;
    resize: none;
    tab-size: 2;
}

.code-editor:focus {
    outline: 2px solid var(--md-sys-color-primary);
    border-color: transparent;
}

/* Segmented Buttons */
.segmented-btn-group {
    display: flex;
    border: 1px solid var(--md-sys-color-outline);
    border-radius: var(--radius-l); /* Pill shape */
    overflow: hidden;
}

.segmented-btn {
    background: transparent;
    border: none;
    border-right: 1px solid var(--md-sys-color-outline);
    color: var(--md-sys-color-on-surface);
    padding: 8px 16px;
    font-size: 0.9em;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background 0.2s;
}

.segmented-btn:last-child {
    border-right: none;
}

.segmented-btn:hover {
    background: var(--md-sys-color-surface-variant);
}

.segmented-btn .material-symbols-rounded {
    font-size: 18px;
}

/* Ensure Dropdown works inside modal */
#fogCreatorModalOverlay .dropdown-menu {
    position: absolute;
    z-index: 2005; /* Higher than modal */
}

/* Sidebar Tabs */
.fog-sidebar .fog-tab {
    padding: 10px 24px;
    cursor: pointer;
    font-size: 0.95em;
    color: var(--md-sys-color-on-surface-variant);
    border-left: 3px solid transparent;
    transition: all 0.2s;
}

.fog-sidebar .fog-tab:hover {
    background: var(--md-sys-color-surface-variant);
}

.fog-sidebar .fog-tab.active {
    background: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
    border-left-color: var(--md-sys-color-primary);
    font-weight: 500;
}

.fog-sidebar .fog-tab-header {
    padding: 15px 24px 5px;
    font-size: 0.8em;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--md-sys-color-primary);
    font-weight: 700;
}

/* Form Area */
.fog-form-content h4 {
    margin-top: 0;
    color: var(--md-sys-color-primary);
}

/* Decoration List Items */
.decoration-item {
    display: flex;
    align-items: center;
    padding: 12px 24px;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    cursor: pointer;
    transition: background 0.2s;
}

.decoration-item:hover {
    background: var(--md-sys-color-surface-variant);
}

.decoration-item .checkbox-wrapper {
    margin-right: 16px;
    display: flex;
    align-items: center;
}

.decoration-item .info {
    flex-grow: 1;
}

.decoration-item .name {
    font-weight: 500;
    font-size: 1rem;
    color: var(--md-sys-color-on-surface);
}

.decoration-item .tags {
    font-size: 0.8rem;
    color: var(--md-sys-color-secondary);
    margin-top: 2px;
}

.decoration-item .files-count {
    font-size: 0.75rem;
    color: var(--md-sys-color-outline);
    background: var(--md-sys-color-surface-variant);
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 8px;
}

/* Category Active State */
.decoration-category {
    padding: 12px 20px;
    cursor: pointer;
    font-size: 0.95rem;
    color: var(--md-sys-color-on-surface-variant);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.decoration-category:hover { background: var(--md-sys-color-surface-variant); }
.decoration-category.active {
    background: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
    font-weight: 600;
}
.cat-badge {
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    font-size: 0.75rem;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
    display: none; /* Hide if 0 */
}

/* --- Validation Error Card (Tertiary Style) --- */
#validation {
  /* Default hidden state */
  display: none; 
  
  /* Layout: Flexbox to align icon and text side-by-side */
  flex-direction: row;
  align-items: flex-start; /* Aligns icon with the first line of text */
  gap: 16px; /* Space between icon and text */
  
  /* Spacing */
  margin-top: 12px;
  padding: 16px 20px;
  
  /* Colors: Tertiary Palette */
  background-color: var(--md-sys-color-tertiary-container);
  color: var(--md-sys-color-on-tertiary-container);
  
  /* Shape & Style */
  border-radius: var(--radius-l);
  border: 1px solid var(--md-sys-color-tertiary);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
  
  /* Typography */
  font-family: 'Roboto', sans-serif;
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.5; /* Good readability */
  
  /* Animation */
  animation: validationPop 0.3s cubic-bezier(0.2, 0, 0, 1) forwards;
}

/* FIX: This forces Flexbox even if JS sets display: 'block' */
#validation[style*="display: block"], 
#validation[style*="display:block"] {
  display: flex !important;
}

/* Icon Styles */
#validation::before {
  content: 'error'; 
  font-family: 'Material Symbols Rounded';
  font-size: 24px;
  
  /* Sizing Fixes: Prevents icon from squishing or moving */
  min-width: 24px; 
  height: 24px;
  line-height: 1;
  
  /* Optical Alignment: Align icon perfectly with text baseline */
  margin-top: -2px; 
  
  font-weight: normal;
  color: inherit;
  font-variation-settings: 'FILL' 1, 'wght' 400;
}

@keyframes validationPop {
  from { opacity: 0; transform: translateY(-8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* --- Minecraft Biome Visualizer Styles (Final Polish) --- */
.mc-scene-container {
    --viz-sky: #88AAFF;
    --viz-grass: #77CC44;
    --viz-foliage: #55AA33;
    --viz-water: #4455FF;
    --env-trunk: #5D4037;
    --viz-water-alpha: 0.8;
    
    height: 180px;
    width: 100%;
    border-radius: var(--radius-m);
    position: relative;
    overflow: hidden;
    background-color: var(--viz-sky);
    border: 1px solid var(--md-sys-color-outline-variant);
    box-shadow: inset 0 0 20px rgba(0,0,0,0.1);
    transition: background-color 0.3s ease;
}

.mc-layer { position: absolute; }

/* Sun */
.mc-sun {
    width: 24px; height: 24px;
    background: #FFF59D;
    top: 20px; right: 20px;
    box-shadow: 0 0 15px rgba(255, 245, 157, 0.8);
    z-index: 0;
}

/* Clouds */
.mc-cloud {
    height: 12px;
    background: rgba(255,255,255,0.7);
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    z-index: 1;
}

/* Background Hills (Restored) */
.mc-hill-bg {
    bottom: 20px; left: 0; right: 0; height: 80px;
    background: var(--viz-grass);
    opacity: 0.96; /* Faded for distance */
    border-radius: 50% 50% 0 0 / 25px 25px 0 0; /* Rounded hill shape */
    transform: scaleX(1.5);
    z-index: 1;
}

/* Ground Plane (Flat) */
.mc-ground {
    bottom: 0; left: 0; right: 0;
    height: 40px;
    z-index: 2; /* In front of hills */
}

.mc-grass-surface {
    width: 100%; height: 100%;
    background: var(--viz-grass);
    transition: background-color 0.3s;
    /* Subtle noise texture */
/*    background-image: radial-gradient(rgba(0,0,0,0.05) 15%, transparent 16%);
    background-size: 12px 12px;*/
}

/* Water Patch (Puddle) */
.mc-water-puddle {
    bottom: 15px;
    left: 35%;
    width: 30%;
    height: 12px;
    background: var(--viz-water);
    opacity: var(--viz-water-alpha);
    border-radius: 50% 50% 40% 40% / 60% 60% 40% 40%;
    z-index: 3; /* On top of ground */
    box-shadow: inset 0 0 4px rgba(0,0,0,0.2);
    transition: background-color 0.3s, opacity 0.3s;
}

/* Trees */
.mc-tree {
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 4; /* On top of everything */
/*    filter: drop-shadow(2px 2px 0px rgba(0,0,0,0.1));*/
}

.mc-leaves {
    width: 32px; height: 32px;
    background: var(--viz-foliage);
    border-radius: 4px;
    transition: background-color 0.3s;
    z-index: 2;
}

.mc-trunk {
    width: 6px; height: 18px;
    background: var(--env-trunk);
    margin-top: -4px;
    z-index: 1;
}
