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

  :root {
    /* Dark theme (default) */
    --primary-color: #f57e20;
    --primary-dark: #ff8b32;
    --secondary-color: #333333;
    --accent-color: #252a7c;
    --accent-dark: #1a1e58;
    --background-dark: #1a1a1a;
    --background-medium: #2a2a2a;
    --background-light: #333333;
    --text-light: #ffffff;
    --text-gray: #cccccc;
    --text-dark: #222222;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #f57e20;
    --border-radius: 0.4rem;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  }

  /* Light theme */
  [data-theme="light"] {
    --background-dark: #f5f5f5;
    --background-medium: #ffffff;
    --background-light: #f0f0f0;
    --text-light: #333333;
    --text-gray: #666666;
    --text-dark: #222222;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  }

  /* Theme transition */
  body * {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
  }

  /* Theme toggle styles */
  .theme-toggle {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--background-light);
    padding: 0.5rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.1);
  }

  .theme-toggle i {
    color: var(--text-light);
    font-size: 1.2rem;
  }

  .theme-toggle:hover {
    background: var(--background-medium);
  }

  html {
    font-size: 82.5%;
    scroll-behavior: smooth;
  }
  body {
    font-family: 'Segoe UI', Arial, sans-serif;
    line-height: 1.4;
    background-color: var(--background-dark);
    color: var(--text-light);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow-x: hidden;
  }
  header, footer {
    text-align: center;
    padding: 1.5rem 1rem;
    background-color: var(--background-medium);
    box-shadow: var(--shadow);
    position: relative;
  }
  header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(135deg, #ff006e, #f9d423, #ff4e50, #3f5efb);
    background-size: 600% 600%;
    animation: colorCycle 10s ease infinite;
  }
  @keyframes colorCycle {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
  }
  header h1 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }
  header p {
    color: var(--text-gray);
    font-size: 1.1rem;
    margin-top: 0.25rem;
  }
  main {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 1.5rem 1rem;
    background: linear-gradient(135deg, var(--background-dark) 0%, rgba(30,30,30,1) 100%);
  }
  form {
    background: var(--background-light);
    padding: 1.8rem;
    border-radius: var(--border-radius);
    width: 100%;
    box-shadow: var(--shadow);
    border: 1px solid rgba(255, 255, 255, 0.05);
    margin: 0 auto;
  }
  fieldset {
    border: none;
    margin-bottom: 1.5rem;
    padding: 1.5rem;
    background-color: rgba(0, 0, 0, 0.05);
    border-radius: var(--border-radius);
  }
  legend {
    font-weight: bold;
    margin-bottom: 1rem;
    color: var(--text-light);
    font-size: 1.1rem;
    position: relative;
    padding-left: 0;
  }
  legend::before {
    display: none;
  }
  .radios {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
  }
  .radios label {
    display: inline-flex;
    align-items: center;
    background: var(--background-medium);
    padding: 0.4rem 0.8rem;
    border-radius: 2rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
    cursor: pointer;
    user-select: none;
  }
  .radios label::before {
    content: '';
    position: absolute;
    left: -100%;
    top: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: 0.5s;
  }
  .radios label:hover {
    background: #444;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  }
  .radios label:hover::before {
    left: 100%;
  }
  .radios input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
  }
  .radios label:has(input[type="radio"]:checked) {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 0 10px rgba(227, 6, 19, 0.5);
  }
  .radios label.selected {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-dark);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  }
  .radios label.selected .plt-laser {
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
  }
  .radios label:not(.selected):hover {
    background-color: var(--background-medium);
    border-color: var(--text-gray);
  }
  .plt-laser {
    position: relative;
    padding: 0.15rem 0.3rem;
    font-weight: 600;
    font-size: 0.7rem;
    color: white;
    background-color: var(--accent-color);
    border-radius: 3px;
    margin-left: 0.3rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  }
  .mode-buttons {
    display: flex;
    margin-bottom: 1.5rem;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  }
  .mode-btn {
    flex: 1;
    padding: 0.9rem;
    border: none;
    background: var(--background-medium);
    color: var(--text-light);
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.9rem;
  }
  .mode-btn i {
    margin-right: 0.4rem;
    font-size: 0.9rem;
  }
  .mode-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: 0.5s;
  }
  .mode-btn:hover::before {
    left: 100%;
  }
  .mode-btn:hover {
    background: #444;
  }
  .mode-btn.active {
    background: var(--primary-color);
    color: white;
    box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.2);
  }
  #cutSection, #engraveSection {
    margin-bottom: 1.5rem;
    animation: fadeIn 0.5s ease-out;
  }
  @keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
  }
  label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-gray);
    font-weight: 500;
  }
  select, input[type="number"] {
    width: 100%;
    padding: 0.8rem 1rem;
    border-radius: var(--border-radius);
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: var(--background-medium);
    color: var(--text-light);
    margin-bottom: 1rem;
    outline: none;
    transition: all 0.3s ease;
  }
  select:hover, input[type="number"]:hover {
    border-color: rgba(255, 255, 255, 0.2);
  }
  select:focus, input[type="number"]:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(227, 6, 19, 0.25);
  }
  .thickness-input {
    margin-top: 1rem;
    position: relative;
  }
  .input-icon-wrapper {
    position: relative;
  }
  .input-icon-wrapper i {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-gray);
    opacity: 0.7;
  }
  .input-icon-wrapper input {
    padding-right: 2.5rem;
  }
  .hint {
    display: block;
    font-size: 0.8rem;
    color: var(--text-gray);
    margin-top: -0.8rem;
    margin-bottom: 1rem;
    opacity: 0.7;
  }
  .unit-toggle {
    margin-bottom: 1.5rem;
    background: var(--background-medium);
    padding: 1rem;
    border-radius: var(--border-radius);
    border: 1px solid rgba(255, 255, 255, 0.05);
  }
  .toggle-switch {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.7rem;
    margin-top: 0.5rem;
  }
  .switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 28px;
  }
  .switch input {
    opacity: 0;
    width: 0;
    height: 0;
  }
  .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--background-medium);
    transition: .4s;
    border: 1px solid rgba(255, 255, 255, 0.2);
  }
  .slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    box-shadow: 0 0 2px rgba(0, 0, 0, 0.3);
  }
  input:checked + .slider {
    background-color: var(--primary-color);
  }
  input:focus + .slider {
    box-shadow: 0 0 1px var(--primary-color);
  }
  input:checked + .slider:before {
    transform: translateX(32px);
  }
  .slider.round {
    border-radius: 34px;
  }
  .slider.round:before {
    border-radius: 50%;
  }
  .hidden {
    display: none;
  }
  .actions {
    display: flex;
    justify-content: space-between;
    margin-top: 1.8rem;
    gap: 1rem;
  }
  .actions button {
    flex: 1;
    padding: 0.9rem 0.8rem;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
  }
  .actions button i {
    margin-right: 0.4rem;
    font-size: 0.9rem;
  }
  .actions button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: 0.5s;
  }
  .actions button:hover::before {
    left: 100%;
  }
  .actions button[type="submit"] {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 4px 15px rgba(227, 6, 19, 0.3);
  }
  .actions button[type="submit"]:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(227, 6, 19, 0.4);
  }
  .actions button[type="submit"]:active {
    transform: translateY(1px);
    box-shadow: 0 2px 10px rgba(227, 6, 19, 0.4);
  }
  .actions button[type="reset"] {
    background: var(--secondary-color);
    color: white;
  }
  .actions button[type="reset"]:hover {
    opacity: 0.9;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  }
  #results {
    margin-top: 1.8rem;
    animation: slideUp 0.5s ease-out;
  }
  @keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
  }
  .result-card {
    background: var(--background-medium);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    border-left: 4px solid var(--primary-color);
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
    opacity: 0;
    transform: translateX(30px);
    transition: opacity 0.4s ease-out, transform 0.4s ease-out;
  }
  .result-card::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 40px;
    height: 40px;
    background: var(--primary-color);
    transform: rotate(45deg) translate(10px, -20px);
    z-index: 1;
  }
  .result-card h3 {
    margin-bottom: 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-light);
    font-size: 1.2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 0.8rem;
  }
  .result-card h3 i {
    color: var(--primary-color);
  }
  .result-card.visible {
    opacity: 1;
    transform: translateX(0);
  }
  .settings {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.2rem;
    margin-bottom: 1.2rem;
  }
  .setting {
    display: flex;
    flex-direction: column;
    background: rgba(0, 0, 0, 0.15);
    padding: 0.8rem;
    border-radius: var(--border-radius);
    transition: transform 0.2s ease;
  }
  .setting:hover {
    transform: translateY(-2px);
  }
  .setting .label {
    font-size: 0.9rem;
    color: var(--text-gray);
    margin-bottom: 0.3rem;
  }
  .setting .value {
    font-size: 1.5rem;
    font-weight: bold;
  }
  #passesRow {
    grid-column: span 2;
  }
  #passesSuggestion {
    background: rgba(255, 193, 7, 0.1);
    padding: 1rem;
    border-radius: var(--border-radius);
    margin-bottom: 1.2rem;
    border-left: 3px solid var(--warning-color);
    position: relative;
  }
  #passesSuggestion::before {
    content: '⚠️';
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2rem;
  }
  .quality-indicator {
    margin-top: 1.2rem;
    padding: 1rem;
    border-radius: var(--border-radius);
    margin-bottom: 1.2rem;
    font-size: 0.95rem;
    position: relative;
    padding-left: 2.5rem;
  }
  .quality-indicator::before {
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
  }
  .quality-indicator.high {
    background: rgba(40, 167, 69, 0.1);
    border-left: 3px solid var(--success-color);
  }
  .quality-indicator.high::before {
    content: '\f058'; 
    color: var(--success-color);
  }
  .quality-indicator.medium {
    background: rgba(255, 193, 7, 0.1);
    border-left: 3px solid var(--warning-color);
  }
  .quality-indicator.medium::before {
    content: '\f071'; 
    color: var(--warning-color);
  }
  .quality-indicator.low {
    background: rgba(227, 6, 19, 0.1);
    border-left: 3px solid var(--danger-color);
  }
  .quality-indicator.low::before {
    content: '\f057'; 
    color: var(--danger-color);
  }
  .save-btn, .share-btn, .install-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
    text-decoration: none;
    margin-top: 1.5rem;
    width: auto; /* Allow buttons to size based on content */
  }
  .save-btn:hover, .share-btn:hover, .install-btn:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
  }
  .save-btn:active, .share-btn:active, .install-btn:active {
    transform: translateY(0);
  }
  .share-btn {
    background-color: #25D366; /* WhatsApp green */
  }
  .share-btn:hover {
    background-color: #1DAE52;
  }
  .install-btn {
    background-color: var(--accent-color); /* Use accent color */
  }
  .install-btn:hover {
    background-color: var(--accent-dark);
  }
  /* Add spacing between buttons */
  .result-card button + button {
    margin-left: 0.5rem;
  }
  #alerts {
    margin-top: 1rem;
    color: var(--danger-color);
    font-weight: bold;
    background: rgba(227, 6, 19, 0.1);
    padding: 0.8rem;
    border-radius: var(--border-radius);
    border-left: 3px solid var(--danger-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
  }
  #alerts:not(:empty)::before {
    content: '\f071';
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
  }
  .plt-credit {
    margin-top: 1.5rem;
    padding: 1rem;
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-gray);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
  }
  .plt-credit a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    position: relative;
  }
  .plt-credit a::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 1px;
    bottom: -2px;
    left: 0;
    background-color: var(--primary-color);
    transform: scaleX(0);
    transform-origin: bottom right;
    transition: transform 0.3s ease;
  }
  .plt-credit a:hover {
    color: #ff6b6b;
  }
  .plt-credit a:hover::after {
    transform: scaleX(1);
    transform-origin: bottom left;
  }
  .footer-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 800px;
    margin: 0 auto;
  }
  .social-icons {
    display: flex;
    gap: 1rem;
  }
  .social-icons a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-light);
    text-decoration: none;
    transition: all 0.3s ease;
  }
  .social-icons a:hover {
    background: var(--primary-color);
    transform: translateY(-3px);
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.1);
  }

  @media (max-width: 500px) {
    html {
        font-size: 90%; /* Slightly larger base font size for mobile */
    }
    
    .settings {
        grid-template-columns: 1fr;
    }
    
    #passesRow {
        grid-column: 1;
    }
    
    .radios {
        justify-content: flex-start;
        flex-wrap: wrap;
    }
    
    .radios label {
        flex: 1 1 calc(50% - 0.5rem); /* Two columns for radio buttons */
        min-width: 120px;
        justify-content: center;
    }
    
    form {
        padding: 1rem;
        margin: 0.5rem;
    }
    
    .footer-content {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem 0;
    }
    
    .social-icons {
        justify-content: center;
    }
    
    .actions {
        flex-direction: column;
    }
    
    .actions button {
        width: 100%;
    }

    .thickness-options {
        justify-content: space-between;
    }

    .thickness-options label {
        flex: 1 1 calc(50% - 0.5rem);
        justify-content: center;
    }

    .result-card {
        margin: 0.5rem;
    }

    .setting {
        padding: 0.6rem;
    }

    .setting .value {
        font-size: 1.2rem;
    }

    .result-card .save-btn,
    .result-card .share-btn,
    .result-card .install-btn {
        width: 100%; /* Make buttons full width */
        display: flex; /* Use flexbox */
        justify-content: center; /* Center content horizontally */
        align-items: center; /* Center content vertically */
        margin-left: 0; 
        margin-right: 0;
        padding-left: 1rem; 
        padding-right: 1rem;
    }
    
    /* Add margin only to subsequent buttons for stacking */
    .result-card button + button {
        margin-left: 0; /* Reset horizontal margin */
        margin-top: 0.5rem; 
    }
  }

  /* Tablet improvements */
  @media (min-width: 501px) and (max-width: 767px) {
    .radios label {
        flex: 1 1 calc(33.33% - 0.5rem);
        min-width: 100px;
    }

    .thickness-options label {
        flex: 1 1 calc(33.33% - 0.5rem);
    }
  }

  /* Larger screens */
  @media (min-width: 1200px) {
    .calculator-grid {
        gap: 2.5rem;
    }

    .results-column {
        padding-left: 1.5rem;
        border-left: 1px solid rgba(255, 255, 255, 0.1);
    }
  }

  .header-logo {
    max-width: 200px;
    height: auto;
    margin-bottom: 1rem;
    transition: transform 0.3s ease;
  }
  .header-logo:hover {
    transform: scale(1.05);
  }
  .thickness-input label {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  .default-thickness {
    font-size: 0.85rem;
    font-style: italic;
    color: var(--text-gray);
    opacity: 0.8;
    margin-left: 0.5rem;
  }
  .untested-notice {
    background: rgba(108, 117, 125, 0.1);
    padding: 0.8rem 1rem;
    border-radius: var(--border-radius);
    margin-bottom: 1.2rem;
    border-left: 3px solid var(--secondary-color);
    font-size: 0.85rem;
    font-style: italic;
    color: var(--text-gray);
    position: relative;
  }
  .untested-notice:not(.hidden) {
    animation: fadeIn 0.5s ease-out;
  }
  .thickness-section {
    margin-top: 1.5rem;
    padding: 1rem;
    background-color: rgba(0, 0, 0, 0.1);
    border-radius: var(--border-radius);
    border: 1px solid rgba(255, 255, 255, 0.05);
  }
  .thickness-label {
    display: block;
    margin-bottom: 0.8rem;
    font-weight: bold;
    color: var(--text-light);
  }
  .thickness-options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem; 
  }
  .thickness-options label {
    background: var(--background-medium);

  }
  .thickness-options label:has(input[type="radio"]:checked) {
    background: var(--accent-color); 
    color: white;
    box-shadow: 0 0 8px rgba(37, 42, 124, 0.4);
  }
  .calculator-grid {
    display: grid;
    grid-template-columns: 1fr; /* Default to single column */
    gap: 1.8rem;
  }
  .results-column {
    display: none; /* Hide results column by default */
  }
  @media (min-width: 768px) {
    form {
        max-width: 600px; /* Moderate initial width */
        transition: max-width 0.4s ease-out; /* Smooth width change if needed */
    }
    
    form.show-results {
        max-width: 1100px; /* Expand slightly more */
    }
    
    /* Switch grid and show results column */
    form.show-results .calculator-grid {
        grid-template-columns: 1fr 1fr; 
    }
    form.show-results .results-column {
        display: block; 
    }
  }
  
  @media (max-width: 767px) {
    form {
        max-width: none; 
        margin: 0.5rem; 
    }
    /* Mobile: Results column appears below */
     form.show-results .results-column {
        display: block; 
        position: static; 
    }
  }
  .input-column {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
  }
  .input-column > section {
    margin-bottom: 1.5rem;
  }
  .input-summary {
    background: var(--background-dark);
    border-radius: var(--border-radius);
    padding: 1rem;
    margin-bottom: 1.5rem;
  }
  .input-summary h4 {
    margin: 0 0 0.5rem 0;
    color: var(--primary-color);
  }
  .input-summary p {
    margin: 0.5rem 0;
    color: var(--text-gray);
  }
  .input-summary span {
    color: var(--text-light);
    font-weight: 500;
  }
  .notes-section {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
  }
  .result-card h3, .result-card h4 {
    color: var(--text-light);
    border-bottom: none;
    padding-bottom: 0;
  }
  .result-card h3 {
    font-size: 1.3rem;
    margin-bottom: 1rem;
  }
  .result-card h4 {
    font-size: 1.1rem;
    margin-bottom: 0.8rem;
    color: var(--primary-color);
  }
  .result-card h3 i {
    color: var(--primary-color);
    margin-right: 0.5rem;
  }
  .results-column #alerts {
    margin-bottom: 1rem;
  }
  @media (max-width: 767px) {
    .results-column {
      position: static;
    }
  }


  .formula-explanation {
    background: rgba(37, 42, 124, 0.1); 
    padding: 0.8rem 1rem;
    border-radius: var(--border-radius);
    margin-bottom: 1.2rem;
    border-left: 3px solid var(--accent-color);
    font-size: 0.8rem;
    font-family: monospace;
    color: var(--text-gray);
    line-height: 1.5;
  }

  .formula-explanation code {
    background: rgba(0, 0, 0, 0.2);
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    font-weight: bold;
    color: var(--text-light);
  }

  .formula-explanation:not(.hidden) {
    animation: fadeIn 0.5s ease-out;
  }

  .disclaimer-section {
    margin-top: 1.5rem;
    padding: 1rem;
    background-color: rgba(0, 0, 0, 0.1);
    border-radius: var(--border-radius);
    font-size: 0.9rem;
    line-height: 1.6;
  }

  .disclaimer-section h3 {
    color: var(--text-light);
    margin-bottom: 0.8rem;
    font-size: 1rem;
    font-weight: 600;
  }

  .disclaimer-section p {
    margin-bottom: 0.8rem;
    position: relative;
    padding-left: 1.5rem;
  }

  .disclaimer-section p::before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--primary-color);
    font-weight: bold;
  }

  footer {
    background: var(--secondary-color);
    color: var(--text-gray);
    padding: 1rem 0;
    text-align: center;
    font-size: 0.85rem;
    margin-top: 2rem; /* Add some space above footer */
    border-top: 1px solid rgba(255, 255, 255, 0.1);
  }

  .footer-content {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    flex-direction: column; /* Stack text and links */
    align-items: center;
    gap: 1rem; /* Space between text and links */
  }

  .header-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.8rem;
    padding: 0.8rem 1rem; /* Add padding around the buttons */
    background-color: var(--background-medium); /* Match header background */
    border-bottom: 1px solid rgba(255, 255, 255, 0.1); /* Separator */
  }

  .header-link-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background-color: var(--background-light);
    color: var(--text-light);
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 500;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: background-color 0.3s ease, color 0.3s ease, transform 0.2s ease;
  }

  .header-link-btn i {
    margin-right: 0.3rem;
  }

  .header-link-btn:hover {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-2px);
  }

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

  /* Adjustments for mobile if needed */
  @media (max-width: 767px) {
    .header-links {
        gap: 0.6rem;
    }
    .header-link-btn {
        font-size: 0.75rem;
        padding: 0.4rem 0.8rem;
    }
  }

  .section-header {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-light);
    margin-bottom: 1.2rem;
    padding-bottom: 0.8rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 0.5rem;
  }

  .section-header span {
    color: var(--primary-color);
    margin-right: 0.3rem;
  }

  .mode-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.1);
  }

  .mode-btn.disabled:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.1);
  }

  .mode-btn.disabled:active {
    transform: none;
  }

  .actions button[type="submit"].loading {
    position: relative;
    color: transparent;
  }

  .actions button[type="submit"].loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin: -10px 0 0 -10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: button-loading-spinner 0.8s linear infinite;
  }

  @keyframes button-loading-spinner {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
  }

  .result-card.loading {
    position: relative;
  }

  .result-card.loading::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--background-medium);
    opacity: 0.7;
    z-index: 2;
    border-radius: var(--border-radius);
  }

  .result-card.loading::after {
    content: '';
    position: absolute;
    width: 40px;
    height: 40px;
    top: 50%;
    left: 50%;
    margin: -20px 0 0 -20px;
    border: 3px solid var(--primary-color);
    border-top-color: transparent;
    border-radius: 50%;
    animation: result-loading-spinner 1s linear infinite;
    z-index: 3;
  }

  @keyframes result-loading-spinner {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
  }

  #alerts.alerts-hidden {
    display: none;
  }

  .qr-code-container {
    margin-top: 1.5rem;
    padding: 1.5rem;
    background-color: #fff;
    border-radius: 12px;
    text-align: center;
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  }

  .qr-code-container p {
    margin-bottom: 1.2rem;
    font-size: 0.95rem;
    color: var(--text-dark);
    font-weight: 500;
  }

  #qrCodeCanvas {
    width: 180px; /* Larger QR code */
    height: 180px;
    margin: 0 auto; /* Center the QR code */
    padding: 10px; /* Increased padding around QR */
    background-color: white; /* QR codes need white background */
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.05);
  }

  #qrCodeCanvas img {
    display: block; /* Ensure image fits canvas */
    width: 100%;
    height: 100%;
    border-radius: 4px;
  }

  .qr-code-container.hidden {
    display: none;
  }