:root {
    --bg-color: #0f0c29;
    --bg-gradient: linear-gradient(to bottom, #302b63, #24243e, #0f0c29);
    --text-color: #ffffff;
    --primary-color: #ff007f;
    --secondary-color: #00d2ff;
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

html, body {
    height: 100%;
}

body {
    background: var(--bg-gradient);
    color: var(--text-color);
    height: 100vh;
    height: 100dvh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

#app {
    width: 100%;
    max-width: 600px;
    height: 100vh;
    height: 100dvh;
    max-height: 900px;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.screen {
    display: none;
    flex-direction: column;
    height: 100%;
    width: 100%;
    padding: 20px;
    overflow-y: auto;
}

.screen.active {
    display: flex;
}

h1, h2 {
    text-align: center;
    margin-bottom: 20px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

/* Settings Form */
.settings {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 20px;
    margin-bottom: 20px;
}

.settings label {
    font-weight: bold;
    color: var(--secondary-color);
}

select, input[type="range"] {
    padding: 10px;
    border-radius: 8px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    outline: none;
}
select option {
    background: #24243e;
}

.primary-btn {
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    padding: 15px;
    border-radius: 10px;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    margin-top: 20px;
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(255, 0, 127, 0.4);
}

#btn-open-vocab-manager {
    background: linear-gradient(45deg, #ff8c00, #ff007f);
    margin-top: 20px;
    margin-bottom: 25px;
    animation: attentionPulseBtn 2s infinite alternate;
}

@keyframes attentionPulseBtn {
    0% { box-shadow: 0 0 10px rgba(255, 140, 0, 0.3); }
    100% { box-shadow: 0 0 20px rgba(255, 0, 127, 0.7); }
}

/* Game Area */
#game-header {
    display: flex;
    justify-content: space-between;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--glass-border);
    font-size: 0.9rem;
    font-weight: bold;
}

#game-area {
    flex-grow: 1;
    position: relative;
    overflow: hidden;
    border-left: 2px solid var(--glass-border);
    border-right: 2px solid var(--glass-border);
    background: rgba(0,0,0,0.2);
}

.falling-word {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    background: var(--secondary-color);
    color: #000;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: bold;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
    white-space: nowrap;
}

.stacked-block {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 30px;
    background: rgba(255, 0, 0, 0.5);
    border-top: 2px solid red;
    transition: bottom 0.3s;
}

#game-footer {
    display: flex;
    justify-content: space-around;
    padding-top: 10px;
    border-top: 2px solid var(--glass-border);
    gap: 10px;
}

.option-btn {
    flex: 1;
    padding: 15px 5px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: white;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s;
}

.option-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Results Table */
#results-table-container {
    max-height: 350px;
    overflow-y: auto;
    margin-top: 10px;
}
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}
th, td {
    padding: 10px;
    border-bottom: 1px solid var(--glass-border);
    text-align: left;
}
.error-row {
    color: #ff4d4d;
    background: rgba(255, 0, 0, 0.1);
}

/* Error List Specific Styles */
#errors-table-container {
    background: #ffffff;
    color: #000000;
    border-radius: 10px;
    padding: 10px;
    margin-top: 15px;
}
#errors-table-container th {
    color: #000000;
    border-bottom: 2px solid #aaaaaa;
}
#errors-table-container td {
    color: #000000;
    border-bottom: 1px solid #eeeeee;
}
#errors-table-container p {
    color: #000000;
}

/* Vokabel-Manager Styles */
textarea {
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    outline: none;
    resize: vertical;
    font-size: 14px;
}

#custom-lists-container table {
    margin-top: 10px;
}

#custom-lists-container th, #custom-lists-container td {
    padding: 8px;
    font-size: 14px;
}

#edit-list-words-container table {
    margin-top: 0;
}
#edit-list-words-container th, #edit-list-words-container td {
    padding: 8px;
}

#vocab-manager-detail input[type="text"] {
    padding: 10px;
    border-radius: 8px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    outline: none;
    flex: 1;
    min-width: 0;
}

/* Gamification & Juice */

.particle {
    position: absolute;
    width: 6px;
    height: 6px;
    background-color: var(--primary-color);
    border-radius: 50%;
    pointer-events: none;
    transition: transform 0.6s ease-out, opacity 0.6s ease-out;
    z-index: 50;
}

.combo-text {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) scale(0.5);
    font-size: 2.5rem;
    font-weight: 900;
    color: #ffd700;
    text-shadow: 0 0 10px #ff8c00, 0 0 20px #ff0000;
    pointer-events: none;
    opacity: 0;
    z-index: 100;
    animation: comboPop 1.5s forwards;
}

@keyframes comboPop {
    0% { transform: translate(-50%, -50%) scale(0.5); opacity: 0; }
    20% { transform: translate(-50%, -50%) scale(1.2); opacity: 1; }
    80% { transform: translate(-50%, -100%) scale(1); opacity: 1; }
    100% { transform: translate(-50%, -150%) scale(1); opacity: 0; }
}

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

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

.boss-word {
    background: linear-gradient(45deg, #ff0000, #ff8c00);
    color: white;
    box-shadow: 0 0 15px #ff0000;
    animation: pulseBoss 0.5s infinite alternate;
}

@keyframes pulseBoss {
    0% { transform: translateX(-50%) scale(1); }
    100% { transform: translateX(-50%) scale(1.15); box-shadow: 0 0 25px #ff0000; }
}

/* Flashcard Training Camp */
.flashcard-container {
    background-color: transparent;
    width: 100%;
    height: 250px;
    perspective: 1000px;
    margin: 0 auto;
    cursor: pointer;
}

.flashcard-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.flashcard-container.flipped .flashcard-inner {
    transform: rotateY(180deg);
}

.flashcard-front, .flashcard-back {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-size: 2rem;
    font-weight: bold;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    background: linear-gradient(135deg, var(--secondary-color), #3a7bd5);
    color: white;
}

.flashcard-back {
    background: linear-gradient(135deg, var(--primary-color), #ff8c00);
    transform: rotateY(180deg);
}

.swipe-left {
    animation: swipeLeftAnim 0.5s forwards;
}

.swipe-right {
    animation: swipeRightAnim 0.5s forwards;
}

@keyframes swipeLeftAnim {
    to { transform: translateX(-150vw) rotate(-20deg); opacity: 0; }
}

@keyframes swipeRightAnim {
    to { transform: translateX(150vw) rotate(20deg); opacity: 0; }
}

.particle-train {
    position: absolute;
    width: 10px;
    height: 10px;
    background-color: #00ff00;
    border-radius: 50%;
    pointer-events: none;
    transition: transform 0.8s cubic-bezier(.2,.8,.3,1), opacity 0.8s ease-out;
    z-index: 200;
}
