/* =============================================
   CSS Design System — Rate Limiting Visual Guide
   ============================================= */

/* CSS Custom Properties */
:root {
    /* Colors */
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-tertiary: #1a1a28;
    --bg-card: #16161f;
    --bg-card-hover: #1e1e2b;

    --text-primary: #e8e8f0;
    --text-secondary: #a0a0b8;
    --text-muted: #6a6a82;

    --accent-primary: #6c5ce7;
    --accent-secondary: #a29bfe;
    --accent-tertiary: #dfe6e9;

    --gradient-1: linear-gradient(135deg, #6c5ce7 0%, #a29bfe 100%);
    --gradient-2: linear-gradient(135deg, #00cec9 0%, #6c5ce7 100%);
    --gradient-3: linear-gradient(135deg, #fd79a8 0%, #6c5ce7 100%);
    --gradient-hero: linear-gradient(135deg, #0a0a0f 0%, #1a1a3a 50%, #0a0a0f 100%);

    --success: #00b894;
    --success-bg: rgba(0, 184, 148, 0.1);
    --error: #e17055;
    --error-bg: rgba(225, 112, 85, 0.1);
    --warning: #fdcb6e;
    --warning-bg: rgba(253, 203, 110, 0.1);
    --info: #74b9ff;
    --info-bg: rgba(116, 185, 255, 0.1);

    /* Typography */
    --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

    /* Spacing */
    --section-padding: 120px;
    --container-width: 1200px;

    /* Borders & Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --border-color: rgba(108, 92, 231, 0.15);
    --border-color-hover: rgba(108, 92, 231, 0.3);

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 40px rgba(108, 92, 231, 0.15);

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* Reset & Base */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 80px;
}

body {
    font-family: var(--font-primary);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.7;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--accent-secondary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--accent-primary);
}

/* Container */
.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 24px;
}

/* =============================================
   Particles Background
   ============================================= */
.particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.particle {
    position: absolute;
    width: 3px;
    height: 3px;
    background: var(--accent-primary);
    border-radius: 50%;
    opacity: 0.15;
    animation: float-particle linear infinite;
}

@keyframes float-particle {
    0% {
        transform: translateY(100vh) translateX(0);
        opacity: 0;
    }
    10% {
        opacity: 0.15;
    }
    90% {
        opacity: 0.15;
    }
    100% {
        transform: translateY(-10vh) translateX(100px);
        opacity: 0;
    }
}

/* =============================================
   Navigation
   ============================================= */
.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 32px;
    z-index: 1000;
    background: rgba(10, 10, 15, 0.85);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 18px;
}

.logo-icon {
    font-size: 24px;
}

.logo-text {
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-links {
    display: flex;
    gap: 24px;
}

.nav-links a {
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.3px;
    transition: color var(--transition-fast);
}

.nav-links a:hover {
    color: var(--text-primary);
}

/* =============================================
   Hero Section
   ============================================= */
.hero {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    background: var(--gradient-hero);
    text-align: center;
    padding: 120px 24px 60px;
}

.hero::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(108, 92, 231, 0.1) 0%, transparent 70%);
    pointer-events: none;
}

.hero-content {
    position: relative;
    z-index: 1;
    max-width: 800px;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    padding: 8px 20px;
    background: rgba(108, 92, 231, 0.1);
    border: 1px solid rgba(108, 92, 231, 0.3);
    border-radius: 100px;
    font-size: 13px;
    font-weight: 600;
    color: var(--accent-secondary);
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 32px;
    animation: fadeInUp 0.8s ease;
}

.hero-title {
    font-size: clamp(40px, 7vw, 80px);
    font-weight: 900;
    line-height: 1.1;
    margin-bottom: 24px;
    letter-spacing: -2px;
    animation: fadeInUp 0.8s ease 0.1s both;
}

.gradient-text {
    background: var(--gradient-2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 18px;
    color: var(--text-secondary);
    max-width: 560px;
    margin: 0 auto 40px;
    line-height: 1.8;
    animation: fadeInUp 0.8s ease 0.2s both;
}

.hero-actions {
    display: flex;
    gap: 16px;
    justify-content: center;
    margin-bottom: 60px;
    animation: fadeInUp 0.8s ease 0.3s both;
}

.btn {
    display: inline-flex;
    align-items: center;
    padding: 14px 32px;
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-normal);
    border: none;
    font-family: var(--font-primary);
}

.btn-primary {
    background: var(--gradient-1);
    color: white;
    box-shadow: 0 4px 20px rgba(108, 92, 231, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 30px rgba(108, 92, 231, 0.4);
    color: white;
}

.btn-secondary {
    background: rgba(108, 92, 231, 0.1);
    color: var(--accent-secondary);
    border: 1px solid rgba(108, 92, 231, 0.3);
}

.btn-secondary:hover {
    background: rgba(108, 92, 231, 0.2);
    transform: translateY(-2px);
    color: var(--accent-secondary);
}

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 64px;
    animation: fadeInUp 0.8s ease 0.4s both;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-number {
    font-size: 32px;
    font-weight: 800;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-label {
    font-size: 13px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 500;
}

/* Scroll Indicator */
.scroll-indicator {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    font-size: 12px;
    animation: bounce 2s ease infinite;
}

.scroll-arrow {
    width: 20px;
    height: 20px;
    border-right: 2px solid var(--text-muted);
    border-bottom: 2px solid var(--text-muted);
    transform: rotate(45deg);
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateX(-50%) translateY(0); }
    40% { transform: translateX(-50%) translateY(-10px); }
    60% { transform: translateX(-50%) translateY(-5px); }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =============================================
   Intro Section
   ============================================= */
.intro-section {
    padding: var(--section-padding) 0;
    background: var(--bg-secondary);
    position: relative;
    z-index: 1;
}

.intro-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 80px;
    align-items: center;
}

.intro-text h2 {
    font-size: 36px;
    font-weight: 800;
    margin-bottom: 20px;
    letter-spacing: -0.5px;
}

.intro-text > p {
    color: var(--text-secondary);
    font-size: 16px;
    margin-bottom: 32px;
    line-height: 1.8;
}

.intro-cards {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.intro-card {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 20px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    transition: all var(--transition-normal);
}

.intro-card:hover {
    border-color: var(--border-color-hover);
    background: var(--bg-card-hover);
    transform: translateX(4px);
}

.intro-card-icon {
    font-size: 28px;
    flex-shrink: 0;
}

.intro-card h4 {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 4px;
}

.intro-card p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Server Illustration */
.intro-visual {
    display: flex;
    justify-content: center;
}

.server-illustration {
    position: relative;
    width: 300px;
    height: 350px;
}

.server-box {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    padding: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    text-align: center;
}

.server-label {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--accent-secondary);
}

.server-meter {
    width: 100%;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 10px;
}

.meter-fill {
    height: 100%;
    width: 40%;
    background: var(--gradient-1);
    border-radius: 4px;
    transition: width 0.5s ease;
}

.server-status {
    font-size: 12px;
    color: var(--success);
    font-weight: 600;
}

.request-rain {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 200px;
    overflow: hidden;
}

.rain-drop {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-primary);
    opacity: 0.6;
    animation: rain-fall 2s ease-in infinite;
}

@keyframes rain-fall {
    0% {
        transform: translateY(-20px);
        opacity: 0;
    }
    20% {
        opacity: 0.6;
    }
    100% {
        transform: translateY(200px);
        opacity: 0;
    }
}

/* =============================================
   Algorithm Sections
   ============================================= */
.algo-section {
    padding: var(--section-padding) 0;
    position: relative;
    z-index: 1;
}

.algo-section:nth-child(odd) {
    background: var(--bg-primary);
}

.algo-section:nth-child(even) {
    background: var(--bg-secondary);
}

.algo-header {
    display: flex;
    align-items: flex-start;
    gap: 24px;
    margin-bottom: 60px;
}

.algo-number {
    font-size: 64px;
    font-weight: 900;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
    opacity: 0.5;
}

.algo-title {
    font-size: 36px;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-bottom: 8px;
}

.algo-tagline {
    color: var(--text-secondary);
    font-size: 16px;
}

/* Algorithm Content Layout */
.algo-content {
    display: grid;
    grid-template-columns: 1fr 1.3fr;
    gap: 48px;
    align-items: start;
}

/* Explanation */
.algo-explanation {
    position: sticky;
    top: 100px;
}

.explanation-block {
    margin-bottom: 24px;
}

.explanation-block h3 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.explanation-block ol {
    padding-left: 20px;
}

.explanation-block li {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 10px;
    line-height: 1.6;
}

.explanation-block li strong {
    color: var(--accent-secondary);
}

.highlight-block {
    padding: 20px;
    background: rgba(108, 92, 231, 0.05);
    border: 1px solid rgba(108, 92, 231, 0.15);
    border-radius: var(--radius-md);
    border-left: 3px solid var(--accent-primary);
}

.highlight-block p {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.7;
}

.highlight-block strong {
    color: var(--accent-secondary);
}

/* Params */
.algo-params {
    margin-top: 24px;
}

.algo-params h3 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 16px;
}

.param-group {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.param-group label {
    font-size: 13px;
    color: var(--text-secondary);
    min-width: 180px;
    font-weight: 500;
}

.param-group input[type="range"] {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    outline: none;
}

.param-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent-primary);
    cursor: pointer;
    box-shadow: 0 0 10px rgba(108, 92, 231, 0.4);
    transition: transform var(--transition-fast);
}

.param-group input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.param-value {
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 600;
    color: var(--accent-secondary);
    min-width: 24px;
    text-align: right;
}

/* Visualization Area */
.algo-visualization {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.viz-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 32px;
    position: relative;
    overflow: hidden;
}

.viz-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--gradient-1);
    opacity: 0.5;
}

/* Request Area (buttons) */
.request-area {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

.send-request-btn, .burst-btn, .reset-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-normal);
    border: none;
    font-family: var(--font-primary);
}

.send-request-btn {
    background: var(--gradient-1);
    color: white;
    box-shadow: 0 2px 12px rgba(108, 92, 231, 0.3);
}

.send-request-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(108, 92, 231, 0.4);
}

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

.burst-btn {
    background: rgba(253, 203, 110, 0.1);
    color: var(--warning);
    border: 1px solid rgba(253, 203, 110, 0.3);
}

.burst-btn:hover {
    background: rgba(253, 203, 110, 0.2);
    transform: translateY(-1px);
}

.reset-btn {
    background: rgba(225, 112, 85, 0.1);
    color: var(--error);
    border: 1px solid rgba(225, 112, 85, 0.3);
}

.reset-btn:hover {
    background: rgba(225, 112, 85, 0.2);
    transform: translateY(-1px);
}

.btn-icon {
    font-size: 14px;
}

/* Request Log */
.request-log {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    max-height: 250px;
    overflow-y: auto;
}

.request-log h4 {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.log-entries {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.log-entry {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 12px;
    animation: slideIn 0.3s ease;
}

.log-entry.accepted {
    background: var(--success-bg);
    color: var(--success);
}

.log-entry.rejected {
    background: var(--error-bg);
    color: var(--error);
}

.log-entry.processed {
    background: var(--info-bg);
    color: var(--info);
}

.log-entry .log-time {
    color: var(--text-muted);
    font-size: 11px;
    min-width: 70px;
}

.log-entry .log-status {
    font-weight: 600;
    min-width: 80px;
}

.log-entry .log-detail {
    color: var(--text-secondary);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Custom scrollbar */
.request-log::-webkit-scrollbar {
    width: 4px;
}

.request-log::-webkit-scrollbar-track {
    background: transparent;
}

.request-log::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 2px;
}

/* =============================================
   Token Bucket Specific Styles
   ============================================= */
.bucket-visual {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.bucket-label {
    font-size: 14px;
    font-weight: 700;
    color: var(--accent-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.bucket-outer {
    position: relative;
    width: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.bucket-body {
    width: 180px;
    height: 200px;
    border: 3px solid var(--accent-primary);
    border-top: none;
    border-radius: 0 0 20px 20px;
    position: relative;
    overflow: hidden;
    background: rgba(108, 92, 231, 0.03);
    clip-path: polygon(5% 0%, 95% 0%, 100% 100%, 0% 100%);
}

.bucket-fill {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(180deg, rgba(108, 92, 231, 0.3) 0%, rgba(108, 92, 231, 0.6) 100%);
    transition: height 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 0 0 16px 16px;
}

.bucket-tokens {
    position: absolute;
    bottom: 10px;
    left: 0;
    right: 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    padding: 8px;
    z-index: 2;
}

.token {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--gradient-1);
    box-shadow: 0 0 10px rgba(108, 92, 231, 0.5);
    animation: tokenAppear 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
}

.token.consumed {
    animation: tokenConsume 0.4s ease forwards;
}

@keyframes tokenAppear {
    from {
        transform: scale(0) translateY(-20px);
        opacity: 0;
    }
    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

@keyframes tokenConsume {
    to {
        transform: scale(0) rotate(180deg);
        opacity: 0;
    }
}

.bucket-capacity-label {
    font-family: var(--font-mono);
    font-size: 16px;
    font-weight: 600;
    margin-top: 12px;
    color: var(--text-primary);
}

.refill-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.refill-indicator.active {
    opacity: 1;
}

.refill-icon {
    animation: drip 1s ease infinite;
}

@keyframes drip {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(3px); }
}

/* =============================================
   Leaking Bucket Specific Styles
   ============================================= */
.leaky-bucket-visual {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.lb-queue {
    display: flex;
    gap: 8px;
    padding: 16px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    border: 2px solid var(--border-color);
    min-height: 60px;
    min-width: 300px;
    justify-content: center;
    align-items: center;
    transition: border-color var(--transition-normal);
}

.lb-queue.full {
    border-color: var(--error);
}

.lb-queue-item {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    background: var(--gradient-1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    animation: queueIn 0.3s ease;
    box-shadow: 0 2px 8px rgba(108, 92, 231, 0.3);
}

.lb-queue-item.processing {
    animation: processOut 0.5s ease forwards;
}

@keyframes queueIn {
    from {
        transform: scale(0) translateY(-20px);
        opacity: 0;
    }
    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

@keyframes processOut {
    to {
        transform: translateY(30px) scale(0.5);
        opacity: 0;
    }
}

.lb-queue-capacity {
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
}

.lb-drip {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.drip-animation {
    width: 4px;
    height: 30px;
    position: relative;
    overflow: hidden;
}

.drip-animation::after {
    content: '';
    position: absolute;
    top: -8px;
    left: 0;
    width: 4px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-primary);
    animation: dripDrop 1s ease-in-out infinite;
}

@keyframes dripDrop {
    0% { top: -8px; opacity: 1; }
    100% { top: 30px; opacity: 0; }
}

.drip-label {
    font-size: 12px;
    color: var(--text-muted);
}

.lb-processed {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: var(--success-bg);
    border-radius: var(--radius-sm);
}

.processed-label {
    font-size: 13px;
    color: var(--success);
    font-weight: 600;
}

.processed-count {
    font-family: var(--font-mono);
    font-size: 18px;
    font-weight: 700;
    color: var(--success);
}

/* =============================================
   Fixed Window Specific Styles
   ============================================= */
.fw-visual {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.fw-timeline {
    display: flex;
    justify-content: center;
}

.fw-window {
    padding: 24px;
    border-radius: var(--radius-lg);
    border: 2px solid var(--border-color);
    background: var(--bg-tertiary);
    min-width: 300px;
    text-align: center;
    transition: all var(--transition-normal);
}

.fw-window.active {
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-glow);
}

.fw-window-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.fw-window-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--accent-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.fw-timer {
    font-family: var(--font-mono);
    font-size: 16px;
    font-weight: 700;
    color: var(--warning);
    background: var(--warning-bg);
    padding: 4px 12px;
    border-radius: var(--radius-sm);
}

.fw-counter-display {
    font-family: var(--font-mono);
    margin-bottom: 16px;
}

.fw-count {
    font-size: 48px;
    font-weight: 800;
    color: var(--text-primary);
    transition: color var(--transition-fast);
}

.fw-count.warning {
    color: var(--warning);
}

.fw-count.danger {
    color: var(--error);
}

.fw-separator {
    font-size: 32px;
    color: var(--text-muted);
    margin: 0 8px;
}

.fw-limit {
    font-size: 32px;
    font-weight: 600;
    color: var(--text-muted);
}

.fw-bar {
    height: 8px;
    background: var(--bg-primary);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 12px;
}

.fw-bar-fill {
    height: 100%;
    background: var(--gradient-1);
    border-radius: 4px;
    transition: width 0.3s ease, background 0.3s ease;
    width: 0%;
}

.fw-bar-fill.warning {
    background: linear-gradient(135deg, var(--warning) 0%, var(--error) 100%);
}

.fw-bar-fill.full {
    background: var(--error);
}

.fw-progress-bar {
    height: 3px;
    background: var(--bg-primary);
    border-radius: 2px;
    overflow: hidden;
}

.fw-progress-fill {
    height: 100%;
    background: var(--accent-primary);
    border-radius: 2px;
    width: 0%;
    transition: width 0.1s linear;
}

/* Window History */
.fw-history h4 {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
}

.fw-history-entries {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.fw-history-entry {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-secondary);
    animation: fadeInUp 0.3s ease;
}

/* =============================================
   Sliding Window Log Specific Styles
   ============================================= */
.sl-visual {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.sl-timeline-container {
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    padding: 20px;
    border: 1px solid var(--border-color);
}

.sl-timeline {
    position: relative;
    height: 120px;
    margin-bottom: 16px;
}

.sl-timeline canvas {
    width: 100%;
    height: 100%;
    border-radius: var(--radius-sm);
}

.sl-info {
    display: flex;
    gap: 24px;
}

.sl-info-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sl-info-label {
    font-size: 13px;
    color: var(--text-muted);
}

.sl-info-value {
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 600;
    color: var(--accent-secondary);
}

.sl-log-visual {
    max-height: 140px;
    overflow-y: auto;
}

.sl-log-visual h4 {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.sl-entries {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.sl-entry {
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    background: rgba(108, 92, 231, 0.1);
    border: 1px solid rgba(108, 92, 231, 0.2);
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--accent-secondary);
    animation: fadeInUp 0.3s ease;
}

.sl-entry.expired {
    opacity: 0.3;
    text-decoration: line-through;
    background: rgba(225, 112, 85, 0.05);
    border-color: rgba(225, 112, 85, 0.1);
    color: var(--text-muted);
}

/* =============================================
   Sliding Window Counter Specific Styles
   ============================================= */
.sc-visual {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.sc-windows {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.sc-window {
    padding: 20px 24px;
    border-radius: var(--radius-md);
    border: 2px solid var(--border-color);
    background: var(--bg-tertiary);
    text-align: center;
    min-width: 160px;
    transition: all var(--transition-normal);
}

.sc-window.prev {
    opacity: 0.7;
    border-style: dashed;
}

.sc-window.current {
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-glow);
}

.sc-window-header {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.sc-window-count {
    font-family: var(--font-mono);
    font-size: 36px;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.sc-window-weight {
    font-size: 12px;
    color: var(--accent-secondary);
    font-weight: 500;
}

.sc-timer {
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 600;
    color: var(--warning);
    background: var(--warning-bg);
    padding: 2px 10px;
    border-radius: var(--radius-sm);
    display: inline-block;
    margin-top: 4px;
}

.sc-window-connector {
    display: flex;
    align-items: center;
    padding: 0 8px;
}

.sc-overlap {
    width: 40px;
    height: 4px;
    background: var(--gradient-1);
    border-radius: 2px;
    position: relative;
}

.sc-overlap::before,
.sc-overlap::after {
    content: '';
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-primary);
    top: -2px;
}

.sc-overlap::before { left: -4px; }
.sc-overlap::after { right: -4px; }

.sc-calculation {
    padding: 20px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.sc-formula {
    margin-bottom: 12px;
}

.sc-formula-label {
    font-size: 13px;
    color: var(--text-muted);
    margin-right: 8px;
}

#sc-formula-detail {
    font-family: var(--font-mono);
    font-size: 14px;
    color: var(--text-primary);
}

#sc-formula-detail strong {
    color: var(--accent-secondary);
    font-size: 16px;
}

.sc-result {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-secondary);
}

.sc-status {
    font-weight: 600;
}

.sc-status.under {
    color: var(--success);
}

.sc-status.over {
    color: var(--error);
}

/* =============================================
   Comparison Section
   ============================================= */
.comparison-section {
    padding: var(--section-padding) 0;
    background: var(--bg-secondary);
    position: relative;
    z-index: 1;
}

.section-title {
    font-size: 36px;
    font-weight: 800;
    text-align: center;
    margin-bottom: 12px;
    letter-spacing: -0.5px;
}

.section-subtitle {
    text-align: center;
    color: var(--text-secondary);
    font-size: 16px;
    margin-bottom: 48px;
}

.comparison-table-wrapper {
    overflow-x: auto;
    margin-bottom: 60px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

.comparison-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.comparison-table thead {
    background: var(--bg-tertiary);
}

.comparison-table th {
    padding: 16px 20px;
    text-align: center;
    font-weight: 700;
    font-size: 13px;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
}

.comparison-table th:first-child {
    text-align: left;
}

.comparison-table td {
    padding: 14px 20px;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.comparison-table td:first-child {
    text-align: left;
}

.comparison-table tr:last-child td {
    border-bottom: none;
}

.comparison-table tr:hover {
    background: rgba(108, 92, 231, 0.03);
}

.feature-name {
    font-weight: 600;
    color: var(--text-primary) !important;
}

.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.badge-green {
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid rgba(0, 184, 148, 0.2);
}

.badge-red {
    background: var(--error-bg);
    color: var(--error);
    border: 1px solid rgba(225, 112, 85, 0.2);
}

.badge-yellow {
    background: var(--warning-bg);
    color: var(--warning);
    border: 1px solid rgba(253, 203, 110, 0.2);
}

.badge-blue {
    background: var(--info-bg);
    color: var(--info);
    border: 1px solid rgba(116, 185, 255, 0.2);
}

/* Decision Tree */
.decision-tree h3 {
    font-size: 24px;
    font-weight: 800;
    text-align: center;
    margin-bottom: 32px;
}

.decision-cards {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
}

.decision-card {
    padding: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    text-align: center;
    transition: all var(--transition-normal);
}

.decision-card:hover {
    transform: translateY(-4px);
    border-color: var(--border-color-hover);
    box-shadow: var(--shadow-glow);
}

.decision-icon {
    font-size: 36px;
    margin-bottom: 16px;
}

.decision-card h4 {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 8px;
}

.decision-card p {
    font-size: 13px;
    color: var(--text-secondary);
}

.decision-card strong {
    color: var(--accent-secondary);
}

/* =============================================
   Footer
   ============================================= */
.footer {
    padding: 48px 0 24px;
    background: var(--bg-primary);
    border-top: 1px solid var(--border-color);
    position: relative;
    z-index: 1;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.footer-brand p {
    color: var(--text-muted);
    font-size: 13px;
    margin-top: 8px;
}

.footer-links {
    display: flex;
    gap: 20px;
}

.footer-links a {
    color: var(--text-muted);
    font-size: 13px;
    transition: color var(--transition-fast);
}

.footer-links a:hover {
    color: var(--text-primary);
}

.footer-bottom {
    text-align: center;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

.footer-bottom p {
    font-size: 13px;
    color: var(--text-muted);
}

/* =============================================
   Request Animations
   ============================================= */
.request-animation {
    position: fixed;
    z-index: 9999;
    pointer-events: none;
    animation: requestFly 0.6s ease-out forwards;
}

.request-accepted {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--success);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
}

.request-rejected {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--error);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
}

@keyframes requestFly {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(0) translateY(-50px);
        opacity: 0;
    }
}

/* =============================================
   Responsive Design
   ============================================= */
@media (max-width: 1024px) {
    .algo-content {
        grid-template-columns: 1fr;
    }

    .algo-explanation {
        position: static;
    }

    .intro-grid {
        grid-template-columns: 1fr;
        gap: 48px;
    }

    .decision-cards {
        grid-template-columns: repeat(3, 1fr);
    }

    .nav-links {
        display: none;
    }
}

@media (max-width: 768px) {
    :root {
        --section-padding: 80px;
    }

    .hero-title {
        font-size: 36px;
    }

    .hero-stats {
        gap: 32px;
    }

    .hero-actions {
        flex-direction: column;
        align-items: center;
    }

    .decision-cards {
        grid-template-columns: 1fr 1fr;
    }

    .comparison-table {
        font-size: 12px;
    }

    .algo-header {
        flex-direction: column;
        gap: 8px;
    }

    .algo-number {
        font-size: 40px;
    }

    .algo-title {
        font-size: 28px;
    }

    .request-area {
        flex-wrap: wrap;
    }

    .footer-content {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }

    .footer-links {
        flex-wrap: wrap;
        justify-content: center;
    }

    .sc-windows {
        flex-direction: column;
        gap: 16px;
    }

    .sc-window-connector {
        transform: rotate(90deg);
    }
}

@media (max-width: 480px) {
    .decision-cards {
        grid-template-columns: 1fr;
    }

    .param-group {
        flex-wrap: wrap;
    }

    .param-group label {
        min-width: unset;
        width: 100%;
    }
}

/* =============================================
   Code Block Style
   ============================================= */
code {
    font-family: var(--font-mono);
    background: var(--bg-tertiary);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 13px;
    color: var(--accent-secondary);
}
