body {
  font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  text-align: center;
  background-color: #0C1016;
  background-size: 400% 400%;
  animation: gradientShift 20s ease infinite;
  color: white;
  min-height: 100vh;
  margin: 0;
  padding: 0;
  position: relative;
  overflow-x: hidden;
}
/*
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(79, 140, 255, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 40% 60%, rgba(28, 181, 224, 0.06) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}*/

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

* {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    scrollbar-color: #0f1419 linear-gradient(135deg, #0f1419 0%, #1a2332 25%, #2d4a66 50%, #1a2332 75%, #0f1419 100%);
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: #fff;
    padding: 20px;
    border-radius: 10px;
    min-width: 300px;
    box-shadow: 0 0 20px rgba(0,0,0,0.2);
}

/* Tooltips und Modals */
#field-tooltip {
    display: none;
    position: fixed;
    z-index: 9999;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border: none;
    padding: 0.8em 1.2em;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15), 0 0 0 1px rgba(255,255,255,0.1);
    font-size: 0.95em;
    pointer-events: none;
    backdrop-filter: blur(10px);
    color: #333;
    font-weight: 500;
}

#name-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
}

#name-modal .modal-content {
    background: #24354B;
    padding: 2.5em 3em;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3), 
                0 0 0 1px rgba(255,255,255,0.1);
    text-align: center;
    border: 1px solid rgba(255,255,255,0.1);
}

#name-input {
    font-size: 1.2em;
    padding: 0.8em 1.2em;
    border-radius: 12px;
    border: 2px solid rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.1);
    color: white;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

#name-input:focus {
    border-color: #4f8cff;
    background: rgba(255,255,255,0.15);
    outline: none;
    box-shadow: 0 0 0 3px rgba(79,140,255,0.2);
}

#name-confirm-btn {
    font-size: 1.1em;
    padding: 0.8em 2.5em;
    border-radius: 12px;
    background: linear-gradient(135deg, #4f8cff 0%, #1cb5e0 100%);
    border: none;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 1em;
}

#name-confirm-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(79,140,255,0.3);
}

#name-error {
    color: #ff6b6b;
    margin-top: 0.8em;
    display: none;
    font-weight: 500;
}

/* Login Options Styling */
.login-options {
    margin: 2em 0;
}

.login-option {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    padding: 1.5em;
    margin: 1em 0;
    text-align: center;
    transition: all 0.3s ease;
}

.login-option:hover {
    border-color: rgba(255, 255, 255, 0.4);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0.1) 100%);
    transform: translateY(-2px);
}

.discord-option {
    border-color: rgba(88, 101, 242, 0.4);
}

.discord-option:hover {
    border-color: rgba(88, 101, 242, 0.6);
    background: linear-gradient(135deg, rgba(88, 101, 242, 0.1) 0%, rgba(88, 101, 242, 0.05) 100%);
}

.guest-option {
    border-color: rgba(156, 163, 175, 0.4);
}

.guest-option:hover {
    border-color: rgba(156, 163, 175, 0.6);
    background: linear-gradient(135deg, rgba(156, 163, 175, 0.1) 0%, rgba(156, 163, 175, 0.05) 100%);
}

.login-option h3 {
    margin: 0 0 0.5em 0;
    font-size: 1.2em;
    color: white;
}

.login-option p {
    margin: 0 0 1em 0;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.95em;
}

.login-divider {
    text-align: center;
    margin: 1.5em 0;
    position: relative;
    display: flex;
    align-items: center;
}

.login-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-50%);
}

.login-divider span {
    background: #24354B;
    padding: 0 1em;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9em;
    position: relative;
    z-index: 1;
    margin: 0 auto;
}

.guest-btn {
    background: linear-gradient(135deg, #6b7280 0%, #9ca3af 100%);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 1em 2em;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.guest-btn:hover {
    background: linear-gradient(135deg, #9ca3af 0%, #6b7280 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(107, 114, 128, 0.3);
}

#name-input-section {
    margin-top: 2em;
    padding-top: 2em;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

#name-section-title {
    color: white;
    margin-bottom: 1em;
    font-size: 1.1em;
}

/* Discord Info Banner */
#discord-info-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #5865F2 0%, #4752C4 100%);
    color: white;
    padding: 0.8em 1em;
    text-align: center;
    font-size: 0.9em;
    font-weight: 500;
    z-index: 1001;
    box-shadow: 0 2px 10px rgba(88, 101, 242, 0.3);
    display: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

#discord-info-banner:hover {
    background: linear-gradient(135deg, #4752C4 0%, #5865F2 100%);
    box-shadow: 0 4px 15px rgba(88, 101, 242, 0.4);
}

#discord-info-banner .banner-icon {
    margin-right: 0.5em;
    font-size: 1.1em;
}

#discord-info-banner .banner-text {
    display: inline;
}

#discord-info-banner .banner-action {
    margin-left: 0.5em;
    font-weight: 600;
    text-decoration: underline;
}

/* Anpassung für Body wenn Banner sichtbar ist */
body.discord-banner-visible {
    padding-top: 3.2em;
}

body.discord-banner-visible #lobby {
    margin-top: 50px;
}

/* Settings Button bleibt unten rechts, auch mit Banner */
#settings-section {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
}

/* Settings Section */
#settings-section {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
}

#settings-btn {
    font-size: 1.5em;
    padding: 0.6em;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    cursor: pointer;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 32px rgba(102,126,234,0.3);
    transition: all 0.3s ease;
}

#settings-btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 12px 40px rgba(102,126,234,0.4);
}

/* Settings Modal */
#settings-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(5px);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}

#settings-modal .modal-content {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    padding: 2.5em;
    border-radius: 20px;
    box-shadow: 0 25px 80px rgba(0,0,0,0.15), 
                0 0 0 1px rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    max-width: 500px;
    width: 90%;
}

#settings-modal h2 {
    margin-top: 0;
    color: black;
}

/* Settings Tabelle */
.settings-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    border: none;
    border-radius: 1em;
    overflow: hidden;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 251, 255, 0.95) 100%);
    backdrop-filter: blur(10px);
}

.settings-table td {
    border: none;
    padding: 1.2em 1em;
    vertical-align: middle;
    border-bottom: 1px solid rgba(79, 140, 255, 0.1);
    transition: background 0.2s ease;
}

.settings-table tr:hover td {
    background: rgba(79, 140, 255, 0.05);
}

.settings-table tr:last-child td {
    border-bottom: none;
}

.settings-table .setting-label {
    padding: 1.2em 1.5em 1.2em 1.5em;
    font-weight: 600;
    color: #234;
    text-align: left;
    width: 140px;
    min-width: 140px;
    font-size: 1.05em;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

.settings-table .setting-value {
    text-align: left;
    padding-right: 1.5em;
}

/* Name Input Container */
.name-input-container {
    display: flex;
    align-items: center;
    gap: 0.5em;
}

#settings-name-input {
    flex: 1;
    padding: 0.8em 1em;
    border: 2px solid rgba(79, 140, 255, 0.3);
    border-radius: 1em;
    font-size: 1em;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    color: #234;
}

#settings-name-input:focus {
    border-color: #1cb5e0;
    box-shadow: 0 0 0 3px rgba(28, 181, 224, 0.2);
    background: rgba(255, 255, 255, 1);
    transform: translateY(-1px);
}

#settings-name-confirm-btn {
    display: none;
    padding: 0.5em 0.8em;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 0.3em;
    cursor: pointer;
    white-space: nowrap;
}

#settings-name-error {
    display: none;
    color: red;
    margin-top: 0.5em;
    font-size: 0.9em;
}

/* Discord Button */
#discord-connect-btn {
    padding: 0.4em 0.8em;
    background: #5865F2;
    color: white;
    border: none;
    border-radius: 0.3em;
    cursor: pointer;
    font-size: 0.9em;
    display: flex;
    align-items: center;
    gap: 0.5em;
}

.discord-container {
    display: flex;
    align-items: center;
    gap: 0.5em;
}

#discord-status {
    color: #666;
    font-weight: normal;
    display: none;
}

.coming-soon {
    color: #666;
    font-weight: normal;
}

/* Close Button Container */
.settings-close-container {
    text-align: center;
    margin-top: 2em;
}

#settings-close-btn {
    padding: 0.5em 1em;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 0.3em;
    cursor: pointer;
}

/* Discord Login Modal */
#discord-login-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}

.discord-modal {
    max-width: 500px;
    width: 90%;
    background: white;
    border-radius: 1em;
    padding: 2em;
    text-align: center;
}

.discord-modal h2 {
    color: #5865F2;
    margin-bottom: 1.5em;
}

.discord-info {
    text-align: left;
    margin-bottom: 2em;
    padding: 1em;
    background: #f8f9fa;
    border-radius: 0.5em;
    border-left: 4px solid #5865F2;
}

.discord-info p {
    margin: 0 0 1em 0;
    color: #333;
    font-weight: bold;
}

.discord-info ul {
    margin: 0;
    padding-left: 1.5em;
    color: #555;
}

.discord-info li {
    margin: 0.5em 0;
}

.discord-login-buttons {
    display: flex;
    gap: 1em;
    justify-content: center;
    flex-wrap: wrap;
}

.discord-primary-btn {
    background: #5865F2;
    color: white;
    border: none;
    border-radius: 0.5em;
    padding: 1em 2em;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5em;
    transition: all 0.2s ease;
    margin: 0 auto;
}

.discord-primary-btn:hover {
    background: #4752C4;
    transform: translateY(-2px);
}

.discord-secondary-btn {
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 0.5em;
    padding: 1em 2em;
    font-size: 1.1em;
    cursor: pointer;
    transition: all 0.2s ease;
}

.discord-secondary-btn:hover {
    background: #545b62;
    transform: translateY(-2px);
}

/* Discord Verification Section */
.verification-info {
    text-align: left;
    margin-bottom: 1.5em;
    padding: 1em;
    background: #f8f9fa;
    border-radius: 0.5em;
    border-left: 4px solid #28a745;
}

.verification-info p {
    margin: 0 0 0.5em 0;
    color: #333;
    font-weight: bold;
}

.verification-info ol {
    margin: 0.5em 0 0 0;
    padding-left: 1.5em;
    color: #555;
}

.verification-info li {
    margin: 0.3em 0;
}

.verification-info code {
    background: #e9ecef;
    padding: 0.2em 0.4em;
    border-radius: 0.3em;
    font-family: monospace;
    color: #d63384;
    font-weight: bold;
}

.verification-input {
    margin-bottom: 1.5em;
}

.verification-input label {
    display: block;
    margin-bottom: 0.5em;
    color: #333;
    font-weight: bold;
}

#verification-code-input {
    width: 100%;
    padding: 0.8em;
    border: 2px solid #ced4da;
    border-radius: 0.5em;
    font-size: 1.1em;
    text-align: center;
    font-family: monospace;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    transition: all 0.3s ease;
}

#verification-code-input:focus {
    border-color: #28a745;
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.25);
    outline: none;
}

.verification-buttons {
    display: flex;
    gap: 1em;
    justify-content: center;
    flex-wrap: wrap;
}

#verification-error {
    color: #dc3545;
    font-size: 0.9em;
    margin-top: 0.5em;
    text-align: center;
    font-weight: bold;
}

.error-message {
    color: #dc3545;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 0.5em;
    padding: 0.5em;
    margin-top: 0.5em;
}

.success-message {
    color: #28a745 !important;
    background: #d4edda !important;
    border: 1px solid #c3e6cb !important;
    border-radius: 0.5em;
    padding: 0.5em;
    margin-top: 0.5em;
}

/* Bestenliste - unter dem Spiel Container */
#highscore-section {
    position: relative;
    width: 100%;
    max-width: 800px;
    margin: 2em auto 0 auto;
    padding: 0 1em;
    z-index: 1000;
}

.highscore-container {
    background: transparent;
    color: #e5e7eb;
    padding: 2em 1.5em;
    border-radius: 20px;
    border: none;
    box-shadow: none;
}

.highscore-title {
    margin: 0 0 1.5em 0;
    text-align: center;
    font-size: 1.4em;
    font-weight: 700;
    color: #f3f4f6;
}

.highscore-discord-notice {
    text-align: center;
    color: #5865F2;
    font-size: 0.85em;
    margin-bottom: 1.2em;
    padding: 0.8em 1em;
    background: linear-gradient(135deg, rgba(88, 101, 242, 0.1) 0%, rgba(88, 101, 242, 0.05) 100%);
    border-radius: 12px;
    border: 1px solid rgba(88, 101, 242, 0.2);
    transition: all 0.3s ease;
    font-weight: 500;
    backdrop-filter: blur(10px);
}

.highscore-discord-notice:hover {
    background: linear-gradient(135deg, rgba(88, 101, 242, 0.15) 0%, rgba(88, 101, 242, 0.1) 100%);
    border: 1px solid rgba(88, 101, 242, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(88, 101, 242, 0.15);
}

#highscore-list {
    font-size: 0.95em;
    color: #d1d5db;
}

.highscore-loading {
    text-align: center;
    color: #9ca3af;
    padding: 0.8em;
}

/* Game Area */
#game-area {
    display: none;
}

#back-btn {
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 1000;
    display: block;
}

/* Back button positioning when Discord banner is visible */
body.discord-banner-visible #back-btn {
    top: 60px;
}

#back-btn button {
    font-size: 1.5em;
    padding: 0.3em 0.7em;
    border-radius: 1em;
    border: none;
    background: #eee;
    cursor: pointer;
}

/* Game Over Overlay */
#game-over-overlay {
    display: none;
}

.game-over-buttons {
    display: flex;
    gap: 1em;
    justify-content: center;
    margin-top: 1.5em;
}

/* Scorecard Container */
#scorecard-container h2 {
    margin: 0 0 10px 0;
}

/* Roll Button */
#roll {
    margin-top: 10px;
}

.lobby-code {
    filter: blur(4px);
    transition: filter 0.3s ease;
    cursor: pointer;
}

.lobby-code:hover {
    filter: blur(0px);
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 30px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-switch .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.4s;
    border-radius: 30px;
}

.toggle-switch .slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: 0.4s;
    border-radius: 50%;
}

.toggle-switch input:checked + .slider {
    background-color: #007bff;
}

.toggle-switch input:checked + .slider:before {
    transform: translateX(30px);
}


/* Discord Avatar Styling */
.discord-avatar {
    transition: transform 0.2s ease;
}

.discord-avatar:hover {
    transform: scale(1.1);
}

/* Eingabefelder sollen weiterhin markierbar bleiben */
input, textarea {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

/* Textarea Styling */
textarea {
    padding: 0.8em 1.2em;
    border: 2px solid rgba(79, 140, 255, 0.3);
    border-radius: 1.5em;
    font-size: 1.1em;
    margin: 0.3em 0.2em;
    outline: none;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(79, 140, 255, 0.1);
    color: #234;
    font-family: inherit;
    resize: vertical;
    min-height: 120px;
}

textarea:focus {
    border: 2px solid #1cb5e0;
    box-shadow: 0 0 0 3px rgba(28, 181, 224, 0.2), 0 8px 25px rgba(79, 140, 255, 0.15);
    background: rgba(255, 255, 255, 1);
    transform: translateY(-2px);
}

/* Würfelanimationen */
@keyframes diceRoll {
    0% { 
        transform: rotate(0deg) scale(1); 
        background: white;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }
    25% { 
        transform: rotate(90deg) scale(1.05) translateY(-3px); 
        background: #f5f5f5;
        box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    }
    50% { 
        transform: rotate(180deg) scale(1.1) translateY(-5px); 
        background: #e8e8e8;
        box-shadow: 0 6px 12px rgba(0,0,0,0.2);
    }
    75% { 
        transform: rotate(270deg) scale(1.05) translateY(-3px); 
        background: #f0f0f0;
        box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    }
    100% { 
        transform: rotate(360deg) scale(1) translateY(0px); 
        background: white;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }
}

@keyframes diceShake {
    0%, 100% { transform: translateX(0) rotate(0deg); }
    10% { transform: translateX(-2px) rotate(-1deg); }
    20% { transform: translateX(2px) rotate(1deg); }
    30% { transform: translateX(-2px) rotate(-0.5deg); }
    40% { transform: translateX(2px) rotate(0.5deg); }
    50% { transform: translateX(-1px) rotate(-0.5deg); }
    60% { transform: translateX(1px) rotate(0.5deg); }
    70% { transform: translateX(-1px) rotate(-0.5deg); }
    80% { transform: translateX(1px) rotate(0.5deg); }
    90% { transform: translateX(-0.5px) rotate(0deg); }
}

.die.rolling {
    animation: diceRoll 0.6s ease-out;
    transform-origin: center;
    z-index: 10;
    position: relative;
}

.die.shaking {
    animation: diceShake 0.4s ease-in-out;
}

/* Startseiten-Container */
#lobby {
  max-width: 480px;
  margin: 80px auto 0 auto;
  background: linear-gradient(135deg, rgba(255,255,255,0.8) 0%, rgba(248,250,252,0.95) 100%);

  border-radius: 24px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.1), 
              0 8px 32px rgba(0,0,0,0.05),
              0 0 0 1px rgba(255,255,255,0.2);
  padding: 3em 2.5em 2.5em 2.5em;
  text-align: center;
  border: 1px solid rgba(255,255,255,0.3);
  backdrop-filter: blur(20px);
  position: relative;
  overflow: hidden;
}

#lobby::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
  border-radius: 24px 24px 0 0;
}

#lobby h1 {
  font-size: 2.5em;
  margin-bottom: 1.5em;
  font-weight: 700;
  letter-spacing: -0.5px;
  text-shadow: none;
  color: #234;
}

#lobby button {
  display: block;
  width: 100%;
  margin: 1em auto;
  font-size: 1.1em;
  padding: 1em 0;
  border-radius: 16px;
  border: none;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  font-weight: 600;
  box-shadow: 0 8px 32px rgba(102,126,234,0.25);
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

#lobby button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left 0.5s;
}

#lobby button:hover::before {
  left: 100%;
}

#lobby button:hover {
  background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
  transform: translateY(-3px);
  box-shadow: 0 12px 40px rgba(102,126,234,0.35);
}

#lobby label, #lobby input, #lobby select {
  font-size: 1.1em;
  margin-top: 0.8em;
  color: #374151;
  font-weight: 500;
}

/* Bestenliste für alle Bildschirmgrößen - unter dem Spiel */
#highscore-section {
  position: relative !important;
  bottom: auto !important;
  left: auto !important;
  transform: none !important;
  right: auto !important;
  max-width: 600px !important;
  min-width: 320px !important;
  width: 95% !important;
  margin: 8em auto 3em auto !important;
  padding: 0 1.5em !important;
  z-index: 500 !important;
}

#highscore-section > div {
  max-width: 500px !important;
  margin: 0 auto !important;
  border-radius: 20px !important;
  background: linear-gradient(135deg, rgba(45, 55, 72, 0.95) 0%, rgba(55, 65, 81, 0.95) 100%);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(79, 140, 255, 0.3);
  box-shadow: 0 20px 60px rgba(0,0,0,0.3), 
              0 8px 32px rgba(0,0,0,0.2);
  overflow: hidden;
  position: relative;
}

#highscore-section > div::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
}

@media (max-width: 768px) {
  /* Mobile Layout */
  body {
    padding: 0;
    margin: 0;
  }

  /* Discord Banner Mobile Anpassung */
  #discord-info-banner {
    font-size: 0.8em;
    padding: 0.6em 0.8em;
  }

  body.discord-banner-visible {
    padding-top: 2.8em;
  }

  body.discord-banner-visible #lobby {
    margin-top: 20px;
  }

  /* Settings Button - oben mittig */
  #settings-section {
    position: fixed !important;
    top: 16px !important;
    left: 50% !important;
    right: auto !important;
    bottom: auto !important;
    transform: translateX(-50%) !important;
    z-index: 1000;
  }

  /* Lobby - über die ganze Breite */
  #lobby {
    max-width: 100vw !important;
    margin: 80px 0 0 0 !important;
    padding: 1.5em 1em !important;
    border-radius: 0 !important;
    border: none !important;
    box-shadow: none !important;
    background: rgba(255,255,255,0.95) !important;
    min-height: auto !important;
  }
  
  #lobby h1 {
    font-size: 1.8em !important;
    margin-bottom: 1em !important;
  }

  #lobby button {
    width: 100% !important;
    font-size: 1.1em !important;
    padding: 1em 0 !important;
    margin: 0.5em 0 !important;
    border-radius: 0.5em !important;
  }

  /* Bestenliste - unter dem Lobby-Container im normalen Fluss für Mobile */
  #highscore-section {
    position: static !important;
    bottom: auto !important;
    left: auto !important;
    transform: none !important;
    right: auto !important;
    max-width: calc(100vw - 40px) !important;
    min-width: 280px !important;
    width: calc(100% - 40px) !important;
    margin: 60px auto 20px auto !important;
    padding: 0 !important;
    z-index: auto !important;
  }

  #highscore-section > div {
    max-width: 500px !important;
    margin: 0 auto !important;
    border-radius: 0.8em !important;
  }

  /* Verstecke Zoom-Funktionen */
  * {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
  }

  /* Ausnahme für Input-Felder */
  input, textarea {
    -webkit-user-select: text !important;
    -moz-user-select: text !important;
    -ms-user-select: text !important;
    user-select: text !important;
  }

  /* Settings Modal für Mobile */
  #settings-modal > div {
    width: 95% !important;
    max-width: 400px !important;
    margin: 0 auto !important;
    padding: 1.5em !important;
  }

  /* Name Modal für Mobile */
  #name-modal > div {
    width: 90% !important;
    max-width: 350px !important;
    padding: 1.5em !important;
  }

  #name-modal input {
    width: 90% !important;
    padding: 0.8em !important;
    font-size: 1.1em !important;
  }
}

@media (max-width: 600px) {
  #lobby {
    max-width: 98vw;
    padding: 1.2em 0.5em;
  }
  #lobby button {
    font-size: 1em;
    padding: 0.6em 0;
  }
}



#dice {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-top: 20px;
  margin-bottom: 1.5em;
}

#roll, 
#toggle-sound {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    border-radius: 16px;
    padding: 18px 36px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 8px 32px rgba(102,126,234,0.25);
    transition: all 0.3s ease;
    margin-bottom: 12px;
    position: relative;
    overflow: hidden;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#roll::before, 
#toggle-sound::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

#roll:hover::before,
#toggle-sound:hover::before {
    left: 100%;
}

#roll:hover, 
#toggle-sound:hover {
  background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
  box-shadow: 0 12px 40px rgba(102,126,234,0.35);
  transform: translateY(-3px);
}

#roll:disabled {
  background: linear-gradient(135deg, #9ca3af 0%, #6b7280 100%);
  color: #d1d5db;
  cursor: not-allowed;
  box-shadow: 0 4px 16px rgba(156,163,175,0.15);
  transform: none;
  opacity: 0.6;
}

#roll:disabled::before {
  display: none;
}



.active-player {
    background: #ffe066 !important;
    color: #222 !important;
    font-weight: bold !important;
}

.die {
  width: 70px;
  height: 70px;
  background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
  color: #374151;
  font-size: 28px !important;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  cursor: pointer;
  box-shadow: 0 8px 32px rgba(0,0,0,0.1), 
              0 4px 16px rgba(0,0,0,0.05),
              inset 0 1px 0 rgba(255,255,255,0.5);
  border: 2px solid rgba(255,255,255,0.3);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.die::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(45deg, transparent 30%, rgba(255,255,255,0.2) 50%, transparent 70%);
  transform: rotate(45deg);
  transition: all 0.6s ease;
  opacity: 0;
}

.die:hover::before {
  opacity: 1;
  animation: shimmer 0.6s ease;
}

@keyframes shimmer {
  0% { transform: translateX(-100%) rotate(45deg); }
  100% { transform: translateX(100%) rotate(45deg); }
}

.die:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 12px 40px rgba(0,0,0,0.15), 
              0 6px 20px rgba(0,0,0,0.1),
              inset 0 1px 0 rgba(255,255,255,0.6);
}

.die.held {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  color: white;
  box-shadow: 0 8px 32px rgba(240,147,251,0.3), 
              0 4px 16px rgba(240,147,251,0.2),
              inset 0 1px 0 rgba(255,255,255,0.3);
  border: 2px solid rgba(240,147,251,0.5);
}

.die.dice-dots {
  font-size: 45px;
  line-height: 1;
  padding: 2px;
}

.die.dice-dots img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 6px;
}

#dice {
    display: flex;
    justify-content: center;
    gap: 0.6em;
    margin-top: 20px;
}


td.clickable { 
    cursor: pointer; 
    background: linear-gradient(135deg, rgba(28, 181, 224, 0.1) 0%, rgba(79, 140, 255, 0.1) 100%);
    transition: all 0.3s ease;
}

td.clickable:hover {
    background: linear-gradient(135deg, rgba(28, 181, 224, 0.2) 0%, rgba(79, 140, 255, 0.2) 100%);
    transform: scale(1.02);
}

#scorecard-container {
  margin-top: 10px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 251, 255, 0.95) 100%);
  backdrop-filter: blur(15px);
  color: #234;
  max-width: 1000px;
  min-width: 400px;
  margin-inline: auto;
  padding: 12px 16px 16px 16px;
  border-radius: 1.5em;
  box-shadow: 0 8px 25px rgba(79, 140, 255, 0.15);
  border: 2px solid rgba(79, 140, 255, 0.1);
}



@media (max-width: 500px) {
  #scorecard-container {
    width: 100%;
    padding: 8px;
    font-size: 0.95rem;
  }
}

#scorecard {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border-radius: 1em;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(79, 140, 255, 0.1);
}

#scorecard td, #scorecard th {
  border: 1px solid rgba(79, 140, 255, 0.2);
  padding: 8px 6px;
  min-width: 85px;
  text-align: center;
  background: rgba(255, 255, 255, 0.8);
  transition: all 0.2s ease;
}

#scorecard th {
  background: linear-gradient(135deg, rgba(79, 140, 255, 0.1) 0%, rgba(28, 181, 224, 0.1) 100%);
  font-size: 1.05em;
  font-weight: 600;
  color: #234;
  border-bottom: 2px solid rgba(79, 140, 255, 0.3);
}

#scorecard th:first-child,
#scorecard td:first-child {
    min-width: 140px;
    max-width: 180px;
    font-weight: 600;
    font-size: 1em;
    background: linear-gradient(135deg, rgba(79, 140, 255, 0.08) 0%, rgba(28, 181, 224, 0.08) 100%);
    color: #234;
}

.score-row {
  cursor: pointer;
  transition: all 0.2s ease;
}

.score-row:hover {
  background: rgba(79, 140, 255, 0.05);
}

.score-row:hover td {
  background: rgba(79, 140, 255, 0.05);
  transform: translateX(2px);
}
.score-row.used {
  background-color: #ccc;
  cursor: not-allowed;
}

.score-row.available {
  background: linear-gradient(135deg, rgba(40, 167, 69, 0.1) 0%, rgba(25, 135, 84, 0.1) 100%);
  border-left: 3px solid #28a745;
}

.score-row.available:hover {
  background: linear-gradient(135deg, rgba(40, 167, 69, 0.2) 0%, rgba(25, 135, 84, 0.2) 100%);
  transform: translateX(3px);
}

.score-row.available td {
  background: inherit;
  color: #155724;
  font-weight: 500;
}

.score-row.available td:first-child {
  background: linear-gradient(135deg, rgba(40, 167, 69, 0.15) 0%, rgba(25, 135, 84, 0.15) 100%);
  color: #155724;
  font-weight: 600;
}


.thick-border-top {
  border-top: 3px solid black !important;
}

.thick-border-bottom {
  border-bottom: 3px solid black !important;
}


.spacer-row td {
  padding: 8px 0;
  background: white;
}




.filled-field {
    background: #eafbe7;
}


#game-over-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
#game-over-content {
  background: white;
  color: #222;
  padding: 40px 32px;
  border-radius: 16px;
  text-align: center;
  min-width: 300px;
}
#restart-btn, #main-menu-btn {
  margin-top: 24px;
  padding: 12px 28px;
  font-size: 1.1rem;
  border-radius: 8px;
  border: none;
  background: linear-gradient(90deg, #4e54c8 0%, #8f94fb 100%);
  color: white;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.3s;
}
#restart-btn:hover, #main-menu-btn:hover {
  background: linear-gradient(90deg, #8f94fb 0%, #4e54c8 100%);
}


/* Buttons */
button {
    background: linear-gradient(90deg, #4f8cff 0%, #1cb5e0 100%);
    color: #fff;
    border: none;
    border-radius: 1.2em;
    padding: 0.6em 1.5em;
    margin: 0.3em 0.2em;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(79,140,255,0.08);
    transition: background 0.2s, transform 0.1s;
}
button:hover, button:focus {
    background: linear-gradient(90deg, #1cb5e0 0%, #4f8cff 100%);
    transform: translateY(-2px) scale(1.04);
    outline: none;
}
button:disabled, button.inactive {
    background: #ccc;
    color: #888;
    cursor: not-allowed;
    box-shadow: none;
}

/* Eingabefelder */
input[type="text"], input[type="number"], input[type="password"], input[type="email"], input[type="search"], input[type="tel"], input[type="url"], input[type="input"] {
    padding: 0.8em 1.2em;
    border: 2px solid rgba(79, 140, 255, 0.3);
    border-radius: 1.5em;
    font-size: 1.1em;
    margin: 0.3em 0.2em;
    outline: none;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(79, 140, 255, 0.1);
    color: #234;
}
input:focus {
    border: 2px solid #1cb5e0;
    box-shadow: 0 0 0 3px rgba(28, 181, 224, 0.2), 0 8px 25px rgba(79, 140, 255, 0.15);
    background: rgba(255, 255, 255, 1);
    transform: translateY(-2px);
}

/* Select */
select {
    padding: 0.8em 1.2em;
    border: 2px solid rgba(79, 140, 255, 0.3);
    border-radius: 1.5em;
    font-size: 1.1em;
    margin: 0.3em 0.2em;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    outline: none;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(79, 140, 255, 0.1);
    color: #234;
    cursor: pointer;
}
select:focus {
    border: 2px solid #1cb5e0;
    box-shadow: 0 0 0 3px rgba(28, 181, 224, 0.2), 0 8px 25px rgba(79, 140, 255, 0.15);
    background: rgba(255, 255, 255, 1);
    transform: translateY(-2px);
}

/* Label */
label {
    font-weight: 600;
    color: #234;
    margin-bottom: 0.4em;
    display: inline-block;
    font-size: 1.05em;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

/* Einladungslink */
#invite-link {
    background: linear-gradient(135deg, rgba(79, 140, 255, 0.1) 0%, rgba(28, 181, 224, 0.1) 100%);
    backdrop-filter: blur(15px);
    border: 2px solid rgba(79, 140, 255, 0.2);
    border-radius: 1.5em;
    padding: 1em 1.5em;
    margin: 1.2em 0 0.8em 0;
    font-size: 1.1em;
    color: #234;
    box-shadow: 0 8px 25px rgba(79, 140, 255, 0.12);
    position: relative;
    overflow: hidden;
}

#invite-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Zurück-Button */
#back-btn button {
    background: #fff;
    color: #4f8cff;
    border: 2px solid #4f8cff;
    font-size: 1.3em;
    border-radius: 2em;
    padding: 0.3em 1.2em;
    box-shadow: 0 2px 8px rgba(79,140,255,0.08);
    transition: background 0.2s, color 0.2s;
}
#back-btn button:hover {
    background: #4f8cff;
    color: #fff;
}

.input-box {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 251, 255, 0.95) 100%);
    backdrop-filter: blur(15px);
    border: 2px solid rgba(79, 140, 255, 0.3);
    border-radius: 1.8em;
    padding: 1em 2em;
    margin: 1.5em auto 1.2em auto;
    display: inline-block;
    box-shadow: 0 8px 25px rgba(79, 140, 255, 0.15);
    position: relative;
    transition: all 0.3s ease;
}

.input-box:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 35px rgba(79, 140, 255, 0.2);
    border-color: rgba(28, 181, 224, 0.5);
}

.input-box label {
    font-size: 1.15em;
    color: #234;
    font-weight: 600;
}

.empty-row {
    height: 0.5em; /* gleiche Höhe wie andere Zeilen, ggf. anpassen */
    border-left: none !important;
    border-right: none !important;
    background: #ECF0F5 !important;
}
.empty-row td {
    border-left: none !important;
    border-right: none !important;
    background: #ECF0F5 !important;
    /*height: 0.5em;*/
    padding: 0;
}



#user-name-display {
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 0.8em;
    padding: 0.5em;
}
#user-name-display:hover {
    background: linear-gradient(135deg, rgba(79, 140, 255, 0.1) 0%, rgba(28, 181, 224, 0.1) 100%);
    transform: scale(1.02);
    box-shadow: 0 4px 15px rgba(79, 140, 255, 0.2);
}

.score-row.selected {
  background: linear-gradient(135deg, #ffe066 0%, #ffeb99 100%) !important;
  box-shadow: 0 4px 15px rgba(255, 224, 102, 0.4) !important;
  transform: scale(1.02) !important;
  border-radius: 0.5em !important;
  animation: selectedPulse 2s infinite;
}

@keyframes selectedPulse {
  0%, 100% { box-shadow: 0 4px 15px rgba(255, 224, 102, 0.4); }
  50% { box-shadow: 0 6px 20px rgba(255, 224, 102, 0.6); }
}

/* Mobile Optimierung für Startseite */
@media (max-width: 768px) {
    /* Prevent zoom and enable touch scrolling */
    html, body {
        touch-action: manipulation;
        -webkit-text-size-adjust: 100%;
        -ms-touch-action: manipulation;
    }
    
    /* Settings Button - unten rechts (immer sichtbar) */
    #settings-section {
        position: fixed !important;
        bottom: 16px !important;
        right: 16px !important;
        top: auto !important;
        left: auto !important;
        transform: none !important;
        z-index: 1000 !important;
    }
    
    #settings-btn {
        width: 50px !important;
        height: 50px !important;
        font-size: 1.5em !important;
    }
    
    /* Lobby - ganze Breite, unter Settings Button */
    #lobby {
        position: static !important;
        top: auto !important;
        left: auto !important;
        transform: none !important;
        width: 100% !important;
        margin: 80px auto 20px auto !important;
        text-align: center !important;
        min-height: auto !important;
        max-width: 350px !important;
        padding: 20px 20px !important;
        font-size: 0.6em !important;
        border-radius: 10px !important;
        order: 1 !important; /* Stelle sicher, dass die Lobby zuerst kommt */
    }
    #waiting{
      order: 1 !important;
    }
    
    #lobby h1 {
        font-size: 2.5em !important;
        margin-bottom: 1.5em !important;
    }
    
    #lobby button {
        width: 100% !important;
        max-width: 280px !important;
        margin: 0.8em auto !important;
        padding: 1em !important;
        font-size: 1.3em !important;
        display: block !important;
        text-align: center !important;
    }
    
    /* Bestenliste - unter dem Lobby-Container im normalen Fluss für Mobile */
    #highscore-section {
        position: static !important;
        bottom: auto !important;
        left: auto !important;
        transform: none !important;
        right: auto !important;
        max-width: calc(100vw - 40px) !important;
        min-width: 280px !important;
        width: calc(100% - 40px) !important;
        margin: 100px auto 20px auto !important;
        padding: 0 !important;
        order: 2 !important;
        z-index: auto !important;
    }
    
    #highscore-section > div {
        max-width: 500px !important;
        margin: 0 auto !important;
        border-radius: 0.8em !important;
        background: linear-gradient(135deg, rgba(45, 55, 72, 0.95) 0%, rgba(55, 65, 81, 0.95) 100%);
    }
    
    /* Modal für Mobile anpassen */
    #settings-modal > div {
        width: 95% !important;
        max-width: 400px !important;
        padding: 1.5em !important;
    }
    
    #settings-modal table {
        font-size: 0.9em !important;
    }
    
    #settings-modal input {
        width: 150px !important;
        font-size: 1em !important;
    }
    
    /* Zoom-Prävention */
    input, select, textarea, button {
        font-size: 16px !important;
    }
    
    /* Scorecard Mobile Optimierung */
    #scorecard-container {
        padding: 5px 8px 10px 8px !important;
        margin: 10px auto !important;
        max-width: 350px !important;
        width: 95% !important;
    }

    #scorecard-container td,
    #scorecard-container th {
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.25);
    }

    
    #scorecard {
        font-size: 1em !important;
    }
    
    #scorecard td, #scorecard th {
        padding: 0.5em 1em !important;
        width: 70px !important;
        max-width: 70px !important;
        font-size: 0.8em !important;
    }
    
    #scorecard th:first-child,
    #scorecard td:first-child {
        min-width: 90px !important;
        max-width: 110px !important;
        font-size: 0.8em !important;

    }
    
    /* Würfel und Button Mobile Optimierung */
    #dice {
        justify-content: center !important;
        gap: 0.4em !important;
        margin: 15px auto !important;
        max-width: 350px !important;
    }
    
    .die {
        width: 50px !important;
        height: 50px !important;
        font-size: 20px !important;
    }
    
    .die.dice-dots {
        font-size: 90px !important;
        padding: 2px !important;
        width: 50px !important;
        height: 50px !important;
    }
    
    .die.dice-dots img {
        width: 100% !important;
        height: 100% !important;
        object-fit: contain !important;
        border-radius: 4px !important;
    }
    
    #roll {
        display: block !important;
        margin: 15px auto !important;
        padding: 12px 24px !important;
        font-size: 14px !important;
        max-width: 200px !important;
    }
}