/* ── ОБЁРТКА ── */
.ghfd-wrap {
    --g-bg:   #0d0d12;
    --g-card: #16161f;
    --g-inp:  #1e1e2a;
    --g-brd:  #2a2a38;
    --g-fg:   #f0f0f5;
    --g-warp: #3b82f6;
    --g-warp2:#06b6d4;
    --g-vless:#a855f7;
    --g-vless2:#ec4899;
    background: var(--g-bg);
    border-radius: 24px;
    max-width: 480px;
    margin: 28px auto;
    color: var(--g-fg);
    box-shadow: 0 0 0 1px var(--g-brd), 0 40px 80px rgba(0,0,0,.6);
    overflow: visible;
    font-family: 'Inter', sans-serif;
}

/* ── ШАПКА ── */
.ghfd-header {
    display: flex; align-items: center; gap: 14px;
    padding: 20px 24px;
    background: var(--g-card);
    border-bottom: 1px solid var(--g-brd);
    border-radius: 24px 24px 0 0;
}
.ghfd-logo {
    width: 46px; height: 46px; flex-shrink: 0;
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; color: #fff;
}
.ghfd-header-text { flex: 1; min-width: 0; }
.ghfd-title { font-size: 16px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ghfd-sub   { font-size: 11px; color: #888; margin-top: 2px; }

/* ── ПЕРЕКЛЮЧАТЕЛЬ ── */
.ghfd-mode-switch {
    display: flex; align-items: center; gap: 8px; flex-shrink: 0; margin-left: auto;
}
.ghfd-mode-label {
    font-size: 11px; font-weight: 700; letter-spacing: .5px;
    color: #555; transition: .3s; white-space: nowrap;
}
.ghfd-mode-label.active.warp-label {
    background: linear-gradient(135deg, var(--g-warp), var(--g-warp2));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.ghfd-mode-label.active.vless-label {
    background: linear-gradient(135deg, var(--g-vless), var(--g-vless2));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.ghfd-toggle { position: relative; display: inline-block; width: 44px; height: 24px; }
.ghfd-toggle input { opacity: 0; width: 0; height: 0; }
.ghfd-slider {
    position: absolute; cursor: pointer; inset: 0;
    background: var(--g-inp); border: 1px solid var(--g-brd);
    border-radius: 24px; transition: .4s;
}
.ghfd-slider:before {
    content: ''; position: absolute;
    width: 16px; height: 16px; left: 3px; bottom: 3px;
    background: #555; border-radius: 50%; transition: .4s;
}
.ghfd-toggle input:checked ~ .ghfd-slider {
    background: linear-gradient(135deg, var(--g-vless), var(--g-vless2));
    border-color: transparent;
}
.ghfd-toggle input:checked ~ .ghfd-slider:before {
    transform: translateX(20px); background: #fff;
}

/* ── BODY ── */
.ghfd-body { padding: 20px 24px 24px; background: var(--g-bg); border-radius: 0 0 24px 24px; }

.ghfd-section { display: flex; flex-direction: column; gap: 10px; animation: ghfd-in .25s ease; }
@keyframes ghfd-in { from { opacity:0; transform: translateY(6px); } to { opacity:1; transform:none; } }

/* ── СТРОКИ WARP ── */
.awg-row {
    display: flex; align-items: center; justify-content: space-between;
    background: var(--g-card); border: 1px solid var(--g-brd);
    border-radius: 14px; padding: 11px 16px; transition: border-color .2s;
}
.awg-row:focus-within { border-color: var(--g-warp); }
.awg-label {
    font-size: 13px; color: #888; font-weight: 500;
    display: flex; align-items: center; gap: 8px; white-space: nowrap;
}
.awg-label i { color: #555; font-size: 12px; }

.awg-select,
.awg-custom-select { width: 165px; min-width: 165px; max-width: 165px; }

.awg-select {
    background: var(--g-inp); border: 1px solid var(--g-brd);
    border-radius: 10px; padding: 8px 28px 8px 10px;
    color: #fff; font-size: 13px; outline: none; cursor: pointer;
    box-sizing: border-box; appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 8px center;
    transition: border-color .2s;
}
.awg-select:focus { border-color: var(--g-warp); }
.awg-select::-webkit-inner-spin-button,
.awg-select::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.awg-select[type=number] { -moz-appearance: textfield; text-align: center; padding: 8px 10px; }

.awg-custom-field { padding: 0 4px; }
.awg-input {
    width: 100%; box-sizing: border-box;
    background: var(--g-inp); border: 1px solid var(--g-brd);
    border-radius: 12px; padding: 12px 16px;
    color: #fff; font-size: 13px; outline: none; transition: border-color .2s;
}
.awg-input:focus        { border-color: var(--g-warp); }
.awg-input::placeholder { color: #444; }

/* ── КАСТОМНЫЙ ДРОПДАУН ── */
.awg-row-endpoint { position: relative; overflow: visible; }
.awg-custom-select { position: relative; box-sizing: border-box; }
.awg-cs-selected {
    display: flex; align-items: center; justify-content: space-between; gap: 6px;
    background: var(--g-inp); border: 1px solid var(--g-brd);
    border-radius: 10px; padding: 8px 10px;
    color: #fff; font-size: 13px; cursor: pointer;
    transition: border-color .2s; user-select: none;
    width: 100%; box-sizing: border-box;
}
.awg-cs-selected:hover { border-color: var(--g-warp); }
.awg-cs-selected > i { color: #555; font-size: 11px; flex-shrink: 0; transition: transform .2s; }
.awg-custom-select.open .awg-cs-selected { border-color: var(--g-warp); }
.awg-custom-select.open .awg-cs-selected > i { transform: rotate(180deg); }
.awg-cs-list {
    display: none; position: absolute;
    bottom: calc(100% + 6px); right: 0; width: 200px;
    background: #1a1a26; border: 1px solid #2a2a38;
    border-radius: 12px; overflow: hidden;
    box-shadow: 0 -8px 32px rgba(0,0,0,.6); z-index: 999;
}
.awg-custom-select.open .awg-cs-list { display: block; }
.awg-cs-option {
    padding: 9px 14px; font-size: 13px; color: #ccc;
    cursor: pointer; transition: background .15s;
    display: flex; align-items: center; gap: 8px; white-space: nowrap;
}
.awg-cs-option:hover    { background: rgba(59,130,246,.15); color: #fff; }
.awg-cs-option.selected { background: rgba(59,130,246,.1);  color: #60a5fa; }
.awg-flag-img { width: 16px; height: 12px; border-radius: 2px; flex-shrink: 0; }

/* ── VLESS ПОЛЯ ── */
.ghfd-vless-info {
    background: rgba(168,85,247,.08); border: 1px solid rgba(168,85,247,.2);
    border-radius: 12px; padding: 12px 16px;
    font-size: 13px; color: #c084fc; line-height: 1.5;
    display: flex; gap: 10px; align-items: flex-start;
}
.ghfd-vless-info i { margin-top: 2px; flex-shrink: 0; }

.ghfd-field { display: flex; flex-direction: column; gap: 6px; }
.ghfd-field-label {
    font-size: 11px; font-weight: 700; text-transform: uppercase;
    letter-spacing: .5px; color: #666;
    display: flex; align-items: center; gap: 6px;
}
.ghfd-field-hint { font-size: 11px; color: #444; padding-left: 4px; }

/* ── КНОПКИ ── */
.ghfd-btn-wrap { margin-top: 4px; }

.ghfd-btn {
    position: relative; overflow: hidden;
    width: 100%; padding: 16px;
    border: none; border-radius: 16px;
    font-size: 15px; font-weight: 700; color: #fff;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: transform .2s, box-shadow .2s, background .4s;
}
.ghfd-btn:hover:not(:disabled)  { transform: translateY(-2px); }
.ghfd-btn:active:not(:disabled) { transform: scale(.98); }
.ghfd-btn:disabled { cursor: wait; opacity: .7; }

.ghfd-btn-warp {
    background: linear-gradient(135deg, var(--g-warp), var(--g-warp2));
    box-shadow: 0 4px 20px rgba(59,130,246,.35);
}
.ghfd-btn-vless {
    background: linear-gradient(135deg, var(--g-vless), var(--g-vless2));
    box-shadow: 0 4px 20px rgba(168,85,247,.35);
}

.ghfd-btn-progress {
    position: absolute; bottom: 0; left: 0; height: 3px; width: 0;
    background: rgba(255,255,255,.6); border-radius: 0 0 16px 16px;
    transition: width 1s ease;
}
.ghfd-btn-content { display: flex; align-items: center; gap: 10px; position: relative; z-index: 1; }

/* Состояния */
.ghfd-btn[data-state="loading"].ghfd-btn-warp { animation: ghfd-pulse-blue 1.4s infinite; }
.ghfd-btn[data-state="loading"].ghfd-btn-vless { animation: ghfd-pulse-purple 1.4s infinite; }
.ghfd-btn[data-state="done"]  { background: linear-gradient(135deg, #10b981, #059669) !important; box-shadow: 0 4px 20px rgba(16,185,129,.4) !important; animation: none !important; }
.ghfd-btn[data-state="error"] { background: linear-gradient(135deg, #ef4444, #b91c1c) !important; box-shadow: 0 4px 20px rgba(239,68,68,.4) !important; animation: none !important; }

@keyframes ghfd-pulse-blue   { 0%,100% { box-shadow: 0 4px 20px rgba(59,130,246,.4); } 50% { box-shadow: 0 4px 32px rgba(59,130,246,.7); } }
@keyframes ghfd-pulse-purple { 0%,100% { box-shadow: 0 4px 20px rgba(168,85,247,.4); } 50% { box-shadow: 0 4px 32px rgba(168,85,247,.7); } }

/* ── СТАТУС ── */
.ghfd-status {
    max-height: 0; overflow: hidden; font-size: 13px; text-align: center;
    border-radius: 12px; transition: all .3s; margin-top: 0;
}
.ghfd-status.visible  { max-height: 60px; margin-top: 12px; padding: 12px 16px; }
.ghfd-status.loading  { background: rgba(245,158,11,.1);  color: #fcd34d; border: 1px solid rgba(245,158,11,.25); }
.ghfd-status.success  { background: rgba(16,185,129,.1);  color: #4ade80; border: 1px solid rgba(16,185,129,.25); }
.ghfd-status.error    { background: rgba(239,68,68,.1);   color: #fca5a5; border: 1px solid rgba(239,68,68,.25); }

/* ── VLESS РЕЗУЛЬТАТ ── */
.ghfd-vless-result { margin-top: 4px; animation: ghfd-in .3s ease; }
.ghfd-result-label {
    font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
    color: #4ade80; display: flex; align-items: center; gap: 7px; margin-bottom: 10px;
}
.ghfd-result-box {
    display: flex; align-items: center;
    background: var(--g-inp); border: 1.5px solid rgba(74,222,128,.3);
    border-radius: 14px; overflow: hidden;
}
.ghfd-result-box input {
    flex: 1; background: none; border: none; outline: none;
    padding: 13px 16px; color: #4ade80; font-size: 12px; font-family: monospace;
}
.ghfd-result-box button {
    background: none; border: none; border-left: 1px solid var(--g-brd);
    padding: 13px 16px; color: #888; cursor: pointer; font-size: 15px; transition: color .2s;
}
.ghfd-result-box button:hover { color: #4ade80; }
.ghfd-result-hint {
    font-size: 12px; color: #555; margin-top: 8px; padding-left: 4px; line-height: 1.5;
}

@media (max-width: 480px) {
    .ghfd-body { padding: 16px; }
    .awg-select, .awg-custom-select { width: 140px; min-width: 140px; max-width: 140px; }
    .ghfd-mode-switch { gap: 6px; }
    .ghfd-mode-label { font-size: 10px; }
}

/* ── Версия модуля ── */
.ghfd-version-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    color: #6b7280;
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 6px;
    padding: 1px 7px;
    vertical-align: middle;
    margin-left: 6px;
    letter-spacing: .3px;
}

/* ── QR-блок ── */
.ghfd-qr-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
    padding: 16px;
    background: rgba(139,92,246,.06);
    border: 1px solid rgba(139,92,246,.2);
    border-radius: 14px;
}
.ghfd-qr-wrap-h2 {
    background: rgba(249,115,22,.06);
    border-color: rgba(249,115,22,.2);
}
.ghfd-qr-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: #a78bfa;
    display: flex;
    align-items: center;
    gap: 6px;
}
.ghfd-qr-label-h2 { color: #fb923c; }
.ghfd-qr-canvas {
    border-radius: 10px;
    background: #fff;
    padding: 8px;
    display: inline-block;
    margin: 0 auto;
}

/* ── PILL SWITCHER ── */
.ghfd-pill-switch {
    position: relative;
    display: flex;
    align-items: center;
    gap: 4px;
    background: #0d0d12;
    border-bottom: 1px solid #2a2a38;
    padding: 10px 16px;
}
.ghfd-pill {
    position: relative;
    z-index: 1;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    border: none;
    border-radius: 10px;
    background: none;
    color: #555;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .4px;
    cursor: pointer;
    transition: color .25s;
    white-space: nowrap;
}
.ghfd-pill i { font-size: 12px; }
.ghfd-pill.active[data-section="warp"]  { color: #60a5fa; }
.ghfd-pill.active[data-section="vless"] { color: #c084fc; }
.ghfd-pill.active[data-section="h2"]    { color: #fb923c; }

/* Подвижный фон активной кнопки */
.ghfd-pill-bg {
    position: absolute;
    top: 10px;
    height: calc(100% - 20px);
    border-radius: 10px;
    transition: left .28s cubic-bezier(.4,0,.2,1), width .28s cubic-bezier(.4,0,.2,1), background .28s;
    pointer-events: none;
    z-index: 0;
}

/* ── H2 акцентные цвета ── */
.ghfd-btn-h2 {
    background: linear-gradient(135deg, #f97316, #ef4444);
    box-shadow: 0 4px 20px rgba(249,115,22,.35);
}
.ghfd-btn[data-state="loading"].ghfd-btn-h2 { animation: ghfd-pulse-orange 1.4s infinite; }
@keyframes ghfd-pulse-orange { 0%,100% { box-shadow:0 4px 20px rgba(249,115,22,.4); } 50% { box-shadow:0 4px 32px rgba(249,115,22,.7); } }

.ghfd-limits-card-h2 {
    background: linear-gradient(135deg, rgba(249,115,22,.12), rgba(239,68,68,.08));
    border-color: rgba(249,115,22,.25);
}
.ghfd-limits-card-h2 .ghfd-limit-item > i { color: #fb923c; }

.ghfd-result-label-h2 { color: #fb923c; }
.ghfd-result-box-h2 { border-color: rgba(251,146,60,.3); }
.ghfd-result-box-h2 input { color: #fb923c; }
.ghfd-result-box-h2 button:hover { color: #fb923c; }

.ghfd-h2-info {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    background: rgba(249,115,22,.07);
    border: 1px solid rgba(249,115,22,.2);
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 13px;
    color: #fb923c;
    line-height: 1.5;
}
.ghfd-h2-info i { margin-top: 2px; flex-shrink: 0; }

/* ── Счётчик ── */
.awg-counter { display:flex;align-items:center;gap:0;background:var(--g-inp);border:1px solid var(--g-brd);border-radius:10px;overflow:hidden;height:36px; }
.awg-counter-btn { background:none;border:none;color:#555;width:36px;height:36px;cursor:pointer;font-size:11px;display:flex;align-items:center;justify-content:center;transition:background .15s,color .15s;flex-shrink:0; }
.awg-counter-btn:hover { background:rgba(59,130,246,.12);color:#60a5fa; }
.awg-counter-val { min-width:36px;text-align:center;font-size:14px;font-weight:700;color:#fff;border-left:1px solid var(--g-brd);border-right:1px solid var(--g-brd);padding:0 4px;line-height:36px;user-select:none; }

/* ── Флаги ── */
.awg-flag-img { width:20px;height:15px;border-radius:2px;flex-shrink:0;box-shadow:0 1px 3px rgba(0,0,0,.3); }
.awg-cs-option { display:flex;align-items:center;gap:10px; }
.awg-cs-option span { flex:1; }

/* ── Браузеры ── */
.ghfd-browser-grid { display:grid;grid-template-columns:repeat(3,1fr);gap:8px;margin-top:2px; }
.ghfd-browser-card { display:flex;flex-direction:column;align-items:center;gap:8px;padding:14px 8px 12px;background:var(--g-card);border:1.5px solid var(--g-brd);border-radius:14px;cursor:pointer;transition:border-color .18s,background .18s,box-shadow .18s;position:relative; }
.ghfd-browser-card input[type=radio] { position:absolute;opacity:0;pointer-events:none; }
.ghfd-browser-card > i { font-size:26px;line-height:1; }
.ghfd-browser-card span { font-size:12px;font-weight:600;color:#6b7280;letter-spacing:.2px; }
.ghfd-browser-card:hover { border-color:rgba(168,85,247,.4);background:rgba(168,85,247,.06); }
.ghfd-browser-card.selected { border-color:rgba(168,85,247,.65);background:rgba(168,85,247,.12);box-shadow:0 0 0 3px rgba(168,85,247,.12); }
.ghfd-browser-card.selected span { color:#c4b5fd; }

/* ── Лимиты VLESS ── */
.ghfd-limits-card { display:flex;align-items:center;background:linear-gradient(135deg,rgba(139,92,246,.12),rgba(236,72,153,.08));border:1px solid rgba(139,92,246,.25);border-radius:14px;padding:14px 20px;gap:0;margin-bottom:2px; }
.ghfd-limit-item { flex:1;display:flex;flex-direction:column;align-items:center;gap:3px;text-align:center; }
.ghfd-limit-item > i { font-size:14px;color:#a78bfa;margin-bottom:2px; }
.ghfd-limit-val { font-size:19px;font-weight:800;color:#e2e8f0;line-height:1; }
.ghfd-limit-lbl { font-size:10px;color:#6b7280;text-transform:uppercase;letter-spacing:.7px;font-weight:600; }
.ghfd-limits-divider { width:1px;height:38px;background:rgba(255,255,255,.08);flex-shrink:0; }