body,
.font-body {
    font-family: "Source Sans 3", ui-sans-serif, system-ui, sans-serif;
    letter-spacing: 0.01em;
    line-height: 1.55;
}

.font-display {
    font-family: "Playfair Display", serif;
}

.text-xs {
    font-size: 0.82rem;
    line-height: 1.28rem;
}

.text-sm {
    font-size: 0.96rem;
    line-height: 1.45rem;
}

body.site-locked > :not(#site-password-gate) {
    display: none !important;
}

#site-password-gate {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: radial-gradient(circle at 12% 16%, rgba(109, 122, 88, 0.28), rgba(250, 249, 247, 0.95) 45%), radial-gradient(circle at 85% 84%, rgba(168, 155, 133, 0.35), rgba(250, 249, 247, 0.98) 55%);
}

.dark #site-password-gate {
    background: radial-gradient(circle at 12% 16%, rgba(109, 122, 88, 0.35), rgba(26, 26, 26, 0.96) 45%), radial-gradient(circle at 85% 84%, rgba(79, 79, 79, 0.45), rgba(26, 26, 26, 0.98) 55%);
}

.site-password-card {
    width: min(94vw, 450px);
    border-radius: 1rem;
    border: 1px solid rgba(139, 152, 118, 0.45);
    background: linear-gradient(145deg, rgba(250, 249, 247, 0.94), rgba(245, 243, 239, 0.94));
    box-shadow: 0 24px 56px -30px rgba(26, 26, 26, 0.55);
    padding: 1.2rem 1.15rem;
}

.dark .site-password-card {
    border-color: rgba(139, 152, 118, 0.5);
    background: linear-gradient(145deg, rgba(56, 63, 47, 0.9), rgba(47, 53, 40, 0.9));
    box-shadow: 0 24px 56px -30px rgba(0, 0, 0, 0.78);
}

.site-password-eyebrow {
    letter-spacing: 0.14em;
    text-transform: uppercase;
    font-size: 0.74rem;
    color: #556144;
}

.dark .site-password-eyebrow {
    color: #d1d7c7;
}

.site-password-title {
    font-family: "Playfair Display", serif;
    font-size: 1.7rem;
    line-height: 1.1;
    margin-top: 0.25rem;
}

.site-password-copy {
    margin-top: 0.45rem;
    font-size: 0.98rem;
    color: #4f4f4f;
}

.dark .site-password-copy {
    color: #e8e4dc;
}

.site-password-form {
    margin-top: 0.9rem;
    display: grid;
    gap: 0.55rem;
}

.site-password-input {
    width: 100%;
    border-radius: 0.65rem;
    border: 1px solid rgba(139, 152, 118, 0.5);
    background: rgba(255, 255, 255, 0.85);
    color: #1a1a1a;
    padding: 0.58rem 0.7rem;
    font-size: 0.95rem;
    outline: none;
}

.dark .site-password-input {
    border-color: rgba(139, 152, 118, 0.6);
    background: rgba(26, 26, 26, 0.72);
    color: #f5f3ef;
}

.site-password-input:focus {
    border-color: rgba(109, 122, 88, 0.9);
    box-shadow: 0 0 0 3px rgba(109, 122, 88, 0.2);
}

.site-password-btn {
    border-radius: 0.65rem;
    border: none;
    background: #444d37;
    color: #ffffff;
    padding: 0.62rem 0.72rem;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.site-password-btn:hover {
    background: #383f2f;
    transform: translateY(-1px);
}

.site-password-error {
    margin-top: 0.55rem;
    min-height: 1.25rem;
    color: #b91c1c;
    font-size: 0.87rem;
}

.dark .site-password-error {
    color: #fca5a5;
}

.grain-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
}

.dark .grain-overlay {
    opacity: 0.05;
}

.text-balance {
    text-wrap: balance;
}

.decorative-line {
    background: linear-gradient(90deg, transparent, currentColor, transparent);
    height: 1px;
}

.card-hover {
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.5s ease;
    will-change: transform;
}

.card-hover:hover {
    transform: translateY(-8px) scale(1.01);
    box-shadow: 0 22px 40px -22px rgba(31, 41, 34, 0.55);
}

.link-underline {
    position: relative;
}

.link-underline::after {
    content: "";
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 1px;
    background: currentColor;
    transition: width 0.3s ease;
}

.link-underline:hover::after {
    width: 100%;
}

.nav-scrolled {
    box-shadow: 0 10px 30px -24px rgba(20, 28, 22, 0.55);
}

.pulse-badge {
    animation: pulseSoft 2.8s ease-in-out infinite;
}

.float-ambient {
    animation: floatAmbient 10s ease-in-out infinite;
}

.interactive-btn {
    position: relative;
    overflow: hidden;
}

.interactive-btn::before {
    content: "";
    position: absolute;
    top: 0;
    left: -120%;
    width: 60%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35), transparent);
    transform: skewX(-20deg);
    transition: left 0.6s ease;
    pointer-events: none;
}

.interactive-btn:hover::before {
    left: 135%;
}

.social-icon {
    transition: transform 0.3s ease, background-color 0.3s ease, box-shadow 0.3s ease;
}

.social-icon:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 14px 20px -16px rgba(140, 155, 118, 0.8);
}

.reveal-item {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity 0.7s ease, transform 0.7s ease;
    transition-delay: var(--reveal-delay, 0ms);
}

.reveal-item.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.progress-fill {
    transform-origin: left center;
    transform: scaleX(0);
    transition: transform 1s cubic-bezier(0.22, 1, 0.36, 1);
}

.progress-fill.is-visible {
    transform: scaleX(1);
}

.theme-spinning i {
    animation: spinAndSettle 0.45s ease;
}

.anim-delay-100 {
    animation-delay: 0.1s;
}

.anim-delay-200 {
    animation-delay: 0.2s;
}

.anim-delay-300 {
    animation-delay: 0.3s;
}

.anim-delay-400 {
    animation-delay: 0.4s;
}

.anim-delay-500 {
    animation-delay: 0.5s;
}

.anim-delay-700 {
    animation-delay: 0.7s;
}

.anim-delay-900 {
    animation-delay: 0.9s;
}

.dot-grid-overlay {
    background-image: radial-gradient(circle at 2px 2px, white 1px, transparent 0);
    background-size: 40px 40px;
}

.game-tab {
    transition: transform 0.25s ease, border-color 0.25s ease, background-color 0.25s ease, box-shadow 0.25s ease;
}

.game-tab:hover {
    transform: translateY(-2px);
    border-color: rgba(109, 122, 88, 0.55);
}

.game-tab.is-active {
    background: linear-gradient(140deg, rgba(109, 122, 88, 0.14), rgba(169, 155, 133, 0.08));
    border-color: rgba(109, 122, 88, 0.7);
    box-shadow: 0 14px 32px -24px rgba(46, 58, 40, 0.75);
}

.acl-stat-card {
    position: relative;
    border-radius: 0.85rem;
    border: 1px solid rgba(176, 186, 160, 0.35);
    background: rgba(250, 249, 247, 0.78);
    padding: 0.5rem 0.45rem;
}

.dark .acl-stat-card {
    border-color: rgba(68, 77, 55, 0.7);
    background: rgba(26, 26, 26, 0.65);
}

.acl-stat-label {
    font-size: 0.63rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #6d6d6d;
}

.dark .acl-stat-label {
    color: #bfb5a3;
}

.acl-stat-value {
    font-family: "Playfair Display", serif;
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1.2;
}

.score-pop {
    position: absolute;
    right: 8px;
    top: 8px;
    font-size: 0.72rem;
    font-weight: 700;
    color: #2f3528;
    opacity: 0;
    transform: translateY(8px);
    pointer-events: none;
}

.dark .score-pop {
    color: #d1d7c7;
}

.score-pop.is-visible {
    animation: scorePop 0.85s ease forwards;
}

.acl-rule-item {
    border: 1px solid rgba(176, 186, 160, 0.5);
    border-radius: 0.8rem;
    padding: 0.72rem 0.75rem;
    display: grid;
    grid-template-columns: 20px minmax(0, 1fr) auto;
    gap: 0.7rem;
    align-items: center;
    background: rgba(250, 249, 247, 0.8);
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.dark .acl-rule-item {
    border-color: rgba(68, 77, 55, 0.75);
    background: rgba(26, 26, 26, 0.72);
}

.acl-rule-item:hover {
    transform: translateY(-1px);
    border-color: rgba(109, 122, 88, 0.75);
    box-shadow: 0 14px 24px -25px rgba(24, 24, 24, 0.9);
}

.acl-rule-item.is-dragging {
    opacity: 0.6;
}

.acl-rule-item.is-over {
    border-color: rgba(109, 122, 88, 0.95);
    box-shadow: 0 0 0 2px rgba(109, 122, 88, 0.28);
}

.acl-rule-handle {
    color: #8b9876;
    font-size: 0.95rem;
    line-height: 1;
    cursor: grab;
}

.acl-rule-item:active .acl-rule-handle {
    cursor: grabbing;
}

.rule-action-chip {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    font-size: 0.66rem;
    line-height: 1;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    padding: 0.32rem 0.5rem;
}

.rule-action-chip.allow {
    background: rgba(34, 197, 94, 0.18);
    color: #14532d;
}

.rule-action-chip.deny {
    background: rgba(239, 68, 68, 0.15);
    color: #7f1d1d;
}

.dark .rule-action-chip.allow {
    color: #86efac;
}

.dark .rule-action-chip.deny {
    color: #fca5a5;
}

.rule-move-btn {
    width: 1.7rem;
    height: 1.7rem;
    border-radius: 0.5rem;
    border: 1px solid rgba(176, 186, 160, 0.55);
    background: transparent;
    color: inherit;
    font-size: 0.82rem;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.rule-move-btn:hover {
    background: rgba(176, 186, 160, 0.2);
    transform: translateY(-1px);
}

.acl-traffic-item {
    border: 1px solid rgba(176, 186, 160, 0.45);
    border-radius: 0.75rem;
    padding: 0.6rem 0.7rem;
    opacity: 0;
    transform: translateY(8px);
    animation: trafficReveal 0.45s ease forwards;
    animation-delay: var(--traffic-delay, 0ms);
}

.acl-traffic-item.pass {
    border-color: rgba(34, 197, 94, 0.45);
    background: rgba(34, 197, 94, 0.09);
}

.acl-traffic-item.fail {
    border-color: rgba(239, 68, 68, 0.45);
    background: rgba(239, 68, 68, 0.08);
}

.terminal-console {
    height: 11rem;
    border-radius: 0.75rem;
    border: 1px solid rgba(68, 77, 55, 0.6);
    background: #101311;
    color: #c9d1c0;
    padding: 0.75rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.8rem;
    line-height: 1.45;
    overflow: auto;
}

.terminal-line {
    opacity: 0;
    transform: translateY(4px);
    animation: terminalReveal 0.35s ease forwards;
}

.terminal-line.pass {
    color: #86efac;
}

.terminal-line.fail {
    color: #fca5a5;
}

.game-simple-copy {
    color: #5d5d5d;
    font-size: 0.95rem;
    line-height: 1.4;
    max-width: 42rem;
}

.dark .game-simple-copy {
    color: #d6cfc2;
}

.solution-panel {
    margin-top: 0.9rem;
    border: 1px solid rgba(139, 152, 118, 0.46);
    border-radius: 0.75rem;
    padding: 0.72rem 0.76rem;
    background: linear-gradient(135deg, rgba(232, 235, 227, 0.76), rgba(245, 243, 239, 0.66));
    color: #2f3528;
}

.dark .solution-panel {
    border-color: rgba(139, 152, 118, 0.55);
    background: linear-gradient(135deg, rgba(56, 63, 47, 0.8), rgba(47, 53, 40, 0.74));
    color: #f5f3ef;
}

.solution-panel h4 {
    font-size: 0.92rem;
    font-weight: 700;
    margin-bottom: 0.32rem;
}

.solution-panel p {
    font-size: 0.87rem;
    line-height: 1.45;
}

.solution-list {
    margin-top: 0.45rem;
    display: grid;
    gap: 0.35rem;
}

.solution-item {
    font-size: 0.84rem;
    line-height: 1.38;
    border-radius: 0.55rem;
    border: 1px solid rgba(139, 152, 118, 0.32);
    background: rgba(250, 249, 247, 0.66);
    padding: 0.4rem 0.48rem;
}

.dark .solution-item {
    border-color: rgba(139, 152, 118, 0.44);
    background: rgba(26, 26, 26, 0.48);
}

.py-test-item {
    border: 1px solid rgba(176, 186, 160, 0.5);
    border-radius: 0.65rem;
    padding: 0.55rem 0.6rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    font-size: 0.86rem;
    background: linear-gradient(135deg, rgba(232, 235, 227, 0.64), rgba(245, 243, 239, 0.66));
    color: #2f3528;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.dark .py-test-item {
    border-color: rgba(109, 122, 88, 0.58);
    background: linear-gradient(135deg, rgba(47, 53, 40, 0.78), rgba(56, 63, 47, 0.74));
    color: #e8e4dc;
}

.py-test-item.pending {
    background: linear-gradient(135deg, rgba(232, 235, 227, 0.8), rgba(214, 207, 194, 0.58));
}

.dark .py-test-item.pending {
    border-color: rgba(139, 152, 118, 0.55);
    background: linear-gradient(135deg, rgba(56, 63, 47, 0.86), rgba(47, 53, 40, 0.78));
}

.py-test-item.pass {
    border-color: rgba(34, 197, 94, 0.48);
    background: rgba(34, 197, 94, 0.11);
}

.dark .py-test-item.pass {
    border-color: rgba(74, 222, 128, 0.58);
    background: linear-gradient(135deg, rgba(20, 83, 45, 0.56), rgba(22, 101, 52, 0.38));
}

.py-test-item.fail {
    border-color: rgba(239, 68, 68, 0.48);
    background: rgba(239, 68, 68, 0.1);
}

.dark .py-test-item.fail {
    border-color: rgba(248, 113, 113, 0.6);
    background: linear-gradient(135deg, rgba(127, 29, 29, 0.56), rgba(153, 27, 27, 0.38));
}

.skeleton-wave {
    position: relative;
    overflow: hidden;
    background: rgba(176, 186, 160, 0.18);
}

.dark .skeleton-wave {
    background: rgba(68, 77, 55, 0.44);
}

.skeleton-wave::after {
    content: "";
    position: absolute;
    inset: 0;
    transform: translateX(-100%);
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.55), transparent);
    animation: skeletonWave 1.2s ease-in-out infinite;
}

@keyframes skeletonWave {
    100% {
        transform: translateX(100%);
    }
}

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

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

@keyframes scorePop {
    0% {
        opacity: 0;
        transform: translateY(8px) scale(0.9);
    }
    30% {
        opacity: 1;
        transform: translateY(-2px) scale(1.02);
    }
    100% {
        opacity: 0;
        transform: translateY(-18px) scale(0.98);
    }
}

@keyframes pulseSoft {
    0%,
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(109, 122, 88, 0.35);
    }
    50% {
        transform: scale(1.02);
        box-shadow: 0 0 0 10px rgba(109, 122, 88, 0);
    }
}

@keyframes floatAmbient {
    0%,
    100% {
        transform: translate3d(0, 0, 0);
    }
    50% {
        transform: translate3d(0, -10px, 0);
    }
}

@keyframes spinAndSettle {
    0% {
        transform: rotate(0deg) scale(1);
    }
    55% {
        transform: rotate(220deg) scale(1.08);
    }
    100% {
        transform: rotate(360deg) scale(1);
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation: none !important;
        transition-duration: 0.01ms !important;
        transition-delay: 0ms !important;
    }

    .reveal-item {
        opacity: 1 !important;
        transform: none !important;
    }

    .progress-fill {
        transform: scaleX(1) !important;
    }
}
