:root {
    --bg: #1a1b2e;
    --bg-alt: #151626;
    --surface: #222340;
    --surface-hover: #2a2b4a;
    --surface-active: #1e1f38;
    --border: #3a3b55;
    --border-light: #4a4b65;

    --text: #e8e8ee;
    --text-muted: #a0a1b8;
    --text-dim: #707188;

    --accent: #ff6b6b;
    --accent-secondary: #ffd93d;
    --accent-gradient: linear-gradient(135deg, #ff6b6b, #ffd93d);
    --accent-glow: rgba(255, 107, 107, 0.25);

    --success: #6bcb6b;
    --warning: #ffd93d;
    --error: #ff6b6b;
    --info: #6bcbff;

    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --radius-xl: 12px;
    --radius-full: 9999px;

    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
    --transition-slow: 0.4s ease;

    --font-sans: "Comic Sans MS", 'Segoe Print', 'Bradley Hand', Chilanka, TSCu_Comic, casual, cursive, Arial, Helvetica, sans-serif;
    --font-mono: "Comic Sans MS", 'Segoe Print', 'Bradley Hand', Chilanka, TSCu_Comic, casual, cursive, Arial, monospace;
}

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

body,
html,
#app {
    font-family: var(--font-sans);
    width: 100vw;
    height: 100vh;
    margin: 0;
    background: var(--bg);
    overflow: hidden;
    color: var(--text);
}

body::before {
    display: none;
}

.browser-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
}

/* Tabs */
.tabs {
    display: flex;
    padding: 8px 10px 0;
    gap: 4px;
    background: var(--bg-alt);
    overflow-x: auto;
    border-bottom: 2px solid var(--border);
}

.tabs::-webkit-scrollbar {
    height: 0;
}

.tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    min-width: 140px;
    max-width: 200px;
    background: var(--surface);
    border: 2px solid var(--border);
    border-bottom: none;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.tab:hover {
    background: var(--surface-hover);
}

.tab.active {
    background: var(--accent);
    color: #fff;
}

.tab.active .tab-title,
.tab.active .tab-close {
    color: #fff;
}

.tab-favicon {
    width: 16px;
    height: 16px;
    border-radius: 3px;
    flex-shrink: 0;
}

.tab-title {
    flex: 1;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tab-close {
    font-size: 16px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px 4px;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    line-height: 1;
    opacity: 0;
}

.tab:hover .tab-close,
.tab.active .tab-close {
    opacity: 1;
}

.tab-close:hover {
    background: rgba(239, 68, 68, 0.2);
    color: var(--error);
}

.new-tab {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    background: var(--surface);
    border: 2px solid var(--border);
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 14px;
    flex-shrink: 0;
    margin-top: 2px;
    font-family: var(--font-sans);
    font-weight: 700;
}

.new-tab:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* Navigation Bar */
.nav {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    background: var(--bg-alt);
    border-bottom: 2px solid var(--border);
}

.nav button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 14px;
    font-family: var(--font-sans);
}

.nav button:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

/* Address Bar Wrapper */
.address-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

input.bar {
    width: 100%;
    height: 32px;
    padding: 0 40px 0 10px;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text);
    font-size: 14px;
    font-family: var(--font-sans);
    outline: none;
}

input.bar:focus {
    border-color: var(--accent);
}

input.bar::placeholder {
    color: var(--text-dim);
}

#home-btn-nav {
    position: absolute;
    right: 4px;
    width: 24px;
    height: 24px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    padding: 0;
}

#home-btn-nav:hover {
    color: var(--accent);
}

/* Loading Bar */
.loading-bar-container {
    height: 2px;
    background: transparent;
    position: relative;
    z-index: 2;
}

.loading-bar {
    height: 100%;
    width: 0%;
    background: var(--accent);
    transition: width 0.2s ease, opacity 0.15s;
}

/* Iframe */
.iframe-container {
    flex: 1;
    position: relative;
    background: var(--bg);
}

.iframe-container iframe {
    width: 100%;
    height: 100%;
    border: none;
    position: absolute;
}

.iframe-container iframe.hidden {
    display: none;
}

.iframe-container iframe.loading {
    filter: blur(20px);
    transition: filter 0.6s ease;
}

.iframe-loading {
    position: absolute;
    inset: 0;
    background: var(--bg);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.message-container {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    width: 100%;
    color: var(--text);
    text-align: center;
    position: absolute;
    top: 0;
    left: 0;
    background: var(--bg);
    z-index: 10;
}

.message-content {
    max-width: 400px;
    padding: 20px;
}

.message-content h1 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
}

.message-content p {
    color: var(--text-muted);
    font-size: 13px;
    word-break: break-all;
}

.spinner {
    border: 3px solid #ddd;
    border-top-color: var(--accent);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 20px;
}

#skip-btn {
    margin-top: 20px;
    padding: 8px 18px;
    background: var(--surface);
    color: var(--text-muted);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 14px;
    font-family: var(--font-sans);
    display: none;
}

#skip-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* Spinner */
.tab-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid #ddd;
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Settings Modal */
.wisp-settings-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.wisp-settings-modal.hidden {
    display: none;
}

.settings-card {
    background: var(--surface);
    width: 420px;
    max-width: 90vw;
    border-radius: var(--radius-lg);
    border: 2px solid var(--border);
    overflow: hidden;
}


.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 22px;
    border-bottom: 1px solid var(--border);
}

.settings-header h2 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 10px;
}

.close-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    display: flex;
}

.close-btn:hover {
    color: var(--text);
    background: var(--surface-hover);
}

.settings-content {
    padding: 22px;
    max-height: 55vh;
    overflow-y: auto;
}

.settings-content::-webkit-scrollbar {
    width: 6px;
}

.settings-content::-webkit-scrollbar-track {
    background: transparent;
}

.settings-content::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.settings-content::-webkit-scrollbar-thumb:hover {
    background: var(--border-light);
}

.section-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 12px;
    font-weight: 600;
}

.server-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 20px;
}

.wisp-option {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px 12px;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
}

.wisp-option:hover {
    border-color: var(--accent);
}

.wisp-option.active {
    border-color: var(--accent);
    background: rgba(255, 107, 107, 0.1);
}

.wisp-option-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.wisp-option-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    display: flex;
    align-items: center;
}

.wisp-option-url {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
}

.server-status {
    display: flex;
    align-items: center;
    gap: 6px;
}

.ping-text {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
}

.status-indicator {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-dim);
}

.status-indicator.status-success {
    background: var(--success);
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.4);
}

.status-indicator.status-error {
    background: var(--error);
    box-shadow: 0 0 6px rgba(239, 68, 68, 0.4);
}

.custom-input-group {
    display: flex;
    gap: 8px;
}

.custom-input-group input {
    flex: 1;
    height: 34px;
    padding: 0 10px;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 13px;
    outline: none;
}

.custom-input-group input:focus {
    border-color: var(--accent);
}

.custom-input-group button {
    height: 34px;
    padding: 0 14px;
    background: var(--accent);
    border: 2px solid var(--accent);
    border-radius: var(--radius-sm);
    color: #fff;
    cursor: pointer;
    font-size: 14px;
    font-family: var(--font-sans);
    font-weight: 700;
}

.custom-input-group button:hover {
    background: #ff5252;
}

.settings-footer {
    padding: 12px 22px;
    border-top: 1px solid var(--border);
    color: var(--text-dim);
    font-size: 12px;
}

.delete-wisp-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    margin-left: 6px;
    transition: color var(--transition-fast);
}

.delete-wisp-btn:hover {
    color: var(--error);
}

/* Toggle Switch */
.toggle-switch {
    width: 40px;
    height: 20px;
    background: rgba(100, 120, 200, 0.15);
    border-radius: 10px;
    position: relative;
    cursor: pointer;
    transition: background 0.2s;
}

.toggle-switch.active {
    background: var(--accent-gradient);
}

.toggle-knob {
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    position: absolute;
    top: 2px;
    left: 2px;
    transition: transform 0.2s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.toggle-switch.active .toggle-knob {
    transform: translateX(20px);
}

.flex {
    display: flex;
}

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-alt);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-light);
}
