/* Reset und Basis-Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
}
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
/* Header Styles */
header {
    text-align: center;
    margin-bottom: 3rem;
    padding: 2rem 0;
}
h1 {
    font-size: 3.5rem;
    font-weight: 700;
    color: white;
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}
.subtitle {
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 400;
}
/* Main Content */
main {
    flex: 1;
}
.dice-section {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 24px;
    padding: 3rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}
/* Würfel Button */
.dice-button-container {
    text-align: center;
    margin-bottom: 3rem;
}
.dice-button {
    position: relative;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #ff6b6b, #ee5a52);
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 8px 20px rgba(238, 90, 82, 0.3);
    overflow: hidden;
}
.dice-button:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 12px 30px rgba(238, 90, 82, 0.4);
}
.dice-button:active {
    transform: translateY(0) scale(0.98);
}
.button-text {
    position: relative;
    z-index: 2;
}
.button-glow {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.3) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
}
.dice-button:hover .button-glow {
    opacity: 1;
}
/* Controls */
.controls {
    margin-bottom: 3rem;
}
.control-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    max-width: 600px;
    margin: 0 auto;
}
.control-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}
.control-item:hover {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(102, 126, 234, 0.3);
    transform: translateY(-1px);
}
.control-item input[type="checkbox"] {
    display: none;
}
.checkmark {
    width: 20px;
    height: 20px;
    border: 2px solid #ddd;
    border-radius: 4px;
    position: relative;
    transition: all 0.3s ease;
}
.control-item input[type="checkbox"]:checked + .checkmark {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-color: #667eea;
}
.control-item input[type="checkbox"]:checked + .checkmark::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
}
.control-text {
    font-weight: 500;
    color: #333;
}
/* Sortier-Buttons */
.sort-controls {
    text-align: center;
    margin-bottom: 2rem;
}
.sort-button {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    margin: 0 0.5rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}
.sort-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(76, 175, 80, 0.4);
}
.sort-button:active {
    transform: translateY(0);
}
/* Export Button (neuer Stil, passend zum "Sortieren beenden"-Stil) */
.export-button {
    background: linear-gradient(135deg, #5cb85c, #4cae4c); /* Grün-Ton, passend */
    box-shadow: 0 4px 12px rgba(92, 184, 92, 0.3);
}
.export-button:hover {
    box-shadow: 0 6px 16px rgba(92, 184, 92, 0.4);
}
/* Würfel Container */
.dice-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    justify-items: center;
    max-width: 1000px;
    margin: 0 auto;
}
.dice-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    cursor: move;
    transition: all 0.3s ease;
}
.dice-item:hover {
    transform: translateY(-2px);
}
.dice-item.dragging {
    opacity: 0.5;
    transform: rotate(5deg);
}
.dice {
    width: 180px;
    height: 180px;
    border: 3px solid #e0e0e0;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
    margin-bottom: 1rem;
    cursor: pointer;
}
.dice:hover {
    border-color: #667eea;
    box-shadow: 0 12px 30px rgba(102, 126, 234, 0.25);
}
/* Im Sortier-Modus zählt das Ziehen, nicht das Würfeln */
.dice-container.sortable .dice {
    cursor: grab;
}
.dice::before {
    content: attr(data-category);
    position: absolute;
    top: 8px;
    left: 8px;
    right: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #666;
    text-align: center;
    opacity: 0.8;
}
.dice img {
    max-width: 120px;
    max-height: 120px;
    object-fit: contain;
    border-radius: 8px;
}
.dice.rolling {
    transform: rotate(360deg) scale(1.1);
    border-color: #667eea;
    box-shadow: 0 12px 30px rgba(102, 126, 234, 0.3);
}
/* Versteckte Würfel */
.dice-item[style*="display: none"] {
    display: none !important;
}
/* Textfelder - Ersetzt den bestehenden .dice-text Abschnitt */
.dice-text {
    width: 180px;
    min-height: 80px;
    max-height: 300px; /* Maximale Höhe für sehr lange Texte */
    padding: 0.8rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: inherit;
    resize: none; /* Automatisches Resize deaktivieren */
    overflow-y: auto; /* Scrollbar bei Bedarf */
    transition: all 0.3s ease;
    background: white;
    line-height: 1.4;
    box-sizing: border-box;
}
.dice-text:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}
.dice-text::placeholder {
    color: #999;
    font-style: italic;
}
/* Order Indicator */
.order-indicator {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 30px;
    height: 30px;
    background: linear-gradient(135deg, #ff6b6b, #ee5a52);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.8rem;
    box-shadow: 0 2px 8px rgba(238, 90, 82, 0.3);
    opacity: 0;
    transition: opacity 0.3s ease;
}
.dice-item.show-order .order-indicator {
    opacity: 1;
}
/* Footer */
footer {
    margin-top: 3rem;
    padding: 2rem 0;
}
.footer-content {
    text-align: center;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
    max-width: 800px;
    margin: 0 auto;
}
.footer-content p {
    margin-bottom: 0.5rem;
}
.footer-content strong {
    color: white;
}
/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    h1 {
        font-size: 2.5rem;
    }
    .dice-section {
        padding: 2rem;
        border-radius: 16px;
    }
    .dice-button {
        width: 100px;
        height: 100px;
        font-size: 1rem;
    }
    .control-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .dice-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    .dice {
        width: 150px;
        height: 150px;
        margin-bottom: 0.8rem;
    }
    .dice img {
        max-width: 100px;
        max-height: 100px;
    }
    /* Responsive Anpassungen - Ersetzt den entsprechenden Teil in den Media Queries */
    .dice-text {
        width: 150px;
        min-height: 60px;
        max-height: 250px;
    }
    .sort-button {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
        margin: 0.2rem;
    }
}
@media (max-width: 480px) {
    h1 {
        font-size: 2rem;
    }
    .dice-section {
        padding: 1.5rem;
    }
    .control-grid {
        grid-template-columns: 1fr;
    }
    .dice-container {
        grid-template-columns: 1fr;
    }
}
/* Animationen */
@keyframes rollAnimation {
    0% {
        transform: rotate(0deg) scale(1);
    }
    25% {
        transform: rotate(90deg) scale(1.05);
    }
    50% {
        transform: rotate(180deg) scale(1.1);
    }
    75% {
        transform: rotate(270deg) scale(1.05);
    }
    100% {
        transform: rotate(360deg) scale(1);
    }
}
.dice.rolling {
    animation: rollAnimation 1s cubic-bezier(0.4, 0, 0.2, 1);
}
/* Fade-in Animation für Bilder */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}
.dice img {
    animation: fadeIn 0.5s ease-out;
}
/* Drag and Drop Styles */
.dice-container.sortable .dice-item {
    cursor: grab;
}
.dice-container.sortable .dice-item:active {
    cursor: grabbing;
}
.drop-zone {
    border: 2px dashed #667eea;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 16px;
}
