/* =============================================================
   ლაზერ ხელსაწყო — Xtool Studio-style light theme
   ============================================================= */

/* ------------------------------------------------------------
   1. TOKENS — Xtool Creative Space palette
   ------------------------------------------------------------ */
:root {
  /* App chrome (black OS-style titlebar) */
  --chrome:          #1D1D1F;
  --chrome-2:        #2A2A2C;
  --chrome-border:   #000;
  --chrome-text:     #ffffff;
  --chrome-muted:    #9096A0;

  /* Surfaces */
  --bg:              #FAFAFA;   /* main canvas */
  --bg-panel:        #FFFFFF;   /* sidebar, cards */
  --bg-subtle:       #F4F5F7;   /* hover, secondary */
  --bg-muted:        #EDEEF0;   /* disabled, input inset */
  --bg-inverse:      #1D1D1F;   /* black (primary CTA) */

  /* Borders */
  --border:          #E5E6E8;
  --border-strong:   #D1D5DB;
  --border-hairline: #EDEEF0;

  /* Text */
  --text:            #1D1D1F;
  --text-muted:      #5E6370;
  --text-dim:        #9096A0;
  --text-inverse:    #FFFFFF;

  /* Brand — xTool green (accent only; CTA is black) */
  --brand:           #00D26A;
  --brand-hover:     #00B85C;
  --brand-soft:      #E6FBF0;
  --brand-border:    #B8F0D3;

  /* Secondary accents */
  --focus-blue:      #2F7BFF;
  --focus-ring:      rgba(47, 123, 255, 0.25);
  --warn:            #FF8A1F;
  --warn-soft:       #FFF2E5;
  --success:         #00D26A;
  --success-soft:    #E6FBF0;
  --danger:          #E5484D;
  --danger-soft:     #FFECEE;

  /* Radius */
  --r-sm: 4px;   /* pills, small */
  --r:    6px;   /* buttons, inputs */
  --r-md: 8px;   /* cards */
  --r-lg: 12px;  /* modals */

  /* Spacing (8-point grid) */
  --s-1:  4px;
  --s-2:  8px;
  --s-3:  12px;
  --s-4:  16px;
  --s-5:  24px;
  --s-6:  32px;
  --s-7:  48px;

  /* Shadows (minimal — flat aesthetic) */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow:    0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.12);
  --shadow-menu: 0 4px 16px rgba(0, 0, 0, 0.1);

  /* Typography */
  --font-body:  'Inter', 'Noto Sans Georgian', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono:  'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  /* Motion */
  --ease:       cubic-bezier(0.3, 0, 0.2, 1);
  --ease-out:   cubic-bezier(0.16, 1, 0.3, 1);
  --t-fast:     120ms;
  --t:          160ms;
  --t-slow:     240ms;

  /* Layout */
  --sidebar-w:  240px;
}

/* ------------------------------------------------------------
   2. BASE
   ------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11', 'ss01';
  text-rendering: optimizeLegibility;
}

body { min-height: 100vh; }

h1, h2, h3, h4 {
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--text);
  line-height: 1.3;
}

h1 { font-size: 24px; line-height: 1.25; letter-spacing: -0.02em; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }

p { margin: 0; }
a { color: var(--focus-blue); text-decoration: none; }
a:hover { text-decoration: underline; }

::selection { background: var(--brand-soft); color: var(--text); }

/* Scrollbars — thin, Xtool-style */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 10px;
  border: 2px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* ------------------------------------------------------------
   3. LAYOUT — sidebar + main
   ------------------------------------------------------------ */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

/* ----- Sidebar ----- */
.sidebar {
  display: flex;
  flex-direction: column;
  background: var(--bg-panel);
  border-right: 1px solid var(--border-hairline);
  position: sticky;
  top: 0;
  height: 100vh;
  padding: var(--s-3) var(--s-2);
  gap: var(--s-4);
  z-index: 50;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-2) var(--s-3);
  margin-bottom: var(--s-1);
}

.logo {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--brand);
  color: var(--chrome);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  box-shadow: 0 1px 2px rgba(0, 210, 106, 0.2);
}

/* xTool brand mark — green squircle + stylized X */
.xtool-mark {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  filter: drop-shadow(0 1px 2px rgba(0, 210, 106, 0.25));
}
.xtool-mark svg { display: block; }

.xtool-word {
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}
.brand-dot {
  color: var(--text-dim);
  font-weight: 400;
  margin: 0 2px;
}

.sidebar-brand-text { min-width: 0; }
.brand-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}
.brand-sub {
  font-size: 11px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
  margin-top: 3px;
  line-height: 1.3;
}

.sidebar-section-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  padding: var(--s-3) var(--s-3) 6px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.sidebar-nav .tab {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  width: 100%;
  padding: 10px 12px;
  background: transparent;
  border: none;
  border-radius: var(--r);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  line-height: 1.3;
  transition: background var(--t) var(--ease);
}
.sidebar-nav .tab:hover { background: var(--bg-subtle); }
.sidebar-nav .tab.active {
  background: var(--bg-subtle);
  color: var(--text);
  font-weight: 600;
}
.sidebar-nav .tab.active .tab-icon { color: var(--brand); }
.sidebar-nav .tab .tab-icon {
  flex-shrink: 0;
  color: var(--text-muted);
}
.sidebar-nav .tab > span {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-nav .tab .tab-key {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 2px 7px;
  background: var(--bg-muted);
  border-radius: 3px;
  color: var(--text-dim);
  font-weight: 500;
  line-height: 1.4;
}
.sidebar-nav .tab.active .tab-key {
  background: var(--bg-panel);
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 1px 6px;
}

.sidebar-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding-top: var(--s-3);
  border-top: 1px solid var(--border);
}

.nav-ghost {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: var(--s-3);
  width: 100%;
  padding: 9px 12px;
  background: transparent;
  border: none;
  border-radius: var(--r);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 13px;
  line-height: 1.3;
  cursor: pointer;
  text-align: left;
  transition: background var(--t) var(--ease);
  position: relative;
}
.nav-ghost > svg {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
}
.nav-ghost > span {
  text-align: left;
}
.nav-ghost:hover { background: var(--bg-subtle); color: var(--text); }
.nav-ghost .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--border-strong);
  margin-left: auto;
}
.nav-ghost.has-key .dot {
  background: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

.sidebar-hint {
  font-size: 11px;
  color: var(--text-dim);
  padding: var(--s-2) var(--s-3) 0;
  line-height: 1.55;
}

/* ----- Main area ----- */
.main {
  min-width: 0;
  padding: var(--s-5) var(--s-6);
  max-width: 1400px;
  background: var(--bg);
}

.section { display: none; animation: sectionIn 240ms var(--ease-out); }
.section.active { display: block; }

@keyframes sectionIn {
  from { opacity: 0; transform: translateY(2px); }
  to   { opacity: 1; transform: translateY(0); }
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: var(--s-4);
  padding-bottom: var(--s-4);
  margin-bottom: var(--s-5);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.section-header h1 { margin-bottom: 6px; }
.section-header p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}
.section-actions {
  display: flex;
  gap: var(--s-2);
  align-items: center;
  flex-wrap: wrap;
}

/* Mobile bar */
.main-mobile-bar {
  display: none;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-2) var(--s-3);
  border-bottom: 1px solid var(--border);
  background: var(--bg-panel);
  position: sticky;
  top: 0;
  z-index: 20;
  margin: calc(-1 * var(--s-5)) calc(-1 * var(--s-6)) var(--s-4);
}
.main-mobile-title { font-weight: 600; font-size: 13px; }

/* ------------------------------------------------------------
   4. BUTTONS — Xtool flat style
   ------------------------------------------------------------ */
button,
.file-btn {
  font-family: inherit;
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: var(--r);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.005em;
  transition: background var(--t) var(--ease), border-color var(--t) var(--ease),
              color var(--t) var(--ease), box-shadow var(--t) var(--ease);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  padding: 0 16px;
  white-space: nowrap;
  line-height: 1.2;
  user-select: none;
  height: 36px;
}
button:focus-visible,
.file-btn:focus-within {
  outline: none;
  box-shadow: 0 0 0 3px var(--focus-ring);
  border-color: var(--focus-blue);
}
button:disabled { opacity: 0.4; cursor: not-allowed; }
button:disabled:hover { background: inherit !important; }

/* Primary = BLACK (Xtool CTA hierarchy) */
.btn-primary {
  background: var(--bg-inverse);
  color: var(--text-inverse);
  border-color: var(--bg-inverse);
  font-weight: 500;
}
.btn-primary:hover:not(:disabled) {
  background: #000;
  border-color: #000;
}
.btn-primary:active:not(:disabled) { background: #000; }

/* Secondary = white with border */
.btn-secondary {
  background: var(--bg-panel);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--bg-subtle);
  border-color: var(--border-strong);
}

/* Brand variant — green fill (used for emphasis, e.g. AI) */
.btn-brand {
  background: var(--brand);
  color: var(--chrome);
  border-color: var(--brand);
  font-weight: 600;
}
.btn-brand:hover:not(:disabled) {
  background: var(--brand-hover);
  border-color: var(--brand-hover);
}

/* Danger */
.btn-danger {
  background: var(--bg-panel);
  color: var(--danger);
  border-color: var(--border);
}
.btn-danger:hover:not(:disabled) {
  background: var(--danger-soft);
  border-color: var(--danger);
}

/* Icon-only */
.btn-icon {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  width: 36px;
  height: 36px;
  padding: 0;
  flex-shrink: 0;
}
.btn-icon:hover:not(:disabled) {
  background: var(--bg-subtle);
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-icon.has-key { color: var(--brand); border-color: var(--brand-border); background: var(--brand-soft); }

.file-btn { cursor: pointer; }

/* ------------------------------------------------------------
   5. FORM CONTROLS
   ------------------------------------------------------------ */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
  line-height: 1.4;
}

input[type="text"],
input[type="search"],
input[type="password"],
input[type="number"],
textarea,
select,
.select {
  width: 100%;
  padding: 0 12px;
  background: var(--bg-panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--r);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.4;
  outline: none;
  transition: border-color var(--t) var(--ease), box-shadow var(--t) var(--ease);
  height: 36px;
}
textarea { height: auto; padding: 10px 12px; }
input:hover:not(:focus),
textarea:hover:not(:focus),
select:hover:not(:focus),
.select:hover:not(:focus) { border-color: var(--border-strong); }
input:focus,
textarea:focus,
select:focus,
.select:focus {
  border-color: var(--focus-blue);
  box-shadow: 0 0 0 3px var(--focus-ring);
}
input::placeholder, textarea::placeholder { color: var(--text-dim); }

textarea {
  resize: vertical;
  min-height: 96px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  padding: 12px 14px;
}

select, .select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 28px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235E6370' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 8px center;
  cursor: pointer;
}

/* Search-with-icon */
.field-icon {
  position: relative;
  flex: 1;
  min-width: 200px;
}
.field-icon .field-icon-svg {
  position: absolute;
  left: 9px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  pointer-events: none;
}
.field-icon input { padding-left: 32px; }

input[type="range"] {
  accent-color: var(--brand);
  width: 140px;
}

/* ------------------------------------------------------------
   6. CARD / PANEL
   ------------------------------------------------------------ */
.card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--s-5);
}

.card-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  font-weight: 600;
  margin-bottom: var(--s-3);
  line-height: 1.4;
}

.button-row {
  display: flex;
  gap: var(--s-2);
  margin-top: var(--s-4);
}
.button-row > * { flex: 1; }

.meta-row {
  display: flex;
  gap: var(--s-2);
  align-items: center;
  justify-content: center;
  margin-top: var(--s-3);
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--text-dim);
  letter-spacing: 0.01em;
  line-height: 1.5;
}

.status-line {
  margin-top: var(--s-3);
  padding: 11px 14px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--r);
  text-align: center;
}
.status-line .status { font-size: 13px; color: var(--text-muted); line-height: 1.45; }

.inline-badge {
  display: inline-block;
  padding: 2px 8px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text);
  margin-left: 4px;
  line-height: 1.4;
}

/* ------------------------------------------------------------
   7. STATUS BAR / PROGRESS
   ------------------------------------------------------------ */
.status-bar {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: 10px 14px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  flex-wrap: wrap;
}
.status-bar .status {
  font-size: 13px;
  color: var(--text-muted);
  flex: 1;
  min-width: 0;
  line-height: 1.5;
}
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border-strong);
  flex-shrink: 0;
  transition: background var(--t) var(--ease);
}
.status-bar.is-active .status-dot {
  background: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
  animation: dotPulse 1.6s ease-in-out infinite;
}
.status-bar.is-success .status-dot { background: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.status-bar.is-error .status-dot   { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }

@keyframes dotPulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.5; }
}

/* Progress bar */
.progress {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  min-width: 180px;
}
.progress-track {
  flex: 1;
  height: 4px;
  background: var(--bg-muted);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}
.progress-fill {
  height: 100%;
  width: 0;
  background: var(--brand);
  border-radius: 2px;
  transition: width 400ms var(--ease-out);
  position: relative;
}
.progress.indeterminate .progress-fill {
  width: 35% !important;
  animation: progressSlide 1.4s ease-in-out infinite;
}
@keyframes progressSlide {
  0%   { transform: translateX(-200%); }
  100% { transform: translateX(400%); }
}
.progress-label {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  min-width: 32px;
  text-align: right;
}

/* ------------------------------------------------------------
   8. QR TAB
   ------------------------------------------------------------ */
.qr-body {
  display: grid;
  grid-template-columns: minmax(340px, 440px) minmax(0, 1fr);
  gap: var(--s-5);
  align-items: stretch;
}
.qr-controls {
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
  height: 100%;
}

/* URL card */
.qr-input-card { padding: var(--s-4) var(--s-5); }
.qr-status-inline {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  margin-top: var(--s-3);
  padding: 8px 10px;
  background: var(--bg-subtle);
  border-radius: var(--r);
  font-size: 13px;
}
.qr-status-inline .status {
  color: var(--text-muted);
  line-height: 1.4;
  flex: 1;
  min-width: 0;
}
.qr-status-inline.is-active .status-dot {
  background: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.qr-status-inline.is-success .status-dot {
  background: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.qr-status-inline.is-error .status-dot {
  background: var(--danger);
  box-shadow: 0 0 0 3px var(--danger-soft);
}

/* Styles card — 3 groups with dividers, distributes evenly in tall card */
.qr-styles-card {
  padding: var(--s-4);
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: var(--s-3);
}
.qr-style-group {
  padding: var(--s-2) var(--s-1);
  display: flex;
  flex-direction: column;
}
.qr-style-group .style-grid { margin-top: auto; }
.qr-style-divider {
  height: 1px;
  background: var(--border-hairline);
}

/* Preview card */
.qr-preview-card {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  padding: 0;
  overflow: hidden;
  height: 100%;
}
.qr-preview-card .pane-label {
  margin: 0;
}
.qr-preview-card .preview-wrap {
  flex: 1;
  min-height: 420px;
  padding: var(--s-4);
  background:
    linear-gradient(45deg,  #f5f6f8 25%, transparent 25%),
    linear-gradient(-45deg, #f5f6f8 25%, transparent 25%),
    linear-gradient(45deg,  transparent 75%, #f5f6f8 75%),
    linear-gradient(-45deg, transparent 75%, #f5f6f8 75%),
    #ffffff;
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0px;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  margin: 0 var(--s-4);
  border: 1px solid var(--border);
  border-radius: var(--r);
}
.qr-preview-card canvas {
  max-width: 100%;
  height: auto;
  max-height: 460px;
  image-rendering: auto;
}

/* Empty state inside preview */
.qr-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  color: var(--text-muted);
  text-align: center;
  pointer-events: none;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.qr-empty[hidden] { display: none !important; }
.qr-empty svg { color: var(--text-dim); opacity: 0.7; }
.qr-empty-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-top: 6px;
  line-height: 1.3;
}
.qr-empty-sub {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  max-width: 260px;
}

/* Preview footer: metadata + download in one row */
.qr-preview-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4) var(--s-4);
  border-top: 1px solid var(--border-hairline);
  margin-top: auto;
  flex-wrap: wrap;
}
.qr-preview-footer .meta-row {
  margin-top: 0;
  flex: 1;
  justify-content: flex-start;
}
.qr-preview-actions {
  display: flex;
  gap: var(--s-2);
  flex-shrink: 0;
}

/* Copy button — 2-state icon + label (default / copied) */
.btn-copy .icon-success,
.btn-copy .label-success { display: none; }
.btn-copy.is-copied {
  background: var(--brand-soft);
  color: var(--brand-hover);
  border-color: var(--brand-border);
}
.btn-copy.is-copied .icon-default,
.btn-copy.is-copied .label-default { display: none; }
.btn-copy.is-copied .icon-success,
.btn-copy.is-copied .label-success { display: inline-flex; }
.btn-copy .icon-success { color: var(--brand-hover); }

/* ----- Style selector (Shape / Border / Center) ----- */
.style-group-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: var(--s-3);
  letter-spacing: -0.005em;
  text-transform: none;
}
.style-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
@media (min-width: 640px) {
  .style-grid { grid-template-columns: repeat(8, 1fr); }
}
.style-btn {
  aspect-ratio: 1;
  width: 100%;
  height: auto;
  padding: 0;
  background: var(--bg-panel);
  border: 1.5px solid var(--border);
  border-radius: var(--r);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: border-color var(--t) var(--ease), background var(--t) var(--ease),
              box-shadow var(--t) var(--ease);
}
.style-btn:hover {
  border-color: var(--border-strong);
  background: var(--bg-subtle);
}
.style-btn.active {
  border-color: var(--brand);
  background: var(--brand-soft);
  box-shadow: 0 0 0 1px var(--brand);
}
.style-btn canvas,
.style-btn svg {
  width: 82%;
  height: 82%;
  display: block;
  color: var(--text);
}
.style-btn.active svg { color: var(--text); }

/* ------------------------------------------------------------
   9. EYE TAB
   ------------------------------------------------------------ */
.eye-layout {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}

.eye-guide {
  list-style: none;
  margin: 0;
  padding: var(--s-3) var(--s-4);
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-3) var(--s-5);
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  border-left: 3px solid var(--brand);
}
.eye-guide li {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  color: var(--text);
  font-size: 14px;
  flex: 1 1 240px;
  min-width: 0;
  line-height: 1.45;
}
.eye-guide .step-n {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand-hover);
  border: 1px solid var(--brand-border);
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  line-height: 1;
}

/* Split panes */
.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-3);
  min-height: 420px;
}
.pane {
  display: flex;
  flex-direction: column;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
}
.pane-label {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: 10px 14px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  font-weight: 600;
  text-transform: uppercase;
  line-height: 1.4;
}
.pane-label .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--border-strong);
}
.pane-label .dot.accent { background: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }

.canvas-wrap {
  flex: 1;
  padding: var(--s-4);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  background:
    radial-gradient(circle at 1px 1px, rgba(0, 0, 0, 0.05) 1px, transparent 0);
  background-size: 16px 16px;
  background-color: #FBFBFC;
  min-height: 380px;
  position: relative;
}
.canvas-wrap.light {
  background:
    radial-gradient(circle at 1px 1px, rgba(0, 0, 0, 0.05) 1px, transparent 0);
  background-size: 16px 16px;
  background-color: #FBFBFC;
}
.canvas-wrap canvas {
  max-width: 100%;
  max-height: 60vh;
  display: block;
}

/* Drop zone */
.empty-msg {
  position: absolute;
  inset: var(--s-4);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.5;
  text-align: center;
  pointer-events: none;
}
.empty-msg p { margin: 0; }
.empty-msg.drop-zone {
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--r);
  background: rgba(255, 255, 255, 0.6);
  transition: border-color var(--t) var(--ease), background var(--t) var(--ease);
}
.empty-msg .drop-icon { color: var(--text-dim); }
.empty-msg .drop-title {
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  margin-top: 6px;
  line-height: 1.3;
}
.empty-msg .drop-sub {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.4;
}

.canvas-wrap.drag-over .drop-zone {
  border-color: var(--brand);
  background: var(--brand-soft);
}
.canvas-wrap.drag-over .drop-icon { color: var(--brand); }

/* AI overlay */
.ai-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 10;
  animation: fadeIn 180ms var(--ease-out);
}
.ai-overlay-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-5) var(--s-6);
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  min-width: 220px;
}
.ai-overlay-title { font-size: 15px; font-weight: 600; color: var(--text); line-height: 1.35; }
.ai-overlay-sub { font-size: 13px; color: var(--text-muted); font-family: var(--font-mono); line-height: 1.4; }

.ai-spinner {
  display: flex;
  gap: 6px;
  height: 10px;
  align-items: center;
}
.ai-spinner > div {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--brand);
  animation: aiSpinnerPulse 1.2s ease-in-out infinite;
}
.ai-spinner > div:nth-child(2) { animation-delay: 0.15s; }
.ai-spinner > div:nth-child(3) { animation-delay: 0.3s; }
@keyframes aiSpinnerPulse {
  0%, 60%, 100% { transform: scale(0.55); opacity: 0.4; }
  30%           { transform: scale(1); opacity: 1; }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Preview checker pattern */
#preview-wrap.checker {
  background:
    linear-gradient(45deg,  #f0f0f0 25%, transparent 25%),
    linear-gradient(-45deg, #f0f0f0 25%, transparent 25%),
    linear-gradient(45deg,  transparent 75%, #f0f0f0 75%),
    linear-gradient(-45deg, transparent 75%, #f0f0f0 75%),
    #ffffff;
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}

/* ------------------------------------------------------------
   10. FONTS TAB
   ------------------------------------------------------------ */
.fonts-toolbar {
  display: flex;
  gap: var(--s-3);
  flex-wrap: wrap;
  padding: var(--s-3) var(--s-4);
  margin-bottom: var(--s-4);
  align-items: center;
  position: sticky;
  top: var(--s-2);
  z-index: 20;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}
.fonts-toolbar input[type="search"],
.fonts-toolbar input[type="text"] { min-width: 200px; flex: 1; }
.fonts-toolbar input[type="search"] { max-width: 260px; }

.size-control {
  display: inline-flex;
  gap: var(--s-3);
  align-items: center;
  font-size: 13px;
  color: var(--text-muted);
  padding: 0 14px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--r);
  height: 36px;
  line-height: 1.3;
}
.size-control strong {
  color: var(--text);
  font-weight: 600;
  min-width: 28px;
  text-align: right;
  font-family: var(--font-mono);
  font-size: 13px;
}

#font-grid {
  display: grid;
  gap: var(--s-3);
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}
.font-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 160px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  transition: border-color var(--t) var(--ease), box-shadow var(--t) var(--ease),
              transform var(--t) var(--ease);
  content-visibility: auto;
  contain-intrinsic-size: 0 180px;
}
.font-card:hover {
  border-color: var(--border-strong);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.04);
  transform: translateY(-1px);
}
.font-card .head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border-hairline);
  gap: var(--s-2);
}
.font-card .head .name {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
  line-height: 1.4;
}
.font-card .head .ext {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 6px;
  background: var(--bg-subtle);
  color: var(--text-dim);
  border-radius: 3px;
  flex-shrink: 0;
  line-height: 1.5;
}
.font-card .head .dl {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  background: transparent;
  color: var(--text-dim);
  border-radius: 4px;
  text-decoration: none;
  transition: background var(--t) var(--ease), color var(--t) var(--ease);
}
.font-card .head .dl:hover { background: var(--bg-subtle); color: var(--text); }
.font-card .head .dl svg { display: block; }
.font-card .preview {
  flex: 1;
  min-height: 100px;
  padding: var(--s-4) var(--s-4);
  background: var(--bg-subtle);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  word-break: break-word;
  line-height: 1.25;
}
.font-card.hidden { display: none; }
.font-card.loading .preview { color: var(--text-dim); }
.font-card.failed .preview { color: var(--danger); font-family: var(--font-mono); font-size: 12px; }
.font-card.failed .head .ext {
  background: var(--danger-soft);
  color: var(--danger);
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--s-3);
  padding: var(--s-7) var(--s-4);
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.5;
  background: var(--bg-panel);
  border: 1px dashed var(--border);
  border-radius: var(--r-md);
}
.empty-state svg { color: var(--text-dim); }

/* ------------------------------------------------------------
   12. MODAL
   ------------------------------------------------------------ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(29, 29, 31, 0.4);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1100;
  animation: fadeIn 160ms var(--ease-out);
}
.modal {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 480px;
  margin: var(--s-4);
  animation: modalIn 220ms var(--ease-out);
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.97) translateY(6px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--border);
}
.modal-head-title {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  color: var(--text);
}
.modal-head h3 { margin: 0; font-size: 16px; font-weight: 600; line-height: 1.3; }
.modal-close { color: var(--text-muted); }
.modal-body { padding: var(--s-4) var(--s-4) var(--s-5); }

.modal-info {
  font-size: 13px;
  color: var(--text-muted);
  background: var(--bg-subtle);
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r);
  margin-bottom: var(--s-4);
  border: 1px solid var(--border);
  line-height: 1.6;
}
.modal-actions {
  display: flex;
  gap: var(--s-2);
  justify-content: flex-end;
  margin-top: var(--s-4);
}

/* Keyboard shortcut list */
.kbd-list { display: flex; flex-direction: column; gap: 1px; }
.kbd-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: var(--r);
  font-size: 14px;
  color: var(--text);
  line-height: 1.45;
}
.kbd-row:hover { background: var(--bg-subtle); }
.kbd-divider {
  height: 1px;
  background: var(--border);
  margin: var(--s-2) 0;
}
kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 22px;
  padding: 0 7px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  line-height: 1;
}

/* ------------------------------------------------------------
   13. TOAST
   ------------------------------------------------------------ */
.toast-stack {
  position: fixed;
  bottom: var(--s-4);
  right: var(--s-4);
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  z-index: 1200;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: 12px 16px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-menu);
  min-width: 260px;
  max-width: 380px;
  font-size: 14px;
  color: var(--text);
  pointer-events: auto;
  animation: toastIn 220ms var(--ease-out);
  line-height: 1.45;
}
.toast.leaving { animation: toastOut 160ms var(--ease) forwards; }
.toast svg { flex-shrink: 0; }
.toast.success { border-left: 3px solid var(--brand); }
.toast.success svg { color: var(--brand); }
.toast.error   { border-left: 3px solid var(--danger); }
.toast.error svg { color: var(--danger); }
.toast.info    { border-left: 3px solid var(--focus-blue); }
.toast.info svg { color: var(--focus-blue); }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(16px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(16px); }
}

/* ------------------------------------------------------------
   14. RESPONSIVE
   ------------------------------------------------------------ */
@media (max-width: 1100px) {
  .split { grid-template-columns: 1fr; }
  .qr-body { grid-template-columns: 1fr; align-items: start; }
  .qr-controls { height: auto; }
  .qr-preview-card { height: auto; }
  .qr-styles-card { flex: none; }
}

@media (max-width: 880px) {
  .app { grid-template-columns: 1fr; }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-w);
    transform: translateX(-100%);
    transition: transform var(--t) var(--ease);
    box-shadow: var(--shadow-lg);
    height: 100vh;
  }
  .sidebar.open { transform: translateX(0); }

  .main-mobile-bar { display: flex; }
  .main { padding: var(--s-4); }
  .main-mobile-bar { margin: calc(-1 * var(--s-4)) calc(-1 * var(--s-4)) var(--s-4); }

  .section-header { flex-direction: column; align-items: stretch; }
  .section-actions { width: 100%; }
  .section-actions > * { flex: 1; min-width: 0; }
}

@media (max-width: 480px) {
  .main { padding: var(--s-3); }
  .main-mobile-bar { margin: calc(-1 * var(--s-3)) calc(-1 * var(--s-3)) var(--s-3); }
  .card { padding: var(--s-4); }
}

/* =============================================================
   GUIDE TAB — Beginner-friendly laser manual in Georgian
   ============================================================= */
.guide-body {
  display: flex;
  flex-direction: column;
  gap: var(--s-6);
}

/* ---------- Hero ---------- */
.guide-hero {
  display: flex;
  gap: var(--s-5);
  align-items: flex-start;
  padding: var(--s-6);
  background: linear-gradient(135deg, var(--brand-soft) 0%, var(--bg-panel) 100%);
  border-color: var(--brand-border);
}
.guide-hero-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.guide-hero-text h2 {
  font-size: 22px;
  margin-bottom: var(--s-3);
}
.guide-hero-text p {
  color: var(--text);
  line-height: 1.65;
  font-size: 15px;
  margin-bottom: var(--s-3);
}
.guide-hero-text p:last-child { margin-bottom: 0; }
.guide-hero-note {
  font-size: 13px !important;
  color: var(--text-muted) !important;
  padding-top: var(--s-3);
  border-top: 1px solid var(--brand-border);
}

/* ---------- Table of contents ---------- */
.guide-toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--s-2) var(--s-4);
}
.guide-toc-list li {
  font-size: 13px;
  line-height: 1.5;
}
.guide-toc-list a {
  color: var(--text);
  text-decoration: none;
  transition: color var(--t) var(--ease);
  display: block;
  padding: 4px 0;
}
.guide-toc-list a:hover {
  color: var(--brand-hover);
}

/* ---------- Section headers ---------- */
.guide-section {
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
  scroll-margin-top: var(--s-5);
}
.guide-section-head {
  display: flex;
  gap: var(--s-4);
  align-items: flex-start;
  padding-bottom: var(--s-3);
  border-bottom: 1px solid var(--border);
}
.guide-section-num {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-inverse);
  color: var(--text-inverse);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 15px;
  line-height: 1;
}
.guide-section-head h2 {
  font-size: 20px;
  margin-bottom: 4px;
}
.guide-section-sub {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}
.guide-para {
  font-size: 14px;
  line-height: 1.65;
  color: var(--text);
}

/* ---------- Callouts ---------- */
.callout {
  display: flex;
  gap: var(--s-3);
  padding: var(--s-4);
  border-radius: var(--r-md);
  border: 1px solid;
  font-size: 13.5px;
  line-height: 1.55;
  align-items: flex-start;
}
.callout-icon {
  flex-shrink: 0;
  margin-top: 1px;
}
/* First <strong> in a callout body is the heading row; later <strong>s
   stay inline (e.g. "ლაზერის ტიპი IR / Fiber" reads as one sentence). */
.callout > div > strong:first-child { display: block; margin-bottom: 4px; }
.callout-danger {
  background: var(--danger-soft);
  border-color: #F5B7B9;
  color: #8B1D20;
}
.callout-danger .callout-icon { color: var(--danger); }
.callout-warn {
  background: var(--warn-soft);
  border-color: #FFCD96;
  color: #8A4400;
}
.callout-warn .callout-icon { color: var(--warn); }
.callout-info {
  background: #EEF4FF;
  border-color: #C6DBFF;
  color: #16366B;
}
.callout-info .callout-icon { color: var(--focus-blue); }
.callout-tip {
  background: var(--brand-soft);
  border-color: var(--brand-border);
  color: #0A5131;
}
.callout-tip .callout-icon { color: var(--brand-hover); }

/* ---------- Safety grid ---------- */
.safety-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--s-3);
}
.safety-item {
  padding: var(--s-4);
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}
.safety-icon {
  color: var(--brand-hover);
}
.safety-item h3 {
  font-size: 14px;
}
.safety-item p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.55;
}

/* ---------- Numbered steps (ol) ---------- */
.guide-steps {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}
.guide-steps li {
  display: flex;
  gap: var(--s-4);
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--s-4);
  align-items: flex-start;
}
.guide-step-n {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 13px;
  line-height: 1;
}
.guide-steps h3 {
  font-size: 14px;
  margin-bottom: 4px;
}
.guide-steps p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
}
.guide-steps em {
  font-style: normal;
  background: var(--bg-subtle);
  padding: 1px 6px;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text);
}

/* ---------- Laser comparison ---------- */
.laser-compare {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: var(--s-4);
}
.laser-card {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}
.laser-card-head {
  display: flex;
  align-items: center;
  gap: var(--s-3);
}
.laser-card-head h3 {
  flex: 1;
  font-size: 16px;
}
.laser-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
}
.laser-dot-blue {
  background: #2F7BFF;
  box-shadow: 0 0 12px rgba(47,123,255,0.5);
}
.laser-dot-ir {
  background: #E5484D;
  box-shadow: 0 0 12px rgba(229,72,77,0.4);
}
.laser-wave {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-dim);
  background: var(--bg-subtle);
  padding: 2px 8px;
  border-radius: var(--r-sm);
}
.laser-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.55;
}
.laser-for, .laser-not {
  background: var(--bg-subtle);
  padding: var(--s-3);
  border-radius: var(--r);
  border: 1px solid var(--border-hairline);
}
.laser-for {
  background: var(--brand-soft);
  border-color: var(--brand-border);
}
.laser-for-label, .laser-not-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  margin-bottom: var(--s-2);
}
.laser-for ul {
  margin: 0;
  padding: 0 0 0 18px;
  font-size: 13px;
  line-height: 1.7;
}
.laser-for li { color: var(--text); }
.laser-for strong { color: var(--brand-hover); }
.laser-not p {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.55;
}

/* ---------- Parameter cards ---------- */
.param-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s-4);
}
@media (max-width: 1100px) {
  .param-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  .param-grid { grid-template-columns: 1fr; }
}
.param-card {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}
.param-head {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  flex-wrap: wrap;
}
.param-head h3 {
  font-size: 15px;
  margin: 0;
}
.param-badge {
  display: inline-block;
  background: var(--bg-inverse);
  color: var(--text-inverse);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: var(--r-sm);
  letter-spacing: 0.02em;
}
.param-badge-sub {
  background: var(--bg-subtle);
  color: var(--text);
  border: 1px solid var(--border);
}
.param-range {
  display: inline-block;
  align-self: flex-start;
  background: var(--brand-soft);
  color: var(--brand-hover);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: var(--r-sm);
  border: 1px solid var(--brand-border);
}
.param-desc, .param-analogy, .param-tip {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text);
  margin: 0;
}
.param-analogy, .param-tip {
  background: var(--bg-subtle);
  padding: var(--s-3);
  border-radius: var(--r);
  border: 1px solid var(--border-hairline);
  color: var(--text-muted);
}
.param-analogy {
  background: #FFF7ED;
  border-color: #FFE4BF;
  color: #6B4500;
}
.param-tip {
  background: #EEF4FF;
  border-color: #C6DBFF;
  color: #16366B;
}
.param-label {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 1px 6px;
  border-radius: 3px;
  background: rgba(0,0,0,0.08);
  margin-right: 6px;
  vertical-align: middle;
}

/* ---------- Recipe groups ---------- */
.recipe-group-title {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  font-size: 15px;
  margin: var(--s-4) 0 0;
}
.recipe-group-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.recipe-group-blue { background: #2F7BFF; }
.recipe-group-ir   { background: #E5484D; }

.recipe-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--s-3);
}
@media (max-width: 1280px) {
  .recipe-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 960px) {
  .recipe-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .recipe-grid { grid-template-columns: 1fr; }
}
.recipe-card {
  padding: var(--s-4);
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}
.recipe-card h4 {
  font-size: 14px;
  font-weight: 600;
  margin: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--s-2);
}
.recipe-op {
  font-size: 11px;
  font-weight: 500;
  background: var(--warn-soft);
  color: var(--warn);
  padding: 2px 7px;
  border-radius: var(--r-sm);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.recipe-settings {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12.5px;
  padding: var(--s-3);
  background: var(--bg-subtle);
  border-radius: var(--r);
}
.recipe-settings > div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--s-3);
}
.recipe-settings span {
  color: var(--text-dim);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 500;
}
.recipe-settings strong {
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
}
.recipe-note {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0;
}
.recipe-silver {
  border-color: var(--brand-border);
  background: linear-gradient(180deg, #F7FFFA 0%, var(--bg-panel) 60%);
}
.recipe-silver h4::after {
  content: '★';
  color: var(--brand-hover);
}
.recipe-cut { border-color: #FFCD96; background: #FFFBF5; }

/* ---------- Silver deep dive ---------- */
.silver-steps {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}
.silver-step {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}
.silver-step-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  padding-bottom: var(--s-2);
  border-bottom: 1px solid var(--border);
}
.silver-settings {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: var(--s-2) var(--s-3);
}
.silver-settings > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--s-2);
  background: var(--bg-subtle);
  border-radius: var(--r);
}
.silver-settings span {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
}
.silver-settings strong {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text);
}
.silver-explain {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
  margin: 0;
}
.silver-cleanup {
  border-color: var(--brand-border);
  background: var(--brand-soft);
}
.silver-cleanup-label {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  color: var(--brand-hover);
  border-bottom-color: var(--brand-border);
}

/* ---------- Color table ---------- */
.color-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  font-size: 13px;
}
.color-table th, .color-table td {
  padding: var(--s-3);
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.color-table th {
  background: var(--bg-subtle);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}
.color-table tr:last-child td { border-bottom: none; }
.color-table td:first-child {
  display: flex;
  align-items: center;
  gap: var(--s-2);
}
.color-swatch {
  display: inline-block;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.color-table td:not(:first-child) {
  font-family: var(--font-mono);
}

/* ---------- Test steps ---------- */
.test-steps {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}
.test-step {
  display: flex;
  gap: var(--s-3);
  padding: var(--s-3);
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  align-items: flex-start;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-muted);
}
.test-step strong { color: var(--text); }
.test-step-n {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bg-inverse);
  color: var(--text-inverse);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 12px;
  line-height: 1;
}

/* ---------- Troubleshooting / FAQ ---------- */
.trouble-list {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}
.trouble-item {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  transition: border-color var(--t) var(--ease);
}
.trouble-item[open] {
  border-color: var(--brand-border);
  box-shadow: var(--shadow-sm);
}
.trouble-item summary {
  padding: var(--s-3) var(--s-4);
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  transition: background var(--t) var(--ease);
}
.trouble-item summary::-webkit-details-marker { display: none; }
.trouble-item summary::after {
  content: '+';
  font-size: 20px;
  line-height: 1;
  color: var(--text-dim);
  flex-shrink: 0;
  font-weight: 300;
  transition: transform var(--t) var(--ease);
}
.trouble-item[open] summary::after {
  content: '−';
  color: var(--brand-hover);
}
.trouble-item summary:hover {
  background: var(--bg-subtle);
}
.trouble-body {
  padding: 0 var(--s-4) var(--s-4);
  font-size: 13px;
  line-height: 1.65;
  color: var(--text-muted);
  border-top: 1px solid var(--border-hairline);
  padding-top: var(--s-3);
}
.trouble-body p { margin-bottom: var(--s-2); }
.trouble-body p:last-child { margin-bottom: 0; }
.trouble-body ul {
  margin: 0;
  padding-left: 20px;
}
.trouble-body li { margin-bottom: 4px; }
.trouble-body strong { color: var(--text); }

/* ---------- Sources ---------- */
.sources-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--s-2);
}
.sources-list li {
  padding: var(--s-2) var(--s-3);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--r);
  font-size: 12.5px;
}
.sources-list a {
  color: var(--text);
  text-decoration: none;
}
.sources-list a:hover {
  color: var(--brand-hover);
  text-decoration: underline;
}
.guide-updated {
  font-size: 12px;
  color: var(--text-dim);
  text-align: center;
  padding-top: var(--s-4);
  font-family: var(--font-mono);
}

/* ---------- Guide mobile ---------- */
@media (max-width: 720px) {
  .guide-hero { flex-direction: column; }
  .guide-toc-list { grid-template-columns: 1fr; }
  .guide-section-head { flex-wrap: wrap; }
  .param-grid, .laser-compare, .recipe-grid, .safety-grid { grid-template-columns: 1fr; }
  .silver-settings { grid-template-columns: repeat(2, 1fr); }
  .color-table { font-size: 12px; }
  .color-table th, .color-table td { padding: var(--s-2); }
}
