:root {
    --bg-color: #050000;
    --primary-color: #ff1a1a;
    --secondary-color: #330000;
    --text-color: #ffffff;
    --danger-color: #ff0000;
}

* {
    box-sizing: border-box;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
}

body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Teko', sans-serif;
    overflow: hidden; /* Verhindert Scrollen beim wilden Tippen */
}

#app {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

.screen {
    position: absolute;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
    text-align: center;
    background: radial-gradient(circle at center, #220000 0%, #000000 100%);
}

.screen.active {
    display: flex;
}

h1, h2, h3 {
    font-size: 4rem;
    margin-bottom: 10px;
    letter-spacing: 2px;
    text-transform: uppercase;
    text-shadow: 0 0 10px rgba(255,0,0,0.5);
    margin-top: 0;
}

h3 {
    font-size: 2.5rem;
}

p {
    font-size: 1.5rem;
    max-width: 400px;
    margin-bottom: 30px;
    color: #ffd1d1;
    font-family: sans-serif;
}

.btn {
    width: 90%;
    max-width: 320px;
    padding: 15px;
    margin: 10px 0;
    font-size: 2.2rem;
    font-family: 'Teko', sans-serif;
    cursor: pointer;
    border: none;
    border-radius: 8px;
    transition: transform 0.1s, box-shadow 0.15s, background 0.2s;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 1px;
}

.btn:active {
    transform: scale(0.95);
}

.btn-primary {
    background: linear-gradient(45deg, var(--danger-color), #ff5500);
    color: white;
    box-shadow: 0 0 20px rgba(255, 0, 0, 0.6);
}

.btn-primary:active {
    box-shadow: 0 0 5px rgba(255, 0, 0, 0.5);
}

.btn-secondary {
    background: rgba(255,255,255,0.05);
    color: white;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.1);
}

.btn-secondary:hover {
    background: rgba(255,255,255,0.1);
}

/* GAME SCREEN */
.hud {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    display: flex;
    justify-content: space-between;
    font-size: 4rem;
    font-weight: bold;
    color: var(--primary-color);
    text-shadow: 0 0 15px rgba(255,0,0,0.8);
    pointer-events: none;
    z-index: 10;
}

#tap-area {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: crosshair;
    background: transparent;
    transition: background 0.05s;
}

.tap-text {
    font-size: 10rem;
    font-weight: 700;
    opacity: 0.05;
    pointer-events: none;
    transition: transform 0.05s, opacity 0.05s;
    color: white;
}

#tap-area:active {
    background: rgba(255, 0, 0, 0.15);
}

#tap-area:active .tap-text {
    transform: scale(1.1);
    opacity: 0.3;
    color: var(--danger-color);
}

/* END SCREEN */
.final-score {
    font-size: 3rem;
    color: white;
    margin: 10px 0 30px;
    text-shadow: 0 0 10px rgba(255,255,255,0.3);
}

#final-score-value {
    font-size: 5rem;
    color: var(--primary-color);
    font-weight: bold;
    text-shadow: 0 0 20px var(--danger-color);
    display: block;
}

input[type="text"] {
    width: 90%;
    max-width: 320px;
    padding: 15px;
    font-size: 1.5rem;
    margin-bottom: 20px;
    background: rgba(0,0,0,0.5);
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    color: white;
    text-align: center;
    outline: none;
    font-family: sans-serif;
    font-weight: bold;
}

input[type="text"]:focus {
    box-shadow: 0 0 15px var(--primary-color);
}

/* HIGHSCORES */
.list {
    width: 95%;
    max-width: 450px;
    max-height: 60vh;
    overflow-y: auto;
    margin-bottom: 20px;
    padding-right: 5px;
}

/* Scrollbar für Webkit */
.list::-webkit-scrollbar {
    width: 6px;
}
.list::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 3px;
}
.list::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.05);
}

.score-item {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-left: 4px solid var(--primary-color);
    padding: 15px;
    margin-bottom: 12px;
    border-radius: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.score-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
}

.score-name {
    font-size: 1.6rem;
    font-weight: bold;
    color: white;
    line-height: 1;
    margin-bottom: 4px;
}

.score-meta {
    font-size: 0.85rem;
    color: #aaa;
    font-family: sans-serif;
}

.score-value {
    font-size: 2.8rem;
    font-weight: bold;
    color: var(--primary-color);
    line-height: 1;
}

.btn-qr {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    margin-left: 15px;
    font-family: 'Teko', sans-serif;
    font-size: 1.4rem;
    box-shadow: 0 0 5px rgba(255,0,0,0.5);
    transition: transform 0.1s;
}

.btn-qr:active {
    transform: scale(0.9);
}

.penalized {
    border-left-color: #ffaa00;
}

.penalized .score-value {
    color: #ffaa00;
}

.penalized .score-name::after {
    content: ' (-10% Zeitstrafe)';
    font-size: 0.8rem;
    color: #ffaa00;
    vertical-align: middle;
    margin-left: 5px;
    font-family: sans-serif;
}

.shared-badge {
    background: #0088ff;
    color: white;
    font-size: 0.7rem;
    padding: 2px 5px;
    border-radius: 4px;
    margin-left: 5px;
    vertical-align: middle;
    font-family: sans-serif;
}

/* QR SCANNER */
#reader {
    width: 100%;
    max-width: 400px;
    margin-bottom: 20px;
    background: #000;
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    overflow: hidden;
}

/* MODAL */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.9);
    z-index: 100;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
}

.modal.active {
    display: flex;
}

.modal-content {
    background: #110000;
    padding: 30px;
    border-radius: 12px;
    border: 2px solid var(--primary-color);
    text-align: center;
    box-shadow: 0 0 30px rgba(255,0,0,0.4);
}

#qrcode-container {
    background: white;
    padding: 15px;
    border-radius: 8px;
    display: inline-block;
    margin-bottom: 20px;
}

#qrcode-container img, #qrcode-container canvas {
    display: block;
    margin: 0 auto;
}

/* Animations */
.glitch {
    position: relative;
    color: white;
}
.glitch::before, .glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-color);
}
.glitch::before {
    left: 3px;
    text-shadow: -2px 0 red;
    clip: rect(24px, 550px, 90px, 0);
    animation: glitch-anim 3s infinite linear alternate-reverse;
}
.glitch::after {
    left: -3px;
    text-shadow: -2px 0 blue;
    clip: rect(85px, 550px, 140px, 0);
    animation: glitch-anim 2.5s infinite linear alternate-reverse;
}

@keyframes glitch-anim {
    0% { clip: rect(10px, 9999px, 81px, 0); }
    10% { clip: rect(44px, 9999px, 12px, 0); }
    20% { clip: rect(78px, 9999px, 83px, 0); }
    30% { clip: rect(32px, 9999px, 54px, 0); }
    40% { clip: rect(1px, 9999px, 96px, 0); }
    50% { clip: rect(87px, 9999px, 23px, 0); }
    60% { clip: rect(56px, 9999px, 7px, 0); }
    70% { clip: rect(93px, 9999px, 45px, 0); }
    80% { clip: rect(12px, 9999px, 68px, 0); }
    90% { clip: rect(65px, 9999px, 34px, 0); }
    100% { clip: rect(2px, 9999px, 78px, 0); }
}

.shake {
    animation: shake 0.3s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes shake {
    10%, 90% { transform: translate3d(-2px, 2px, 0); }
    20%, 80% { transform: translate3d(4px, -2px, 0); }
    30%, 50%, 70% { transform: translate3d(-6px, 2px, 0); }
    40%, 60% { transform: translate3d(6px, -2px, 0); }
}
