:root {
    --bg-color: #080710;
    --card-bg: rgba(17, 16, 28, 0.65);
    --card-border: rgba(255, 255, 255, 0.06);
    --card-glow-purple: rgba(139, 92, 246, 0.15);
    --card-glow-blue: rgba(6, 182, 212, 0.15);
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --color-primary: #6366f1; 
    --color-secondary: #06b6d4; 
    --color-accent: #d946ef; 
    
    --gradient-primary: linear-gradient(135deg, #6366f1 0%, #a855f7 50%, #d946ef 100%);
    --gradient-blue: linear-gradient(135deg, #0ea5e9 0%, #06b6d4 100%);
    --gradient-purple: linear-gradient(135deg, #8b5cf6 0%, #d946ef 100%);
    --gradient-gold: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
    
    --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -4px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
    --shadow-neon-blue: 0 0 20px rgba(6, 182, 212, 0.35);
    --shadow-neon-purple: 0 0 20px rgba(139, 92, 246, 0.35);
}

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

body {
    background-color: var(--bg-color);
    background-image: 
        radial-gradient(at 10% 20%, rgba(99, 102, 241, 0.08) 0px, transparent 50%),
        radial-gradient(at 90% 80%, rgba(217, 70, 239, 0.08) 0px, transparent 50%),
        radial-gradient(at 50% 50%, rgba(6, 182, 212, 0.03) 0px, transparent 50%);
    background-attachment: fixed;
    color: var(--text-primary);
    font-family: var(--font-sans);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

.mono {
    font-family: var(--font-mono);
    font-weight: 600;
}

.text-gradient {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 800;
}

.glass-panel {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.app-header {
    border-bottom: 1px solid var(--card-border);
    background: rgba(8, 7, 16, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.025em;
}

.logo .icon {
    font-size: 1.6rem;
    filter: drop-shadow(0 0 8px rgba(6, 182, 212, 0.6));
}

.logo-sub {
    color: var(--text-primary);
    font-weight: 400;
    opacity: 0.9;
}

.header-tagline {
    font-size: 0.875rem;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.04);
    padding: 0.35rem 0.85rem;
    border-radius: 9999px;
    border: 1px solid var(--card-border);
}

.app-main {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 2.5rem 1rem;
    max-width: 100%;
}

.game-wrapper {
    width: 100%;
    max-width: 900px;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.controls-card {
    padding: 1.5rem;
}

.section-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.duration-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0.75rem;
}

.btn-duration {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--card-border);
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-size: 0.95rem;
    font-weight: 600;
    padding: 0.85rem 0.5rem;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
    text-align: center;
}

.btn-duration:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.15);
}

.btn-duration.active {
    background: var(--gradient-primary);
    color: #ffffff;
    border-color: transparent;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
}

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

.stat-card {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.stat-card.highlight-purple::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--gradient-purple);
}

.stat-card.highlight-blue::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--gradient-blue);
}

.stat-label {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.progress-bar-container {
    height: 4px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 2px;
    margin-top: 0.75rem;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--gradient-blue);
    border-radius: 2px;
    transition: width 0.1s linear;
}

.click-zone-container {
    width: 100%;
}

.click-zone {
    height: 320px;
    width: 100%;
    position: relative;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    user-select: none;
    outline: none;
    overflow: hidden;
}

.click-zone:hover {
    border-color: rgba(6, 182, 212, 0.3);
    background: rgba(23, 21, 38, 0.75);
    box-shadow: 0 10px 30px rgba(6, 182, 212, 0.08);
}

.click-zone:focus-visible {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.3);
}

.click-zone.active-game {
    border-color: rgba(217, 70, 239, 0.4);
    box-shadow: 0 10px 40px rgba(217, 70, 239, 0.12);
    animation: borderPulse 2s infinite ease-in-out;
}

.click-zone:active {
    transform: scale(0.985);
}

.click-zone-ripple-canvas-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

#ripple-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.click-zone-content {
    position: relative;
    z-index: 5;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 2rem;
}

.pulse-icon {
    font-size: 3.5rem;
    filter: drop-shadow(0 0 12px rgba(139, 92, 246, 0.4));
    margin-bottom: 0.5rem;
    animation: floatAnimation 3s infinite ease-in-out;
}

.click-prompt {
    font-size: 2.25rem;
    font-weight: 800;
    letter-spacing: -0.025em;
    color: var(--text-primary);
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.click-subtext {
    font-size: 1.05rem;
    color: var(--text-secondary);
    max-width: 380px;
    line-height: 1.4;
}

.floating-click-indicator {
    position: absolute;
    color: #ffffff;
    font-family: var(--font-mono);
    font-weight: 800;
    font-size: 1.5rem;
    pointer-events: none;
    z-index: 10;
    animation: fadeUpOut 0.6s cubic-bezier(0.1, 0.8, 0.3, 1) forwards;
    text-shadow: 0 0 10px rgba(217, 70, 239, 0.8), 0 0 20px rgba(217, 70, 239, 0.4);
}

@keyframes floatAnimation {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

@keyframes fadeUpOut {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -150%) scale(0.7);
    }
}

@keyframes borderPulse {
    0%, 100% { border-color: rgba(217, 70, 239, 0.3); }
    50% { border-color: rgba(6, 182, 212, 0.6); }
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.info-card {
    padding: 1.5rem;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 0.5rem;
}

.instructions-list {
    padding-left: 1.25rem;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.instructions-list li {
    margin-bottom: 0.75rem;
}

.ranks-table {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.rank-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.4rem 0.75rem;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.03);
}

.rank-badge {
    font-size: 0.85rem;
    font-weight: 700;
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.rank-badge.sloth { background: rgba(100, 116, 139, 0.15); color: #94a3b8; border: 1px solid rgba(100, 116, 139, 0.3); }
.rank-badge.turtle { background: rgba(20, 184, 166, 0.15); color: #2dd4bf; border: 1px solid rgba(20, 184, 166, 0.3); }
.rank-badge.rabbit { background: rgba(99, 102, 241, 0.15); color: #818cf8; border: 1px solid rgba(99, 102, 241, 0.3); }
.rank-badge.cheetah { background: rgba(249, 115, 22, 0.15); color: #fb923c; border: 1px solid rgba(249, 115, 22, 0.3); }
.rank-badge.flash { background: rgba(239, 68, 68, 0.15); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.3); box-shadow: 0 0 10px rgba(239, 68, 68, 0.2); }

.rank-range {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.history-card {
    padding: 1.5rem;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 0.5rem;
}

.history-header .card-title {
    margin-bottom: 0;
    border-bottom: none;
    padding-bottom: 0;
}

.btn-clear {
    background: transparent;
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #f87171;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.35rem 0.75rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-clear:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.4);
}

.history-table-wrapper {
    overflow-x: auto;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.history-table th {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-secondary);
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    letter-spacing: 0.05em;
}

.history-table td {
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

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

.history-table tr.empty-row td {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem;
    font-style: italic;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(8, 7, 16, 0.75);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    padding: 1rem;
}

.modal-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.glass-panel-modal {
    background: rgba(20, 18, 36, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7), 0 0 30px rgba(139, 92, 246, 0.15);
    border-radius: 24px;
    width: 100%;
    max-width: 460px;
    padding: 2rem;
    position: relative;
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.open .glass-panel-modal {
    transform: scale(1);
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1.25rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.75rem;
    cursor: pointer;
    transition: color 0.2s ease;
    outline: none;
    line-height: 1;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-header {
    text-align: center;
    margin-bottom: 1.75rem;
}

.trophy-icon {
    font-size: 3.5rem;
    filter: drop-shadow(0 0 15px rgba(245, 158, 11, 0.4));
    margin-bottom: 0.5rem;
}

.modal-header h2 {
    font-size: 1.75rem;
    font-weight: 800;
}

.modal-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.75rem;
}

.modal-stat {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 0.85rem 0.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.modal-stat.highlight {
    background: rgba(139, 92, 246, 0.08);
    border-color: rgba(139, 92, 246, 0.2);
}

.modal-stat-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.modal-stat-value {
    font-size: 1.35rem;
    font-weight: 700;
}

.modal-stat.highlight .modal-stat-value {
    color: #a78bfa;
}

.rank-result-container {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 16px;
    padding: 1.25rem;
    text-align: center;
    margin-bottom: 2rem;
}

.rank-result-label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.rank-badge-result {
    font-size: 1.5rem;
    font-weight: 800;
    display: inline-block;
    padding: 0.5rem 1.5rem;
    border-radius: 9999px;
    text-transform: uppercase;
    margin-bottom: 0.75rem;
    box-shadow: var(--shadow-md);
    letter-spacing: 0.05em;
}

.rank-badge-result.sloth { background: var(--gradient-purple); color: #ffffff; }
.rank-badge-result.turtle { background: var(--gradient-blue); color: #ffffff; }
.rank-badge-result.rabbit { background: var(--gradient-primary); color: #ffffff; }
.rank-badge-result.cheetah { background: linear-gradient(135deg, #f97316 0%, #ec4899 100%); color: #ffffff; }
.rank-badge-result.flash { background: var(--gradient-gold); color: #ffffff; animation: pulseGlow 1.5s infinite; }

@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 0 15px rgba(245, 158, 11, 0.5); }
    50% { box-shadow: 0 0 30px rgba(239, 68, 68, 0.8); }
}

.rank-commentary {
    font-size: 0.95rem;
    color: var(--text-secondary);
    font-style: italic;
    line-height: 1.4;
}

.modal-actions {
    display: flex;
}

.btn-primary {
    background: var(--gradient-primary);
    border: none;
    color: #ffffff;
    font-family: var(--font-sans);
    font-size: 1.05rem;
    font-weight: 700;
    padding: 1rem;
    width: 100%;
    border-radius: 12px;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(139, 92, 246, 0.35);
    transition: all 0.2s ease;
    outline: none;
}

.btn-primary:hover {
    box-shadow: 0 8px 25px rgba(139, 92, 246, 0.5);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(1px);
}

.app-footer {
    border-top: 1px solid var(--card-border);
    padding: 2rem 0;
    margin-top: 4rem;
    background: rgba(8, 7, 16, 0.5);
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    text-align: center;
}

.app-footer p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.footer-links {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.footer-link {
    color: var(--text-muted);
    text-decoration: none;
}

.footer-divider {
    opacity: 0.5;
}

.article-content {
    padding: 2.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    line-height: 1.7;
}

.article-content h1 {
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 0.5rem;
}

.article-content h2 {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 1.75rem;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 0.5rem;
}

.article-content h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 1.25rem;
    margin-bottom: 0.25rem;
}

.article-content p {
    color: var(--text-secondary);
    font-size: 1.05rem;
}

.article-content .intro-text {
    font-size: 1.15rem;
    line-height: 1.7;
    color: var(--text-primary);
    opacity: 0.95;
}

.article-list {
    margin-left: 1.5rem;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.article-list li strong {
    color: var(--text-primary);
}

.table-container {
    overflow-x: auto;
    margin: 1.5rem 0;
    border-radius: 12px;
    border: 1px solid var(--card-border);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: rgba(255, 255, 255, 0.01);
}

.data-table th {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-primary);
    font-weight: 600;
    text-align: left;
    padding: 1rem;
    border-bottom: 1px solid var(--card-border);
    font-size: 0.95rem;
}

.data-table td {
    padding: 1rem;
    color: var(--text-secondary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    font-size: 0.95rem;
}

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

.data-table tr:hover td {
    background: rgba(255, 255, 255, 0.01);
    color: var(--text-primary);
}

.cta-container {
    display: flex;
    justify-content: center;
    margin: 2rem 0 0.5rem 0;
}

.cta-btn {
    display: inline-block;
    padding: 1rem 2.5rem;
    font-size: 1.1rem;
    text-decoration: none;
    text-align: center;
    border-radius: 12px;
    font-weight: 700;
    transition: all 0.2s ease;
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.3);
}

.cta-btn:hover {
    box-shadow: 0 6px 30px rgba(139, 92, 246, 0.5);
    transform: translateY(-2px);
}

.cta-subtext {
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

@media (max-width: 768px) {
    .header-container {
        padding: 1rem;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .header-tagline {
        display: none;
    }
    
    .duration-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .stat-card {
        padding: 1rem;
    }
    
    .click-zone {
        height: 260px;
    }
    
    .click-prompt {
        font-size: 1.75rem;
    }
    
    .pulse-icon {
        font-size: 3rem;
    }
    
    .info-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .history-card {
        padding: 1rem;
    }
    
    .history-table th, 
    .history-table td {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }

    .article-content {
        padding: 1.25rem;
    }

    .article-content h1 {
        font-size: 1.8rem;
    }

    .article-content h2 {
        font-size: 1.35rem;
    }

    .article-content h3 {
        font-size: 1.1rem;
    }

    .cta-btn {
        padding: 0.85rem 1.75rem;
        font-size: 1rem;
        width: 100%;
    }
}
