:root {
    --bg-base: #0b1118;
    --bg-surface: #131a23;
    --bg-surface-2: #1a2230;
    --bg-input: #0f161e;
    --bg-hover: #1f2937;

    --border: #1f2a37;
    --border-strong: #2a3645;
    --border-focus: #3b82f6;

    --text-primary: #e6edf5;
    --text-secondary: #9aa7b8;
    --text-muted: #6b7689;

    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --accent-dim: rgba(59, 130, 246, 0.12);

    --error: #ef4444;
    --error-bg: rgba(239, 68, 68, 0.10);
    --success: #10b981;
    --warning: #f59e0b;

    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;

    --font-mono: 'IBM Plex Mono', 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;
    --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-body);
    background: var(--bg-base);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    font-feature-settings: 'cv11', 'ss01';
}

.noise { display: none; }

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 40px 24px 80px;
}

.header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding-bottom: 20px;
    margin-bottom: 28px;
    border-bottom: 1px solid var(--border);
}

.logo {
    display: flex;
    align-items: center;
    gap: 14px;
    position: relative;
    padding-left: 14px;
}

.logo::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    width: 4px;
    height: 16px;
    background: var(--accent);
    border-radius: 1px;
    transform: translateY(-50%);
}

.logo-text {
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 1.5px;
    color: var(--text-primary);
}

.ip-display {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.ip-row {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 10px 0;
}

.ip-row + .ip-row {
    border-top: 1px solid var(--border);
}

.ip-label {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--text-muted);
    width: 48px;
    flex-shrink: 0;
}

.ip-value {
    font-family: var(--font-mono);
    font-size: clamp(16px, 2.4vw, 20px);
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.3;
    flex: 1;
    word-break: break-all;
}

.ipheader {
    cursor: pointer;
    transition: color 0.15s;
}

.ipheader:hover {
    color: var(--accent);
}

.search-wrap {
    margin-bottom: 24px;
}

.search-bar {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--bg-input);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    padding: 0 6px 0 14px;
    height: 42px;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.search-bar:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

.search-icon {
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    flex-shrink: 0;
    margin-right: 10px;
}

.search-bar:focus-within .search-icon {
    color: var(--accent);
}

.search-field {
    flex: 1;
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text-primary);
    outline: none;
    line-height: 42px;
    white-space: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
}

.search-field::-webkit-scrollbar { display: none; }

.search-placeholder {
    position: absolute;
    left: 40px;
    font-family: var(--font-body);
    font-size: 13px;
    color: var(--text-muted);
    pointer-events: none;
}

.search-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: var(--radius-sm);
    border: none;
    background: var(--accent);
    color: white;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s;
}

.search-btn svg {
    width: 14px;
    height: 14px;
}

.search-btn:hover {
    background: var(--accent-hover);
}

.search-btn:active {
    background: var(--accent-hover);
}

.error-bar {
    position: relative;
    height: 2px;
    margin-top: 8px;
    border-radius: 0;
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.25s;
}

.error-bar-track {
    position: absolute;
    inset: 0;
    background: var(--border);
}

.error-bar-fill {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--error);
    transition: width 5s linear;
}

.error-text {
    font-size: 12px;
    color: var(--error);
    margin-top: 6px;
    opacity: 0;
    transition: opacity 0.2s;
    font-weight: 500;
}

.tabs {
    display: flex;
    gap: 0;
    margin: 0;
    border-bottom: 1px solid var(--border);
}

.tab {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 10px 16px;
    margin-bottom: -1px;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
}

.tab svg {
    width: 14px;
    height: 14px;
    opacity: 0.7;
}

.tab:hover {
    color: var(--text-secondary);
}

.tab.active {
    color: var(--text-primary);
    border-bottom-color: var(--accent);
}

.tab.active svg {
    opacity: 1;
    color: var(--accent);
}

.panels-container {
    position: relative;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    overflow: hidden;
}

.panels {
    display: flex;
    transition: transform 0.3s ease;
}

.panel {
    min-width: 100%;
    padding: 20px;
}

.info-grid {
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    gap: 20px;
    align-items: stretch;
}

.info-cards {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.card-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.section-title {
    font-family: var(--font-body);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    color: var(--text-secondary);
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
}

.info-card {
    background: var(--bg-surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 14px;
    transition: background 0.12s;
    min-height: 34px;
}

.info-row:hover {
    background: var(--bg-hover);
}

.info-row + .info-row {
    border-top: 1px solid var(--border);
}

.info-key {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.info-val {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-primary);
    text-align: right;
    word-break: break-all;
    padding-left: 16px;
    font-weight: 500;
}

.info-val.proxy-true {
    color: var(--error);
    background: var(--error-bg);
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-val.proxy-false {
    color: var(--success);
    background: rgba(16, 185, 129, 0.10);
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.map-wrap {
    position: relative;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    min-height: 400px;
    height: 100%;
    background: var(--bg-base);
}

#hmap {
    width: 100%;
    height: 100%;
    min-height: 400px;
    background: var(--bg-base);
}

.cotoax-marker-wrap {
    background: transparent !important;
    border: none !important;
}

.cotoax-marker {
    position: relative;
    width: 14px;
    height: 14px;
}

.cotoax-marker .core {
    position: absolute;
    inset: 3px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.9);
    z-index: 2;
}

.cotoax-marker .ring,
.cotoax-marker .ring-2 {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: var(--accent);
    opacity: 0.4;
    animation: marker-pulse 2.2s ease-out infinite;
}

.cotoax-marker .ring-2 { animation-delay: 1.1s; }

@keyframes marker-pulse {
    0%   { transform: scale(0.55); opacity: 0.5; }
    100% { transform: scale(2.4);  opacity: 0;    }
}

.leaflet-control-zoom a {
    background: var(--bg-surface) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-strong) !important;
    transition: background 0.15s;
}

.leaflet-control-zoom a:hover {
    background: var(--bg-hover) !important;
    color: var(--accent) !important;
}

.leaflet-control-attribution {
    background: var(--bg-surface) !important;
    color: var(--text-muted) !important;
    font-size: 10px !important;
    padding: 2px 8px !important;
    border: 1px solid var(--border) !important;
    border-bottom: none !important;
    border-right: none !important;
}

.leaflet-control-attribution a {
    color: var(--text-secondary) !important;
}

.leaflet-container { font-family: var(--font-body); }

.raw-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.format-label {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
}

.format-label::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--success);
}

.copy-btn {
    position: relative;
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-surface-2);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    padding: 6px 12px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.copy-btn:hover {
    border-color: var(--accent);
    color: var(--text-primary);
    background: var(--bg-hover);
}

.copy-btn #checkico {
    position: absolute;
    left: 12px;
    opacity: 0;
    color: var(--success);
    transition: opacity 0.2s;
}

.copy-btn.copied {
    border-color: var(--success);
    color: var(--success);
}

.copy-btn.copied #checkico { opacity: 1; }
.copy-btn.copied #clipboardico { opacity: 0; }

.copy-label {
    font-size: 12px;
    transition: opacity 0.2s;
}

.code-wrap {
    position: relative;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px;
    overflow: auto;
    max-height: 520px;
}

.code-wrap::-webkit-scrollbar { width: 8px; height: 8px; }
.code-wrap::-webkit-scrollbar-track { background: transparent; }
.code-wrap::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 4px;
}
.code-wrap::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

.code-wrap pre { margin: 0; }

.code-wrap code {
    font-family: var(--font-mono);
    font-size: 12.5px;
    line-height: 1.65;
    background: transparent !important;
    padding: 0 !important;
}

.hljs { background: transparent !important; }

@media (max-width: 900px) {
    .container {
        padding: 32px 20px 64px;
    }
    .info-grid {
        grid-template-columns: 1fr;
    }
    .map-wrap, #hmap {
        min-height: 320px;
    }
}

@media (max-width: 640px) {
    .container {
        padding: 24px 14px 56px;
    }

    .header {
        margin-bottom: 20px;
        padding-bottom: 14px;
    }

    .logo {
        gap: 10px;
    }

    .logo-text {
        font-size: 13px;
        letter-spacing: 1.2px;
    }

    .ip-display {
        padding: 12px 14px;
    }

    .ip-row {
        gap: 12px;
    }

    .ip-label {
        width: 40px;
        font-size: 10px;
    }

    .panel {
        padding: 14px;
    }

    .tab {
        padding: 9px 12px;
        font-size: 12px;
    }

    .info-row {
        padding: 8px 12px;
    }

    .map-wrap, #hmap {
        min-height: 280px;
    }
}

@media (max-width: 420px) {
    .search-bar {
        height: 40px;
    }

    .search-field {
        line-height: 40px;
        font-size: 12px;
    }

    .search-placeholder {
        font-size: 12px;
    }

    .ip-value {
        font-size: 15px;
    }

    .info-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
        padding: 8px 12px;
    }

    .info-val {
        text-align: left;
        padding-left: 0;
    }
}