:root {
    --ink: #f4f6fa;
    --felt: #0d3a22;
    --felt-light: #1a6b3c;
    --panel: #ffffff;
    --panel-light: #f4f6fa;
    --border: #e2e6ee;
    --gold: #b45309;
    --gold-dark: #92400e;
    --gold-soft: rgba(180,83,9,0.09);
    --text: #16181d;
    --text-muted: #6b7280;
    --red: #dc2626;
    --danger: #dc2626;
    --danger-hover: #ef4444;
    --success-bg: #eefbf1;
    --success-border: #86efac;
    --success-text: #15803d;
    --edu: #4f46e5;
    --edu-dark: #4338ca;
    --edu-soft: rgba(79,70,229,0.08);
}

* { box-sizing: border-box; }

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes popIn {
    from { opacity: 0; transform: scale(0.7) rotate(-6deg); }
    to { opacity: 1; transform: scale(1) rotate(0); }
}
@keyframes dealCard {
    0% { opacity: 0; transform: translate(-70px, -110px) rotate(-30deg) scale(0.55); }
    55% { opacity: 1; }
    78% { transform: translate(4px, 3px) rotate(3deg) scale(1.04); }
    100% { opacity: 1; transform: translate(0, 0) rotate(0deg) scale(1); }
}
@keyframes pulseGold {
    0%, 100% { box-shadow: 0 0 0 0 rgba(242, 193, 78, 0.55); }
    50% { box-shadow: 0 0 0 7px rgba(242, 193, 78, 0); }
}
@keyframes pulseGreen {
    0%, 100% { box-shadow: 0 0 0 0 rgba(75, 224, 138, 0.55), 0 8px 18px rgba(0,0,0,0.35); }
    50% { box-shadow: 0 0 0 8px rgba(75, 224, 138, 0), 0 8px 18px rgba(0,0,0,0.35); }
}
@keyframes shimmer {
    0% { background-position: 0% 50%; }
    100% { background-position: 200% 50%; }
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background:
        radial-gradient(ellipse at top, #ffffff 0%, var(--ink) 75%);
    background-attachment: fixed;
    color: var(--text);
    min-height: 100vh;
    -webkit-tap-highlight-color: transparent;
    position: relative;
}
body::before, body::after {
    content: "";
    position: fixed;
    border-radius: 50%;
    filter: blur(70px);
    z-index: 0;
    pointer-events: none;
    opacity: 0.4;
}
body::before {
    width: 460px; height: 460px;
    background: radial-gradient(circle, var(--edu), transparent 72%);
    top: -140px; right: -120px;
    animation: blobFloat1 20s ease-in-out infinite;
}
body::after {
    width: 400px; height: 400px;
    background: radial-gradient(circle, var(--gold), transparent 72%);
    bottom: -160px; left: -100px;
    animation: blobFloat2 24s ease-in-out infinite;
}
@keyframes blobFloat1 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(-40px, 50px) scale(1.12); }
}
@keyframes blobFloat2 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(50px, -40px) scale(1.08); }
}
header.topbar, main.container, footer { position: relative; z-index: 1; }

main.container { animation: fadeInUp 0.35s ease both; }

/* Card-Grid Entrance-Animation + reichhaltigere Hover-Effekte */
@keyframes cardPopIn {
    from { opacity: 0; transform: translateY(16px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.home-grid > *, .wisdom-row > *, .games-grid > *, .achievements-grid > *,
.tables-grid > *, .missions-grid > * {
    animation: cardPopIn 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.home-grid > *:nth-child(1), .wisdom-row > *:nth-child(1), .games-grid > *:nth-child(1), .achievements-grid > *:nth-child(1), .tables-grid > *:nth-child(1), .missions-grid > *:nth-child(1) { animation-delay: 0.02s; }
.home-grid > *:nth-child(2), .wisdom-row > *:nth-child(2), .games-grid > *:nth-child(2), .achievements-grid > *:nth-child(2), .tables-grid > *:nth-child(2), .missions-grid > *:nth-child(2) { animation-delay: 0.07s; }
.home-grid > *:nth-child(3), .wisdom-row > *:nth-child(3), .games-grid > *:nth-child(3), .achievements-grid > *:nth-child(3), .tables-grid > *:nth-child(3), .missions-grid > *:nth-child(3) { animation-delay: 0.12s; }
.home-grid > *:nth-child(4), .games-grid > *:nth-child(4), .achievements-grid > *:nth-child(4), .tables-grid > *:nth-child(4), .missions-grid > *:nth-child(4) { animation-delay: 0.17s; }
.home-grid > *:nth-child(5), .achievements-grid > *:nth-child(5), .tables-grid > *:nth-child(5), .missions-grid > *:nth-child(5) { animation-delay: 0.22s; }
.achievements-grid > *:nth-child(6), .tables-grid > *:nth-child(6), .missions-grid > *:nth-child(6) { animation-delay: 0.27s; }
.achievements-grid > *:nth-child(7), .tables-grid > *:nth-child(7) { animation-delay: 0.32s; }
.achievements-grid > *:nth-child(8), .tables-grid > *:nth-child(8) { animation-delay: 0.37s; }
.achievements-grid > *:nth-child(n+9) { animation-delay: 0.4s; }

.home-card, .game-card, .table-card, .mission-card {
    transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.22s ease, border-color 0.22s ease;
}
.home-card:hover, .game-card:hover, .table-card:hover, .mission-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 16px 32px rgba(16,24,40,0.13);
}
.home-card-icon, .game-card-emoji {
    display: inline-block;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.home-card:hover .home-card-icon, .game-card:hover .game-card-emoji {
    transform: scale(1.18) rotate(-6deg);
}
.wisdom-card {
    transition: transform 0.22s ease, box-shadow 0.22s ease;
}
.wisdom-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 28px rgba(16,24,40,0.1);
}

/* Fortschrittsbalken-Glanz */
.xp-bar-fill, .mission-progress-fill, .quiz-progress-fill {
    position: relative;
    overflow: hidden;
}
.xp-bar-fill::after, .mission-progress-fill::after, .quiz-progress-fill::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.55), transparent);
    background-size: 60% 100%;
    background-repeat: no-repeat;
    animation: progressShimmer 2.4s ease-in-out infinite;
}
@keyframes progressShimmer {
    0% { background-position: -60% 0; }
    100% { background-position: 160% 0; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
}

a { color: var(--edu-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
.link-muted { color: var(--text-muted); font-size: 0.85rem; }
.muted, .hint { color: var(--text-muted); }
.hint { font-style: italic; }
code {
    background: #eef0f5;
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
    font-size: 0.85em;
}

/* Topbar */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 0.7rem 1.5rem;
    background: #ffffff;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 2px rgba(16,24,40,0.04);
    flex-wrap: wrap;
    position: sticky;
    top: 0;
    z-index: 10;
}
.brand {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: 0.02em;
    background: linear-gradient(90deg, var(--edu-dark), #8b7ff5, var(--edu), var(--edu-dark), var(--edu-dark));
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: shimmer 6s linear infinite;
    text-decoration: none;
    cursor: pointer;
}
.brand:hover { text-decoration: none; opacity: 0.85; }
.brand-icon { width: 24px; height: 24px; flex-shrink: 0; }
.brand-icon-lg {
    width: 44px;
    height: 44px;
    display: block;
    margin: 0 auto 0.35rem;
}
/* SVG-Iconset (assets/icons.svg) - ersetzt Emoji in Navigation/Badges, siehe icon() in includes/i18n.php */
.icon {
    width: 1em;
    height: 1em;
    flex-shrink: 0;
    vertical-align: -0.15em;
}

.topnav { display: flex; gap: 1.15rem; }
.topnav a {
    display: flex;
    align-items: center;
    gap: 0.32rem;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.9rem;
    padding-bottom: 2px;
    border-bottom: 2px solid transparent;
}
.topnav a .icon { width: 17px; height: 17px; }
.topnav a:hover { color: var(--text); text-decoration: none; }
.topnav a.active { color: var(--edu-dark); border-bottom-color: var(--edu-dark); }
.topbar-user {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}
.chip-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.28rem;
    background: var(--gold-soft);
    border: 1px solid var(--gold-dark);
    color: var(--gold-dark);
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.85rem;
}
.level-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.28rem;
    background: var(--edu-soft);
    border: 1px solid var(--edu-dark);
    color: var(--edu-dark);
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: default;
}
.level-badge .icon { color: var(--gold); }

.xp-bar-wrap { max-width: 420px; margin: 0 0 1.2rem; }
.xp-bar-label { font-size: 0.82rem; color: var(--text-muted); margin-bottom: 0.3rem; }
.xp-bar {
    height: 10px;
    background: var(--panel-light);
    border: 1px solid var(--border);
    border-radius: 999px;
    overflow: hidden;
}
.xp-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--edu-dark), var(--edu));
    border-radius: 999px;
    transition: width 0.4s ease;
}

/* Taegliche Missionen */
.missions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.8rem;
    margin-bottom: 1.5rem;
}
.mission-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.9rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.mission-card.ready { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold) inset; }
.mission-card.claimed { opacity: 0.6; }
.mission-label { font-weight: 700; font-size: 0.92rem; }
.mission-progress-bar {
    height: 8px;
    background: var(--panel-light);
    border: 1px solid var(--border);
    border-radius: 999px;
    overflow: hidden;
}
.mission-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--gold-dark), var(--gold));
    border-radius: 999px;
    transition: width 0.4s ease;
}
.mission-meta { font-size: 0.78rem; color: var(--text-muted); }
.mission-status { font-size: 0.82rem; color: var(--gold); font-weight: 700; }
.mission-status.muted { color: var(--text-muted); font-weight: 400; }

/* Idiotentest-Urkunde */
.cert-preview {
    text-align: center;
    background: linear-gradient(180deg, #fdf6e3, #f8ecc8);
    border: 2px solid var(--gold-dark);
    border-radius: 12px;
    padding: 1.4rem 1rem;
    margin: 1rem 0;
}
.cert-preview-seal { font-size: 2.4rem; }
.cert-preview-title { color: var(--gold); font-size: 1.1rem; margin: 0.3rem 0; }
.share-buttons { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.6rem 0; }
.share-buttons button, .share-buttons a { flex: 1; text-align: center; min-width: 120px; }

/* Achievements */
.achievements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 0.7rem;
    margin-bottom: 1.5rem;
}
.achievement-badge {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.8rem 0.5rem;
    text-align: center;
    opacity: 0.45;
    filter: grayscale(1);
}
.achievement-badge.unlocked { opacity: 1; filter: none; border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold) inset, 0 4px 14px rgba(180,83,9,0.15); transition: transform 0.2s ease, box-shadow 0.2s ease; }
.achievement-badge.unlocked:hover { transform: translateY(-3px) scale(1.03); box-shadow: 0 0 0 1px var(--gold) inset, 0 10px 22px rgba(180,83,9,0.25); }
.achievement-icon { display: block; font-size: 1.8rem; margin-bottom: 0.3rem; }
.achievement-label { display: block; font-size: 0.72rem; font-weight: 700; }
.achievement-progress { display: block; font-size: 0.65rem; color: var(--text-muted); margin-top: 0.2rem; }

/* Benachrichtigungsglocke */
.bell-badge {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    text-decoration: none;
    padding: 0.15rem 0.3rem;
}
.bell-badge .icon { color: var(--text-muted); }
.bell-badge:hover .icon { color: var(--edu-dark); }
.bell-badge.has-unread { animation: pulseGold 1.8s ease-in-out infinite; border-radius: 50%; }
.bell-badge.has-unread .icon { color: var(--gold-dark); }
.lb-tabs { display: flex; gap: 0.5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.lb-tabs .btn-like.active { background: var(--gold-dark); border-color: var(--gold); color: #fff; }

/* Home */
.home-hero {
    background: linear-gradient(160deg, var(--panel-light), var(--panel) 70%);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.5rem 1.6rem 1.3rem;
    margin: 1rem 0 1.5rem;
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(16,24,40,0.06);
    animation: cardPopIn 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.home-hero::before {
    content: "";
    position: absolute;
    top: -45%; right: -10%;
    width: 280px; height: 280px;
    background: radial-gradient(circle, rgba(79,70,229,0.14), transparent 70%);
    pointer-events: none;
    animation: heroGlowDrift 12s ease-in-out infinite;
}
.home-hero::after {
    content: "";
    position: absolute;
    bottom: -50%; left: -8%;
    width: 220px; height: 220px;
    background: radial-gradient(circle, rgba(180,83,9,0.10), transparent 70%);
    pointer-events: none;
    animation: heroGlowDrift 14s ease-in-out infinite reverse;
}
@keyframes heroGlowDrift {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(-18px, 14px); }
}
.home-hero h2 { margin: 0 0 1rem; font-size: 1.5rem; position: relative; }
.home-stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.7rem;
    position: relative;
}
.home-stat {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.8rem 0.6rem;
    text-align: center;
}
.home-stat .val { display: block; font-size: 1.15rem; font-weight: 800; color: var(--gold); }
.home-stat .lbl { display: block; font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.02em; margin-top: 0.15rem; }

.wisdom-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
    margin: 0 0 1.6rem;
}
.wisdom-card {
    background: linear-gradient(160deg, var(--panel-light), var(--panel));
    border: 1px solid var(--border);
    border-left: 4px solid var(--edu);
    border-radius: 14px;
    padding: 1.2rem 1.35rem;
}
.wisdom-card-head { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.55rem; }
.wisdom-card-head .icon { font-size: 1.3rem; }
.wisdom-card-head h4 { margin: 0; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--edu); }
.wisdom-card p { margin: 0 0 0.7rem; font-size: 1.02rem; line-height: 1.5; }
.wisdom-card .content-category { position: static; }

.home-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 0.9rem;
    margin-bottom: 1.5rem;
}
.home-card {
    position: relative;
    display: block;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.1rem;
    text-decoration: none;
    color: var(--text);
    transition: transform 0.15s ease, border-color 0.15s ease;
}
.home-card:hover { transform: translateY(-2px); border-color: var(--gold-dark); text-decoration: none; }
.home-card h3 { margin: 0.2rem 0 0.3rem; font-size: 1rem; }
.home-card-icon { font-size: 1.8rem; }
.home-card-badge {
    position: absolute;
    top: 0.7rem;
    right: 0.7rem;
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    background: var(--panel-light);
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 0.15rem 0.4rem;
    border-radius: 999px;
}
.home-card-badge-alert {
    background: var(--gold);
    border-color: var(--gold-dark);
    color: #fff;
    animation: pulseAlert 1.8s ease-in-out infinite;
}
@keyframes pulseAlert {
    0%, 100% { box-shadow: 0 0 0 0 rgba(176, 128, 44, 0.5); }
    50% { box-shadow: 0 0 0 6px rgba(176, 128, 44, 0); }
}
.home-card-admin { border-color: var(--gold-dark); }
.content-category {
    position: absolute;
    top: 0.7rem;
    right: 0.7rem;
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    background: var(--edu-soft);
    border: 1px solid var(--edu-dark);
    color: var(--edu);
    padding: 0.15rem 0.4rem;
    border-radius: 999px;
}

/* Bottom-Navigation (Mobile) */
.bottom-nav {
    display: none;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    background: var(--panel);
    border-top: 1px solid var(--border);
    z-index: 500;
    padding: 0.3rem 0 calc(0.3rem + env(safe-area-inset-bottom, 0px));
}
.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.1rem;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.62rem;
    flex: 1;
    padding: 0.2rem 0;
}
.bottom-nav-item .bn-icon { font-size: 1.15rem; display: flex; }
.bottom-nav-item .bn-icon .icon { width: 20px; height: 20px; }
.bottom-nav-item.active { color: var(--gold); }
@media (max-width: 700px) {
    .bottom-nav { display: flex; }
    body.has-bottom-nav main.container,
    body.has-bottom-nav { padding-bottom: 4.2rem; }
    header.topbar .topnav { display: none; }
}
.bell-count {
    position: absolute;
    top: -0.2rem;
    right: -0.1rem;
    background: var(--danger);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 800;
    border-radius: 999px;
    padding: 0.05rem 0.3rem;
    line-height: 1.3;
}

.sound-toggle {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 999px;
    width: 2rem;
    height: 2rem;
    padding: 0;
    font-size: 1rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: none;
}
.sound-toggle:hover { filter: brightness(1.3); transform: none; box-shadow: none; }

.container { max-width: 980px; margin: 0 auto; padding: 1.25rem 1.25rem 3rem; }

h1, h2, h3 { color: var(--text); font-weight: 700; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.05rem; color: var(--gold); }
.section-head { display: flex; justify-content: space-between; align-items: center; margin: 1.5rem 0 0.75rem; }

.error {
    background: #fef2f2;
    border: 1px solid #fca5a5;
    color: #b91c1c;
    padding: 0.6rem 0.9rem;
    border-radius: 8px;
    animation: fadeInUp 0.25s ease both;
}
.result {
    background: var(--success-bg);
    border: 1px solid var(--success-border);
    color: var(--success-text);
    padding: 0.6rem 0.9rem;
    border-radius: 8px;
    font-size: 0.92rem;
    animation: fadeInUp 0.25s ease both;
}
@keyframes celebrateGlow {
    0% { box-shadow: 0 0 0 0 rgba(242,193,78,0.7); transform: scale(1); }
    35% { box-shadow: 0 0 24px 6px rgba(242,193,78,0.55); transform: scale(1.035); }
    100% { box-shadow: 0 0 0 0 rgba(242,193,78,0); transform: scale(1); }
}
.result.celebrate { animation: fadeInUp 0.25s ease both, celebrateGlow 0.9s ease-out 0.1s; }

/* Forms & inputs */
input, select, button, textarea {
    font-size: 0.95rem;
    padding: 0.55rem 0.7rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--panel-light);
    color: var(--text);
    font-family: inherit;
}
textarea { resize: vertical; line-height: 1.4; }
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--edu);
    box-shadow: 0 0 0 3px var(--edu-soft);
}
.section-head-sub {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--gold-dark);
    margin: 0.4rem 0 -0.2rem;
    padding-top: 0.7rem;
    border-top: 1px dashed var(--border);
}
button {
    position: relative;
    overflow: hidden;
    background: linear-gradient(180deg, var(--edu), var(--edu-dark));
    border: 1px solid var(--edu-dark);
    cursor: pointer;
    color: white;
    font-weight: 700;
    letter-spacing: 0.01em;
    transition: transform 0.12s ease, filter 0.15s ease, box-shadow 0.15s ease;
    box-shadow: 0 2px 0 rgba(67,56,202,0.15);
}
button::before {
    content: "";
    position: absolute;
    top: 0; left: -75%;
    width: 50%; height: 100%;
    background: linear-gradient(120deg, transparent, rgba(255,255,255,0.35), transparent);
    transform: skewX(-20deg);
    transition: left 0.5s ease;
    pointer-events: none;
}
button:hover:not(:disabled)::before { left: 125%; }
button:hover:not(:disabled) { filter: brightness(1.08); transform: translateY(-1px); box-shadow: 0 5px 12px rgba(67,56,202,0.25); }
button:active:not(:disabled) { transform: translateY(1px); box-shadow: 0 1px 0 rgba(67,56,202,0.15); }
button:disabled { background: #e5e7eb; border-color: #e5e7eb; color: #9ca3af; cursor: not-allowed; filter: none; box-shadow: none; }
button.small { padding: 0.3rem 0.6rem; font-size: 0.8rem; }
button.danger { background: linear-gradient(180deg, var(--danger-hover), var(--danger)); border-color: #b91c1c; }
button.secondary { background: var(--panel-light); border-color: var(--border); color: var(--text); }
.full-width { width: 100%; display: block; text-align: center; }
.btn-like {
    display: inline-block;
    padding: 0.55rem 0.7rem;
    border-radius: 8px;
    background: var(--panel-light);
    border: 1px solid var(--border);
    color: var(--text);
    font-weight: 700;
}
.btn-like:hover { text-decoration: none; filter: brightness(0.97); }

/* Auth pages */
.auth-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.auth-box {
    background: var(--panel);
    border: 1px solid var(--border);
    padding: 2.25rem;
    border-radius: 14px;
    width: 340px;
    box-shadow: 0 20px 50px rgba(16,24,40,0.09);
}
.auth-lang { display: flex; justify-content: flex-end; margin-bottom: 0.5rem; }
.auth-lang select { font-size: 0.8rem; padding: 0.25rem 0.4rem; }
.lang-switcher select { background: var(--panel-light); color: var(--text); }
.auth-box h1 { margin: 0 0 0.25rem; text-align: center; }
.auth-box h2 { text-align: center; margin-top: 0; color: var(--text-muted); font-size: 1rem; font-weight: 600; }
.auth-box form { display: flex; flex-direction: column; gap: 0.85rem; margin-top: 1.25rem; }
.auth-box label { display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.88rem; color: var(--text-muted); }
.auth-box p { text-align: center; font-size: 0.9rem; }

/* Cards / panels */
.card {
    background: var(--panel);
    border: 1px solid var(--border);
    padding: 1.25rem;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    max-width: 380px;
}
.card label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.88rem; color: var(--text-muted); }

/* Games hub */
.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
}
.game-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1.5rem 1rem;
    text-align: center;
    box-shadow: 0 2px 8px rgba(16,24,40,0.05);
    color: var(--text);
    transition: transform 0.1s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.game-card:hover { text-decoration: none; transform: translateY(-3px); box-shadow: 0 10px 24px rgba(16,24,40,0.1); border-color: var(--gold-dark); }
.game-card-emoji { font-size: 2.4rem; margin-bottom: 0.5rem; }
.game-card h3 { margin: 0 0 0.3rem; color: var(--gold); }

/* Lobby layout */
.lobby-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 2rem;
    align-items: start;
}
.tables-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.9rem;
    margin-bottom: 0.5rem;
}
.table-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    box-shadow: 0 2px 8px rgba(16,24,40,0.05);
}
.table-card-head { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; }
.table-card-head h3 { margin: 0; font-size: 1rem; }
.table-card-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    font-size: 0.82rem;
    color: var(--text-muted);
}
.badge {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
}
.badge.status-waiting { background: var(--gold-soft); color: var(--gold-dark); border: 1px solid var(--gold-dark); }
.badge.status-betting, .badge.status-showdown { background: var(--success-bg); color: var(--success-text); border: 1px solid var(--success-border); }
.badge.admin-badge { background: var(--gold); color: #fff; }

/* Chat */
.side-col { position: sticky; top: 4.5rem; }
.chat-box {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}
.chat-messages {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 340px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}
.chat-messages li {
    font-size: 0.87rem;
    line-height: 1.35;
    word-wrap: break-word;
    color: var(--text);
}
.chat-messages li strong { color: var(--gold); }
.chat-author { color: var(--gold); text-decoration: none; }
.chat-author:hover { text-decoration: underline; }
.chat-form { display: flex; gap: 0.5rem; }
.chat-form input { flex: 1; min-width: 0; }

.main-chat { max-width: 640px; }
.main-chat .chat-messages { max-height: 55vh; }

/* Public player profile */
.profile-hero {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1.5rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}
.profile-avatar-big {
    width: 84px;
    height: 84px;
    border-radius: 50%;
    background: var(--panel-light);
    border: 2px solid var(--gold-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.6rem;
    flex-shrink: 0;
}
.profile-hero-info h2 { margin: 0 0 0.25rem; }
.profile-hero-meta { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; font-size: 0.85rem; color: var(--text-muted); align-items: center; }
.profile-status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 0.35rem; }
.profile-status-dot.online { background: #4be08a; box-shadow: 0 0 6px #4be08a; }
.profile-status-dot.offline { background: #6b6b6b; }
.profile-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}
.profile-stat {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.85rem 1rem;
    text-align: center;
}
.profile-stat .val { font-size: 1.3rem; font-weight: 800; color: var(--gold); display: block; }
.profile-stat .lbl { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.03em; }
.profile-bio-box {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.1rem 1.25rem;
    font-size: 0.92rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.avatar-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    background: var(--panel-light);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.6rem;
}
.avatar-picker label { flex-direction: row !important; align-items: center; gap: 0.3rem !important; color: var(--text-muted); font-size: 0.85rem; }
.avatar-choice {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.1rem;
    height: 2.1rem;
    border-radius: 8px;
    background: #ffffff;
    border: 1px solid var(--border);
    cursor: pointer;
}
.avatar-choice input { display: none; }
.avatar-choice span { font-size: 1.2rem; }
.avatar-choice:has(input:checked) { background: var(--gold-soft); box-shadow: 0 0 0 2px var(--gold); }

/* Table page */
.table-title-row { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 0.4rem; }

.table-oval {
    position: relative;
    width: 100%;
    max-width: 820px;
    aspect-ratio: 2 / 1.1;
    margin: 1.5rem auto;
    border-radius: 50%;
    background: radial-gradient(ellipse at center, var(--felt-light) 0%, var(--felt) 55%, #082217 100%);
    border: 10px solid #1c120a;
    box-shadow:
        0 0 0 3px var(--gold-dark),
        inset 0 0 60px rgba(0,0,0,0.5),
        0 20px 50px rgba(0,0,0,0.5);
}

.table-center {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    text-align: center;
}
.pot-badge {
    background: rgba(6, 20, 13, 0.75);
    border: 2px solid var(--gold);
    color: var(--gold);
    border-radius: 999px;
    padding: 0.6rem 1.1rem;
    font-size: 0.8rem;
    line-height: 1.2;
}
.pot-badge strong { font-size: 1.2rem; display: block; }
.current-bet-badge {
    background: rgba(6, 20, 13, 0.75);
    border: 1px solid var(--border);
    color: var(--text-muted);
    border-radius: 999px;
    padding: 0.3rem 0.7rem;
    font-size: 0.75rem;
}

/* Zug-Timer-Ring */
.turn-countdown {
    position: relative;
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.turn-countdown-ring { width: 40px; height: 40px; transform: rotate(-90deg); }
.turn-countdown-ring .ring-bg {
    fill: none;
    stroke: rgba(255,255,255,0.12);
    stroke-width: 3;
}
.turn-countdown-ring .ring-fg {
    fill: none;
    stroke: var(--gold);
    stroke-width: 3;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.4s linear, stroke 0.3s ease;
}
.turn-countdown-warn .ring-fg { stroke: var(--danger-hover); }
.turn-countdown-text {
    position: absolute;
    font-size: 0.62rem;
    font-weight: 700;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}
.turn-countdown-warn .turn-countdown-text { color: #ffb3b3; }

/* Wuerfel-Buehne (PixiJS) */
.dice-stage { min-height: 64px; margin: 0.4rem 0; }
.dice-stage:empty { min-height: 0; margin: 0; }

.seat {
    position: absolute;
    left: var(--x);
    top: var(--y);
    transform: translate(-50%, -50%);
    width: 138px;
    background: rgba(10, 27, 18, 0.92);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 0.55rem 0.5rem;
    text-align: center;
    box-shadow: 0 8px 18px rgba(0,0,0,0.35);
}
.seat { transition: transform 0.15s ease, border-color 0.2s ease; }
.seat.dealer { border-color: var(--gold); animation: pulseGold 2.4s ease-in-out infinite; }
.seat.active-turn { border-color: #4be08a; animation: pulseGreen 1.6s ease-in-out infinite; transform: translate(-50%, -50%) scale(1.04); }
.seat-no { font-size: 0.68rem; color: var(--text-muted); margin-bottom: 0.3rem; letter-spacing: 0.03em; }

.avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(160deg, var(--felt-light), #0a2e1a);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 0.35rem;
    font-weight: 800;
    color: var(--gold);
}
.avatar.empty-avatar { color: var(--text-muted); border-style: dashed; background: transparent; font-size: 1.1rem; }

.empty-seat { color: var(--text-muted); font-size: 0.8rem; margin-bottom: 0.35rem; }
.player-name { font-weight: 700; font-size: 0.85rem; }
.player-chips { font-size: 0.78rem; color: var(--text-muted); margin-bottom: 0.35rem; }
.folded { color: var(--red); font-style: italic; font-size: 0.8rem; }
.seat-bet { font-size: 0.72rem; color: var(--gold); margin-top: 0.3rem; }

.cards { display: flex; justify-content: center; gap: 0.25rem; flex-wrap: wrap; }
span.card {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #fbfbf6;
    color: #111;
    border-radius: 5px;
    padding: 0.3rem 0.35rem;
    font-weight: 800;
    font-size: 0.8rem;
    min-width: 1.6rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.4);
    border: 1px solid rgba(0,0,0,0.08);
    animation: dealCard 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) both;
    transition: transform 0.15s ease;
}
span.card:hover { transform: translateY(-3px); }
.cards span.card:nth-child(1) { animation-delay: 0s; }
.cards span.card:nth-child(2) { animation-delay: 0.1s; }
.cards span.card:nth-child(3) { animation-delay: 0.2s; }
.cards span.card:nth-child(4) { animation-delay: 0.3s; }
.cards span.card:nth-child(5) { animation-delay: 0.4s; }
.cards span.card:nth-child(6) { animation-delay: 0.5s; }
span.card.red { color: var(--red); }
span.card.black { color: #161616; }
span.card.back {
    color: transparent;
    background: repeating-linear-gradient(135deg, #1d3c66, #1d3c66 4px, #14315a 4px, #14315a 8px);
    border: 1px solid var(--gold-dark);
}

.actions { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; margin: 1.25rem 0; }
.actions form { display: flex; gap: 0.4rem; align-items: center; }
.bet-form input[type=number] { width: 5rem; }

.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-top: 1rem;
}
.two-col .chat-box { max-height: none; }
.two-col .chat-messages { max-height: 220px; }

.log { list-style: none; padding: 0; margin: 0; max-height: 260px; overflow-y: auto; }
.log li { padding: 0.35rem 0; border-bottom: 1px solid var(--border); font-size: 0.85rem; color: var(--text-muted); }

/* Slots */
.slot-reels {
    display: flex;
    justify-content: center;
    gap: 0.8rem;
    margin: 1.5rem 0;
}
.slot-reel {
    width: 4.5rem;
    height: 4.5rem;
    background: linear-gradient(180deg, #1b2f22, #0a1b12);
    border: 3px solid var(--gold-dark);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2rem;
    box-shadow: inset 0 0 14px rgba(0,0,0,0.5);
    animation: popIn 0.3s ease both;
}

/* Nardi (Backgammon) board - echte Dreieck-Points mit gestapelten Steinen */
.nardi-board {
    position: relative;
    background:
        repeating-linear-gradient(115deg, rgba(0,0,0,0.06) 0 2px, transparent 2px 6px),
        linear-gradient(160deg, #40270f, #1f1206);
    border: 7px solid #170d05;
    border-radius: 10px;
    padding: 0.9rem 0.6rem;
    margin: 1rem 0;
    box-shadow: inset 0 0 40px rgba(0,0,0,0.55), 0 15px 35px rgba(0,0,0,0.4);
}
.nardi-row { display: flex; height: 9.6rem; gap: 2px; }
.nardi-row.bottom { margin-top: 0.7rem; }
.nardi-point { flex: 1; position: relative; min-width: 0; height: 100%; }
.nardi-row.top .nardi-point { clip-path: polygon(6% 0, 94% 0, 50% 94%); align-self: flex-start; }
.nardi-row.bottom .nardi-point { clip-path: polygon(50% 6%, 94% 100%, 6% 100%); align-self: flex-end; }
.nardi-point.light { background: linear-gradient(180deg, #e2c88c, #b3925a); }
.nardi-point.dark { background: linear-gradient(180deg, #6b4226, #43260e); }
.nardi-row.bottom .nardi-point.light { background: linear-gradient(0deg, #e2c88c, #b3925a); }
.nardi-row.bottom .nardi-point.dark { background: linear-gradient(0deg, #6b4226, #43260e); }

.nardi-bar {
    width: 1.4rem;
    background: linear-gradient(180deg, #130b04, #291809);
    border-left: 2px solid #000;
    border-right: 2px solid #000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
}

.nardi-checkers {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    z-index: 2;
}
.nardi-row.top .nardi-checkers { top: 0.2rem; }
.nardi-row.bottom .nardi-checkers { bottom: 0.2rem; flex-direction: column-reverse; }

.nardi-checker {
    width: 1.55rem;
    height: 1.55rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.62rem;
    font-weight: 800;
    box-shadow: 0 2px 4px rgba(0,0,0,0.5), inset 0 -2px 3px rgba(0,0,0,0.25), inset 0 2px 2px rgba(255,255,255,0.35);
    border: 1px solid rgba(0,0,0,0.45);
    flex-shrink: 0;
}
.nardi-checkers .nardi-checker { margin-top: -0.6rem; }
.nardi-checkers .nardi-checker:first-child { margin-top: 0; }
.nardi-checker.p1 { background: radial-gradient(circle at 35% 30%, #fff3cf, var(--gold) 65%, var(--gold-dark)); color: #1a1200; }
.nardi-checker.p2 { background: radial-gradient(circle at 35% 30%, #7c8fa3, #223040 65%, #0b1116); color: #eaf6ff; }

.flying-piece { filter: drop-shadow(0 8px 12px rgba(0,0,0,0.55)); }

.nardi-point-label {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.55rem;
    color: rgba(0,0,0,0.6);
    font-weight: 800;
    z-index: 1;
}
.nardi-row.top .nardi-point-label { bottom: 0.15rem; }
.nardi-row.bottom .nardi-point-label { top: 0.15rem; }

/* Durak - Kartentisch statt lose verstreuter Karten */
.durak-table-cards {
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    gap: 0.9rem;
    background:
        radial-gradient(ellipse at 50% 0%, rgba(255,255,255,0.05), transparent 60%),
        var(--felt);
    border: 3px solid var(--gold-dark);
    border-radius: 12px;
    padding: 1.1rem;
    margin-bottom: 1rem;
    min-height: 5.5rem;
    box-shadow: inset 0 0 30px rgba(0,0,0,0.4);
}
.durak-pair {
    display: flex;
    position: relative;
    background: rgba(0,0,0,0.18);
    border-radius: 8px;
    padding: 0.3rem;
}
.durak-pair span.card:last-child { margin-left: -1.4rem; transform: rotate(6deg); }
.durak-trump-card span.card { box-shadow: 0 0 0 2px var(--gold), 0 4px 10px rgba(0,0,0,0.5); }
.durak-opponent-hand {
    display: flex;
    justify-content: center;
    margin: 0.6rem 0 1rem;
    height: 3.6rem;
}
.durak-opponent-hand .card.back {
    margin-left: -1.55rem;
    transition: transform 0.15s ease;
}
.durak-opponent-hand .card.back:first-child { margin-left: 0; }
.durak-opponent-hand .card.back:nth-child(odd) { transform: rotate(-4deg) translateY(2px); }
.durak-opponent-hand .card.back:nth-child(even) { transform: rotate(4deg) translateY(2px); }
.durak-talon {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(0,0,0,0.25);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.4rem 0.8rem;
}
.durak-talon .card.back { width: 1.9rem; height: 2.6rem; }
.durak-talon .card.back:nth-child(2) { margin-left: -1.65rem; }
.durak-talon .card.back:nth-child(3) { margin-left: -1.65rem; }

/* Admin */
.admin-table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th, .admin-table td { text-align: left; padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--border); }
.admin-table input { width: 100%; min-width: 90px; }
.admin-table .chips-input { min-width: 90px; }
.admin-table td.muted { font-size: 0.78rem; color: var(--text-muted); white-space: nowrap; }

.table-list { width: 100%; border-collapse: collapse; }
.table-list th, .table-list td { text-align: left; padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--border); }

/* Responsive */
@media (max-width: 900px) {
    .lobby-layout { grid-template-columns: 1fr; }
    .side-col { position: static; }
    .two-col { grid-template-columns: 1fr; }
    .games-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}

@media (max-width: 700px) {
    .container { padding: 1rem 0.85rem 2.5rem; }
    h2 { font-size: clamp(1.1rem, 5vw, 1.35rem); }

    .topbar { padding: 0.55rem 0.85rem; gap: 0.5rem 0.75rem; }
    .topnav { gap: 0.75rem; order: 3; width: 100%; overflow-x: auto; }
    .topbar-user { gap: 0.5rem; font-size: 0.8rem; }
    .lang-switcher select { padding: 0.3rem; font-size: 0.75rem; }

    .table-oval {
        position: static;
        aspect-ratio: auto;
        border-radius: 16px;
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.6rem;
        padding: 1.25rem;
    }
    .table-center { position: static; transform: none; margin-bottom: 0.25rem; width: 100%; flex-direction: row; justify-content: center; }
    .seat { position: static; transform: none; width: 44%; }
    .seat.active-turn { transform: scale(1.03); }

    .nardi-row { height: 6.4rem; gap: 1px; }
    .nardi-checker { width: 1.05rem; height: 1.05rem; font-size: 0.5rem; }
    .nardi-checkers .nardi-checker { margin-top: -0.42rem; }
    .nardi-point-label { font-size: 0.45rem; }
    .nardi-bar { width: 0.9rem; }
    .nardi-board { padding: 0.5rem 0.3rem; }
    .durak-opponent-hand .card.back { margin-left: -1.1rem; }

    /* Groessere Tippflaechen auf Touch-Geraeten */
    button, .btn-like, input, select { min-height: 42px; }
    button.small { min-height: 34px; }

    .actions { gap: 0.5rem; }
    .actions form { flex: 1 1 auto; }
    .actions form:not(.bet-form) button { width: 100%; }
}

@media (max-width: 420px) {
    .seat { width: 47%; }
    span.card { font-size: 0.72rem; padding: 0.25rem 0.3rem; }
}

/* Gehirntraining-Minispiele */
.brain-stage {
    background: var(--panel);
    border: 1px solid var(--edu-dark);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    max-width: 480px;
    margin: 1rem 0;
    box-shadow: 0 0 0 1px var(--edu-soft) inset;
}
.brain-status { font-weight: 700; margin: 0 0 1rem; min-height: 1.4em; color: var(--edu); }

.mm-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.4rem;
    max-width: 340px;
    margin: 0 auto 1.2rem;
}
.mm-cell {
    aspect-ratio: 1;
    background: var(--panel-light);
    border: 1px solid var(--border);
    border-radius: 6px;
    transition: background 0.12s ease;
}
.mm-cell.mm-lit { background: var(--gold); border-color: var(--gold); }
.mm-cell.mm-picked { background: #3a7350; border-color: #3a7350; }
.mm-cell.mm-wrong { background: var(--danger); border-color: var(--danger); }

.sm-pads {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem;
    max-width: 260px;
    margin: 0 auto 1.2rem;
}
.sm-pad {
    aspect-ratio: 1;
    border-radius: 12px;
    opacity: 0.55;
    cursor: pointer;
    transition: opacity 0.12s ease, transform 0.1s ease;
}
.sm-pad.sm-active { opacity: 1; transform: scale(0.96); }
.sm-pad.sm-wrong { opacity: 1; background: var(--danger) !important; }
.sm-pad-0 { background: #d64545; }
.sm-pad-1 { background: #3f8f57; }
.sm-pad-2 { background: #3b7fc4; }
.sm-pad-3 { background: var(--gold); }

.nm-display {
    font-size: 2.4rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    margin: 0 auto 1.2rem;
    color: var(--gold);
    font-variant-numeric: tabular-nums;
}
.nm-input {
    display: block;
    width: 100%;
    max-width: 220px;
    margin: 0 auto 0.8rem;
    text-align: center;
    font-size: 1.3rem;
    letter-spacing: 0.08em;
}

.rt-box {
    max-width: 300px;
    height: 160px;
    margin: 0 auto 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--panel-light);
    border: 1px solid var(--border);
    border-radius: 12px;
    font-weight: 800;
    font-size: 1.2rem;
    cursor: pointer;
    user-select: none;
}
.rt-box.rt-wait { background: #7a3a3a; }
.rt-box.rt-go { background: #3a7350; }

.ms-timer { font-size: 1.3rem; font-weight: 800; color: var(--edu-dark); margin-bottom: 0.6rem; font-variant-numeric: tabular-nums; }
.ms-problem { font-size: 2.2rem; font-weight: 800; margin: 0 auto 1.2rem; color: var(--text); font-variant-numeric: tabular-nums; min-height: 2.6rem; }
.ms-input {
    display: block;
    width: 100%;
    max-width: 200px;
    margin: 0 auto 0.8rem;
    text-align: center;
    font-size: 1.4rem;
    font-weight: 700;
}

.oo-timer-bar { height: 6px; background: var(--panel-light); border: 1px solid var(--border); border-radius: 999px; overflow: hidden; max-width: 340px; margin: 0 auto 0.8rem; }
.oo-timer-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--edu-dark), var(--gold)); }
.oo-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0.4rem;
    max-width: 340px;
    margin: 0 auto 1.2rem;
}
.oo-cell {
    aspect-ratio: 1;
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    transition: transform 0.08s ease;
}
.oo-cell:hover { transform: scale(1.05); }

.cf-word { font-size: 2.4rem; font-weight: 800; margin: 0 auto 1.2rem; min-height: 3rem; letter-spacing: 0.04em; }
.cf-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem;
    max-width: 320px;
    margin: 0 auto 1rem;
}
.cf-btn {
    border: none;
    border-radius: 10px;
    padding: 0.9rem 0.5rem;
    font-weight: 800;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.club-icon-picker { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.3rem 0 1rem; }
.club-icon-opt { cursor: pointer; }
.club-icon-opt input { position: absolute; opacity: 0; pointer-events: none; }
.club-icon-opt span {
    display: flex; align-items: center; justify-content: center;
    width: 42px; height: 42px; font-size: 1.3rem;
    background: var(--panel-light); border: 1px solid var(--border); border-radius: 10px;
    transition: border-color 0.12s ease, background 0.12s ease;
}
.club-icon-opt input:checked + span { border-color: var(--edu); background: var(--edu-soft); }

.idiotentest-count-options { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.idiotentest-count-opt {
    flex: 1 1 80px;
    text-align: center;
    padding: 0.9rem 0.5rem;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--panel-light);
    color: var(--text);
    font-weight: 800;
    font-size: 1.15rem;
    text-decoration: none;
    transition: border-color 0.12s ease, background 0.12s ease, transform 0.12s ease;
}
.idiotentest-count-opt:hover { border-color: var(--edu); background: var(--edu-soft); transform: translateY(-2px); }

.idiotentest-review { margin-top: 1rem; border-top: 1px solid var(--border); padding-top: 0.8rem; }
.idiotentest-review summary { cursor: pointer; font-weight: 700; color: var(--edu-dark); }
.idiotentest-review .review-heading {
    margin: 0 0 0.7rem;
    font-size: 0.95rem;
    color: var(--edu-dark);
    text-align: left;
}
.idiotentest-review.is-open .idiotentest-review-item { text-align: left; }

/* ===== Tisch-Effekte (Seka / Backgammon / Durak) - siehe assets/table-fx.js ===== */
.table-fx-canvas { position: fixed; inset: 0; pointer-events: none; z-index: 999; }

.turn-banner {
    position: fixed;
    left: 50%;
    top: 84px; /* Startwert - table-fx.js setzt ihn passend unter die Kopfzeile */
    transform: translate(-50%, -14px);
    background: linear-gradient(180deg, var(--edu), var(--edu-dark));
    color: #fff;
    font-weight: 800;
    letter-spacing: 0.02em;
    padding: 0.65rem 1.5rem;
    border-radius: 999px;
    box-shadow: 0 12px 30px rgba(79,70,229,0.4);
    opacity: 0;
    pointer-events: none;
    z-index: 1000;
    transition: opacity 0.25s ease, transform 0.25s ease;
}
.turn-banner.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* Wenn man am Zug ist, bekommt der Tisch einen ruhigen, aber klaren Rahmen-Puls. */
@keyframes myTurnPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(79,70,229,0.0); }
    50%      { box-shadow: 0 0 0 5px rgba(79,70,229,0.18); }
}
body.my-turn-active .table-oval,
body.my-turn-active .nardi-board,
body.my-turn-active .durak-table-cards {
    animation: myTurnPulse 2s ease-in-out infinite;
    border-radius: 14px;
}
@media (prefers-reduced-motion: reduce) {
    .turn-banner { transition: none; }
    body.my-turn-active .table-oval,
    body.my-turn-active .nardi-board,
    body.my-turn-active .durak-table-cards { animation: none; }
}

/* Persoenlichkeitstest: Typ-Ergebnis mit Verteilungsbalken */
.pers-type-badge {
    width: 92px; height: 92px;
    margin: 0 auto 0.6rem;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 40px;
    background: linear-gradient(135deg, var(--edu), var(--edu-dark));
    box-shadow: 0 10px 26px rgba(79,70,229,0.35);
}
.pers-bars { margin: 1.2rem 0 0; display: flex; flex-direction: column; gap: 0.55rem; }
.pers-bar-row { display: grid; grid-template-columns: 8.5rem 1fr 3rem; align-items: center; gap: 0.6rem; }
.pers-bar-label { font-size: 0.85rem; font-weight: 600; text-align: left; }
.pers-bar { height: 10px; background: var(--panel-light); border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.pers-bar-fill { height: 100%; background: var(--border); border-radius: 999px; transition: width 0.6s ease; }
.pers-bar-fill.is-top { background: linear-gradient(90deg, var(--edu-dark), var(--edu)); }
.pers-bar-pct { font-size: 0.82rem; color: var(--text-muted); font-variant-numeric: tabular-nums; text-align: right; }
@media (max-width: 480px) {
    .pers-bar-row { grid-template-columns: 6.5rem 1fr 2.6rem; }
    .pers-bar-label { font-size: 0.78rem; }
}

/* Fertige Urkunde direkt auf der Ergebnisseite (inkl. PDF-Download) */
.cert-ready {
    background: linear-gradient(180deg, #fdf6e3, #f8ecc8);
    border: 2px solid var(--gold-dark);
    border-radius: 12px;
    padding: 1.3rem 1rem 1.4rem;
    margin: 1rem 0;
    text-align: center;
}
.cert-ready-name {
    font-size: 1.25rem;
    font-weight: 800;
    margin: 0.5rem 0 0.1rem;
    color: #2a1c05;
}
.cert-download-btn {
    display: inline-block;
    background: linear-gradient(180deg, var(--gold), var(--gold-dark));
    border: 1px solid var(--gold-dark);
    color: #fff;
    font-weight: 800;
    padding: 0.7rem 1.4rem;
    border-radius: 999px;
    box-shadow: 0 6px 16px rgba(180,83,9,0.3);
}
.cert-download-btn:hover { text-decoration: none; filter: brightness(1.05); }
.idiotentest-review-item {
    margin: 0.9rem 0;
    padding: 0.7rem 0.9rem;
    border-radius: 8px;
    border-left: 3px solid var(--border);
    background: var(--panel-light);
}
.idiotentest-review-item.is-correct { border-left-color: var(--success-border, #3f8f57); }
.idiotentest-review-item.is-wrong { border-left-color: var(--danger); }
.idiotentest-review-item .q { font-weight: 700; margin: 0 0 0.4rem; }
.idiotentest-review-item .opt { margin: 0.15rem 0; font-size: 0.92rem; color: var(--text-muted); }
.idiotentest-review-item .opt.is-correct-opt { color: #3f8f57; font-weight: 700; }
.idiotentest-review-item .opt.is-wrong-opt { color: var(--danger); font-weight: 700; }
.idiotentest-history-item { margin-bottom: 1rem; }

/* Dynamischer Quiz-Ablauf */
.quiz-progress-wrap { max-width: 640px; margin: 0 0 1.2rem; }
.quiz-progress-label { font-size: 0.82rem; color: var(--text-muted); margin-bottom: 0.35rem; font-weight: 600; }
.quiz-progress-bar { height: 8px; background: var(--panel-light); border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.quiz-progress-fill { height: 100%; background: linear-gradient(90deg, var(--edu-dark), var(--edu)); border-radius: 999px; transition: width 0.35s ease; }

.quiz-form { position: relative; min-height: 220px; }
.quiz-step { display: none; }
.quiz-step.active { display: block; animation: quizStepIn 0.3s ease; }
@keyframes quizStepIn {
    from { opacity: 0; transform: translateX(16px); }
    to { opacity: 1; transform: translateX(0); }
}
.quiz-fieldset {
    border: 1px solid var(--edu-dark);
    border-radius: 12px;
    padding: 1rem 1.1rem;
    margin: 0;
    box-shadow: 0 0 0 1px var(--edu-soft) inset;
}
.quiz-legend { padding: 0 0.4rem; font-weight: 700; color: var(--edu-dark); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.03em; }
.quiz-question { margin: 0.2rem 0 1rem; font-size: 1.08rem; font-weight: 600; }
.quiz-option {
    display: flex !important;
    flex-direction: row !important;
    align-items: center;
    gap: 0.6rem !important;
    font-weight: 400 !important;
    color: var(--text) !important;
    padding: 0.6rem 0.7rem;
    border-radius: 8px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background 0.12s ease, border-color 0.12s ease;
}
.quiz-option:hover { background: var(--edu-soft); }
.quiz-option-picked { background: var(--edu-soft); border-color: var(--edu); }
.quiz-back-btn { margin-top: 0.9rem; }

/* ===== Quiz-Neugestaltung: Karten-Antworten, Pruefungsatmosphaere, animiertes Ergebnis ===== */

.quiz-arena {
    max-width: 640px;
    margin: 0 auto;
    padding: 1.6rem 1.4rem 1.8rem;
    border-radius: 18px;
    background:
        radial-gradient(ellipse at 15% -10%, var(--edu-soft), transparent 55%),
        radial-gradient(ellipse at 100% 110%, var(--gold-soft), transparent 50%),
        var(--panel);
    border: 1px solid var(--border);
    box-shadow: 0 20px 46px rgba(16,24,40,0.08);
}

.quiz-dots { display: flex; gap: 0.32rem; flex-wrap: wrap; margin-bottom: 0.5rem; }
.quiz-dot {
    width: 9px; height: 9px; border-radius: 50%;
    background: var(--border);
    transition: background 0.2s ease, transform 0.2s ease;
}
.quiz-dot.is-done { background: var(--edu); }
.quiz-dot.is-current { background: var(--gold); transform: scale(1.35); }

.quiz-progress-label { display: flex; align-items: baseline; justify-content: space-between; }
.quiz-progress-label .quiz-cat-label { font-size: 0.78rem; color: var(--edu-dark); font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }

.quiz-fieldset { border: none; box-shadow: none; padding: 0; }
.quiz-legend { display: none; }
.quiz-question {
    font-size: 1.28rem;
    line-height: 1.35;
    margin: 0 0 1.3rem;
    text-wrap: balance;
}

.quiz-option {
    display: flex !important;
    align-items: center;
    gap: 0.8rem !important;
    padding: 0.85rem 1rem !important;
    border-radius: 12px;
    border: 1.5px solid var(--border) !important;
    background: var(--panel-light);
    cursor: pointer;
    margin-bottom: 0.6rem;
    transition: border-color 0.15s ease, background 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}
.quiz-option:last-child { margin-bottom: 0; }
.quiz-option:hover { border-color: var(--edu) !important; background: var(--edu-soft); transform: translateX(2px); }
.quiz-option input[type="radio"] {
    position: absolute;
    width: 1px; height: 1px;
    opacity: 0; pointer-events: none;
}
.quiz-option-letter {
    flex-shrink: 0;
    width: 30px; height: 30px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 0.85rem;
    background: var(--panel);
    border: 1.5px solid var(--border);
    color: var(--text-muted);
    transition: inherit;
}
.quiz-option span:last-child { font-weight: 600; }
.quiz-option-picked {
    border-color: var(--edu) !important;
    background: var(--edu-soft);
    box-shadow: 0 0 0 3px var(--edu-soft);
}
.quiz-option-picked .quiz-option-letter {
    background: var(--edu);
    border-color: var(--edu);
    color: #fff;
}
.quiz-option-picked::after {
    content: '✓';
    margin-left: auto;
    color: var(--edu);
    font-weight: 800;
    animation: quizCheckIn 0.25s ease;
}
@keyframes quizCheckIn { from { opacity: 0; transform: scale(0.4); } to { opacity: 1; transform: scale(1); } }

/* Ergebnis-Reveal */
.quiz-result-reveal { text-align: center; }
.quiz-result-ring-wrap { position: relative; width: 148px; height: 148px; margin: 0.2rem auto 1rem; }
.quiz-result-ring-wrap svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.quiz-result-ring-bg { fill: none; stroke: var(--panel-light); stroke-width: 10; }
.quiz-result-ring-fill {
    fill: none; stroke: var(--edu); stroke-width: 10; stroke-linecap: round;
    stroke-dasharray: 402; stroke-dashoffset: 402;
    transition: stroke-dashoffset 1.1s cubic-bezier(0.22, 1, 0.36, 1);
}
.quiz-result-ring-inner {
    position: absolute; inset: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.quiz-result-score { font-size: 1.9rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.quiz-result-total { font-size: 0.78rem; color: var(--text-muted); }

.quiz-result-reveal > * { opacity: 0; animation: quizFadeUp 0.5s ease forwards; }
.quiz-result-reveal .quiz-result-ring-wrap { animation-delay: 0.05s; }
.quiz-result-reveal h3 { animation-delay: 0.25s; }
.quiz-result-reveal .result { animation-delay: 0.4s; }
.quiz-result-reveal .hint { animation-delay: 0.5s; }
.quiz-result-reveal form { animation-delay: 0.6s; }
.quiz-result-reveal .quiz-result-actions { animation-delay: 0.7s; }
@keyframes quizFadeUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.quiz-fx-canvas { position: fixed; inset: 0; pointer-events: none; z-index: 999; }

/* Urkunde: Siegel mit Logo */
.cert-seal {
    position: relative;
    width: 84px; height: 84px;
    margin: 0 auto 0.4rem;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, #fff7e0, var(--gold) 70%, var(--gold-dark));
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 8px 20px rgba(180,83,9,0.35), 0 0 0 4px #fff, 0 0 0 5px var(--gold-dark);
}
.cert-seal img { width: 42px; height: 42px; filter: drop-shadow(0 1px 1px rgba(0,0,0,0.15)); }
.cert-preview { animation: quizFadeUp 0.5s ease; }

@media (prefers-reduced-motion: reduce) {
    .quiz-result-reveal > *, .quiz-step.active, .cert-preview { animation: none !important; opacity: 1 !important; }
    .quiz-result-ring-fill { transition: none; }
}
