* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --matrix-green: #00ff41;
    --matrix-dark-green: #003b00;
    --matrix-bg: #0d0208;
    --red-hair: #ff4500;
    --terminal-bg: rgba(0, 20, 0, 0.9);
}

body {
    font-family: 'Courier New', monospace;
    background: var(--matrix-bg);
    color: var(--matrix-green);
    min-height: 100vh;
    overflow-x: hidden;
}

#matrix-rain {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    position: relative;
    z-index: 1;
}

/* Glitch Effect */
.glitch-container {
    text-align: center;
    margin-bottom: 30px;
}

.glitch {
    font-size: 3rem;
    font-weight: bold;
    text-transform: uppercase;
    position: relative;
    text-shadow: 0.05em 0 0 #00fffc, -0.03em -0.04em 0 #fc00ff,
                 0.025em 0.04em 0 #fffc00;
    animation: glitch 725ms infinite;
}

.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.glitch::before {
    animation: glitch-top 1s linear infinite;
    clip-path: polygon(0 0, 100% 0, 100% 33%, 0 33%);
    -webkit-clip-path: polygon(0 0, 100% 0, 100% 33%, 0 33%);
}

.glitch::after {
    animation: glitch-bottom 1.5s linear infinite;
    clip-path: polygon(0 67%, 100% 67%, 100% 100%, 0 100%);
    -webkit-clip-path: polygon(0 67%, 100% 67%, 100% 100%, 0 100%);
}

@keyframes glitch {
    0% { text-shadow: 0.05em 0 0 #00fffc, -0.03em -0.04em 0 #fc00ff, 0.025em 0.04em 0 #fffc00; }
    15% { text-shadow: 0.05em 0 0 #00fffc, -0.03em -0.04em 0 #fc00ff, 0.025em 0.04em 0 #fffc00; }
    16% { text-shadow: -0.05em -0.025em 0 #00fffc, 0.025em 0.035em 0 #fc00ff, -0.05em -0.05em 0 #fffc00; }
    49% { text-shadow: -0.05em -0.025em 0 #00fffc, 0.025em 0.035em 0 #fc00ff, -0.05em -0.05em 0 #fffc00; }
    50% { text-shadow: 0.05em 0.035em 0 #00fffc, 0.03em 0 0 #fc00ff, 0 -0.04em 0 #fffc00; }
    99% { text-shadow: 0.05em 0.035em 0 #00fffc, 0.03em 0 0 #fc00ff, 0 -0.04em 0 #fffc00; }
    100% { text-shadow: -0.05em 0 0 #00fffc, -0.025em -0.04em 0 #fc00ff, -0.04em -0.025em 0 #fffc00; }
}

@keyframes glitch-top {
    0% { transform: translate(0); }
    20% { transform: translate(-2px, 2px); }
    40% { transform: translate(-2px, -2px); }
    60% { transform: translate(2px, 2px); }
    80% { transform: translate(2px, -2px); }
    100% { transform: translate(0); }
}

@keyframes glitch-bottom {
    0% { transform: translate(0); }
    20% { transform: translate(2px, -2px); }
    40% { transform: translate(2px, 2px); }
    60% { transform: translate(-2px, -2px); }
    80% { transform: translate(-2px, 2px); }
    100% { transform: translate(0); }
}

.subtitle {
    font-size: 1rem;
    color: #00ff41;
    letter-spacing: 3px;
    margin-top: 10px;
    animation: flicker 2s infinite;
}

@keyframes flicker {
    0%, 19%, 21%, 23%, 25%, 54%, 56%, 100% { opacity: 1; }
    20%, 24%, 55% { opacity: 0.5; }
}

/* Terminal */
.terminal {
    background: var(--terminal-bg);
    border: 2px solid var(--matrix-green);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 0 20px rgba(0, 255, 65, 0.3),
                inset 0 0 20px rgba(0, 255, 65, 0.1);
}

.terminal-header {
    background: linear-gradient(180deg, #2d2d2d 0%, #1a1a1a 100%);
    padding: 10px 15px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid var(--matrix-green);
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.dot.red { background: #ff5f56; }
.dot.yellow { background: #ffbd2e; }
.dot.green { background: #27ca40; }

.terminal-title {
    margin-left: auto;
    font-size: 0.8rem;
    color: #888;
}

.terminal-body {
    padding: 30px;
    position: relative;
}

.scan-line {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: rgba(0, 255, 65, 0.5);
    animation: scan 3s linear infinite;
}

@keyframes scan {
    0% { top: 0; }
    100% { top: 100%; }
}

/* Patient Card */
.patient-card {
    display: flex;
    gap: 30px;
    background: rgba(0, 255, 65, 0.05);
    border: 1px solid rgba(0, 255, 65, 0.3);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
}

.avatar-container {
    text-align: center;
}

.avatar {
    width: 100px;
    height: 120px;
    background: linear-gradient(180deg, #1a1a1a 0%, #0a0a0a 100%);
    border: 2px solid var(--matrix-green);
    border-radius: 10px;
    position: relative;
    overflow: hidden;
}

.hair {
    position: absolute;
    top: 5px;
    left: 10px;
    right: 10px;
    height: 35px;
    background: var(--red-hair);
    border-radius: 20px 20px 0 0;
    box-shadow: 0 0 15px var(--red-hair);
}

.face {
    position: absolute;
    top: 35px;
    left: 20px;
    right: 20px;
    bottom: 20px;
}

.eyes {
    display: flex;
    justify-content: space-between;
    padding: 15px 5px;
}

.eye {
    width: 15px;
    height: 15px;
    background: var(--matrix-green);
    border-radius: 50%;
    animation: blink-eyes 3s infinite;
    box-shadow: 0 0 10px var(--matrix-green);
}

@keyframes blink-eyes {
    0%, 90%, 100% { transform: scaleY(1); }
    95% { transform: scaleY(0.1); }
}

.mouth {
    width: 30px;
    height: 10px;
    border: 2px solid var(--matrix-green);
    border-top: none;
    border-radius: 0 0 15px 15px;
    margin: 10px auto;
}

.status-indicator {
    margin-top: 10px;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 0.8rem;
    font-weight: bold;
}

.status-indicator.critical {
    background: rgba(255, 0, 0, 0.3);
    border: 1px solid #ff0000;
    color: #ff0000;
    animation: pulse-red 1s infinite;
}

.status-indicator.healed {
    background: rgba(0, 255, 65, 0.3);
    border: 1px solid var(--matrix-green);
    color: var(--matrix-green);
}

@keyframes pulse-red {
    0%, 100% { box-shadow: 0 0 5px #ff0000; }
    50% { box-shadow: 0 0 20px #ff0000; }
}

.patient-info {
    flex: 1;
}

.patient-name {
    font-size: 1.8rem;
    margin-bottom: 15px;
    text-shadow: 0 0 10px var(--matrix-green);
}

.info-grid {
    display: grid;
    gap: 10px;
}

.info-item {
    display: flex;
    gap: 10px;
}

.label {
    color: #888;
    min-width: 120px;
}

.value {
    color: var(--matrix-green);
}

.value.blink {
    animation: blink 1s infinite;
    color: #ff0000;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

.red-text {
    color: var(--red-hair) !important;
    text-shadow: 0 0 5px var(--red-hair);
}

.based {
    color: gold !important;
    text-shadow: 0 0 10px gold;
    font-weight: bold;
}

/* Console Output */
.console-output {
    background: #000;
    border: 1px solid var(--matrix-dark-green);
    border-radius: 5px;
    padding: 15px;
    margin: 20px 0;
    height: 150px;
    overflow-y: auto;
    font-size: 0.9rem;
}

.console-output p {
    margin: 5px 0;
    opacity: 0;
    animation: fadeIn 0.5s forwards;
}

@keyframes fadeIn {
    to { opacity: 1; }
}

/* Progress Bar */
.progress-container {
    margin: 20px 0;
}

.progress-label {
    margin-bottom: 10px;
    font-size: 0.9rem;
}

.progress-bar {
    height: 30px;
    background: #001100;
    border: 2px solid var(--matrix-green);
    border-radius: 5px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--matrix-dark-green), var(--matrix-green));
    transition: width 0.3s ease;
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(255,255,255,0.2) 50%,
        transparent 100%);
    animation: shine 1s infinite;
}

@keyframes shine {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.progress-percent {
    text-align: right;
    margin-top: 5px;
    font-size: 1.2rem;
    font-weight: bold;
}

/* Rescue Button */
.rescue-btn {
    width: 100%;
    padding: 20px;
    background: transparent;
    border: 2px solid var(--matrix-green);
    color: var(--matrix-green);
    font-family: 'Courier New', monospace;
    font-size: 1.2rem;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 3px;
}

.rescue-btn:hover {
    background: rgba(0, 255, 65, 0.1);
    box-shadow: 0 0 30px rgba(0, 255, 65, 0.5);
    transform: scale(1.02);
}

.rescue-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-glow {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        to bottom right,
        rgba(0, 255, 65, 0) 0%,
        rgba(0, 255, 65, 0.1) 50%,
        rgba(0, 255, 65, 0) 100%
    );
    transform: rotate(45deg);
    animation: btn-shine 3s infinite;
}

@keyframes btn-shine {
    0% { transform: translateX(-100%) rotate(45deg); }
    100% { transform: translateX(100%) rotate(45deg); }
}

/* Success Screen */
.rescue-complete {
    text-align: center;
    padding: 30px;
    background: rgba(0, 255, 65, 0.1);
    border: 2px solid var(--matrix-green);
    border-radius: 10px;
    margin-top: 20px;
}

.rescue-complete.hidden {
    display: none;
}

.success-icon {
    font-size: 4rem;
    color: var(--matrix-green);
    text-shadow: 0 0 30px var(--matrix-green);
    animation: pulse-success 1s infinite;
}

@keyframes pulse-success {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.rescue-complete h2 {
    margin: 20px 0;
    font-size: 1.5rem;
}

.rescue-complete p {
    margin: 10px 0;
    color: #aaa;
}

/* Footer */
footer {
    text-align: center;
    margin-top: 30px;
    padding: 20px;
    border-top: 1px solid rgba(0, 255, 65, 0.3);
    color: #555;
    font-size: 0.8rem;
}

/* Responsive */
@media (max-width: 600px) {
    .glitch {
        font-size: 1.8rem;
    }

    .patient-card {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .info-item {
        flex-direction: column;
        gap: 2px;
    }

    .label {
        min-width: auto;
    }
}
