:root {
    --primary: #8b5cf6;
    --primary-glow: rgba(139, 92, 246, 0.5);
    --cyan: #06b6d4;
    --cyan-glow: rgba(6, 182, 212, 0.4);
    --bg-dark: #020617;
    --card-bg: rgba(15, 23, 42, 0.75);
    --card-border: rgba(255, 255, 255, 0.1);
    --text-main: #f8fafc;
    --text-dim: #94a3b8;
    --text-muted: #475569;
    --font-mono: 'JetBrains Mono', monospace;
}

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

body {
    font-family: 'Manrope', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

/* Background Layers */
.bg-layer {
    position: fixed;
    inset: 0;
    z-index: -1;
}

.bg-layer.space {
    background: radial-gradient(circle at 50% 50%, #0f172a 0%, #020617 100%);
}

.bg-layer.grid {
    background-image:
        linear-gradient(rgba(139, 92, 246, 0.08) 1px, transparent 1px),
        linear-gradient(90deg, rgba(139, 92, 246, 0.08) 1px, transparent 1px);
    background-size: 80px 80px;
    mask-image: radial-gradient(circle at 50% 50%, black, transparent 95%);
    animation: grid-drift 100s linear infinite;
}

@keyframes grid-drift {
    from {
        background-position: 0 0;
    }

    to {
        background-position: 800px 800px;
    }
}

.bg-layer.glow {
    background:
        radial-gradient(circle at 10% 20%, rgba(139, 92, 246, 0.15), transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(6, 182, 212, 0.1), transparent 40%),
        radial-gradient(ellipse at 50% -20%, rgba(139, 92, 246, 0.2), transparent 70%);
}

/* Layout */
.portal-root {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 1000px;
    min-height: 100vh;
    padding: 2rem;
    position: relative;
    z-index: 1;
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
    width: 100%;
}

.logo {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-icon {
    font-size: 2.25rem;
    color: var(--primary);
    text-shadow: 0 0 20px var(--primary-glow);
    animation: pulse-glow 3s infinite;
}

@keyframes pulse-glow {

    0%,
    100% {
        filter: drop-shadow(0 0 5px var(--primary-glow));
    }

    50% {
        filter: drop-shadow(0 0 15px var(--primary-glow));
    }
}

.logo-text {
    font-weight: 800;
    letter-spacing: 0.35em;
    font-size: 1.5rem;
    background: linear-gradient(90deg, #fff, var(--text-dim));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.lang-switcher {
    display: flex;
    gap: 0.25rem;
    background: rgba(255, 255, 255, 0.05);
    padding: 0.25rem;
    border-radius: 99px;
    border: 1px solid var(--card-border);
}

.lang-btn {
    background: transparent;
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0.4;
    filter: grayscale(1);
}

.lang-btn:hover {
    opacity: 0.8;
    background: rgba(255, 255, 255, 0.1);
}

.lang-btn.active {
    opacity: 1;
    filter: grayscale(0);
    background: var(--primary-glow);
    box-shadow: 0 0 15px var(--primary-glow);
    transform: scale(1.15);
}

.system-status {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(0, 0, 0, 0.4);
    padding: 0.5rem 1.25rem;
    border-radius: 999px;
    border: 1px solid var(--card-border);
    backdrop-filter: blur(8px);
}

.status-dot {
    width: 10px;
    height: 10px;
    background: var(--cyan);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--cyan);
}

.status-dot.pulsing {
    animation: status-pulse 2s infinite;
}

@keyframes status-pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.4);
        opacity: 0.6;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.status-label {
    font-size: 0.8rem;
    font-weight: 800;
    color: var(--cyan);
    letter-spacing: 0.12em;
}

/* Core Interface */
.core-interface {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

/* Control Panel */
.control-panel {
    width: 100%;
    max-width: 800px;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(32px);
    -webkit-backdrop-filter: blur(32px);
    border: 1px solid var(--card-border);
    border-radius: 2.5rem;
    padding: 3.5rem;
    position: relative;
    overflow: hidden;
    box-shadow: 0 20px 60px -15px rgba(0, 0, 0, 0.6);
}

.glass-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 200%;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--primary), transparent);
    animation: border-line 6s linear infinite;
}

@keyframes border-line {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(50%);
    }
}

.tag {
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: 0.25em;
    margin-bottom: 1.5rem;
    display: block;
    text-transform: uppercase;
}

.task-id-tag {
    position: absolute;
    top: 1.75rem;
    right: 2.5rem;
    font-size: 0.75rem;
    font-family: var(--font-mono);
    color: var(--text-muted);
}

h1 {
    font-size: 3.75rem;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, #fff 40%, #94a3b8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.03em;
    text-align: center;
}

.desc {
    color: var(--text-dim);
    font-size: 1.3rem;
    line-height: 1.75;
    margin-bottom: 3.5rem;
    text-align: center;
    max-width: 90%;
    margin-left: auto;
    margin-right: auto;
}

.input-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    background: rgba(0, 0, 0, 0.5);
    padding: 1.5rem;
    border-radius: 1.5rem;
    border: 1px solid var(--card-border);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.input-container:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 40px rgba(139, 92, 246, 0.25);
    transform: translateY(-4px);
}

textarea {
    background: transparent;
    border: none;
    color: white;
    font-size: 1.25rem;
    min-height: 100px;
    resize: none;
    outline: none;
    padding: 0.5rem;
    font-family: inherit;
    line-height: 1.6;
    transition: opacity 0.3s ease;
}

textarea.fade-out {
    opacity: 0;
}

.glow-btn {
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    color: white;
    border: none;
    padding: 1.25rem;
    border-radius: 1.25rem;
    font-weight: 800;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.4s;
    letter-spacing: 0.12em;
}

.glow-btn:hover:not(:disabled) {
    transform: translateY(-4px) scale(1.03);
    box-shadow: 0 0 40px var(--primary-glow);
    background: linear-gradient(135deg, #a78bfa, var(--primary));
}

.glow-btn:active {
    transform: translateY(0);
}

.endpoint-info {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--card-border);
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.endpoint-info .label {
    color: var(--text-muted);
    font-weight: 800;
}

code {
    color: var(--text-muted);
    font-family: var(--font-mono);
    opacity: 0.8;
}

.endpoint-info.hidden {
    display: none !important;
}

/* Monitor Card */
.monitor-card {
    padding: 2.5rem;
    border-color: var(--primary-glow);
    animation: slideIn 0.8s cubic-bezier(0.2, 1, 0.3, 1);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(40px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.monitor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.tab {
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--text-muted);
    padding-bottom: 0.5rem;
    border-bottom: 2px solid transparent;
    letter-spacing: 0.12em;
}

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

.status-pill {
    background: var(--primary-glow);
    color: var(--primary);
    padding: 0.3rem 1rem;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 800;
    margin-left: 1.5rem;
    box-shadow: 0 0 15px var(--primary-glow);
}

.decision-code {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-muted);
}

.terminal-view {
    background: rgba(0, 0, 0, 0.65);
    border-radius: 1.25rem;
    height: 160px;
    padding: 1.5rem;
    margin-bottom: 2.5rem;
    overflow-y: auto;
    border: 1px solid var(--card-border);
}

/* Custom Scrollbar */
.terminal-view::-webkit-scrollbar {
    width: 4px;
}

.terminal-view::-webkit-scrollbar-thumb {
    background: var(--card-border);
    border-radius: 10px;
}

.terminal-content {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    line-height: 1.7;
}

.line {
    margin-bottom: 0.4rem;
}

.line.muted {
    color: var(--text-muted);
}

.line.info {
    color: var(--cyan);
    text-shadow: 0 0 10px var(--cyan-glow);
}

.line.success {
    color: #10b981;
    text-shadow: 0 0 10px rgba(16, 185, 129, 0.4);
}

.progress-section {
    margin-bottom: 3rem;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.progress-label {
    font-size: 0.8rem;
    font-weight: 800;
    color: var(--text-dim);
    letter-spacing: 0.12em;
}

.progress-value {
    font-family: var(--font-mono);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
}

.progress-track {
    height: 14px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 7px;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--cyan));
    width: 0%;
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 20px var(--primary-glow);
}

.progress-scanner {
    position: absolute;
    top: 0;
    left: 0;
    width: 150px;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    animation: scanProgress 2.5s linear infinite;
}

@keyframes scanProgress {
    from {
        transform: translateX(-150px);
    }

    to {
        transform: translateX(1000px);
    }
}

.status-msg {
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-top: 1rem;
    font-weight: 500;
    opacity: 0.8;
}

.action-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
}

.action-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
    color: white;
    padding: 1.25rem;
    border-radius: 1.25rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    transition: all 0.4s ease;
}

.action-btn .icon {
    font-family: var(--font-mono);
    font-weight: 800;
    font-size: 1.1rem;
    color: var(--text-dim);
}

.action-btn .label {
    font-size: 0.75rem;
    font-weight: 800;
    color: var(--text-muted);
    letter-spacing: 0.05em;
}

.action-btn:hover:not(.is-disabled) {
    background: rgba(255, 255, 255, 0.12);
    border-color: var(--primary);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

.action-btn:hover:not(.is-disabled) .icon {
    color: var(--primary);
}

.action-btn:hover:not(.is-disabled) .label {
    color: var(--text-main);
}

.action-btn.primary {
    grid-column: span 3;
    background: linear-gradient(135deg, var(--primary-glow), rgba(139, 92, 246, 0.15));
    border-color: var(--primary);
}

.action-btn.is-disabled {
    opacity: 0.2;
    cursor: not-allowed;
    filter: grayscale(1);
}

.hidden {
    display: none !important;
}

/* Footer */
.portal-footer {
    display: flex;
    justify-content: space-between;
    border-top: 1px solid var(--card-border);
    padding-top: 1.5rem;
    margin-top: 2rem;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
}

.footer-segment {
    letter-spacing: 0.2em;
    opacity: 0.7;
    font-weight: 600;
}

/* Responsive */
@media (max-width: 1400px) {
    .core-interface {
        gap: 4rem;
    }

    h1 {
        font-size: 3rem;
    }
}

@media (max-width: 1200px) {
    .core-interface {
        grid-template-columns: 1fr;
        gap: 2rem;
        max-width: 900px;
    }

    .hero-visual {
        display: none;
    }

    .portal-root {
        padding: 2rem;
    }

    h1 {
        font-size: 2.8rem;
    }
}

@media (max-width: 768px) {
    h1 {
        font-size: 2.75rem;
    }

    .glass-card {
        padding: 2.5rem;
    }

    .navbar {
        flex-direction: column;
        gap: 2rem;
    }
}

@media (max-width: 640px) {
    .portal-root {
        padding: 1.5rem;
    }

    .glass-card {
        padding: 2rem;
    }

    h1 {
        font-size: 2.2rem;
    }

    .action-grid {
        grid-template-columns: 1fr;
    }

    .action-btn.primary {
        grid-column: span 1;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 2.25rem;
    }

    .action-grid {
        grid-template-columns: 1fr;
    }
}