body { font-family: Arial, sans-serif; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); margin: 0; padding: 10px; min-height: 100vh; user-select: none; overflow-x: hidden; }
.game-container { position: relative; background: white; border-radius: 15px; box-shadow: 0 10px 30px rgba(0,0,0,0.3); padding: 15px; max-width: 1200px; margin: 0 auto; min-height: calc(100vh - 20px); display: flex; flex-direction: column; }
.game-header { text-align: center; margin-bottom: 15px; flex-shrink: 0; }
.game-header h1 { color: #333; margin: 0; font-size: 2.5em; }
.game-info { display: flex; justify-content: center; flex-wrap: wrap; gap: 15px 20px; margin-bottom: 15px; font-size: 1em; flex-shrink: 0; }
.info-item { color: #666; }
.game-board { display: flex; gap: 20px; justify-content: center; align-items: flex-start; flex: 1; min-height: 0; position: relative; }
.board-container { position: relative; overflow: auto; max-height: 100%; display: flex; justify-content: center; align-items: center; }
.game-over-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.75); color: white; display: none; flex-direction: column; align-items: center; justify-content: center; z-index: 200; border-radius: 10px; text-align: center; line-height: 1.4; pointer-events: none; }
.game-over-overlay.active { display: flex; pointer-events: auto; }
.game-over-overlay h2 { font-size: 3em; margin: 0; }
.game-over-overlay p { font-size: 1.2em; margin: 5px 0; }
.board { display: grid; gap: 1px; background: #ccc; padding: 10px; border-radius: 10px; }
.cell {
    width: 20px;
    height: 20px;
    background: #f0f0f0;
    border: 1px solid #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: bold;
    position: relative;
    cursor: pointer;
    transition: all var(--vf-duration-fast) var(--vf-ease-smooth);
    /* will-change removed to fix scroll bug */
}

/* --- PERFORMANCE-OPTIMIERUNG: CSS --- */
.word-preview {
    position: fixed;
    display: flex;
    pointer-events: none;
    opacity: var(--vf-opacity-preview);
    z-index: 1000;
    top: 0;
    left: 0;
    transition: transform var(--vf-duration-fast) var(--vf-ease-out);
    will-change: transform;
    transform: translateZ(0);
    backface-visibility: hidden;
}

.preview-letter {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    color: white;
    margin: 0.5px;
    border-radius: 2px;
    will-change: transform, opacity;
    transform: translateZ(0);
}
.word-preview.valid .preview-letter {
    background-color: var(--vf-color-valid);
    box-shadow: var(--vf-shadow-glow) var(--vf-color-valid);
}
.word-preview.invalid .preview-letter {
    background-color: var(--vf-color-invalid);
    box-shadow: var(--vf-shadow-glow) var(--vf-color-invalid);
}
.cell.bonus-1 { background: #ffeb3b; color: #333; }
.cell.bonus-2 { background: #ff9800; color: white; }
.cell.bonus-3 { background: #f44336; color: white; }
.cell.bonus-swap { background: #9c27b0; color: white; }
.cell.bonus-recycle { background: #8bc34a; color: white; font-size: 14px; }
.cell.bonus-goal { background: #333; color: white; font-size: 14px; }
.cell.bonus-bomb { background: #616161; color: white; font-size: 14px; }
.cell.occupied { background: #2196f3; color: white; font-size: 12px; }



.word-list { width: 200px; background: #f5f5f5; padding: 5px; border-radius: 5px; display: flex; flex-direction: column; position: sticky; top: 0; align-self: flex-start; max-height: calc(100vh - 40px);}
#wordList { overflow-y: auto; flex-grow: 1; margin-bottom: 5px; padding-right: 5px; min-height: 50px; }
.word-list h3 { margin-top: 0; color: #333; font-size: 14px; font-weight: bold; margin-bottom: 8px; }
.scroll-buttons { display: flex; gap: 5px; margin-bottom: 5px; }
.scroll-btn { 
    background: #2196f3; 
    color: white; 
    border: none; 
    border-radius: 3px; 
    padding: 4px 8px; 
    cursor: pointer; 
    font-size: 12px; 
    flex: 1;
    transition: all 0.2s ease;
}
.scroll-btn:hover:not(:disabled) { background: #1976d2; }
.scroll-btn:disabled { background: #ccc; color: #999; cursor: not-allowed; opacity: 0.5; }
.word-item {
    background: #fff;
    padding: 4px 8px;
    margin: 2px 0;
    border-radius: 5px;
    cursor: grab;
    border: 2px solid #ddd;
    transition: all var(--vf-duration-normal) var(--vf-ease-smooth);
    text-align: center;
    font-weight: bold;
    font-size: 12px;
    position: relative;
    will-change: transform, background-color, border-color;
    transform: translateZ(0);
}
.word-item:hover {
    background: #e3f2fd;
    border-color: var(--vf-color-highlight);
    transform: translateY(-2px) scale(var(--vf-scale-hover));
    box-shadow: var(--vf-shadow-hover);
}
.word-item.dragging {
    opacity: 0.5;
    transform: rotate(5deg) translateZ(0);
    will-change: transform;
}
.word-item.unplayable {
    background-color: #e0e0e0;
    color: #9e9e9e;
    border-color: #ccc;
    cursor: not-allowed;
    pointer-events: none;
    opacity: var(--vf-opacity-disabled);
    filter: grayscale(0.5);
    transition: all var(--vf-duration-normal) var(--vf-ease-smooth);
}

/* NEUER STIL ZUR HERVORHEBUNG VON BONUSWÖRTERN */
.word-item.is-bonus {
    border-color: #ffd700; /* Gold */
    border-width: 2px;
    box-shadow: 0 0 6px rgba(255, 215, 0, 0.7); /* Leichter goldener Schein */
    background: #fffbef; /* Sehr heller, warmer Hintergrund */
}

.reset-btn {
    background: #ff5722;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    margin-top: 10px;
    width: 100%;
    flex-shrink: 0;
    transition: all var(--vf-duration-fast) var(--vf-ease-smooth);
    will-change: transform, background-color;
    transform: translateZ(0);
}
.reset-btn:hover {
    background: #d84315;
    transform: translateY(-1px) scale(var(--vf-scale-hover));
    box-shadow: var(--vf-shadow-hover);
}
.reset-btn:active {
    transform: translateY(0) scale(var(--vf-scale-active));
}
.test-btn {
    background: #4caf50;
    margin-top: 5px;
}
.test-btn:hover {
    background: #388e3c;
}
.legend-container { margin-top: 30px; padding-top: 20px; border-top: 1px solid #e0e0e0; }
.legend-container h3 { text-align: center; margin-top: 0; margin-bottom: 20px; color: #333; font-size: 1.3em; }
.legend-items { display: flex; flex-wrap: wrap; justify-content: center; gap: 15px 30px; }
.legend-item { display: flex; align-items: center; }
.legend-symbol { width: 22px; height: 22px; border-radius: 4px; display: flex; align-items: center; justify-content: center; font-weight: bold; font-size: 10px; margin-right: 10px; flex-shrink: 0; }
.legend-symbol.bonus-1 { background: #ffeb3b; color: #333; } .legend-symbol.bonus-2 { background: #ff9800; color: white; } .legend-symbol.bonus-3 { background: #f44336; color: white; } .legend-symbol.bonus-swap { background: #9c27b0; color: white; } .legend-symbol.bonus-recycle { background: #8bc34a; color: white; font-size: 14px; } .legend-symbol.bonus-goal { background: #333; color: white; font-size: 14px; }
.legend-symbol.bonus-bomb { background: #616161; color: white; font-size: 14px; }
.legend-description { font-size: 14px; color: #555; text-align: left; }
.bonus-text { position: absolute; top: 0; left: 0; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 1.5em; color: #4caf50; font-weight: bold; opacity: 0; pointer-events: none; }
@keyframes plop-out {
    to {
        transform: scale(0) translateZ(0);
        opacity: 0;
    }
}
@keyframes fade-in-out {
    0%, 100% {
        opacity: 0;
        transform: scale(0.5) translateZ(0);
    }
    50% {
        opacity: 1;
        transform: scale(var(--vf-scale-emphasis)) translateZ(0);
    }
}
.is-animating-word {
    animation: plop-out var(--vf-duration-normal) var(--vf-ease-smooth) forwards;
    will-change: transform, opacity;
}
.is-animating-bonus {
    animation: fade-in-out var(--vf-duration-emphasis) var(--vf-ease-bounce) forwards;
    will-change: transform, opacity;
}
.is-wobbling {
    animation: wobble var(--vf-duration-slow) var(--vf-ease-smooth) infinite;
    will-change: transform;
}
@keyframes wobble {
    0%, 100% { transform: rotate(0deg) translateZ(0); }
    25% { transform: rotate(3deg) translateZ(0); }
    75% { transform: rotate(-3deg) translateZ(0); }
}
.is-exploding {
    animation: explode var(--vf-duration-slow) var(--vf-ease-smooth) forwards;
    will-change: transform, opacity;
}
@keyframes explode {
    0% {
        transform: scale(1) rotate(0) translateZ(0);
        opacity: 1;
    }
    50% {
        transform: scale(var(--vf-scale-emphasis)) rotate(15deg) translateZ(0);
    }
    100% {
        transform: scale(0) rotate(-90deg) translateZ(0);
        opacity: 0;
    }
}
.settings-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 24px;
    cursor: pointer;
    background: none;
    border: none;
    color: #aaa;
    transition: all var(--vf-duration-normal) var(--vf-ease-smooth);
    will-change: transform, color;
    transform: translateZ(0);
}
.settings-btn:hover {
    color: #333;
    transform: scale(var(--vf-scale-hover)) translateZ(0);
}
.settings-dialog { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); z-index: 300; display: none; align-items: center; justify-content: center; }
.settings-dialog.active { display: flex; }
.settings-modal { background: white; padding: 25px 35px; border-radius: 10px; box-shadow: 0 5px 15px rgba(0,0,0,0.3); position: relative; }
.settings-modal h2 { margin-top: 0; margin-bottom: 10px; }
.settings-modal h2:not(:first-of-type) { margin-top: 20px; }
.settings-modal .close-btn { position: absolute; top: 10px; right: 15px; font-size: 24px; cursor: pointer; border: none; background: none; color: #aaa; }
.lang-options { display: flex; gap: 10px; margin-top: 10px; }
.lang-btn {
    padding: 10px 20px;
    border: 2px solid #ddd;
    background: #f0f0f0;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    transition: all var(--vf-duration-fast) var(--vf-ease-smooth);
    will-change: transform, background-color, border-color;
    transform: translateZ(0);
}
.lang-btn:hover {
    border-color: var(--vf-color-highlight);
    transform: translateY(-1px) scale(var(--vf-scale-hover));
    box-shadow: var(--vf-shadow-hover);
}
.lang-btn:active {
    transform: translateY(0) scale(var(--vf-scale-active));
}
.lang-btn.active {
    background: var(--vf-color-highlight);
    color: white;
    border-color: var(--vf-color-highlight);
}
.vf-valid-bonus-position {
  outline: 3px solid var(--vf-color-valid);
  outline-offset: -3px;
  box-shadow: 0 0 12px var(--vf-color-valid), inset 0 0 8px rgba(76, 175, 80, 0.5);
  transform: scale(1.1);
  transition: all var(--vf-duration-fast) var(--vf-ease-smooth);
  will-change: transform, box-shadow, outline;
  z-index: 10;
  position: relative;
}

/* ===== RESPONSIVE DESIGN ===== */

/* Tablet Portrait und kleine Desktops */
@media screen and (max-width: 1024px) {
  .game-container {
    max-width: 100%;
    padding: 10px;
    margin: 0 5px;
  }
  
  .game-header h1 {
    font-size: 2em;
  }
  
  .game-info {
    font-size: 0.9em;
    gap: 10px 15px;
  }
  
  .game-board {
    gap: 15px;
  }
  
  .word-list {
    width: 180px;
  }
}

/* Mobile Landscape */
@media screen and (max-width: 768px) and (orientation: landscape) {
  body {
    padding: 5px;
  }
  
  .game-container {
    padding: 10px;
    min-height: calc(100vh - 10px);
  }
  
  .game-header {
    margin-bottom: 10px;
  }
  
  .game-header h1 {
    font-size: 1.5em;
  }
  
  .game-info {
    font-size: 0.8em;
    gap: 5px 10px;
    margin-bottom: 10px;
  }
  
  .game-board {
    gap: 10px;
  }
  
  .word-list {
    width: 160px;
    max-height: calc(100vh - 20px);
    font-size: 0.9em;
  }
  
  .word-list h3 {
    font-size: 12px;
    margin-bottom: 5px;
  }
  
  .word-item {
    font-size: 11px;
    padding: 3px 6px;
  }
  
  .reset-btn {
    font-size: 12px;
    padding: 5px 10px;
  }
  
  .legend-container {
    margin-top: 15px;
  }
  
  .legend-items {
    gap: 8px 15px;
  }
  
  .legend-description {
    font-size: 12px;
  }
  
  .settings-btn {
    top: 10px;
    right: 15px;
    font-size: 20px;
  }
}

/* Mobile Portrait */
@media screen and (max-width: 768px) and (orientation: portrait) {
  body {
    padding: 5px;
  }
  
  .game-container {
    padding: 10px;
    min-height: calc(100vh - 10px);
  }
  
  .game-header {
    margin-bottom: 10px;
  }
  
  .game-header h1 {
    font-size: 1.8em;
  }
  
  .game-info {
    font-size: 0.85em;
    gap: 8px 12px;
    margin-bottom: 10px;
  }
  
  .game-board {
    flex-direction: column;
    align-items: center;
    gap: 15px;
  }
  
  .board-container {
    order: 2;
    width: 100%;
  }
  
  .word-list {
    order: 1;
    width: 100%;
    max-width: 400px;
    max-height: 200px;
    position: static;
    margin-bottom: 10px;
  }
  
  .legend-container {
    margin-top: 15px;
  }
  
  .legend-items {
    gap: 10px 20px;
  }
  
  .legend-description {
    font-size: 12px;
  }
  
  .settings-btn {
    top: 5px;
    right: 10px;
    font-size: 18px;
  }
}

/* Sehr kleine Handys */
@media screen and (max-width: 480px) {
  .game-header h1 {
    font-size: 1.5em;
  }
  
  .game-info {
    font-size: 0.8em;
    gap: 5px 8px;
  }
  
  .info-item {
    text-align: center;
    min-width: 80px;
  }
  
  .word-list {
    max-height: 150px;
  }
  
  .word-item {
    font-size: 10px;
    padding: 2px 5px;
  }
  
  .reset-btn {
    font-size: 11px;
    padding: 4px 8px;
  }
  
  .legend-items {
    gap: 8px 12px;
  }
  
  .legend-description {
    font-size: 11px;
  }
  
  .settings-modal {
    padding: 15px 20px;
    margin: 10px;
    max-width: calc(100vw - 20px);
  }
  
  .lang-options {
    flex-wrap: wrap;
    gap: 8px;
  }
  
  .lang-btn {
    padding: 8px 16px;
    font-size: 0.9em;
  }
}

/* Touch-optimierte Verbesserungen */
@media (hover: none) and (pointer: coarse) {
  .word-item {
    padding: 6px 10px;
    margin: 3px 0;
    min-height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .reset-btn, .test-btn {
    min-height: 44px;
    padding: 10px 15px;
  }
  
  .settings-btn {
    font-size: 28px;
    padding: 10px;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .lang-btn {
    min-height: 44px;
    min-width: 60px;
  }
}

/* Verhindert Zoom bei doppelten Taps auf Touch-Geräten */
@media screen and (max-width: 768px) {
  .word-item, .reset-btn, .lang-btn, .settings-btn {
    touch-action: manipulation;
  }
  
  body {
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
  }
}
