/* ============================================================================
   Twitter Header Generator (new 2026-10-15)
   Everything is scoped to .thg-page or a thg- class - no global :root / body /
   .tool-container rules. Light default, dark via [data-theme="dark"].
   Accent #3399cc (social). Settings panel = compact option rows standard.
   ========================================================================== */
.thg-page {
    --tool-accent: #3399cc;
    --primary: #3399cc;
    --primary-light: #e0f2fe;
    --primary-dark: #2a87b8;
    --success: #339966;
    --success-light: #d1fae5;
    --warning: #b7791f;
    --warning-light: #fef3c7;
    --danger: #e64e4e;
    --danger-light: #fee2e2;
    --info-light: #e0f2fe;
    --bg: #f8fafc;
    --bg-elevated: #ffffff;
    --bg-secondary: #f1f5f9;
    --bg-tertiary: #e2e8f0;
    --text: #1e293b;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-full: 9999px;
    --input-bg: #ffffff;
    --input-border: #cbd5e1;
    --switch-off-bg: #cbd5e1;
    --switch-off-border: #b6c2d1;
    --switch-knob-border: rgba(15, 23, 42, 0.12);
    --checker: #e2e8f0;
    color: var(--text);
}
[data-theme="dark"] .thg-page {
    --tool-accent: #4db8e8;
    --primary: #4db8e8;
    --primary-light: rgba(77, 184, 232, 0.15);
    --primary-dark: #7cccf0;
    --success: #4ade80;
    --success-light: rgba(74, 222, 128, 0.14);
    --warning: #fbbf24;
    --warning-light: rgba(251, 191, 36, 0.14);
    --danger: #f87171;
    --danger-light: rgba(248, 113, 113, 0.14);
    --info-light: rgba(77, 184, 232, 0.12);
    --bg: #0f172a;
    --bg-elevated: #1e293b;
    --bg-secondary: #273449;
    --bg-tertiary: #334155;
    --text: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --border: #334155;
    --input-bg: #0f172a;
    --input-border: #475569;
    --switch-off-bg: #475569;
    --switch-off-border: #55657c;
    --switch-knob-border: rgba(0, 0, 0, 0.3);
    --checker: #334155;
}
.thg-page *, .thg-page *::before, .thg-page *::after { box-sizing: border-box; }
.thg-page [hidden] { display: none !important; }

/* ---------- header ---------- */
.thg-page .tool-header { text-align: center; margin-bottom: 1.5rem; }
.thg-page .thg-title-row { display: flex; align-items: center; justify-content: center; gap: 0.85rem; margin-bottom: 0.85rem; }
.thg-page .thg-title-icon { width: 56px; height: 56px; border-radius: 12px; background: #3399cc; color: #fff; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.thg-page .thg-title-icon svg { width: 28px; height: 28px; display: block; }
.thg-page .tool-title { margin: 0; color: var(--primary); font-size: clamp(1.6rem, 4vw, 2.3rem); font-weight: 700; letter-spacing: -0.02em; }
.thg-page .tool-description a { color: var(--primary); }

/* ---------- friendly error ---------- */
.thg-page .thg-err { display: flex; gap: 0.75rem; align-items: flex-start; background: var(--danger-light); border: 1px solid var(--danger); color: var(--text); border-radius: 12px; padding: 0.85rem 1rem; margin: 0 0 1rem; }
.thg-page .thg-err > svg { width: 20px; height: 20px; color: var(--danger); margin-top: 2px; flex-shrink: 0; }
.thg-page .thg-err-body { flex: 1; min-width: 0; }
.thg-page .thg-err-body p { margin: 0; line-height: 1.55; font-size: 0.93rem; overflow-wrap: anywhere; }
.thg-page .thg-err-body p + p { margin-top: 0.3rem; color: var(--text-muted); font-size: 0.86rem; }
.thg-page .thg-err a { color: var(--danger); font-weight: 600; }
.thg-page .thg-err-x { background: none; border: 0; color: var(--text-muted); cursor: pointer; padding: 2px; border-radius: 6px; display: inline-flex; width: auto; }
.thg-page .thg-err-x:hover { color: var(--text); background: var(--bg-secondary); }
.thg-page .thg-err-x svg { width: 18px; height: 18px; }

/* ---------- editor grid ---------- */
.thg-page .thg-editor { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); gap: 1.25rem; align-items: start; margin-bottom: 2.5rem; }
.thg-page .thg-preview-col, .thg-page .thg-controls { min-width: 0; }
.thg-page .thg-preview-col { position: sticky; top: 1rem; }

/* platform tabs (mode tabs) */
.thg-page .thg-tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; padding: 4px; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius-md); margin-bottom: 0.75rem; }
.thg-page .thg-tab { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 0.5rem 0.25rem; border: 0; border-radius: 9px; background: transparent; color: var(--text-secondary); cursor: pointer; font: inherit; font-size: 0.85rem; font-weight: 600; line-height: 1.2; width: auto; min-width: 0; transition: background 0.15s, color 0.15s; }
.thg-page .thg-tab svg { width: 18px; height: 18px; }
.thg-page .thg-tab small { font-size: 0.72rem; font-weight: 500; color: var(--text-muted); white-space: nowrap; }
.thg-page .thg-tab:hover { color: var(--text); background: var(--bg-elevated); }
.thg-page .thg-tab.active { background: var(--bg-elevated); color: var(--primary); box-shadow: 0 1px 3px rgba(15, 23, 42, 0.1); }
.thg-page .thg-tab.active small { color: var(--primary); }

/* preview */
.thg-page .thg-stage-card { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 0.85rem; }
.thg-page .thg-stage-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.6rem; font-size: 0.85rem; color: var(--text-secondary); font-weight: 600; }
.thg-page .thg-stage-head span { display: inline-flex; align-items: center; gap: 0.4rem; min-width: 0; }
.thg-page .thg-stage-head svg { width: 16px; height: 16px; }
.thg-page .thg-chip { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: var(--radius-full); background: var(--primary-light); color: var(--primary); font-size: 0.75rem; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.thg-page .thg-stage { position: relative; width: 100%; border-radius: 8px; overflow: hidden; background: repeating-conic-gradient(var(--checker) 0% 25%, transparent 0% 50%) 50% / 16px 16px; outline: 1px solid var(--border); }
.thg-page .thg-stage.drag { outline: 2px dashed var(--primary); outline-offset: 2px; }
.thg-page .thg-stage canvas { display: block; width: 100%; height: auto; }
.thg-page .thg-stage .thg-overlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.thg-page .thg-stage-note { margin: 0.6rem 0 0; font-size: 0.8rem; color: var(--text-muted); line-height: 1.5; display: flex; gap: 0.4rem; align-items: flex-start; }
.thg-page .thg-stage-note svg { width: 14px; height: 14px; flex-shrink: 0; margin-top: 2px; }

/* summary + actions under the preview */
.thg-page .thg-summary { margin-top: 0.75rem; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 0.85rem 1rem; }
.thg-page .thg-sum-row { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; font-size: 0.88rem; }
.thg-page .thg-sum-main { display: flex; align-items: center; gap: 0.5rem; color: var(--text-secondary); min-width: 0; }
.thg-page .thg-sum-main svg { width: 16px; height: 16px; color: var(--primary); flex-shrink: 0; }
.thg-page .thg-sum-main strong { color: var(--text); font-variant-numeric: tabular-nums; }
.thg-page .thg-limit { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.8rem; font-weight: 600; padding: 2px 9px; border-radius: var(--radius-full); white-space: nowrap; }
.thg-page .thg-limit svg { width: 14px; height: 14px; }
.thg-page .thg-limit.ok { background: var(--success-light); color: var(--success); }
.thg-page .thg-limit.over { background: var(--warning-light); color: var(--warning); }
.thg-page .thg-limit.na { background: var(--bg-secondary); color: var(--text-muted); }
.thg-page .thg-actions { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 0.5rem; margin-top: 0.8rem; }
.thg-page .thg-actions .thg-btn-zip { grid-column: 1 / -1; }

/* buttons */
.thg-page .thg-btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem; padding: 0.7rem 1rem; border-radius: 10px; font: inherit; font-size: 0.92rem; font-weight: 600; cursor: pointer; border: 1px solid transparent; width: 100%; min-width: 0; line-height: 1.2; transition: background 0.15s, border-color 0.15s, color 0.15s; }
.thg-page .thg-btn svg { width: 17px; height: 17px; flex-shrink: 0; }
.thg-page .thg-btn-primary { background: #2a87b8; color: #fff; }
.thg-page .thg-btn-primary:hover { background: #1f6f99; }
.thg-page .thg-btn-secondary { background: var(--bg-elevated); color: var(--text); border-color: var(--input-border); }
.thg-page .thg-btn-secondary:hover { border-color: var(--primary); color: var(--primary); }
.thg-page .thg-btn:disabled { opacity: 0.6; cursor: progress; }
.thg-page .thg-btn-sm { width: auto; padding: 0.45rem 0.75rem; font-size: 0.82rem; border-radius: 8px; }
.thg-page .thg-btn-sm svg { width: 15px; height: 15px; }
.thg-page .thg-linkbtn { background: none; border: 0; padding: 0; width: auto; color: var(--text-muted); font: inherit; font-size: 0.8rem; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 0.3rem; }
.thg-page .thg-linkbtn:hover { color: var(--primary); }
.thg-page .thg-linkbtn svg { width: 14px; height: 14px; }

.thg-page .thg-toast { margin: 0.6rem 0 0; font-size: 0.85rem; color: var(--success); font-weight: 600; display: flex; gap: 0.4rem; align-items: center; }
.thg-page .thg-toast svg { width: 16px; height: 16px; flex-shrink: 0; }

/* ---------- cards in the controls column ---------- */
.thg-page .thg-card { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 1rem 1.1rem; margin-bottom: 0.875rem; }
.thg-page .thg-card-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.75rem; }
.thg-page .thg-card-title { display: inline-flex; align-items: center; gap: 0.45rem; font-weight: 700; font-size: 0.95rem; color: var(--text); margin: 0; }
.thg-page .thg-card-title svg { width: 17px; height: 17px; color: var(--primary); }
.thg-page .thg-cap { display: block; font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); margin: 0.85rem 0 0.45rem; }

/* templates */
.thg-page .thg-tpls { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.5rem; }
.thg-page .thg-tpl { display: flex; flex-direction: column; gap: 4px; padding: 4px; border: 1px solid var(--border); border-radius: 9px; background: var(--bg-elevated); cursor: pointer; width: auto; min-width: 0; font: inherit; color: var(--text-secondary); transition: border-color 0.15s; }
.thg-page .thg-tpl canvas { display: block; width: 100%; height: auto; aspect-ratio: 3 / 1; border-radius: 6px; background: var(--bg-secondary); }
.thg-page .thg-tpl span { font-size: 0.74rem; font-weight: 600; line-height: 1.2; padding: 0 2px 2px; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thg-page .thg-tpl:hover { border-color: var(--primary); }
.thg-page .thg-tpl.active { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-light); }
.thg-page .thg-tpl.active span { color: var(--primary); }

/* saved designs */
.thg-page .thg-designs { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }
.thg-page .thg-design { display: inline-flex; align-items: center; border: 1px solid var(--input-border); border-radius: var(--radius-full); background: var(--bg-elevated); overflow: hidden; max-width: 100%; }
.thg-page .thg-design.active { border-color: var(--primary); background: var(--primary-light); }
.thg-page .thg-design-apply { border: 0; background: none; padding: 0.3rem 0.35rem 0.3rem 0.75rem; font: inherit; font-size: 0.8rem; font-weight: 600; color: var(--text); cursor: pointer; width: auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 180px; }
.thg-page .thg-design.active .thg-design-apply { color: var(--primary); }
.thg-page .thg-design-del { border: 0; background: none; padding: 0.3rem 0.55rem 0.3rem 0.2rem; color: var(--text-muted); cursor: pointer; display: inline-flex; width: auto; }
.thg-page .thg-design-del:hover { color: var(--danger); }
.thg-page .thg-design-del svg { width: 13px; height: 13px; }
.thg-page .thg-empty { font-size: 0.8rem; color: var(--text-muted); }
.thg-page .thg-save-row { display: flex; gap: 0.4rem; margin-top: 0.6rem; }
.thg-page .thg-save-row input { flex: 1; min-width: 0; }

/* text inputs (main setting) */
.thg-page .thg-field { margin-bottom: 0.7rem; }
.thg-page .thg-field:last-child { margin-bottom: 0; }
.thg-page .thg-field-label { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; font-size: 0.8rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 0.3rem; }
.thg-page .thg-field-label em { font-style: normal; font-weight: 500; color: var(--text-muted); font-size: 0.74rem; font-variant-numeric: tabular-nums; }
.tool-container .thg-page input.thg-input, .thg-page input.thg-input {
    width: 100% !important; max-width: none !important; margin: 0 !important; padding: 0.6rem 0.75rem !important; border: 1px solid var(--input-border) !important; border-radius: 9px !important;
    background: var(--input-bg) !important; color: var(--text) !important; font: inherit !important; font-size: 0.92rem !important; height: auto !important; box-shadow: none !important; line-height: 1.35 !important;
}
.thg-page input.thg-input:focus { outline: none; border-color: var(--primary) !important; box-shadow: 0 0 0 3px var(--primary-light) !important; }
.thg-page input.thg-input::placeholder { color: var(--text-muted); opacity: 1; }

/* ---------- compact option rows ---------- */
.thg-page .thg-adv { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; margin-bottom: 0.875rem; }
.thg-page .thg-adv-row + .thg-adv-row { border-top: 1px solid var(--border); }
.thg-page .thg-adv-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; width: 100%; min-height: 52px; padding: 0.6rem 1rem; background: none; border: 0; cursor: pointer; text-align: left; font: inherit; color: var(--text); border-radius: 0; }
.thg-page .thg-adv-head:hover { background: var(--bg-secondary); }
.thg-page .thg-adv-head:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.thg-page .thg-adv-left, .thg-page .thg-adv-right { display: flex; align-items: center; gap: 0.65rem; min-width: 0; }
.thg-page .thg-adv-right { flex-shrink: 0; gap: 0.45rem; }
.thg-page .thg-adv-left > svg { width: 18px; height: 18px; color: var(--primary); flex-shrink: 0; }
.thg-page .thg-adv-text { display: flex; flex-direction: column; min-width: 0; }
.thg-page .thg-adv-title { font-weight: 600; font-size: 0.9rem; line-height: 1.3; }
.thg-page .thg-adv-hint { font-size: 0.76rem; color: var(--text-muted); line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thg-page .thg-adv-value { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: var(--radius-full); background: var(--bg-secondary); border: 1px solid var(--border); color: var(--text-secondary); font-size: 0.75rem; font-weight: 700; white-space: nowrap; max-width: 120px; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.thg-page .thg-adv-chev { width: 16px; height: 16px; color: var(--text-muted); transition: transform 0.2s; }
.thg-page .thg-adv-row.open .thg-adv-chev { transform: rotate(180deg); }
.thg-page .thg-adv-row.open .thg-adv-head, .thg-page .thg-adv-row.open .thg-adv-body { background: var(--bg-secondary); }
.thg-page .thg-adv-body { padding: 0.25rem 1rem 1rem; }

/* segmented controls */
.thg-page .thg-seg { display: flex; gap: 3px; padding: 3px; background: var(--bg-tertiary); border-radius: 9px; }
.thg-page .thg-seg button { flex: 1 1 0; min-width: 0; border: 0; background: transparent; padding: 0.42rem 0.4rem; border-radius: 7px; font: inherit; font-size: 0.8rem; font-weight: 600; color: var(--text-secondary); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 0.3rem; white-space: nowrap; width: auto; }
.thg-page .thg-seg button svg { width: 15px; height: 15px; }
.thg-page .thg-seg button:hover { color: var(--text); }
.thg-page .thg-seg button.active { background: var(--bg-elevated); color: var(--primary); box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12); }

/* range + labelled controls */
.thg-page .thg-ctl { margin-top: 0.75rem; }
.thg-page .thg-ctl-label { display: flex; justify-content: space-between; align-items: center; font-size: 0.8rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 0.3rem; gap: 0.5rem; }
.thg-page .thg-ctl-label output { font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; font-size: 0.78rem; }
.tool-container .thg-page input[type="range"].thg-range, .thg-page input[type="range"].thg-range { width: 100% !important; margin: 0 !important; accent-color: var(--primary); height: 22px; background: transparent !important; border: 0 !important; padding: 0 !important; box-shadow: none !important; }
.thg-page .thg-two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0.75rem; }
.thg-page .thg-two > * { min-width: 0; }

/* colour inputs */
.thg-page .thg-colors { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; }
.thg-page .thg-color { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.78rem; font-weight: 600; color: var(--text-secondary); cursor: pointer; }
.tool-container .thg-page input[type="color"].thg-color-in, .thg-page input[type="color"].thg-color-in { -webkit-appearance: none; appearance: none; width: 34px !important; height: 34px !important; min-width: 34px; padding: 2px !important; margin: 0 !important; border: 1px solid var(--input-border) !important; border-radius: 9px !important; background: var(--input-bg) !important; cursor: pointer; box-shadow: none !important; }
.thg-page input[type="color"].thg-color-in::-webkit-color-swatch-wrapper { padding: 0; }
.thg-page input[type="color"].thg-color-in::-webkit-color-swatch { border: 0; border-radius: 6px; }
.thg-page input[type="color"].thg-color-in::-moz-color-swatch { border: 0; border-radius: 6px; }
.thg-page .thg-swatches { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.6rem; }
.thg-page .thg-swatch { width: 26px; height: 26px; min-width: 26px; padding: 0; border-radius: 50%; border: 1px solid rgba(15, 23, 42, 0.18); cursor: pointer; }
.thg-page .thg-swatch:hover { transform: scale(1.1); }
.thg-page .thg-iconbtn { width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--input-border); background: var(--bg-elevated); color: var(--text-secondary); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
.thg-page .thg-iconbtn:hover { color: var(--primary); border-color: var(--primary); }
.thg-page .thg-iconbtn svg { width: 16px; height: 16px; }

/* pattern + font pickers */
.thg-page .thg-pick { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.4rem; }
.thg-page .thg-pick button { border: 1px solid var(--input-border); background: var(--bg-elevated); border-radius: 8px; padding: 0.5rem 0.25rem; font: inherit; font-size: 0.76rem; font-weight: 600; color: var(--text-secondary); cursor: pointer; min-width: 0; width: auto; display: flex; flex-direction: column; align-items: center; gap: 0.25rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thg-page .thg-pick button svg { width: 18px; height: 18px; }
.thg-page .thg-pick button:hover { border-color: var(--primary); }
.thg-page .thg-pick button.active { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.thg-page .thg-fonts button { font-size: 1rem; padding: 0.55rem 0.25rem; color: var(--text); }
.thg-page .thg-fonts button small { font-family: inherit; font-size: 0.66rem; color: var(--text-muted); font-weight: 600; }
.thg-page .thg-fonts button.active small { color: var(--primary); }

/* upload buttons */
.thg-page .thg-upload { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.thg-page .thg-upload-name { font-size: 0.8rem; color: var(--text-muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; flex: 1; }
.thg-page .thg-hint { font-size: 0.78rem; color: var(--text-muted); margin: 0.5rem 0 0; line-height: 1.5; }
.thg-page .thg-hint a { color: var(--primary); }

/* switches (ON/OFF label beside) */
.thg-page .thg-switch-row { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin-top: 0.75rem; font-size: 0.84rem; font-weight: 600; color: var(--text-secondary); cursor: pointer; }
.thg-page .thg-switch-row > span:first-child { min-width: 0; }
.thg-page .thg-switch-wrap { display: inline-flex; align-items: center; gap: 0.45rem; flex-shrink: 0; }
.thg-page .thg-onoff { font-size: 0.7rem; font-weight: 800; letter-spacing: 0.04em; width: 2.1em; color: var(--text-muted); }
.thg-page .thg-onoff.on { color: var(--primary); }

.tool-container input[type="checkbox"].thg-switch,
input[type="checkbox"].thg-switch {
    -webkit-appearance: none !important; -moz-appearance: none !important; appearance: none !important;
    box-sizing: border-box !important; position: relative !important; display: inline-block !important;
    width: 44px !important; min-width: 44px !important; max-width: 44px !important;
    height: 24px !important; min-height: 24px !important; padding: 0 !important; margin: 0 !important;
    border: 1px solid var(--switch-off-border) !important; border-radius: 9999px !important;
    background: var(--switch-off-bg) !important; background-color: var(--switch-off-bg) !important;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.08) !important; cursor: pointer !important; flex-shrink: 0 !important; outline: none !important;
    transition: background-color 0.2s ease, border-color 0.2s ease !important;
}
.tool-container input[type="checkbox"].thg-switch:checked,
input[type="checkbox"].thg-switch:checked { background: var(--primary) !important; background-color: var(--primary) !important; border-color: var(--primary) !important; box-shadow: none !important; }
.tool-container input[type="checkbox"].thg-switch:focus-visible,
input[type="checkbox"].thg-switch:focus-visible { box-shadow: 0 0 0 3px var(--primary-light) !important; }
.tool-container input[type="checkbox"].thg-switch::after,
.tool-container input[type="checkbox"].thg-switch:checked::after,
input[type="checkbox"].thg-switch::after,
input[type="checkbox"].thg-switch:checked::after {
    content: '' !important; position: absolute !important; top: 2px !important; left: 2px !important; right: auto !important; bottom: auto !important;
    width: 18px !important; height: 18px !important; margin: 0 !important; padding: 0 !important; font-size: 0 !important;
    border-radius: 50% !important; border: 1px solid var(--switch-knob-border) !important; background: #ffffff !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25) !important; transform: none !important; transition: transform 0.2s ease !important;
}
.tool-container input[type="checkbox"].thg-switch:checked::after,
input[type="checkbox"].thg-switch:checked::after { transform: translateX(20px) !important; }

/* guard callouts (soft blue notice, amber warning) */
.thg-page .thg-note { display: flex; gap: 0.6rem; align-items: flex-start; border-radius: 10px; padding: 0.7rem 0.85rem; font-size: 0.83rem; line-height: 1.5; margin-top: 0.75rem; border: 1px solid; }
.thg-page .thg-note svg { width: 17px; height: 17px; flex-shrink: 0; margin-top: 1px; }
.thg-page .thg-note p { margin: 0; min-width: 0; }
.thg-page .thg-note a { font-weight: 600; }
.thg-page .thg-note-info { background: var(--info-light); border-color: rgba(51, 153, 204, 0.35); color: var(--text); }
.thg-page .thg-note-info svg, .thg-page .thg-note-info a { color: var(--primary); }
.thg-page .thg-note-warn { background: var(--warning-light); border-color: rgba(183, 121, 31, 0.4); color: var(--text); }
.thg-page .thg-note-warn svg, .thg-page .thg-note-warn a { color: var(--warning); }

/* ConvertICO ring loader overlay (ZIP build) */
.thg-page .thg-busy { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.6); z-index: 9000; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.thg-page .thg-busy-card { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.6rem 2rem; min-width: 300px; text-align: center; }
.thg-page .thg-busy-card p { margin: 0.9rem 0 0; font-weight: 600; color: var(--text); }
.thg-page .thg-busy-card small { display: block; margin-top: 0.25rem; color: var(--text-muted); font-size: 0.82rem; }
.thg-page .thg-loader { display: block; width: 48px; height: 48px; margin: 0 auto; overflow: visible;
    --cico-outer: #f2534e; --cico-outer-soft: #f8d3d1; --cico-mid: #31ae77; --cico-mid-soft: #d0e7dd; --cico-inner: #2b9edb; }
[data-theme="dark"] .thg-page .thg-loader { --cico-outer-soft: rgba(242, 83, 78, 0.22); --cico-mid-soft: rgba(49, 174, 119, 0.22); }
.thg-page .thg-loader circle { fill: none; stroke-width: 72; transform-box: fill-box; transform-origin: center; }
.thg-page .thg-loader .bp { stroke: var(--cico-outer-soft); }
.thg-page .thg-loader .gp { stroke: var(--cico-mid-soft); }
.thg-page .thg-loader .b { stroke: var(--cico-outer); stroke-linecap: round; stroke-dasharray: 35.3 100; animation: thgSpinL 1.3s linear infinite; }
.thg-page .thg-loader .g { stroke: var(--cico-mid); stroke-linecap: round; stroke-dasharray: 75.8 100; animation: thgSpinR 2.1s linear infinite; }
.thg-page .thg-loader .r { stroke: var(--cico-inner); animation: thgBreathe 1.3s ease-in-out infinite; }
@keyframes thgSpinL { from { transform: rotate(117deg); } to { transform: rotate(-243deg); } }
@keyframes thgSpinR { from { transform: rotate(36deg); } to { transform: rotate(396deg); } }
@keyframes thgBreathe { 50% { transform: scale(0.9); } }
@media (prefers-reduced-motion: reduce) {
    .thg-page .thg-loader .b { animation-duration: 4s; }
    .thg-page .thg-loader .g { animation-duration: 6s; }
    .thg-page .thg-loader .r { animation: none; }
}

/* ---------- info sections ---------- */
.thg-page .thg-info { display: flex; flex-direction: column; gap: 1.25rem; margin-bottom: 2rem; }
.thg-page .thg-info-card { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 1.4rem 1.5rem; }
.thg-page .thg-info-card h2 { display: flex; align-items: center; gap: 0.55rem; margin: 0 0 0.9rem; font-size: 1.3rem; color: var(--text); }
.thg-page .thg-info-card h2 svg { width: 22px; height: 22px; color: var(--primary); flex-shrink: 0; }
.thg-page .thg-info-card p { line-height: 1.7; color: var(--text-secondary); margin: 0 0 0.8rem; }
.thg-page .thg-info-card p:last-child { margin-bottom: 0; }
.thg-page .thg-info-card a { color: var(--primary); }
.thg-page .thg-table-wrap { overflow-x: auto; margin: 0.25rem 0 1rem; border: 1px solid var(--border); border-radius: 10px; }
.thg-page .thg-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; min-width: 520px; }
.thg-page .thg-table th, .thg-page .thg-table td { padding: 0.6rem 0.8rem; text-align: left; border-bottom: 1px solid var(--border); color: var(--text-secondary); }
.thg-page .thg-table th { background: var(--bg-secondary); color: var(--text); font-weight: 700; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; }
.thg-page .thg-table tr:last-child td { border-bottom: 0; }
.thg-page .thg-table td:first-child { color: var(--text); font-weight: 600; }
.thg-page .thg-features { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.85rem; margin-bottom: 0.9rem; }
.thg-page .thg-feature { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 10px; padding: 0.95rem 1rem; min-width: 0; }
.thg-page .thg-feature svg { width: 20px; height: 20px; color: var(--primary); }
.thg-page .thg-feature h3 { margin: 0.45rem 0 0.3rem; font-size: 0.98rem; color: var(--text); }
.thg-page .thg-feature p { font-size: 0.88rem; line-height: 1.6; margin: 0; }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
    .thg-page .thg-editor { grid-template-columns: minmax(0, 1fr); }
    .thg-page .thg-preview-col { position: static; }
}
@media (max-width: 560px) {
    .thg-page .thg-tab small { display: none; }
    .thg-page .thg-tpls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .thg-page .thg-pick { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .thg-page .thg-features { grid-template-columns: minmax(0, 1fr); }
    .thg-page .thg-actions { grid-template-columns: minmax(0, 1fr); }
    .thg-page .thg-info-card { padding: 1.1rem; }
    .thg-page .thg-adv-value { max-width: 90px; }
}
