:root {
    --bs-primary: #2563eb;
    --bs-primary-rgb: 37, 99, 235;
    --bs-primary-text-emphasis: #1d4ed8;
    --bs-primary-bg-subtle: #eff6ff;
    --bs-primary-border-subtle: #bfdbfe;
    --bs-secondary-color: #6b7280;
    --bs-secondary-color-rgb: 107, 114, 128;
    --bs-body-bg: #f6f7f9;
    --bs-body-bg-rgb: 246, 247, 249;
    --bs-body-color: #374151;
    --bs-body-color-rgb: 55, 65, 81;
    --bs-emphasis-color: #1f2937;
    --bs-heading-color: var(--bs-emphasis-color);
    --bs-link-color: var(--bs-primary);
    --bs-link-color-rgb: var(--bs-primary-rgb);
    --bs-link-hover-color: var(--bs-primary-text-emphasis);
    --bs-link-hover-color-rgb: 29, 78, 216;
    --bs-border-color: #e5e7eb;
    --bs-border-color-translucent: rgba(17, 24, 39, 0.1);
    --bs-tertiary-bg: #ffffff;
    --bs-tertiary-bg-rgb: 255, 255, 255;
    --bs-light-bg-subtle: #f9fafb;
    --nav-height: 54px;
}

html,
body {
    min-height: 100%;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.my-nav {
    --bs-navbar-padding-y: 0;
}

.my-nav .nav-shell {
    min-height: var(--nav-height);
}

.brand-mark {
    width: 40px;
    height: 40px;
    flex: 0 0 auto;
    border-radius: 12px;
    box-shadow: 0 6px 16px rgba(17, 24, 39, 0.07);
}

.brand-mark-image {
    width: 32px;
    height: 32px;
}

.text-logo {
    font-size: 1.68rem;
}

.text-logo a {
    min-height: 42px;
    padding: 0;
}

.btn-primary {
    --bs-btn-color: var(--bs-white);
    --bs-btn-bg: var(--bs-primary);
    --bs-btn-border-color: var(--bs-primary);
    --bs-btn-hover-color: var(--bs-white);
    --bs-btn-hover-bg: var(--bs-primary-text-emphasis);
    --bs-btn-hover-border-color: var(--bs-primary-text-emphasis);
    --bs-btn-focus-shadow-rgb: var(--bs-primary-rgb);
    --bs-btn-active-color: var(--bs-white);
    --bs-btn-active-bg: var(--bs-primary-text-emphasis);
    --bs-btn-active-border-color: var(--bs-primary-text-emphasis);
    --bs-btn-disabled-bg: var(--bs-primary);
    --bs-btn-disabled-border-color: var(--bs-primary);
}

.btn-outline-secondary {
    --bs-btn-color: var(--bs-body-color);
    --bs-btn-bg: var(--bs-white);
    --bs-btn-border-color: var(--bs-border-color);
    --bs-btn-hover-color: var(--bs-primary-text-emphasis);
    --bs-btn-hover-bg: var(--bs-primary-bg-subtle);
    --bs-btn-hover-border-color: var(--bs-primary-border-subtle);
    --bs-btn-focus-shadow-rgb: var(--bs-primary-rgb);
    --bs-btn-active-color: var(--bs-primary-text-emphasis);
    --bs-btn-active-bg: var(--bs-primary-bg-subtle);
    --bs-btn-active-border-color: var(--bs-primary-border-subtle);
    --bs-btn-disabled-color: var(--bs-secondary-color);
    --bs-btn-disabled-border-color: var(--bs-border-color);
}

.form-select:focus {
    border-color: rgba(var(--bs-primary-rgb), 0.42);
    box-shadow: 0 0 0 0.25rem rgba(var(--bs-primary-rgb), 0.16);
}

#main,
.main-content {
    padding-top: 1.35rem;
    padding-bottom: 2rem;
}

.panel-title {
    color: var(--bs-heading-color);
    font-size: clamp(1.38rem, 2.1vw, 1.95rem);
    line-height: 1.24;
}

.page-content {
    max-width: 920px;
    margin-right: auto;
    margin-left: auto;
    box-shadow: none;
}

.page-content .page-header {
    padding: 1.22rem 1.28rem 1.18rem;
    border-bottom: 1px solid var(--bs-border-color);
    background: var(--bs-primary-bg-subtle);
}

.page-content .page-header .panel-title {
    color: var(--bs-emphasis-color);
    font-size: clamp(1.8rem, 3vw, 2rem);
    font-weight: 800;
    line-height: 1.18;
}

.page-content .page-description {
    max-width: 820px;
    margin: 0.55rem 0 0;
    color: var(--bs-secondary-color);
    font-size: 1rem;
    line-height: 1.7;
}

.page-content .article-body {
    padding: 1.42rem 1.28rem 1.5rem;
    color: var(--bs-body-color);
    font-size: 1rem;
    line-height: 1.7;
    overflow-wrap: break-word;
    word-break: break-word;
}

.page-content .article-body > article,
.page-content .article-body > section {
    margin: 0;
}

.page-content .article-body section {
    margin-bottom: 1.12rem;
}

.page-content .article-body > *:first-child,
.page-content .article-body article > *:first-child,
.page-content .article-body section > *:first-child,
.page-content h2:first-child,
.page-content h3:first-child,
.page-content h4:first-child {
    margin-top: 0;
}

.page-content p {
    margin: 0 0 1rem;
}

.page-content ul,
.page-content ol {
    margin: 0.75rem 0 1.25rem;
    padding-left: 2rem;
}

.page-content li {
    margin: 0.24rem 0;
    padding-left: 0.05rem;
}

.page-content h2,
.page-content h3,
.page-content h4 {
    margin: 1.32rem 0 0.72rem;
    color: var(--bs-emphasis-color);
    font-weight: 800;
    line-height: 1.25;
}

.page-content h2 {
    padding-bottom: 0.42rem;
    border-bottom: 1px solid var(--bs-border-color);
    font-size: clamp(1.38rem, 1.9vw, 1.5rem);
}

.page-content h3 {
    padding-bottom: 0.36rem;
    border-bottom: 1px solid var(--bs-border-color);
    font-size: clamp(1.18rem, 1.45vw, 1.3rem);
}

.page-content h4 {
    font-size: 1.06rem;
}

.page-content a {
    color: var(--bs-primary-text-emphasis);
    text-decoration-color: rgba(var(--bs-primary-rgb), 0.24);
    text-underline-offset: 0.16em;
}

.page-content a:hover,
.page-content a:focus {
    text-decoration-color: rgba(var(--bs-primary-rgb), 0.44);
}

.page-content blockquote {
    margin: 1.1rem 0;
    padding: 0.7rem 0.95rem;
    border-left: 3px solid var(--bs-primary-border-subtle);
    background: var(--bs-tertiary-bg);
    color: var(--bs-secondary-color);
}

.page-content code {
    padding: 0.12rem 0.35rem;
    border-radius: var(--bs-border-radius-sm);
    background: var(--bs-primary-bg-subtle);
    color: var(--bs-primary-text-emphasis);
    font-size: 0.93em;
}

.page-content pre {
    margin: 1rem 0;
    padding: 0.8rem 0.95rem;
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius);
    background: var(--bs-light-bg-subtle);
    overflow: auto;
}

.page-content pre code {
    padding: 0;
    background: transparent;
    color: inherit;
}

.page-content table {
    width: 100%;
    margin: 1rem 0;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.page-content th,
.page-content td {
    padding: 0.56rem 0.62rem;
    border: 1px solid var(--bs-border-color);
    vertical-align: top;
}

.page-content th {
    background: var(--bs-primary-bg-subtle);
    color: var(--bs-primary-text-emphasis);
    font-weight: 700;
}

.page-content tbody tr:nth-child(even) td {
    background: var(--bs-light-bg-subtle);
}

.page-content img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0.9rem auto;
    border-radius: var(--bs-border-radius);
}

.filter .form-select,
.filter .btn {
    height: 42px;
}

.vpn-table {
    --bs-table-color: var(--bs-body-color);
    --bs-table-bg: var(--bs-white);
    --bs-table-border-color: var(--bs-border-color);
    --bs-table-striped-color: var(--bs-body-color);
    --bs-table-striped-bg: var(--bs-light-bg-subtle);
    --bs-table-hover-color: var(--bs-body-color);
    --bs-table-hover-bg: var(--bs-primary-bg-subtle);
    min-width: 100%;
    table-layout: fixed;
}

.vpn-table th,
.vpn-table td {
    padding: 0.72rem 0.85rem;
    vertical-align: middle;
}

.vpn-table thead th {
    background: var(--bs-primary-bg-subtle);
    color: var(--bs-primary-text-emphasis);
    border-bottom: 1px solid var(--bs-primary-border-subtle);
    font-size: 0.875rem;
    font-weight: 700;
    line-height: 1.35;
    white-space: normal;
}

.vpn-list-panel .vpn-table th,
.vpn-list-panel .vpn-table td {
    text-align: left;
}

.vpn-list-panel .vpn-table thead tr:first-child,
.vpn-list-panel .vpn-table thead tr:first-child > th,
.countries-panel .vpn-table thead th,
.countries-panel .countries-table thead tr {
    border-top: 0;
    border-top-width: 0;
}

.vpn-list-panel .vpn-table tbody tr:last-child,
.countries-panel .countries-table tbody tr:last-child {
    border-bottom-width: 0;
}

.vpn-list-panel .vpn-table tr > :first-child,
.countries-panel .countries-table tr > :first-child {
    border-left: 0;
}

.vpn-list-panel .vpn-table tr > :last-child,
.countries-panel .countries-table tr > :last-child {
    border-right: 0;
}

.vpn-list-panel .vpn-table tbody tr:last-child > th,
.vpn-list-panel .vpn-table tbody tr:last-child > td,
.countries-panel .countries-table tbody tr:last-child > th,
.countries-panel .countries-table tbody tr:last-child > td {
    border-bottom: 0;
}

.vpn-table th.country-col,
.vpn-table td.country-cell {
    width: 20%;
}

.vpn-table th.hostname-col,
.vpn-table td.hostname-cell {
    width: 34%;
}

.vpn-table th.protocols-col,
.vpn-table td.protocols-cell {
    width: 46%;
}

.countries-table th:nth-child(n + 2),
.countries-table td:nth-child(n + 2) {
    min-width: 104px;
    text-align: center;
}

.vpn-table a,
.countries-table a {
    text-decoration: none;
}

.vpn-table a:hover,
.vpn-table a:focus,
.countries-table a:hover,
.countries-table a:focus {
    text-decoration: underline;
    text-underline-offset: 0.14em;
}

.vpn-table .country-cell {
    white-space: nowrap;
}

.vpn-table .country-cell a {
    display: inline-block;
    max-width: calc(100% - 1.5rem);
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
}

.vpn-table .hostname-text {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.protocols-hint {
    display: inline-flex;
    align-items: center;
    gap: 0.28rem;
    margin-left: auto;
    padding: 0.16rem 0.46rem;
    border: 1px solid rgba(var(--bs-primary-rgb), 0.18);
    border-radius: 999px;
    background: rgba(var(--bs-primary-rgb), 0.08);
    color: #4b5563;
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.15;
    white-space: nowrap;
}

.protocol-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.34rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 0.42rem;
    min-height: 30px;
    padding: 0.34rem 0.58rem;
    font-size: 0.75rem;
    line-height: 1.1;
    font-weight: 600;
    white-space: nowrap;
    background: var(--bs-white);
    color: var(--bs-body-color);
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.protocol-chip i {
    font-size: 0.72rem;
}

.protocol-chip:not(:disabled) {
    cursor: pointer;
}

.protocol-chip:not(:disabled):hover {
    transform: translateY(-1px);
}

.protocol-chip-ssl {
    border-color: #bfdbfe;
    background: #eff6ff;
    color: #1d4ed8;
}

.protocol-chip-l2tp {
    border-color: #bbf7d0;
    background: #f0fdf4;
    color: #15803d;
}

.protocol-chip-open {
    border-color: #fde68a;
    background: #fffbeb;
    color: #a16207;
}

.protocol-chip-sstp {
    border-color: #ddd6fe;
    background: #faf5ff;
    color: #6d28d9;
}

.protocol-chip.is-disabled,
.protocol-chip:disabled {
    opacity: 0.56;
    color: var(--bs-secondary-color);
    background: var(--bs-tertiary-bg);
    border-color: var(--bs-border-color);
    cursor: not-allowed;
}

.pagination {
    --bs-pagination-color: var(--bs-body-color);
    --bs-pagination-border-color: var(--bs-border-color);
    --bs-pagination-hover-color: var(--bs-primary-text-emphasis);
    --bs-pagination-hover-bg: var(--bs-primary-bg-subtle);
    --bs-pagination-hover-border-color: var(--bs-primary-border-subtle);
    --bs-pagination-focus-color: var(--bs-primary-text-emphasis);
    --bs-pagination-focus-bg: var(--bs-primary-bg-subtle);
    --bs-pagination-active-bg: var(--bs-primary);
    --bs-pagination-active-border-color: var(--bs-primary);
    --bs-pagination-focus-box-shadow: 0 0 0 0.25rem rgba(var(--bs-primary-rgb), 0.16);
}

.pagination .page-link {
    min-width: 38px;
    text-align: center;
}

.pagination .page-item:not(.disabled) .page-link {
    cursor: pointer;
}

.langs .dropdown-menu {
    --bs-dropdown-border-color: var(--bs-border-color);
    --bs-dropdown-link-color: var(--bs-body-color);
    --bs-dropdown-link-hover-color: var(--bs-primary-text-emphasis);
    --bs-dropdown-link-hover-bg: var(--bs-primary-bg-subtle);
    --bs-dropdown-link-active-color: var(--bs-primary-text-emphasis);
    --bs-dropdown-link-active-bg: var(--bs-primary-bg-subtle);
}

.scrollable-menu {
    max-height: 220px;
    overflow-x: hidden;
    overflow-y: auto;
}

.ad-slot {
    margin-bottom: 1rem;
}

.ad-slot:not(:empty) {
    min-height: 90px;
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius);
    background: var(--bs-tertiary-bg);
    padding: 0.5rem;
}

.protocol-modal-dialog {
    max-width: 560px;
}

.protocol-modal {
    --bs-modal-border-color: var(--bs-border-color);
    --bs-modal-header-border-color: var(--bs-border-color);
    --bs-modal-footer-border-color: var(--bs-border-color);
    border: 1px solid var(--bs-border-color);
    box-shadow: 0 16px 36px rgba(17, 24, 39, 0.14);
    background: var(--bs-white);
}

.protocol-modal .modal-header {
    background: var(--bs-light-bg-subtle);
    padding-top: 0.85rem;
    padding-bottom: 0.85rem;
    padding-right: 2.75rem;
}

.protocol-modal .modal-title {
    font-size: 1.02rem;
    letter-spacing: 0.01em;
}

.protocol-modal .modal-body {
    padding-top: 0.9rem;
    padding-bottom: 0.9rem;
}

.protocol-detail-item {
    display: grid;
    grid-template-columns: 108px minmax(0, 1fr) 96px;
    border: 1px solid var(--bs-border-color);
    border-radius: 0.45rem;
    overflow: hidden;
    background: var(--bs-white);
}

.protocol-detail-cell {
    min-height: 42px;
    padding: 0.48rem 0.62rem;
}

.protocol-detail-cell + .protocol-detail-cell {
    border-left: 1px solid var(--bs-border-color);
}

.protocol-detail-label {
    font-size: 0.84rem;
    color: var(--bs-secondary-color);
    line-height: 1.4;
}

.protocol-detail-value {
    font-size: 0.82rem;
    font-weight: 400;
    text-align: left;
    color: var(--bs-emphasis-color);
    min-width: 0;
    word-break: break-word;
}

.protocol-detail-value.is-empty {
    font-weight: 500;
    color: var(--bs-secondary-color);
}

.protocol-copy-btn {
    font-size: 0.74rem;
    line-height: 1;
    padding: 0.34rem 0.5rem;
}

.protocol-copy-btn.is-disabled,
.protocol-copy-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    pointer-events: none;
}

.protocol-copy-btn i {
    font-size: 0.68rem;
}

.protocol-copy-btn.is-copied {
    --bs-btn-color: #0f766e;
    --bs-btn-border-color: #67e8f9;
    --bs-btn-bg: #ecfeff;
    --bs-btn-hover-color: #0f766e;
    --bs-btn-hover-border-color: #22d3ee;
    --bs-btn-hover-bg: #cffafe;
    --bs-btn-active-color: #0f766e;
    --bs-btn-active-border-color: #22d3ee;
    --bs-btn-active-bg: #cffafe;
}

.protocol-copy-btn.is-error {
    --bs-btn-color: #9a3412;
    --bs-btn-border-color: #fdba74;
    --bs-btn-bg: #fff7ed;
    --bs-btn-hover-color: #9a3412;
    --bs-btn-hover-border-color: #fb923c;
    --bs-btn-hover-bg: #ffedd5;
    --bs-btn-active-color: #9a3412;
    --bs-btn-active-border-color: #fb923c;
    --bs-btn-active-bg: #ffedd5;
}

.protocol-detail-empty {
    font-size: 0.84rem;
    color: var(--bs-secondary-color);
    border: 1px dashed var(--bs-border-color);
    border-radius: 0.5rem;
    background: var(--bs-light-bg-subtle);
    padding: 0.44rem 0.58rem;
}

.download-modal-dialog {
    max-width: 640px;
}

.download-modal {
    --bs-modal-border-color: var(--bs-border-color);
    --bs-modal-footer-border-color: var(--bs-border-color);
}

.download-share-card {
    min-height: 46px;
    font-size: 0.88rem;
    transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.download-share-card:hover,
.download-modal-promo:hover .download-modal-placeholder {
    border-color: var(--bs-primary-border-subtle) !important;
    background: var(--bs-primary-bg-subtle) !important;
}

.download-share-icon {
    width: 26px;
    height: 26px;
    border-radius: var(--bs-border-radius);
    background: var(--bs-primary-bg-subtle);
    color: var(--bs-primary);
}

.download-share-x .download-share-icon {
    color: var(--bs-body-color);
}

.download-share-facebook .download-share-icon {
    background: #eaf1ff;
    color: #1d4ed8;
}

.download-share-telegram .download-share-icon {
    background: #e9f7ff;
    color: #0284c7;
}

.download-modal-kicker-icon {
    width: 16px;
    height: 16px;
    font-size: 0.58rem;
}

.download-modal-placeholder {
    min-height: 128px;
}

.download-modal-promo-icon {
    width: 46px;
    height: 46px;
}

.download-modal-promo-icon .fa-earth-asia {
    font-size: 1.38rem;
}

.download-modal-placeholder-text {
    max-width: 360px;
    line-height: 1.52;
}

.download-modal-button {
    min-width: 118px;
    min-height: 40px;
    padding: 0.46rem 0.92rem;
    font-size: 0.88rem;
}

@media (max-width: 991.98px) {
    :root {
        --nav-height: 52px;
    }

    .my-nav .navbar-collapse {
        margin-top: 0.5rem;
        padding: 0.65rem;
        background: var(--bs-white);
        border: 1px solid var(--bs-border-color);
        border-radius: var(--bs-border-radius-lg);
    }

    .header-tools {
        width: 100%;
        justify-content: center;
    }

    .brand-mark {
        width: 36px;
        height: 36px;
        border-radius: 11px;
    }

    .brand-mark-image {
        width: 30px;
        height: 30px;
    }

    .text-logo {
        font-size: 1.5rem;
    }
}

@media (max-width: 767.98px) {
    #main,
    .main-content {
        padding-top: 1rem;
    }

    .page-content .page-header {
        padding: 1rem;
    }

    .page-content .page-header .panel-title {
        font-size: 1.55rem;
    }

    .page-content .page-description {
        font-size: 0.95rem;
        line-height: 1.62;
    }

    .page-content .article-body {
        padding: 1.1rem 1rem 1.2rem;
        font-size: 1rem;
        line-height: 1.74;
    }

    .page-content h2 {
        font-size: 1.18rem;
    }

    .page-content table {
        font-size: 0.9rem;
    }

    .download-modal-dialog {
        max-width: none;
        margin: 0.75rem;
    }

    .protocol-modal-dialog {
        max-width: none;
        margin: 0.75rem;
    }

    .protocol-detail-item {
        grid-template-columns: 84px minmax(0, 1fr) 82px;
    }

    .protocol-detail-cell {
        min-height: 38px;
        padding: 0.4rem 0.46rem;
    }

    .protocol-detail-label {
        font-size: 0.8rem;
    }

    .protocol-copy-btn {
        width: auto;
        justify-content: center;
        padding: 0.3rem 0.42rem;
        font-size: 0.7rem;
    }

    .protocol-copy-btn i {
        font-size: 0.64rem;
    }

    .download-modal-button {
        flex: 1 1 0;
        min-width: 0;
        padding-left: 0.6rem;
        padding-right: 0.6rem;
    }

    .vpn-list-panel {
        overflow: visible !important;
        border: 0 !important;
        background: transparent !important;
    }

    .vpn-table,
    .vpn-table tbody,
    .vpn-table tr,
    .vpn-table td {
        display: block;
    }

    .vpn-table {
        min-width: 0;
        border: 0;
        background: transparent;
    }

    .vpn-table thead {
        display: none;
    }

    .vpn-table tbody {
        display: grid;
        gap: 0.7rem;
    }

    .vpn-table tbody tr {
        border: 1px solid var(--bs-border-color);
        border-radius: 0.5rem;
        overflow: hidden;
        background: var(--bs-white);
    }

    .vpn-table th,
    .vpn-table td {
        padding: 0.58rem 0.62rem;
    }

    .vpn-table td {
        width: auto !important;
        border: 0;
    }

    .vpn-table td + td {
        border-top: 1px solid var(--bs-border-color);
    }

    .vpn-table td::before {
        display: block;
        margin-bottom: 0.24rem;
        color: var(--bs-secondary-color);
        font-size: 0.68rem;
        font-weight: 700;
        line-height: 1.2;
        text-transform: uppercase;
    }

    .vpn-table td[data-label]::before {
        content: attr(data-label);
    }

    .vpn-table .country-cell {
        white-space: normal;
    }

    .vpn-table .country-cell a {
        max-width: calc(100% - 1.5rem);
    }

    .vpn-table .hostname-text {
        max-width: none;
        white-space: normal;
        word-break: break-all;
    }

    .protocol-chip {
        min-height: 34px;
        padding: 0.4rem 0.58rem;
        font-size: 0.74rem;
    }

    .protocol-chip i {
        font-size: 0.68rem;
    }
}
