.knitting-gauge-card {
    --gauge-primary: #b06161;
    --gauge-secondary: #ead7bb;
    --gauge-accent: #d37676;
    --gauge-bg: rgba(255, 255, 255, 0.75);
    --gauge-sidebar-bg: rgba(255, 255, 255, 0.45);
    --gauge-item-bg: rgba(255, 255, 255, 0.45);
    --gauge-border: rgba(0, 0, 0, 0.05);
    --gauge-input-bg: rgba(255, 255, 255, 0.6);
    --gauge-radius: 24px;
    --gauge-shadow: 0 15px 40px rgba(0, 0, 0, 0.08);

    display: grid;
    grid-template-columns: 320px 1fr;
    max-width: 1150px;
    width: 95%;
    margin: 2rem auto;
    background: var(--gauge-bg);
    backdrop-filter: blur(15px);
    border-radius: var(--gauge-radius);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: var(--gauge-shadow);
    color: #444;
  }

  .theme-dark .knitting-gauge-card {
    --gauge-primary: #ff7e7e;
    --gauge-secondary: #2d2d30;
    --gauge-accent: #ffa4a4;
    --gauge-bg: rgba(13, 13, 15, 0.95);
    --gauge-sidebar-bg: rgba(0, 0, 0, 0.3);
    --gauge-item-bg: rgba(255, 255, 255, 0.03);
    --gauge-border: rgba(255, 255, 255, 0.1);
    --gauge-input-bg: rgba(255, 255, 255, 0.05);
    --gauge-shadow: 0 25px 60px rgba(0, 0, 0, 0.6);

    color: #f3f4f6;
    border-color: var(--gauge-border);
  }

  .gauge-sidebar {
    background: var(--gauge-sidebar-bg);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    border-right: 1px solid var(--gauge-border);
    max-height: 85vh;
    overflow-y: auto;
  }

  .config-section {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
  }

  .config-section h3 {
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1rem;
    color: var(--gauge-primary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
  }

  .input-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
  }

  .gauge-field {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    position: relative;
  }

  .gauge-field label {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    opacity: 0.6;
    display: flex;
    justify-content: space-between;
  }

  .label-sub {
    font-weight: 400;
    opacity: 0.8;
    text-transform: none;
  }

  .stepper-container {
    display: flex;
    align-items: center;
    background: var(--gauge-input-bg);
    border: 1px solid var(--gauge-border);
    border-radius: 8px;
    overflow: hidden;
  }

  .stepper-container:focus-within {
    border-color: var(--gauge-primary);
    box-shadow: 0 0 0 2px rgba(176, 97, 97, 0.2);
  }

  .stepper-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(0, 0, 0, 0.05);
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    color: inherit;
  }

  .theme-dark .stepper-btn {
    background: rgba(255, 255, 255, 0.04);
  }

  .stepper-btn:hover {
    background: var(--gauge-secondary);
  }

  .gauge-input {
    flex: 1;
    width: 100%;
    border: none;
    background: transparent;
    padding: 0.4rem 0.5rem;
    font-size: 0.9rem;
    text-align: center;
    font-weight: 600;
    color: inherit;
  }

  .gauge-input:focus {
    outline: none;
  }

  .gauge-input-bordered {
    border: 1px solid var(--gauge-border);
    border-radius: 8px;
    background: var(--gauge-input-bg);
  }

  .gauge-select {
    width: 100%;
    padding: 0.5rem;
    border-radius: 8px;
    border: 1px solid var(--gauge-border);
    background: var(--gauge-input-bg);
    font-size: 0.8rem;
    color: inherit;
  }

  .gauge-main {
    padding: 2.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    justify-content: center;
  }

  .top-display {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 3rem;
    align-items: center;
  }

  .visualizer-container {
    position: relative;
    width: 180px;
    height: 180px;
    background: var(--gauge-sidebar-bg);
    border-radius: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px dashed var(--gauge-border);
    overflow: hidden;
  }

  .knit-swatch {
    width: 130px;
    height: 130px;
    background-color: var(--gauge-primary);
    background-image: radial-gradient(circle at 50% 50%, var(--gauge-accent) 1px, transparent 1px);
    background-size: 12px 12px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    transition: all 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
  }

  .main-stat h2 {
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    opacity: 0.6;
    margin: 0 0 0.5rem;
  }

  .main-stat .val {
    font-size: 4rem;
    font-weight: 950;
    color: var(--gauge-primary);
    line-height: 1;
  }

  .val-detail {
    font-size: 0.8rem;
    font-weight: 600;
    opacity: 0.8;
  }

  .metrics-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
  }

  .metric-item {
    padding: 1.2rem;
    background: var(--gauge-item-bg);
    border: 1px solid var(--gauge-border);
    border-radius: 18px;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    position: relative;
  }

  .metric-item .sv {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--gauge-accent);
  }

  .sv-suggestion {
    font-size: 1rem;
    line-height: 1.2;
  }

  .metric-item .sl {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    opacity: 0.5;
    display: flex;
    align-items: center;
    gap: 0.3rem;
  }

  .info-icon {
    font-size: 0.75rem;
    font-style: normal;
    cursor: help;
    opacity: 0.5;
    background: rgba(0, 0, 0, 0.08);
    border-radius: 50%;
    width: 14px;
    height: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .theme-dark .info-icon {
    background: rgba(255, 255, 255, 0.12);
  }

  .info-icon:hover {
    opacity: 1;
  }

  [data-tooltip] {
    position: relative;
  }

  [data-tooltip]::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 0.5rem 0.8rem;
    border-radius: 6px;
    font-size: 0.7rem;
    white-space: normal;
    width: 200px;
    text-align: center;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 100;
    pointer-events: none;
  }

  .theme-dark [data-tooltip]::before {
    background: #1f2937;
    border: 1px solid rgba(255, 255, 255, 0.1);
  }

  [data-tooltip]:hover::before {
    visibility: visible;
    opacity: 1;
  }

  .yarn-calc-extra {
    padding: 1rem;
    background: rgba(176, 97, 97, 0.05);
    border-radius: 12px;
    font-size: 0.8rem;
    border: 1px solid rgba(176, 97, 97, 0.1);
    display: none;
  }

  .theme-dark .yarn-calc-extra {
    background: rgba(255, 126, 126, 0.08);
    border-color: rgba(255, 126, 126, 0.15);
  }

  .yarn-title {
    margin: 0;
    font-weight: 700;
    color: var(--gauge-primary);
  }

  .alert-card {
    padding: 1rem;
    border-radius: 12px;
    font-size: 0.82rem;
    margin-top: 0.5rem;
    display: none;
    animation: fade-in 0.4s ease;
  }

  .alert-card-warn {
    background: #fffbeb;
    color: #92400e;
    border: 1px solid #fde68a;
  }

  .theme-dark .alert-card-warn {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border-color: rgba(245, 158, 11, 0.3);
  }

  .alert-card-err {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
  }

  .theme-dark .alert-card-err {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.3);
  }

  .btn-group {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 0.75rem;
    margin-top: auto;
    padding-top: 1rem;
  }

  .ui-btn {
    padding: 0.8rem;
    border-radius: 12px;
    border: none;
    font-size: 0.75rem;
    font-weight: 800;
    cursor: pointer;
    text-transform: uppercase;
    transition: all 0.2s;
  }

  .ui-btn-primary {
    background: var(--gauge-primary);
    color: white;
  }

  .ui-btn-primary:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
  }

  .ui-btn-secondary {
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: inherit;
  }

  .theme-dark .ui-btn-secondary {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.15);
  }

  .ui-btn-secondary:hover {
    background: rgba(0, 0, 0, 0.08);
  }

  .theme-dark .ui-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.12);
  }

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

  @media (max-width: 900px) {
    .knitting-gauge-card {
      grid-template-columns: 1fr;
      max-height: none;
    }

    .gauge-sidebar {
      border-right: none;
      border-bottom: 1px solid var(--gauge-border);
      max-height: none;
    }

    .top-display {
      grid-template-columns: 1fr;
      text-align: center;
      justify-items: center;
    }

    .metrics-grid {
      grid-template-columns: 1fr;
    }
  }