:root {
    --color-tema: #0288d1;
    --color-hover: #0277bd;
    --nexo-font: 'Montserrat', sans-serif;
}

html,
body {
    overflow-x: hidden;
    width: 100%;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--fondo-body);
    transition: background-color 0.3s ease, color 0.3s ease;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main {
    flex: 1;
}

header {
    text-align: center;
    width: 100%;
    margin-top: 5rem;
}

.btn-back {
    display: inline-block;
    margin: 2rem auto 1rem auto;
    padding: 10px 20px;
    background-color: var(--fondo-card);
    border: 2px solid var(--borde-card);
    border-radius: 8px;
    text-decoration: none;
    color: var(--texto-negro);
    font-weight: 700;
    transition: all 0.2s;
}

.btn-back:hover {
    background-color: var(--color-tema);
    color: #fff;
    border-color: var(--color-tema);
    transform: translateY(-2px);
}

.page-title {
    font-family: 'Montserrat', sans-serif !important;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: -1px;
    margin: 1.5rem auto 0.8rem auto;
    font-size: clamp(2rem, 5vw, 3.2rem);
    color: var(--color-tema);
}

.intro-text {
    font-size: 1rem;
    color: var(--texto-gris);
    margin-bottom: 2.5rem;
    text-align: center;
}

.dashboard-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.5rem;
    max-width: 900px;
    margin: 0 auto 2.5rem auto;
    padding: 0 20px;
}

.tool-card {
    flex: 0 1 400px;
    background-color: var(--fondo-card);
    border: 2px solid var(--borde-card);
    border-radius: 16px;
    padding: 2rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: var(--sombra-industrial);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.tool-card:hover {
    transform: translate(-4px, -4px);
    box-shadow: 8px 8px 0px var(--color-tema);
    border-color: var(--color-tema);
    background-color: var(--fondo-card-hover, #e3f2fd);
}

.card-icon {
    font-size: 3rem;
    margin-bottom: 1.2rem;
}

.card-content h2 {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--texto-negro);
    margin-bottom: 0.8rem;
}

.card-content p {
    font-size: 0.95rem;
    color: var(--texto-gris);
    line-height: 1.5;
    margin-bottom: 1.2rem;
}

.hz-tag {
    display: inline-block;
    background: linear-gradient(135deg, #00bcd4, #0288d1);
    color: #fff;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.btn-action {
    padding: 12px 30px;
    background-color: var(--color-tema);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-action:hover {
    background-color: var(--color-hover);
    transform: scale(1.05);
}

.test-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    background-color: #000;
}

.pixel-ui-layer {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    z-index: 10000;
}

.pixel-msg {
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 1rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.pixel-exit-btn {
    padding: 12px 24px;
    background-color: #ff4444;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.pixel-exit-btn:hover {
    background-color: #cc0000;
    transform: scale(1.05);
}

.ghost-bg {
    background-color: #1a1a1a;
}

.ghost-header {
    position: absolute;
    top: 20px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 40px;
    z-index: 10000;
}

.ghost-info {
    text-align: left;
}

.fps-title {
    font-size: 1.8rem;
    font-weight: 900;
    color: #fff;
    margin: 0;
}

.highlight-cyan {
    color: #00bcd4;
}

.fps-subtitle {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.7);
    margin: 5px 0 0 0;
}

.btn-exit-ghost {
    padding: 12px 24px;
    background-color: #ff4444;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-exit-ghost:hover {
    background-color: #cc0000;
    transform: scale(1.05);
}

.controls-panel {
    position: fixed;
    top: 100px;
    right: 20px;
    background: rgba(0, 0, 0, 0.9);
    border: 2px solid #00bcd4;
    border-radius: 12px;
    padding: 1.5rem;
    max-width: 320px;
    z-index: 10001;
    color: #fff;
    box-shadow: 0 8px 24px rgba(0, 188, 212, 0.3);
}

.controls-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #00bcd4;
}

.controls-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: #00bcd4;
}

.btn-toggle-controls {
    background: transparent;
    border: 1px solid #00bcd4;
    color: #00bcd4;
    width: 30px;
    height: 30px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1;
    transition: all 0.2s;
}

.btn-toggle-controls:hover {
    background: #00bcd4;
    color: #000;
}

.controls-content {
    display: block;
}

.control-group {
    margin-bottom: 1rem;
}

.control-group label {
    display: block;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    color: #aaa;
}

.control-group input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #333;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.control-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #00bcd4;
    cursor: pointer;
    transition: all 0.2s;
}

.control-group input[type="range"]::-webkit-slider-thumb:hover {
    background: #00e5ff;
    transform: scale(1.2);
}

.control-group input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #00bcd4;
    cursor: pointer;
    border: none;
}

.control-group select {
    width: 100%;
    padding: 8px;
    background: #333;
    border: 1px solid #555;
    border-radius: 6px;
    color: #fff;
    font-size: 0.9rem;
    cursor: pointer;
}

.control-group select:focus {
    outline: none;
    border-color: #00bcd4;
}

.control-group input[type="color"] {
    width: 100%;
    height: 40px;
    border: 1px solid #555;
    border-radius: 6px;
    cursor: pointer;
    background: transparent;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.btn-reset {
    width: 100%;
    padding: 10px;
    background: linear-gradient(135deg, #00bcd4, #0288d1);
    border: none;
    border-radius: 8px;
    color: #fff;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 0.5rem;
}

.btn-reset:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 188, 212, 0.4);
}

.lanes-container {
    position: absolute;
    top: 120px;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 0;
    padding: 0;
    max-width: 100%;
    overflow-y: auto;
    overflow-x: hidden;
}

.ghost-lane {
    position: relative;
    width: 100%;
    min-height: 200px;
    height: 200px;
    display: flex;
    align-items: center;
    border-bottom: 2px solid rgba(255, 255, 255, 0.15);
    overflow: hidden;
    flex-shrink: 0;
}

.ghost-lane:last-child {
    border-bottom: none;
}

.lane-label {
    position: absolute;
    left: 30px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: rgba(0, 0, 0, 0.85);
    padding: 16px 20px;
    border-radius: 10px;
    border-left: 5px solid #00bcd4;
    z-index: 10;
    min-width: 220px;
    backdrop-filter: blur(10px);
}

.lane-name {
    font-size: 1.3rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.lane-speed {
    font-size: 1rem;
    color: #bbb;
    font-weight: 700;
}

.lane-fps {
    font-size: 0.85rem;
    color: #00bcd4;
    font-weight: 700;
}

.ghost-object {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    will-change: transform;
}

.ghost-object.square {
    border-radius: 15px;
}

.ghost-object.circle {
    border-radius: 50%;
}

.ghost-object.ufo {
    display: flex;
    align-items: center;
    justify-content: center;
}

.ghost-object img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

body.dark-mode {
    --color-tema: #4fc3f7;
    --fondo-card-hover: #1a1a1a;
}

body.dark-mode .page-title {
    color: var(--color-tema);
}

body.dark-mode .intro-text {
    color: #aaa;
}

body.dark-mode .tool-card {
    background-color: #27272a;
    border-color: #444;
}

body.dark-mode .tool-card:hover {
    background-color: #1a1a1a;
    border-color: var(--color-tema);
    box-shadow: 8px 8px 0px var(--color-tema);
}

body.dark-mode .card-content h2 {
    color: #fff;
}

body.dark-mode .card-content p {
    color: #aaa;
}

body.dark-mode .btn-back {
    background-color: #27272a;
    border-color: #555;
    color: #fff;
}

body.dark-mode .btn-back:hover {
    background-color: var(--color-tema);
    color: #000;
    border-color: var(--color-tema);
}

@media (max-width: 768px) {
    .page-title {
        font-size: 2.5rem;
    }
    
    .dashboard-container {
        gap: 1.5rem;
        padding: 0 15px;
    }
    
    .tool-card {
        flex: 1 1 100%;
        padding: 2rem;
    }
    
    .card-icon {
        font-size: 3rem;
    }
    
    .card-content h2 {
        font-size: 1.5rem;
    }
    
    .ghost-header {
        flex-direction: column;
        gap: 15px;
        padding: 20px;
    }
    
    .fps-title {
        font-size: 1.4rem;
    }
    
    .controls-panel {
        top: 80px;
        right: 10px;
        left: 10px;
        max-width: none;
        padding: 1rem;
    }
    
    .controls-header h3 {
        font-size: 1rem;
    }
    
    .lanes-container {
        gap: 0;
        padding: 0;
        top: 100px;
    }
    
    .ghost-lane {
        min-height: 160px;
        height: 160px;
    }
    
    .lane-label {
        left: 15px;
        min-width: 180px;
        padding: 12px 16px;
    }
    
    .lane-name {
        font-size: 1.1rem;
    }
    
    .lane-speed {
        font-size: 0.9rem;
    }
    
    .lane-fps {
        font-size: 0.75rem;
    }
}

@media (max-width: 480px) {
    .controls-panel {
        top: 70px;
        padding: 0.8rem;
        font-size: 0.85rem;
    }
    
    .control-group {
        margin-bottom: 0.8rem;
    }
    
    .control-group label {
        font-size: 0.8rem;
    }
    
    .btn-reset {
        padding: 8px;
        font-size: 0.8rem;
    }
    
    .lanes-container {
        top: 90px;
    }
    
    .ghost-lane {
        min-height: 140px;
        height: 140px;
    }
    
    .lane-label {
        left: 10px;
        min-width: 150px;
        padding: 10px 14px;
    }
    
    .lane-name {
        font-size: 1rem;
    }
    
    .lane-speed {
        font-size: 0.8rem;
    }
    
    .lane-fps {
        font-size: 0.7rem;
    }
}
