:root {
    --bg-dark: #121212;
    --card-bg: rgba(30, 30, 30, 0.7);
    --input-bg: #0a0a0a;
    --primary: #EB5757;
    --primary-hover: #d94a4a;
    --danger: #cf3030;
    --danger-hover: #b02424;
    --success: #4ade80;
    --text-main: #f1f1f1;
    --text-muted: #a0a0a0;
    --border: #333;
    --radius: 12px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-dark);
}
::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #444;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem 1rem;
}

#app {
    width: 100%;
    max-width: 480px; 
    margin: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
    animation: fadeIn 0.5s ease-out;
    transition: max-width 0.3s ease;
}

header {
    text-align: center;
    margin-bottom: 5px;
}

.logo-link {
    display: inline-block;
    cursor: pointer;
    text-decoration: none;
    border: none;
    outline: none;
    transition: transform 0.2s;
}

header .logo {
    height: 40px;
    width: auto;
    margin-bottom: 12px;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

h1 {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.025em;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

.subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.5;
}

.subtitle b {
    color: var(--text-main);
    font-weight: 600;
}

.card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius);
    padding: 30px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
    position: relative;
}

.input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.input-wrapper {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
}

.clear-btn {
    position: absolute;
    right: 10px;
    background: #333;
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    cursor: pointer;
    line-height: 1;
    transition: background 0.2s;
}

.clear-btn:hover { background: #444; }

input[type="text"], select {
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-main);
    font-family: 'JetBrains Mono', monospace;
    font-size: 16px;
    padding: 10px 12px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

input[type="text"] {
    width: 100%;
    padding-right: 35px;
}

input[type="text"]:focus, select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(235, 87, 87, 0.2);
}

select {
    width: 90px;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a0a0a0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 14px;
    padding-right: 24px;
    padding-left: 10px;
    font-weight: 600;
}

.btn {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    font-size: 1rem;
    transition: transform 0.1s, background 0.2s;
    font-family: 'Inter', sans-serif;
}

.btn:active { transform: scale(0.98); }

.btn.primary { background: var(--primary); color: white; }
.btn.primary:hover { background: var(--primary-hover); }

.btn.secondary { background: #333; color: white; }
.btn.secondary:hover { background: #444; }

.btn.danger-outline {
    background: transparent;
    border: 1px solid var(--danger);
    color: var(--danger);
}
.btn.danger-outline:hover { background: rgba(207, 48, 48, 0.1); }

#results {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
}

.server-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.provider-name {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1rem;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}
.status-dot.success { background-color: var(--success); box-shadow: 0 0 8px var(--success); }
.status-dot.error { background-color: var(--danger); box-shadow: 0 0 8px var(--danger); }

.server-ip {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    color: var(--text-muted);
    background: rgba(255,255,255,0.05);
    padding: 4px 8px;
    border-radius: 4px;
}

.dns-data-box {
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px;
    max-height: 250px;
    overflow-y: auto;
}

.record-row {
    padding: 8px;
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    color: var(--text-main);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    border: 1px solid transparent;
}

.record-row:hover {
    background: #1a1a1a;
    border-color: #333;
}

.record-row.copied {
    background: rgba(74, 222, 128, 0.1);
    border-color: rgba(74, 222, 128, 0.3);
}

.record-content {
    word-break: break-all;
    white-space: pre-wrap;
}

.copy-icon {
    color: var(--text-muted);
    opacity: 0;
    transition: opacity 0.2s;
    margin-top: 2px;
}

.record-row:hover .copy-icon { opacity: 1; }

.empty-record {
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
    padding: 10px;
    font-size: 0.9rem;
}

.error-message {
    color: var(--danger);
    font-weight: 600;
    text-align: center;
    padding: 15px;
    background: rgba(207, 48, 48, 0.1);
    border-radius: 8px;
    font-size: 0.9rem;
}

.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    min-height: 200px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 1rem;
}

.action-buttons {
    grid-column: 1 / -1;
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: var(--success);
    color: #000;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 1000;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 600px) {
    body { padding: 1rem; }
    .card { padding: 20px; }
    
    .input-group {
        flex-direction: column;
    }
    
    select {
        width: 100%;
    }
}

@media (min-width: 800px) {
    #app {
        max-width: 900px;
    }

    #app > .card {
        max-width: 480px;
        width: 100%;
        margin: 0 auto;
    }

    #results {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        align-items: stretch;
        gap: 20px;
    }

    .loading {
        grid-column: 1 / -1;
    }
}