/* Fonts */
/* Fonts - loaded via <link> in index.html for performance */

/* Reset & Variables */
:root {
    /* Global Pink Update - Replacing Fluorescent Green */
    --zzz-primary: #FDB2C8;
    --zzz-primary-dim: rgba(253, 178, 200, 0.2);
    --zzz-primary-glow: rgba(253, 178, 200, 0.5);

    --zzz-accent: #E48534;
    /* Orange Accent */
    --zzz-accent-dim: rgba(228, 133, 52, 0.2);

    /* Dedicated Pink Theme Vars (Synced) */
    --zzz-pink: #FDB2C8;
    --zzz-pink-light: #FFD4E2;
    --zzz-pink-glow: rgba(253, 178, 200, 0.6);
    --zzz-pink-dim: rgba(253, 178, 200, 0.15);

    --zzz-bg: #050505;
    --zzz-bg-secondary: #0a0a0a;

    --zzz-panel-bg: rgba(20, 20, 20, 0.75);
    --zzz-panel-border: rgba(255, 255, 255, 0.1);
    --zzz-panel-blur: 24px;

    --zzz-text-main: #ffffff;
    --zzz-text-muted: #999999;
    --zzz-text-dark: #000000;

    --zzz-alert: #ff3355;

    --font-display: 'Outfit', sans-serif;
    --font-ui: 'Inter', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    --radius-sm: 6px;
    --radius-md: 16px;
    --radius-lg: 32px;

    --anim-speed: 0.3s;
}

@keyframes shake {
    0% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-10px) rotate(-2deg);
    }

    50% {
        transform: translateX(10px) rotate(2deg);
    }

    75% {
        transform: translateX(-10px) rotate(-2deg);
    }

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

@keyframes flow {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-5px);
    }
}

.shake-animation {
    animation: shake 0.4s ease-in-out;
}

* {
    box-sizing: border-box;
}

body {
    background-color: var(--zzz-bg);
    color: var(--zzz-text-main);
    font-family: var(--font-ui);
    font-size: 16px;
    line-height: 1;
    margin: 0;
    padding: 20px;
    min-height: 100vh;
    background-image:
        radial-gradient(circle at 10% 20%, rgba(205, 231, 74, 0.08) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(228, 133, 52, 0.06) 0%, transparent 40%),
        linear-gradient(to bottom, #050505 0%, #0a0a0a 100%);
    overflow-x: hidden;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

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

::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #444;
}

/* Video Background */
.video-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    z-index: -1;
    /* Behind content, over body bg */
    overflow: hidden;
}

.video-background video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: filter 0.5s ease;
}

.video-background video.is-blurred {
    filter: blur(15px);
}

.container {
    max-width: 1440px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
    padding-bottom: 200px;
    margin-top: 100vh;
    /* Strictly below fold */
    transition: margin-top 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Header */
/* Header */
/* Header */
header {
    text-align: center;
    margin: 0;
    padding: 20px;

    /* Fixed Centered - Initial State */
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;

    z-index: 1000;

    /* Removed Background & Borders */
    background: transparent;
    border-bottom: none;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;

    transition: all 0.8s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
    /* Let clicks pass through */

    /* Flex column for easier movement */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Scrolled State for Header (Desktop: Top-Left) */
body.u-scrolled header {
    top: 20px;
    left: 40px;
    transform: none;
    /* Reset center translate */
    width: auto;
    padding: 0;
    align-items: flex-start;
    /* Align children left */
}

/* Specific Child Adjustments on Scroll */
body.u-scrolled h1 {
    font-size: 2.5rem;
    /* Shrink title */
    margin-bottom: 5px;
}

body.u-scrolled .switch-container {
    transform: scale(0.85);
    /* Slightly smaller buttons */
    transform-origin: left top;
    margin-top: 5px !important;
}

body.u-scrolled .version {
    font-size: 0.65rem;
    padding: 2px 8px;
    margin-top: 5px;
    opacity: 0.8;
}

body.u-scrolled .credits {
    display: block;
    /* Ensure visible */
    font-size: 0.6rem;
    margin-top: 2px;
    opacity: 0.7;
    text-align: left;
}

/* Ensure buttons inside header work */
header * {
    pointer-events: auto;
}

header::after {
    display: none;
    /* Removed the old underline */
}

h1 {
    font-family: var(--font-display);
    font-size: 5rem;
    font-weight: 900;
    color: var(--zzz-pink);
    text-transform: uppercase;
    letter-spacing: -0.01em;
    margin: 0 0 10px 0;
    font-style: italic;
    line-height: 1.1;
    position: relative;
    transition: font-size 0.8s cubic-bezier(0.16, 1, 0.3, 1);

    /* Main Gradient (Pink/Purple) */
    background: linear-gradient(45deg,
            var(--zzz-pink),
            #fff,
            var(--zzz-pink),
            #D500F9,
            var(--zzz-pink));
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;

    /* White Light Flowing Stroke Effect */
    -webkit-text-stroke: 0px transparent;
    /* Placeholder */
    animation: flow 4s linear infinite, float 3s ease-in-out infinite;

    /* Glow */
    filter: drop-shadow(0 0 5px rgba(255, 128, 171, 0.5));
}

/* The White Light Flowing Overlay */
h1::before {
    content: "ZZZ神秘小算盘";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;

    /* White Light Gradient */
    background: linear-gradient(120deg,
            transparent 30%,
            rgba(255, 255, 255, 0.8) 50%,
            transparent 70%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;

    /* Animation: Fast Flow */
    animation: flow 2.5s linear infinite reverse;
    pointer-events: none;
    mix-blend-mode: overlay;
    /* Blend nicely with pink */
}

.credits {
    font-family: var(--font-ui);
    color: var(--zzz-text-muted);
    margin-top: 10px;
    font-size: 0.9rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    opacity: 1;
    /* Ensure visible initially */
    transition: all 0.5s ease;
}

/* Version - Always Visible */
.version {
    display: inline-block;
    background: var(--zzz-pink-dim);
    color: var(--zzz-pink);
    border-color: var(--zzz-pink-glow);
    font-weight: 600;
    padding: 4px 12px;
    font-size: 0.75rem;
    border-radius: 20px;
    margin-top: 15px;
    border: 1px solid rgba(253, 178, 200, 0.3);
    font-family: var(--font-mono);
    opacity: 1;
    transition: all 0.5s ease;
}

/* Credits - Always Visible */
.credits {
    /* Styles already defined above (lines 317-324), but we'll consolidate here to handle the duplicate class issue or just target the opacity rules */
    opacity: 1;
    transition: all 0.5s ease;
}

/* Scrolled State Adjustments */
body.u-scrolled .version {
    font-size: 0.65rem;
    padding: 2px 8px;
    margin-top: 5px;
    opacity: 0.8;
}

body.u-scrolled .credits {
    display: block;
    font-size: 0.6rem;
    margin-top: 2px;
    opacity: 0.7;
    text-align: left;
}

/* Module Layout */
.module {
    background: var(--zzz-panel-bg);
    border: 1px solid var(--zzz-panel-border);
    margin-bottom: 25px;
    padding: 25px 40px;
    position: relative;
    backdrop-filter: blur(var(--zzz-panel-blur));
    -webkit-backdrop-filter: blur(var(--zzz-panel-blur));
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.5);
    transition: transform var(--anim-speed), border-color var(--anim-speed);
    will-change: transform;
}

.module:hover {
    border-color: rgba(255, 255, 255, 0.15);
}

.module-title {
    position: absolute;
    top: -18px;
    left: 40px;
    background: linear-gradient(135deg, var(--zzz-primary), var(--zzz-accent));
    color: #000;
    padding: 10px 30px;
    font-weight: 700;
    font-size: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(204, 255, 0, 0.3);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-family: var(--font-display);
    z-index: 2;
}

.module-title span {
    display: block;
}

/* Grid Systems */
.grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
    gap: 30px;
    margin-top: 0px;
}

.grid-2-split {
    display: grid;
    grid-template-columns: 1fr 1.25fr;
    gap: 40px;
    align-items: stretch;
    /* Stretch to equal height */
}

@media (max-width: 1024px) {
    .grid-2-split {
        grid-template-columns: 1fr;
    }

    h1 {
        font-size: 3rem;
    }
}

/* Responsive Header Behavior */
@media (max-width: 768px) {
    h1 {
        font-size: 2.5rem;
    }

    /* On scroll on mobile: Scroll it away completely */
    body.u-scrolled header {
        transform: translateY(-200%);
        /* Move up out of view */
        opacity: 0;
        pointer-events: none;
        transition: all 0.5s ease;
    }

    .module {
        padding: 25px;
    }

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

/* Sub-Modules */
.sub-module {
    border: 1px solid var(--zzz-panel-border);
    border-radius: var(--radius-md);
    padding: 30px 25px;
    /* Compact padding */
    background: rgba(0, 0, 0, 0.2);
    transition: all var(--anim-speed);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.sub-module:hover {
    background: rgba(255, 255, 255, 0.02);
    border-color: rgba(255, 255, 255, 0.15);
}

.sub-module h3 {
    color: var(--zzz-text-main);
    margin: 0 0 25px 0;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--zzz-panel-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 700;
}

.sub-module h3::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    background: var(--zzz-primary);
    border-radius: 50%;
    margin-right: 12px;
    box-shadow: 0 0 10px var(--zzz-primary);
}

/* Preset & Rank Layout */
.preset-container {
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 20px;
}

.preset-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.preset-row label {
    flex: 1;
    color: var(--zzz-text-muted);
    font-weight: 500;
}

.preset-row select {
    flex: 1;
    background-color: #000000 !important;
    color: #ffffff;
    border: 1px solid #333;
    width: 100%;
    max-width: none;
    /* Override default max-width */
}

.rank-row {
    display: flex;
    justify-content: flex-end;
    /* Align rank buttons to right */
    width: 100%;
}

.rank-row .rank-selector {
    margin-left: 0;
    justify-content: flex-end;
    width: 100%;
}

/* Inputs Refactored */
.input-group {
    display: grid;
    grid-template-columns: 1fr auto;
    /* Label takes space, Input takes what it needs */
    gap: 20px;
    align-items: center;
    margin-bottom: 10px;
    font-size: 1rem;
}

.input-group:last-child {
    margin-bottom: 0;
}

label {
    color: var(--zzz-text-muted);
    font-weight: 500;
    text-align: left;
}

input[type="number"],
input[type="text"] {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid #333;
    color: var(--zzz-text-main);
    padding: 10px 14px;
    width: 120px;
    font-family: var(--font-mono);
    text-align: right;
    font-size: 0.9rem;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

select {
    background-color: #000000;
    color: #ffffff;
    border: 1px solid #333;
    padding: 10px 14px;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
    width: auto;
    min-width: 150px;
    max-width: 100%;
    text-align: left;
    cursor: pointer;
}

input[type="number"]:focus,
input[type="text"]:focus,
select:focus {
    outline: none;
    border-color: var(--zzz-primary);
    box-shadow: 0 0 0 2px rgba(205, 231, 74, 0.1);
}

/* Specific focus background for inputs only, keep select black */
input[type="number"]:focus,
input[type="text"]:focus {
    background: rgba(205, 231, 74, 0.05);
}

/* Buttons & Switches */
.zzz-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid transparent;
    color: var(--zzz-text-muted);
    padding: 8px 20px;
    cursor: pointer;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.8rem;
    transition: all 0.2s;
    border-radius: var(--radius-md);
    font-family: var(--font-ui);
    letter-spacing: 0.5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 36px;
}

.zzz-btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.2);
}

.zzz-btn.active {
    background: var(--zzz-primary);
    color: #000;
    box-shadow: 0 0 25px rgba(205, 231, 74, 0.25);
    font-weight: 800;
}

.switch-container {
    display: flex;
    gap: 6px;
    background: rgba(0, 0, 0, 0.3);
    padding: 4px;
    border-radius: var(--radius-md);
}

.switch-container .zzz-btn {
    border-radius: 10px;
    padding: 0 16px;
    height: 32px;
}

/* Cinema & Star Buttons */
.rank-selector {
    display: flex;
    gap: 8px;
    margin-left: 15px;
}

.rank-btn {
    width: 28px;
    height: 28px;
    border: 1px solid #333;
    background: #111;
    color: #555;
    font-size: 0.75rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    border-radius: 6px;
    font-family: var(--font-mono);
}

.rank-btn:hover {
    border-color: #555;
    color: #888;
}

.rank-btn.active {
    background: var(--zzz-primary);
    color: #000;
    border-color: var(--zzz-primary);
    box-shadow: 0 0 15px rgba(205, 231, 74, 0.3);
    font-weight: bold;
}

/* Calculation Log */
.calc-log {
    background: #080808;
    border: 1px solid #222;
    padding: 30px;
    font-family: var(--font-mono);
    color: #ccc;
    white-space: pre-wrap;
    line-height: 1.8;
    font-size: 0.9rem;
    border-radius: var(--radius-md);
    box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.5);
}

.in-combat-highlight {
    color: var(--zzz-primary);
    font-weight: bold;
}

.alert-text {
    color: var(--zzz-alert);
    font-weight: bold;
}

/* Tooltips */
.u-tooltip {
    border-bottom: 1px dotted var(--zzz-primary);
    cursor: help;
    position: relative;
    transition: color 0.2s;
    display: inline-block;
}

.u-tooltip:hover {
    color: var(--zzz-primary);
}

.u-tooltip .u-tooltip-content {
    visibility: hidden;
    position: absolute;
    bottom: 130%;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: rgba(10, 10, 10, 0.95);
    border: 1px solid #333;
    color: #eee;
    padding: 20px;
    border-radius: 12px;
    white-space: pre-wrap;
    z-index: 100;
    font-size: 0.85rem;
    min-width: 300px;
    text-align: left;
    line-height: 1.6;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
    opacity: 0;
    transition: all 0.2s cubic-bezier(0.165, 0.84, 0.44, 1);
    font-family: var(--font-mono);
}

.u-tooltip:hover .u-tooltip-content {
    visibility: visible;
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.u-tooltip-title {
    color: var(--zzz-primary);
    font-weight: bold;
    display: block;
    margin-bottom: 10px;
    border-bottom: 1px solid #333;
    padding-bottom: 8px;
    font-size: 0.95rem;
}

/* Chart & Opt */
.opt-controls {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 40px;
    padding: 25px;
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.btn-large {
    padding: 0 35px;
    font-size: 1rem;
    letter-spacing: 1px;
    height: 48px;
}

.chart-wrapper {
    height: 500px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--zzz-panel-border);
    padding: 20px;
    border-radius: var(--radius-md);
}

.panel-data {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
    font-size: 0.95rem;
}

.panel-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding: 12px 0;
}

.panel-row span:first-child {
    color: var(--zzz-text-muted);
}

.panel-row span:last-child {
    color: var(--zzz-text-main);
    font-family: var(--font-mono);
    font-weight: bold;
    font-size: 1rem;
}

.opt-config-box {
    background: rgba(205, 231, 74, 0.05);
    border: 1px solid var(--zzz-primary-dim);
    padding: 30px;
    margin-bottom: 30px;
    text-align: center;
    border-radius: var(--radius-md);
}

.opt-config-title {
    font-size: 0.85rem;
    color: var(--zzz-primary);
    text-transform: uppercase;
    margin-bottom: 8px;
    opacity: 0.9;
    word-spacing: 2px;
}

.opt-config-val {
    font-size: 1.2rem;
    font-weight: 900;
    letter-spacing: 0.5px;
}

.opt-sub-stats {
    font-size: 0.85rem;
    color: #aaa;
    margin-top: 5px;
    font-family: var(--font-mono);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

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

.modal-content {
    background: #111;
    border: 1px solid #333;
    padding: 50px;
    max-width: 650px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
    border-radius: var(--radius-lg);
    transform: scale(0.95);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal.show .modal-content {
    transform: scale(1);
}

.modal h2 {
    color: var(--zzz-primary);
    margin-top: 0;
    font-size: 2rem;
    margin-bottom: 20px;
}

.modal p {
    color: #ccc;
    line-height: 1.8;
    margin-bottom: 40px;
    font-size: 1.05rem;
}

/* Toast Notification */
.toast {
    position: fixed;
    top: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background: rgba(20, 20, 20, 0.95);
    color: var(--zzz-primary);
    border: 1px solid var(--zzz-primary);
    padding: 12px 30px;
    font-weight: 600;
    font-size: 1rem;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.5);
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Export Button Specifics */
#export-btn {
    /* Fixed positioning at bottom-right corner */
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 1000;

    /* Visual styling */
    border-color: var(--zzz-primary);
    color: var(--zzz-primary);
    background: rgba(204, 255, 0, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);

    /* Enhanced visibility */
    box-shadow:
        0 4px 20px rgba(0, 0, 0, 0.6),
        0 0 30px rgba(205, 231, 74, 0.2);

    /* Sizing */
    font-size: 1.1rem;
    padding: 14px 32px;
    min-width: 200px;

    /* Smooth transitions */
    transition: all 0.3s ease;
}

#export-btn:hover {
    background: var(--zzz-primary);
    color: #000;
    transform: translateY(-2px);
    box-shadow:
        0 6px 25px rgba(0, 0, 0, 0.8),
        0 0 40px rgba(205, 231, 74, 0.4);
}

#export-btn:active {
    transform: translateY(0);
}

#export-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Responsive adjustments for smaller screens */
@media (max-width: 768px) {
    #export-btn {
        bottom: 20px;
        right: 20px;
        font-size: 1rem;
        padding: 12px 24px;
        min-width: 160px;
    }
}

/* Default Hidden Fields */
.input-group.default-hidden {
    display: none;
}

/* Logic for Break Mode */
body[data-mode="break"] .input-group.default-hidden {
    display: grid;
}

body[data-mode="break"] .input-group.break-hidden {
    display: none;
}