:root {
    --primary: #5b5ce2;
    --primary-dark: #4546b8;
    --secondary: #222831;
    --danger: #dc3545;
    --success: #20c997;
    --warning: #ffc107;

    --bg: #f4f6fb;
    --card: #ffffff;
    --text: #222831;
    --muted: #6c757d;
    --border: #e5e7eb;

    --radius: 16px;
    --shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    --shadow-soft: 0 4px 14px rgba(0, 0, 0, 0.06);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: linear-gradient(135deg,#1e293b 0%,#0f172a 50%,#111827 100%);
    color: var(--text);
    min-height: 100vh;
}

.page-intro {
    max-width: 760px;
}

.game-container {
    width: min(1200px, calc(100% - 32px));
    margin: 40px auto;
    padding: 32px;
    border-radius: 28px;
background:

    linear-gradient(

        135deg,

        rgba(30,41,59,0.92),

        rgba(15,23,42,0.92)

    );  backdrop-filter: blur(16px);
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 8px 32px rgba(0,0,0,0.28);
    color: white;

}

.game-page-container {
    min-height: calc(100vh - 32px);
    margin: 16px auto;
    display: flex;
    flex-direction: column;
}

.game-page-container #game-screen {
    display: flex;
    flex: 1;
    flex-direction: column;
}
.game-container h1,
.game-container h2,
.game-container h3 {
    color: white;
}

.game-container > h1 {
    text-align: center;
}

.ui-icon {
    width: 1.15em;
    height: 1.15em;
    display: inline-block;
    vertical-align: -0.18em;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
}

.ui-icon-filled {
    fill: currentColor;
    stroke: none;
}

.life-icon.is-full,
.ui-icon-heart {
    color: #f43f5e;
}

.life-icon.is-empty {
    color: color-mix(in srgb, var(--text-muted) 62%, transparent);
}

.ui-icon-check,
.feedback-card.correct .feedback-svg {
    color: #22c55e;
}

.ui-icon-x,
.feedback-card.incorrect .feedback-svg {
    color: #ef4444;
}

.ui-icon-clock,
.feedback-inline-icon,
.room-status-icon {
    color: #38bdf8;
}

.badge-svg,
.badge-popup-icon,
.ui-icon-medal,
.ui-icon-trophy {
    color: #f59e0b;
}

.profile-avatar-svg,
.insight-svg,
.ui-icon-brain,
.ui-icon-rocket,
.ui-icon-zap,
.ui-icon-school,
.ui-icon-target,
.ui-icon-analytics {
    color: #5b5ce8;
}

.badge-card .ui-icon-school {
    color: #2563eb;
}

.badge-card .ui-icon-home {
    color: #0ea5e9;
}

.badge-card .ui-icon-rocket {
    color: #7c3aed;
}

.badge-card .ui-icon-check {
    color: #16a34a;
}

.badge-card .ui-icon-target {
    color: #dc2626;
}

.badge-card .ui-icon-file {
    color: #0891b2;
}

.badge-card .ui-icon-users {
    color: #0f766e;
}

.badge-card .ui-icon-analytics {
    color: #4f46e5;
}

.badge-card .ui-icon-star {
    color: #f59e0b;
}

.ui-icon-leaf {
    color: #10b981;
}

.theme-toggle-svg {
    width: 14px;
    height: 14px;
    color: currentColor;
}

.auth-container {
    max-width: 520px;
}

.auth-container > p {
    text-align: center;
}

.game-container p {
    color: rgba(255,255,255,0.92);
}

.admin-container {
    max-width: 1520px;
}

h1, h2, h3 {
    margin-top: 0;
}

p {
    color: var(--muted);
    line-height: 1.5;
}

/* Forms */

.form-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 15px;
}

.form-group label {
    margin-bottom: 6px;
    font-weight: bold;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    min-height: 46px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 15px;
    background: white;
}

.password-policy-hint,
.password-policy-list {
    display: grid;
    gap: 7px;
    margin: 10px 0 0;
    padding: 0;
    list-style: none;
    color: rgba(255,255,255,0.78);
    font-size: 13px;
    line-height: 1.35;
}

.password-policy-list li {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 24px;
    transition: color 0.18s ease;
}

.password-policy-check {
    display: inline-grid;
    place-items: center;
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.32);
    color: transparent;
    font-size: 12px;
    font-weight: 900;
    transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.password-policy-list li.is-met {
    color: #86efac;
}

.password-policy-list li.is-met .password-policy-check {
    background: #22c55e;
    border-color: #22c55e;
    color: white;
}

:root[data-theme="light"] .password-policy-hint,
:root[data-theme="light"] .password-policy-list {
    color: #334155;
}

:root[data-theme="light"] .password-policy-check {
    border-color: #94a3b8;
    background: #ffffff;
}

:root[data-theme="light"] .password-policy-list li.is-met {
    color: #15803d;
}

:root[data-theme="light"] .password-policy-list li.is-met .password-policy-check {
    background: #16a34a;
    border-color: #16a34a;
    color: #ffffff;
}

input.password-confirm-valid {
    border-color: #22c55e !important;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.22) !important;
}

input.password-confirm-invalid {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.22) !important;
}

.form-group select {
    appearance: none;
    background-image:
        linear-gradient(45deg, transparent 50%, #64748b 50%),
        linear-gradient(135deg, #64748b 50%, transparent 50%);
    background-position:
        calc(100% - 18px) 50%,
        calc(100% - 12px) 50%;
    background-size:
        6px 6px,
        6px 6px;
    background-repeat: no-repeat;
    padding-right: 36px;
}

select,
input,
textarea {
    max-width: 100%;
}

.form-group textarea {
    min-height: 90px;
    resize: vertical;
}

.form-group input[type="file"] {
    min-height: 46px;
    padding: 8px;
    background: #f8fafc;
    border: 1px dashed #a5b4fc;
    color: #111827;
    cursor: pointer;
}

.form-group input[type="file"]::file-selector-button {
    min-height: 36px;
    margin-right: 12px;
    padding: 8px 14px;
    border: 0;
    border-radius: 9px;
    background: var(--primary);
    color: white;
    font-weight: 800;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.form-group input[type="file"]::-webkit-file-upload-button {
    min-height: 36px;
    margin-right: 12px;
    padding: 8px 14px;
    border: 0;
    border-radius: 9px;
    background: var(--primary);
    color: white;
    font-weight: 800;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.form-group input[type="file"]:hover::file-selector-button,
.form-group input[type="file"]:hover::-webkit-file-upload-button {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 15px;
}

.register-auth-container {
    max-width: 1120px;
}

.register-layout {
    display: grid;
    grid-template-columns: minmax(300px, 0.9fr) minmax(360px, 1.1fr);
    gap: 18px;
    align-items: start;
}

.register-panel {
    padding: 18px;
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.06);
}

.register-panel h2 {
    margin: 0 0 14px;
    text-align: left;
    font-size: 18px;
}

.register-panel label,
.register-panel .form-group label {
    color: #f8fafc;
}

.optional-section-heading {
    margin-bottom: 16px;
}

.optional-section-heading span {
    display: inline-flex;
    padding: 5px 10px;
    border-radius: 999px;
    background: rgba(91, 92, 226, 0.16);
    color: #c7d2fe;
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.optional-section-heading h2 {
    margin-top: 10px;
    margin-bottom: 6px;
}

.optional-section-heading p {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}

.role-picker {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.role-choice {
    position: relative;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 7px 10px;
    align-items: center;
    min-height: 96px;
    padding: 13px;
    border: 1px solid rgba(148, 163, 184, 0.38);
    border-radius: 14px;
    background: rgba(15, 23, 42, 0.55);
    cursor: pointer;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease, background 0.18s ease;
}

.role-choice input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.role-choice-icon {
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    color: #ffffff;
    background: linear-gradient(135deg, #5b5ce2, #14b8a6);
}

.role-choice strong {
    color: #f8fafc;
    font-size: 15px;
    line-height: 1.15;
}

.role-choice em {
    grid-column: 1 / -1;
    color: #cbd5e1;
    font-size: 12px;
    font-style: normal;
    font-weight: 700;
    line-height: 1.35;
}

.role-choice:has(input:checked) {
    border-color: #7c3aed;
    background: linear-gradient(135deg, rgba(91, 92, 226, 0.3), rgba(20, 184, 166, 0.16));
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.18);
}

.role-choice:hover {
    transform: translateY(-1px);
    border-color: #8b5cf6;
}

.register-role-note {
    margin: -4px 0 16px;
    padding: 12px 14px;
    border: 1px solid rgba(20, 184, 166, 0.28);
    border-radius: 12px;
    background: rgba(20, 184, 166, 0.1);
    color: #d1fae5;
    font-size: 13px;
    font-weight: 800;
    line-height: 1.4;
}

:root[data-theme="light"] .register-panel {
    background: rgba(248, 250, 252, 0.94);
    border-color: rgba(203, 213, 225, 0.95);
}

:root[data-theme="light"] .register-panel label,
:root[data-theme="light"] .register-panel .form-group label {
    color: #0f172a;
}

:root[data-theme="light"] .optional-section-heading span {
    background: rgba(91, 92, 226, 0.12);
    color: #3730a3;
}

:root[data-theme="light"] .role-choice {
    background: #ffffff;
    border-color: #cbd5e1;
}

:root[data-theme="light"] .role-choice strong {
    color: #0f172a;
}

:root[data-theme="light"] .role-choice em {
    color: #475569;
}

:root[data-theme="light"] .role-choice:has(input:checked) {
    background: linear-gradient(135deg, rgba(238, 242, 255, 0.98), rgba(240, 253, 250, 0.98));
    border-color: #5b5ce2;
}

:root[data-theme="light"] .register-role-note {
    background: #ecfdf5;
    border-color: #99f6e4;
    color: #065f46;
}

@media (max-width: 640px) {
    .role-picker {
        grid-template-columns: 1fr;
    }
}

.metric-empty-note {
    display: block;
    max-width: 220px;
    margin: 2px auto 0;
    color: #64748b;
    font-size: 12px;
    font-weight: 800;
    line-height: 1.35;
    text-align: center;
}

:root[data-theme="dark"] .metric-empty-note {
    color: #cbd5e1;
}

.required-mark {
    color: #fb7185;
    font-weight: 900;
}

.register-auth-container form > .primary-btn {
    width: 100%;
    max-width: none;
    margin: 18px 0 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Buttons */

.primary-btn,
.difficulty-btn {
    width: 100%;
    padding: 13px 16px;
    border: none;
    border-radius: 12px;
    background: var(--primary);
    color: white;
    font-size: 16px;
    cursor: pointer;
    text-decoration: none;
    transition: 0.2s ease;
}

.primary-btn:hover,
.difficulty-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.primary-btn:disabled,
.difficulty-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
    filter: grayscale(0.2);
}

.logout-btn {
    background: var(--danger);
    color: white;
    padding: 9px 14px;
    border-radius: 10px;
    text-decoration: none;
    font-size: 14px;
}

.logout-btn:hover {
    background: #b02a37;
}

.secondary-btn,
.secondary-landing {
    background: var(--secondary) !important;
}

.secondary-form-btn {
    margin-top: 10px;
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 10px;
    background: var(--muted);
    color: white;
    font-size: 16px;
    cursor: pointer;
}

.primary-btn + .primary-btn,
.primary-btn + .logout-btn,
.logout-btn + .logout-btn,
.logout-btn + .primary-btn,
.secondary-form-btn + .primary-btn,
.secondary-form-btn + .secondary-form-btn {
    margin-top: 10px;
}

.top-links .primary-btn + .primary-btn,
.top-links .primary-btn + .logout-btn,
.top-links .logout-btn + .logout-btn,
.top-links .logout-btn + .primary-btn {
    margin-top: 0;
}

.admin-form > .primary-btn,
form > .primary-btn {
    margin-top: 14px;
}

/* Header */

.top-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.top-links {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.language-switch {
    font-size: 14px;
}

.language-switch a {
    text-decoration: none;
    margin: 0 4px;
    color: var(--primary);
    font-weight: bold;
}

/* Landing */

.landing-actions {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: 25px;
}

.landing-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-align: center;
    text-decoration: none;
}

.admin-login-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 10px;
    text-align: center;
    color: var(--muted);
    font-size: 14px;
    text-decoration: none;
}

.admin-login-link:hover {
    text-decoration: underline;
}

.room-menu-btn,
.room-back-link {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: min(100%, 520px);
    min-height: 52px;
    margin: 0 auto 15px;
    text-align: center;
    text-decoration: none;
}

.room-back-link {
    min-height: 44px;
}

.room-page-top-links {
    margin-left: auto;
}

/* Game */

.difficulty-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 20px;
}

.difficulty-btn {
    min-width: 140px;
}

.hud,
.game-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    background: rgba(255,255,255,0.94);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    margin-bottom: 14px;
}

.hud-stat {
    min-width: 0;
    padding: 12px 14px;
    border-radius: 14px;
    background: white;
    box-shadow: var(--shadow-soft);
}

.hud > p,
.game-info > p {
    min-width: 0;
    margin: 0;
    padding: 12px 14px;
    border-radius: 14px;
    background: white;
    box-shadow: var(--shadow-soft);
}

.hud-stat span {
    display: block;
    margin-bottom: 6px;
    color: #64748b;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0;
}

.hud-stat strong {
    display: block;
    color: #111827;
    font-size: 20px;
    line-height: 1.15;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hud > p strong,
.game-info > p strong {
    color: #64748b;
    font-size: 12px;
    text-transform: uppercase;
}

.game-progress-panel {
    padding: 14px;
    margin-bottom: 18px;
    border-radius: 16px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
}

.progress-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.progress-meta span {
    color: rgba(255,255,255,0.88);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.progress-meta strong {
    color: white;
    font-size: 14px;
    text-align: right;
}

.progress-track {
    height: 14px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(255,255,255,0.24);
    border: 1px solid rgba(255,255,255,0.24);
}

.progress-fill {
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #22c55e, #38bdf8, #818cf8);
    box-shadow: 0 0 16px rgba(56,189,248,0.5);
    transition: width 0.25s ease;
}

.progress-fill.is-active {
    min-width: 12px;
}

.question-box {
    margin-top: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.room-play-container {
    width: min(1400px, calc(100% - 32px));
}

.room-play-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(260px, 320px);
    gap: 18px;
    align-items: stretch;
    flex: 1;
}

.room-play-layout .question-box {
    min-width: 0;
    margin-top: 0;
}

.question-meta {
    width: fit-content;
    max-width: 100%;
    margin: 0 auto 12px;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.18);
    color: rgba(255,255,255,0.92) !important;
    font-size: 13px;
    font-weight: 800;
    text-align: center;
}

.option-btn {
    display: flex;
    align-items: center;
    gap: 14px;

    margin: 12px 0;
    padding: 16px 18px;
    width: 100%;

    border: 2px solid transparent;
    border-radius: 16px;

    background: white;
    color: var(--text);

    cursor: pointer;

    transition: 0.2s ease;

    box-shadow: var(--shadow-soft);

    font-size: 16px;
    text-align: left;
}

.option-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    border-color: var(--primary);
    background: #f8f9ff;
}

.option-btn:disabled {
    opacity: 0.75;
    cursor: not-allowed;
}

.feedback-card {
    width: 100%;
    margin: 14px 0;
    padding: 20px;
    border-radius: 18px;
    border: 2px solid transparent;
    color: #111827;
    box-shadow: var(--shadow-soft);
    text-align: left;
}

.feedback-card.correct {
    background: #ecfdf5;
    border-color: #86efac;
}

.feedback-card.incorrect {
    background: #fef2f2;
    border-color: #fca5a5;
}

.feedback-card-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 12px;
}

.feedback-status-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(255,255,255,0.8);
    font-size: 22px;
    flex-shrink: 0;
}

.feedback-eyebrow {
    display: block;
    color: #4b5563;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0;
    margin-bottom: 3px;
}

.feedback-card h3 {
    color: #111827 !important;
    margin: 0;
    font-size: 22px;
}

.feedback-card p {
    color: #1f2937 !important;
    line-height: 1.55;
    margin: 10px 0;
}

.feedback-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 16px;
}

#feedback-countdown {
    color: #374151;
    font-weight: 800;
}

.feedback-continue-btn,
.play-again-btn {
    width: auto;
    min-width: 150px;
}

.game-over-title {
    display: block;
    text-align: center;
    font-size: clamp(32px, 5vw, 58px);
    line-height: 1.05;
}

.game-over-card {
    width: min(820px, 100%);
    margin: 8px auto 0;
    padding: 22px;
    border-radius: 22px;
    background: rgba(255,255,255,0.96);
    border: 1px solid rgba(255,255,255,0.24);
    box-shadow: 0 16px 34px rgba(0,0,0,0.2);
}

.game-over-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.game-over-stat {
    min-width: 0;
    padding: 16px;
    border-radius: 16px;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    text-align: center;
}

.game-over-stat span {
    display: block;
    margin-bottom: 8px;
    color: #475569;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.game-over-stat strong {
    display: block;
    color: #111827;
    font-size: 24px;
    line-height: 1.15;
}

.save-status-pill {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 14px;
    border-radius: 14px;
    font-weight: 800;
    text-align: center;
}

.game-over-save-actions {
    display: flex;
    align-items: stretch;
    justify-content: center;
    gap: 12px;
    margin-top: 16px;
}

.game-over-save-actions .save-status-pill {
    flex: 1 1 auto;
}

.game-stats-link {
    flex: 0 0 auto;
    width: auto;
    min-width: 220px;
    margin: 0;
    text-decoration: none;
}

.game-stats-link[hidden] {
    display: none;
}

.save-status-pill.is-saving {
    background: #eef2ff;
    color: #3730a3;
}

.save-status-pill.is-saved {
    background: #dcfce7;
    color: #166534;
}

.save-status-pill.is-error {
    background: #fee2e2;
    color: #991b1b;
}

.game-over-actions {
    display: flex;
    justify-content: center;
    margin-top: 18px;
}

.game-over-actions .play-again-btn {
    max-width: 280px;
}

.game-result-stats-page .game-result-summary {
    margin: 16px 0 24px;
}

.game-result-answer-table td:nth-child(2),
.game-result-answer-table td:nth-child(4),
.game-result-answer-table td:nth-child(5) {
    white-space: normal;
    line-height: 1.35;
}

.game-result-answer-table tr.is-correct td {
    background: rgba(220, 252, 231, 0.68);
}

.game-result-answer-table tr.is-incorrect td {
    background: rgba(254, 226, 226, 0.68);
}

.game-result-feedback-section {
    margin-bottom: 24px;
}

.game-result-feedback-card {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(240px, 0.8fr);
    gap: 18px;
    padding: 20px;
    border-radius: 18px;
    background:
        linear-gradient(135deg, rgba(91, 91, 232, 0.14), rgba(20, 184, 166, 0.12)),
        var(--theme-section-bg);
    border: 1px solid var(--theme-container-border);
    color: var(--theme-section-text);
}

.game-result-feedback-card h3 {
    margin: 0 0 8px;
    color: var(--theme-section-text);
}

.game-result-feedback-card p {
    margin: 0;
    color: var(--theme-section-muted);
}

.game-result-feedback-card ul {
    display: grid;
    gap: 10px;
    margin: 0;
    padding-left: 18px;
    color: var(--theme-section-text);
    font-weight: 700;
}

.game-result-charts-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 24px;
}

.game-result-charts-grid .chart-card {
    min-height: 340px;
    border: 1px solid var(--theme-container-border);
    background: var(--theme-section-bg);
    color: var(--theme-section-text);
}

.game-result-charts-grid .chart-card h3 {
    color: var(--theme-section-text) !important;
}

.game-result-charts-grid .chart-card canvas {
    width: 100%;
    max-height: 280px;
}

.section-heading-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.section-heading-row h2 {
    margin: 0 0 6px;
}

.section-heading-row p {
    margin: 0;
    color: var(--theme-muted);
}

.empty-state-panel {
    text-align: center;
}

.option-radio {
    width: 22px;
    height: 22px;

    border-radius: 50%;
    border: 2px solid var(--primary);

    flex-shrink: 0;

    position: relative;
}

.option-radio::after {
    content: "";

    position: absolute;

    top: 50%;
    left: 50%;

    width: 10px;
    height: 10px;

    border-radius: 50%;

    background: var(--primary);

    transform: translate(-50%, -50%) scale(0);

    transition: 0.2s ease;
}

.option-btn:hover .option-radio::after {
    transform: translate(-50%, -50%) scale(1);
}

.option-btn.is-selected {
    border-color: #818cf8;
    background: #eef2ff;
    color: #111827;
    box-shadow: 0 8px 18px rgba(79, 70, 229, 0.18);
}

.option-btn.is-selected .option-radio::after {
    transform: translate(-50%, -50%) scale(1);
}

.submit-answer-btn {
    margin-top: 14px;
}

.submit-answer-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

#feedback {
    font-weight: bold;
    margin-top: 14px;
}

/* Dashboard cards */

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 16px;
    margin-top: 20px;
}

.dashboard-card {
    background:
        linear-gradient(
            135deg,
            rgba(255,255,255,0.92),
            rgba(248,250,252,0.88)
        );
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 22px;
    padding: 22px;
    text-align: center;
    box-shadow:
        0 10px 24px rgba(0,0,0,0.16);
    color: #111827;
    transition: 0.2s ease;
    overflow-x: auto;
}

.dashboard-card h3 {
    margin-bottom: 10px;
    font-size: 17px;
    color: #374151;
    font-weight: 700;
}

.dashboard-card p {
    font-size: 34px;
    font-weight: 800;
    margin: 0;
    color: #111827;
}

.dashboard-link {
    display: block;
    text-decoration: none;
    color: inherit;
    transition: 0.2s ease;
}

.dashboard-link:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
}

/* Admin dashboard */

.admin-dashboard-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 25px;
    margin-top: 25px;
    align-items: start;
}

.dashboard-summary-section {
    width: 100%;
}

.admin-tools-panel {
    background:
        linear-gradient(
            135deg,
            rgba(15,23,42,0.92),
            rgba(30,41,59,0.92)
        );
    border-radius: 28px;
    padding: 22px;
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow:
        0 10px 28px rgba(0,0,0,0.24);
}
.admin-tools-panel h2 {
    color: white;
}

.admin-tools-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 10px;
}

.tool-card {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px 16px;
    background:
        rgba(255,255,255,0.06);
    border:
        1px solid rgba(255,255,255,0.06);
    backdrop-filter: blur(10px);
}

.tool-card h3 {
    color: white;
    margin: 0;
    font-size: 15px;
    line-height: 1.25;
    text-align: center;
}

.tool-card p {
    color: rgba(255,255,255,0.9);
}

/* Admin sections */

.admin-question-nav {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 10px;
    margin: 22px 0 8px;
}

.admin-question-nav a {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 12px;
    border-radius: 999px;
    border: 1px solid #94a3b8;
    background: #f8fafc;
    color: #0f172a !important;
    font-size: 14px;
    font-weight: 800;
    text-decoration: none;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
}

.admin-question-nav a:hover {
    background: #dbeafe;
    border-color: #2563eb;
    color: #0f172a !important;
}

.admin-section {
    margin-top: 28px;
    padding: 20px;
    background: #f8f9fc;
    border: 1px solid var(--border);
    border-radius: 18px;
    overflow: visible;
}

.admin-section-heading {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 10px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #111827;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.admin-section-heading h2 {
    flex: 1;
    min-width: 220px;
    margin: 0;
}

.admin-section-heading > span:not(.accordion-icon) {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 6px 10px;
    border-radius: 999px;
    background: #dcfce7;
    color: #14532d !important;
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0;
}

.admin-section-heading:hover h2 {
    color: #1d4ed8 !important;
}

.accordion-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    margin-left: auto;
    border-radius: 999px;
    background: #e0f2fe;
    border: 1px solid #bae6fd;
    color: #0f172a !important;
    font-size: 20px;
    font-weight: 900;
    line-height: 1;
    flex: 0 0 auto;
}

.accordion-icon::before {
    content: "+";
}

.admin-section.is-open .accordion-icon {
    background: #dcfce7;
    border-color: #86efac;
    color: #14532d !important;
}

.admin-section.is-open .accordion-icon::before {
    content: "-";
}

.admin-section-body {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #dbe3ef;
    animation: fadeIn 0.18s ease;
}

.admin-section-body[hidden] {
    display: none;
}

.admin-section-body > p:first-child {
    margin-top: 0;
}

.custom-category-input {
    display: none;
    margin-top: 8px;
}

.admin-section + .admin-section,
.dashboard-grid + .admin-section,
.admin-section + .dashboard-grid,
.analytics-layout + .admin-section {
    margin-top: 32px;
}

.admin-section > .primary-btn,
.admin-section > .logout-btn,
.admin-section > form,
.admin-section > table,
.admin-section > .admin-table,
.admin-section > .dashboard-grid,
.admin-section > .analytics-layout {
    margin-top: 16px;
}

.admin-table {
    width: 100%;
    min-width: 0;
    table-layout: auto;
    border-collapse: separate;
    border-spacing: 0;
    background: white;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
    font-size: 14px;
}

.admin-table th,
.admin-table td {
    border: 0;
    border-bottom: 1px solid #dbe3ef;
    padding: 12px 14px;
    vertical-align: top;
    line-height: 1.45;
}

.admin-table th {
    background: #111827;
    color: white;
    font-weight: 800;
    text-align: left;
    white-space: normal;
}

.admin-table th:not(:last-child),
.admin-table td:not(:last-child) {
    border-right: 1px solid #e2e8f0;
}

.admin-table tbody tr:last-child td {
    border-bottom: 0;
}

.admin-table tbody tr:hover td {
    background: #eef4ff;
}

.admin-table td:first-child,
.admin-table th:first-child {
    padding-left: 16px;
}

.admin-table td:last-child,
.admin-table th:last-child {
    padding-right: 16px;
}

.admin-table .table-input,
.admin-table input,
.admin-table select {
    width: 100%;
    min-width: 0;
    min-height: 40px;
}

.table-btn {
    padding: 7px 10px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    margin: 2px;
}

.history-stats-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 76px;
    min-height: 34px;
    padding: 7px 10px;
    border-radius: 999px;
    background: rgba(20, 184, 166, 0.92) !important;
    color: #ffffff !important;
    font-size: 12px;
    font-weight: 900;
    line-height: 1;
    white-space: nowrap;
    text-decoration: none !important;
}

.history-stats-btn svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    stroke-width: 2.4;
    fill: none;
}

.history-stats-btn:hover {
    background: rgba(13, 148, 136, 0.96) !important;
    transform: translateY(-1px);
}

.report-view-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    padding: 9px 13px;
    border-radius: 999px;
    background: #eef2ff;
    border: 1px solid #c7d2fe;
    color: #3730a3 !important;
    font-size: 13px;
    font-weight: 800;
    line-height: 1;
    text-decoration: none !important;
    white-space: nowrap;
    box-shadow: 0 6px 14px rgba(79, 70, 229, 0.14);
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.report-view-btn:hover {
    background: #e0e7ff;
    color: #312e81 !important;
    text-decoration: none !important;
    transform: translateY(-1px);
    box-shadow: 0 10px 20px rgba(79, 70, 229, 0.22);
}

.report-view-icon {
    font-size: 15px;
    line-height: 1;
}

.edit-btn {
    background: var(--warning);
}

.delete-btn {
    background: var(--danger);
    color: white;
}

/* Room setup */

.question-select-item {
    display: block;
    background: white;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 8px;
    cursor: pointer;
}

.room-config-summary {
    margin-top: 16px;
}

.room-config-summary p {
    color: #111827 !important;
    font-weight: 700;
}

.room-config-table {
    min-width: 560px;
}

.room-lobby-settings {
    display: grid;
    grid-template-columns: repeat(2, minmax(180px, 1fr)) minmax(150px, auto);
    gap: 12px;
    align-items: end;
    margin: 0 0 16px;
    padding: 16px;
    border: 1px solid rgba(203, 213, 225, 0.85);
    border-radius: 16px;
    background: rgba(248, 250, 252, 0.92);
}

.room-lobby-settings .form-group {
    margin: 0;
}

.room-lobby-settings .primary-btn {
    width: 100%;
    min-height: 46px;
    margin: 0;
}

.room-requirement-builder {
    display: grid;
    grid-template-columns: minmax(220px, 1.4fr) minmax(130px, 0.7fr) minmax(130px, 0.7fr) minmax(150px, auto);
    gap: 12px;
    align-items: end;
    margin: 16px 0;
    padding: 16px;
    border: 1px solid rgba(203, 213, 225, 0.85);
    border-radius: 16px;
    background: rgba(248, 250, 252, 0.92);
}

.hint-icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    min-width: 30px;
    border: 1px solid rgba(91, 92, 226, 0.34);
    border-radius: 999px;
    background: rgba(91, 92, 226, 0.12);
    color: #3730a3;
    font-size: 15px;
    font-weight: 900;
    line-height: 1;
    cursor: pointer;
    box-shadow: none;
}

.hint-icon-button:hover,
.hint-icon-button:focus-visible {
    background: #5b5ce8;
    color: #ffffff;
    outline: none;
}

.room-requirement-builder > .hint-icon-button {
    grid-column: 1 / -1;
    justify-self: end;
}

.inline-hint {
    width: 24px;
    height: 24px;
    min-width: 24px;
    margin-left: 6px;
    vertical-align: middle;
    font-size: 13px;
}

.room-config-hint {
    grid-column: 1 / -1;
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid rgba(37, 99, 235, 0.22);
    background: rgba(219, 234, 254, 0.58);
    color: #1e293b;
    font-size: 13px;
    line-height: 1.45;
}

.room-config-hint strong {
    color: #1d4ed8;
    white-space: nowrap;
}

.room-selection-actions,
.room-question-bank-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 12px 0;
}

.room-selection-actions span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.room-question-bank-panel {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid rgba(148, 163, 184, 0.28);
}

.room-question-bank-heading h3,
.room-question-bank-heading p {
    margin: 0;
    text-align: left;
}

.room-question-bank-heading p {
    margin-top: 5px;
    color: var(--muted) !important;
    font-size: 14px;
}

.compact-bank-filters {
    width: 100%;
    grid-template-columns: minmax(280px, 2fr) minmax(190px, 1fr) minmax(170px, 0.9fr) minmax(150px, auto);
}

.compact-bank-filters .secondary-form-btn {
    width: 100%;
    min-height: 46px;
    align-self: end;
}

.room-question-bank-table .col-select {
    width: 52px;
    text-align: center;
}

.room-question-bank-table input[type="checkbox"],
.room-question-detail summary input[type="checkbox"] {
    width: 18px;
    height: 18px;
    min-width: 18px;
    accent-color: #5b5ce8;
}

.room-question-detail summary {
    grid-template-columns: auto auto minmax(0, 1fr) auto;
}

.room-question-id-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    padding: 5px 9px;
    border-radius: 999px;
    background: rgba(91, 92, 226, 0.12);
    color: #3730a3;
    font-size: 12px;
    font-weight: 900;
}

.room-question-detail summary strong {
    min-width: 0;
    overflow-wrap: anywhere;
}

.room-question-state-pills {
    display: inline-flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
}

.room-question-state-pills span {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 4px 8px;
    border-radius: 999px;
    background: #eef2ff;
    color: #3730a3;
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0;
}

.room-bank-assigned-pill {
    display: inline-flex;
    margin-left: 8px;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(20, 184, 166, 0.14);
    color: #0f766e;
    font-size: 11px;
    font-weight: 900;
    white-space: nowrap;
}

.room-question-bank-table tr.is-assigned-to-room td {
    opacity: 0.72;
}

:root[data-theme="dark"] .room-config-hint {
    background: rgba(37, 99, 235, 0.14);
    border-color: rgba(147, 197, 253, 0.22);
    color: #dbeafe;
}

:root[data-theme="dark"] .room-config-hint strong {
    color: #93c5fd;
}

:root[data-theme="dark"] .room-bank-assigned-pill {
    background: rgba(45, 212, 191, 0.14);
    color: #99f6e4;
}

:root[data-theme="dark"] .hint-icon-button {
    border-color: rgba(129, 140, 248, 0.45);
    background: rgba(129, 140, 248, 0.18);
    color: #c7d2fe;
}

:root[data-theme="dark"] .hint-icon-button:hover,
:root[data-theme="dark"] .hint-icon-button:focus-visible {
    background: #6366f1;
    color: #ffffff;
}

:root[data-theme="dark"] .room-question-id-badge {
    background: rgba(129, 140, 248, 0.2);
    color: #c7d2fe;
}

:root[data-theme="dark"] .room-question-state-pills span {
    background: rgba(45, 212, 191, 0.13);
    color: #99f6e4;
}

.room-requirement-builder .form-group {
    margin: 0;
}

.room-requirement-builder .primary-btn {
    min-height: 46px;
    margin: 0;
}

:root[data-theme="dark"] .room-lobby-settings {
    background: rgba(15, 23, 42, 0.58);
    border-color: rgba(148, 163, 184, 0.26);
}

:root[data-theme="dark"] .room-lobby-settings label,
:root[data-theme="dark"] .room-requirement-builder label {
    color: #e5edf7;
}

:root[data-theme="dark"] .room-requirement-builder {
    background: rgba(15, 23, 42, 0.58);
    border-color: rgba(148, 163, 184, 0.26);
}

.room-question-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 10px;
    margin: 12px 0 16px;
    padding: 14px;
    border-radius: 14px;
    border: 1px solid #dbe3ef;
    background: #f8fafc;
    color: #111827;
}

.room-question-summary span,
.room-question-summary em {
    color: #111827;
}

.room-question-summary em {
    grid-column: 1 / -1;
    font-style: normal;
    font-weight: 800;
}

.room-question-summary.is-success {
    background: #ecfdf5;
    border-color: #86efac;
}

.room-question-summary.is-warning {
    background: #fffbeb;
    border-color: #fcd34d;
}

.room-requirements-list {
    overflow-x: auto;
    margin-top: 16px;
}

.assigned-room-questions {
    display: grid;
    gap: 10px;
    margin-top: 12px;
}

.room-question-detail,
.question-stat-card {
    border: 1px solid #dbe3ef;
    border-radius: 12px;
    background: #ffffff;
    color: #111827;
    box-shadow: var(--shadow-soft);
    overflow: hidden;
}

.room-question-detail summary,
.question-stat-card summary {
    display: grid;
    gap: 10px;
    align-items: center;
    padding: 13px 14px;
    cursor: pointer;
    color: #111827;
}

.room-question-detail summary {
    grid-template-columns: auto auto minmax(0, 1fr) auto;
}

.question-stat-card summary {
    grid-template-columns: auto 1fr auto;
}

.room-question-detail summary strong,
.question-stat-card summary strong {
    color: #111827;
}

.room-question-detail summary em,
.question-stat-card summary em {
    color: #475569;
    font-style: normal;
    font-weight: 800;
    white-space: nowrap;
}

.room-question-detail-body,
.question-stat-body {
    padding: 0 14px 14px;
}

.room-question-detail-body p,
.question-stat-body p {
    color: #111827 !important;
}

.question-stats-list {
    display: grid;
    gap: 12px;
}

.question-stat-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 10px;
    margin: 10px 0 14px;
}

.question-stat-metrics span {
    padding: 9px 10px;
    border-radius: 10px;
    background: #f8fafc;
    color: #111827;
    border: 1px solid #e2e8f0;
}

@media (max-width: 720px) {
    .room-lobby-settings,
    .room-requirement-builder {
        grid-template-columns: 1fr;
    }

    .room-selection-actions,
    .room-question-bank-heading {
        align-items: stretch;
        flex-direction: column;
    }

    .compact-bank-filters {
        grid-template-columns: 1fr;
    }
}

.question-option-stats {
    display: grid;
    gap: 9px;
    padding: 0;
    margin: 0;
    list-style: none;
}

.question-option-stat {
    padding: 10px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
}

.question-option-stat.is-correct {
    border-color: #86efac;
    background: #ecfdf5;
}

.question-option-stat.is-most-wrong {
    border-color: #fca5a5;
    background: #fef2f2;
}

.question-option-stat-row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 10px;
    align-items: center;
    color: #111827;
}

.question-option-stat-row em {
    font-style: normal;
    font-weight: 900;
}

.question-option-track {
    height: 7px;
    margin-top: 8px;
    border-radius: 999px;
    background: #e2e8f0;
    overflow: hidden;
}

.question-option-track span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: #5b5ce2;
}

.question-option-stat.is-correct .question-option-track span {
    background: #16a34a;
}

.question-option-stat.is-most-wrong .question-option-track span {
    background: #dc2626;
}

.config-status {
    display: inline-flex;
    align-items: center;
    padding: 5px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.config-status.good {
    background: #dcfce7;
    color: #166534;
}

.config-status.bad {
    background: #fee2e2;
    color: #991b1b;
}

.ai-generation-progress {
    margin-top: 16px;
    padding: 14px;
    border-radius: 14px;
    background: #f8fafc;
    border: 1px solid #dbe3ef;
}

.ai-generation-progress .progress-meta span,
.ai-generation-progress .progress-meta strong {
    color: #111827;
}

.ai-generation-progress .progress-track {
    background: #e2e8f0;
    border-color: #cbd5e1;
}

.question-select-item:hover {
    background: #eef1ff;
}

.question-select-item input {
    margin-right: 8px;
}

#players-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 0;
    margin: 16px 0 0;
    list-style: none;
}

.player-pill {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    min-height: 42px;
    max-width: 100%;
    padding: 7px 12px 7px 8px;
    border-radius: 999px;
    background: white;
    border: 1px solid #dbe3ef;
    box-shadow: var(--shadow-soft);
    color: #111827;
    font-weight: 800;
    animation: playerPillIn 0.35s ease both;
}

.player-pill-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #5b5ce2, #38bdf8);
    color: white;
    font-size: 13px;
    flex: 0 0 auto;
}

.player-pill-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.player-pill.is-current {
    border-color: #86efac;
    background: #ecfdf5;
}

.player-pill.is-empty {
    background: #f8fafc;
    color: #64748b;
    box-shadow: none;
}

.room-status-message {
    display: none;
    width: min(680px, 100%);
    margin: 18px auto 0;
    padding: 12px 16px;
    border-radius: 14px;
    background: rgba(255,255,255,0.94);
    border: 1px solid rgba(203,213,225,0.9);
    color: #111827 !important;
    font-weight: 800;
    text-align: center;
    box-shadow: var(--shadow-soft);
    animation: fadeIn 0.25s ease;
}

.room-status-message:not(:empty),
.room-status-message.is-info {
    display: block;
}

.room-status-message.is-info {
    background: #eef2ff;
    border-color: #c7d2fe;
    color: #3730a3 !important;
}

.room-status-message.is-success {
    background: #ecfdf5;
    border-color: #86efac;
    color: #166534 !important;
}

.room-status-message.is-error {
    background: #fef2f2;
    border-color: #fca5a5;
    color: #991b1b !important;
}

.room-status-message.is-warning {
    background: #fffbeb;
    border-color: #fcd34d;
    color: #92400e !important;
}

.room-loader {
    display: flex;
    justify-content: center;
    margin: 14px auto 0;
    font-size: 28px;
    animation: pulse 1.2s ease-in-out infinite;
}

/* Live ranking */

#live-ranking-box {
    animation: fadeIn 0.25s ease-in-out;
}

.live-ranking-panel {
    display: block;
    margin-top: 0;
    align-self: stretch;
    max-height: min(620px, calc(100vh - 260px));
    overflow-y: auto;
    position: sticky;
    top: 16px;
}

.live-ranking-panel h2 {
    margin-bottom: 14px;
    font-size: 18px;
}

.live-ranking-item {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    background: white;
    padding: 12px;
    border-radius: 10px;
    margin-bottom: 8px;
    border: 1px solid var(--border);
    transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.live-ranking-item:hover {
    transform: translateY(-1px);
    border-color: #a5b4fc;
}

.current-player-rank {
    background: #d4edda !important;
    font-weight: bold;
}

/* Podium */

.podium-section {
    margin-top: 25px;
    margin-bottom: 25px;
    text-align: center;
}

.podium-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 18px;
    align-items: end;
}

.podium-card {
    background: white;
    color: #111827;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 24px;
    text-align: center;
    box-shadow: var(--shadow);
    animation: podiumPop 0.35s ease-in-out;
}

.podium-card h3 {
    color: #111827 !important;
    margin: 10px 0;
}

.podium-card p {
    font-size: 30px;
    font-weight: bold;
    margin: 0;
    color: #111827 !important;
}

.podium-card small {
    color: #374151 !important;
}

.podium-medal {
    font-size: 44px;
}

.first-place {
    transform: scale(1.05);
}

.second-place {
    opacity: 0.95;
}

.third-place {
    opacity: 0.9;
}

/* Analytics */

.analytics-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 20px;
}

/* Recent table */

.recent-games-section {
    margin-top: 30px;
}

#recentGamesTable {
    border-collapse: collapse;
    margin-top: 10px;
}

#recentGamesTable th,
#recentGamesTable td {
    padding: 10px;
    text-align: center;
}

/* Animations */

@keyframes podiumPop {
    from {
        transform: scale(0.92);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes playerPillIn {
    from {
        opacity: 0;
        transform: translateY(8px) scale(0.96);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 0.72;
    }

    50% {
        transform: scale(1.08);
        opacity: 1;
    }
}

/* Responsive */

@media (max-width: 1000px) {
    .admin-dashboard-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    .analytics-layout {
        grid-template-columns: 1fr;
    }

    .register-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 650px) {
    body {
        background:
            linear-gradient(180deg, #0f172a 0%, #172033 100%);
    }

    .game-container {
        width: min(100% - 20px, 1200px);
        margin: 10px auto;
        padding: 16px;
        border-radius: 20px;
    }

    .auth-container {
        width: 100%;
        min-height: 100vh;
        margin: 0;
        padding: 18px 16px 24px;
        border: 0;
        border-radius: 0;
        box-shadow: none;
        background:
            linear-gradient(180deg, rgba(30,41,59,0.98), rgba(15,23,42,0.98));
    }

    .auth-container .top-actions {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        margin-bottom: 28px;
    }

    .auth-container .language-pill {
        align-self: center;
    }

    .auth-container .admin-login-link {
        margin: 0;
        padding: 9px 12px;
        font-size: 13px;
    }

    .auth-container h1 {
        margin-bottom: 18px;
        font-size: 28px;
        line-height: 1.12;
        text-align: left;
    }

    .auth-container > p {
        margin: 0 0 18px;
        text-align: left;
        font-size: 14px;
    }

    .auth-container form {
        display: grid;
        gap: 2px;
    }

    .register-auth-container {
        max-width: none;
    }

    .register-panel {
        padding: 14px;
        border-radius: 16px;
    }

    .register-auth-container form > .primary-btn {
        max-width: none;
    }

    .auth-container .form-group {
        margin-bottom: 14px;
    }

    .auth-container .form-group label {
        font-size: 13px;
        letter-spacing: 0;
    }

    .auth-container .form-group input {
        min-height: 52px;
        border-radius: 12px;
        font-size: 16px;
    }

    .auth-container .primary-btn {
        min-height: 52px;
        border-radius: 12px;
        font-size: 15px;
        font-weight: 800;
    }

    .auth-container #login-message,
    .auth-container #register-message,
    .auth-container #forgot-password-message,
    .auth-container #reset-password-message {
        min-height: 22px;
        margin: 14px 0 0;
        text-align: center;
        font-size: 14px;
    }

    .auth-container p[style*="text-align:center"] {
        text-align: center !important;
    }

    .game-page-container {
        min-height: calc(100vh - 20px);
    }

    .top-actions,
    .game-info {
        flex-direction: column;
        align-items: stretch;
    }

    .top-actions {
        gap: 10px;
    }

    .top-links {
        flex-direction: column;
        width: 100%;
        gap: 8px;
    }

    .game-page-container .top-links {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .game-page-container .top-links .logout-btn {
        padding: 8px 9px;
        font-size: 12px;
    }

    .game-page-container h1 {
        font-size: 24px;
        line-height: 1.15;
        margin-bottom: 14px;
    }

    .language-pill {
        align-self: flex-start;
        max-width: 100%;
        padding: 7px 11px;
        gap: 8px;
        font-size: 13px;
        flex: 0 0 auto;
    }

    .hud {
        grid-template-columns: 1fr;
        gap: 8px;
        padding: 10px;
    }

    .hud-stat {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding: 10px 12px;
    }

    .hud-stat span {
        margin: 0;
        font-size: 11px;
    }

    .hud-stat strong {
        font-size: 17px;
        text-align: right;
    }

    .hud > p,
    .game-info > p {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding: 10px 12px;
    }

    .progress-meta {
        align-items: flex-start;
        flex-direction: column;
        gap: 4px;
    }

    .progress-meta strong {
        text-align: left;
    }

    .game-page-container .question-box {
        justify-content: flex-start;
        margin-top: 8px;
    }

    .room-play-container {
        width: min(100% - 20px, 1400px);
    }

    .room-play-layout {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .live-ranking-panel {
        position: static;
        max-height: 280px;
        margin-top: 4px;
    }

    .game-over-card {
        padding: 14px;
        border-radius: 18px;
    }

    .game-over-stats {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .game-over-stat {
        padding: 12px 10px;
    }

    .game-over-stat span {
        font-size: 10px;
    }

    .game-over-stat strong {
        font-size: 18px;
    }

    .game-over-save-actions {
        flex-direction: column;
    }

    .game-over-save-actions .save-status-pill,
    .game-over-save-actions .game-stats-link {
        width: 100%;
        min-width: 0;
    }

    .game-over-actions .play-again-btn {
        width: 100%;
        max-width: none;
    }

    .game-result-feedback-card,
    .game-result-charts-grid {
        grid-template-columns: 1fr;
    }

    .logout-btn,
    .primary-btn {
        text-align: center;
    }

    .admin-section,
    .dashboard-card {
        padding: 14px;
    }

    .admin-table {
        min-width: 0;
        font-size: 13px;
    }

    .admin-table th,
    .admin-table td {
        padding: 10px 12px;
    }

    .report-view-btn {
        width: 100%;
        min-width: 150px;
    }

    #players-list {
        display: grid;
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .player-pill {
        width: 100%;
        justify-content: flex-start;
    }

    .mistake-option {
        grid-template-columns: 30px 1fr;
    }

    .mistake-option em {
        grid-column: 2;
        width: fit-content;
    }
}
.landing-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    margin-bottom: 28px;
}

.language-pill {
    display: flex;
    align-items: center;
    gap: 10px;

    padding: 8px 14px;
    border-radius: 999px;

    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
}

.language-pill a {
    color: rgba(255,255,255,0.88);
    text-decoration: none;
    font-weight: 700;
}

.language-pill a:hover {
    color: white;
}

.language-pill span {
    color: rgba(255,255,255,0.75);
}

.language-pill.is-disabled {
    opacity: 0.55;
}

.language-pill.is-disabled a {
    pointer-events: none;
    cursor: not-allowed;
}

.admin-login-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;

    margin: 6px auto 0;
    padding: 10px 16px;

    width: fit-content;

    color: rgba(255,255,255,0.9);
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;

    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.08);

    transition: 0.2s ease;
}

.admin-login-link:hover {
    color: white;
    background: rgba(255,255,255,0.08);
}

.top-actions .admin-login-link {
    margin: 0;
}

.page-centered-top-actions {
    justify-content: flex-end;
}

.page-title-block {
    display: grid;
    place-items: center;
    gap: 8px;
    margin: 4px auto 22px;
    text-align: center;
}

.page-title-block h1 {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin: 0;
}

.page-title-block h1 svg {
    width: 30px;
    height: 30px;
}

.page-title-block p {
    max-width: 680px;
    margin: 0 auto;
    color: var(--muted-on-dark, rgba(255, 255, 255, 0.78)) !important;
}

.brand-icon {
    width: 96px;
    height: 96px;

    display: grid;
    place-items: center;

    flex-shrink: 0;
}

.brand-icon img {
    width: 96px;
    height: 96px;

    object-fit: contain;

    filter:
        drop-shadow(0 10px 18px rgba(91,92,226,0.35));
}
.hero-title {
    display: flex;
    align-items: center;
    justify-content: center;

    gap: 22px;

    margin-bottom: 22px;

    text-align: left;
}
.hero-section {
    text-align: center;
}
.hero-logo {
    width: 150px;
    height: 150px;
    object-fit: contain;
    filter:
        drop-shadow(0 18px 30px rgba(91,92,226,0.35));
    flex-shrink: 0;
}

.hero-title h1 {
    margin: 0;
    line-height: 0.95;
    font-size: clamp(3rem, 5vw, 5rem);
}

h1,
h2,
h3,
.primary-btn,
.difficulty-btn,
.dashboard-card p {
    font-family: 'Orbitron', sans-serif;
}
.landing-container {
    max-width: 820px;
    min-height: auto;
    margin: 30px auto;
    padding: 34px 40px 40px;
}

.landing-container .hero-section {
    max-width: 660px;
    margin: 0 auto 26px;
}

.landing-container .hero-title {
    justify-content: center;
    gap: 16px;
}

.landing-container .hero-logo {
    width: 70px;
    height: 70px;
}

.landing-container .hero-title h1 {
    font-size: clamp(2.05rem, 4.2vw, 3.2rem);
    max-width: 560px;
}

.landing-container .landing-description,
.landing-container p {
    font-size: 15px;
    max-width: 650px;
    margin-left: auto;
    margin-right: auto;
    text-align: center;
}

.landing-container .landing-actions {
    max-width: 560px;
    margin: 24px auto 0;
}

.landing-container .landing-btn {
    min-height: 54px;
    font-size: 15px;
    max-width: 520px;
}

.landing-container .admin-login-link {
    margin: 0 auto;
    max-width: 100%;
}
.admin-section {
    color: #111827;
}

.admin-section h2,
.admin-section h3,
.admin-section p,
.admin-section label {
    color: #111827 !important;
}

.admin-section .dashboard-card h3 {
    color: #374151 !important;
}

.admin-section .dashboard-card p {
    color: #111827 !important;
}

.admin-table {
    color: #111827;
}

.admin-table th {
    background: #111827;
    color: white !important;
}

.admin-table td {
    background: white;
    color: #111827 !important;
}

.admin-table tr:nth-child(even) td {
    background: #f8fafc;
}

.admin-table tr:hover td {
    background: #eef4ff;
}

.admin-table td .report-view-btn,
.game-container .admin-table td .report-view-btn {
    background: #e0e7ff;
    border-color: #a5b4fc;
    color: #1e1b4b !important;
}

.admin-table td .report-view-btn span,
.game-container .admin-table td .report-view-btn span {
    color: #1e1b4b !important;
}

.admin-table td .report-view-btn:hover,
.game-container .admin-table td .report-view-btn:hover {
    background: #c7d2fe;
    color: #111827 !important;
}

.live-ranking-panel,
.live-ranking-panel h2,
.live-ranking-panel p,
.live-ranking-panel span,
.live-ranking-panel strong,
.live-ranking-item,
.live-ranking-item span,
.live-ranking-item strong,
.podium-section,
.podium-section h2,
.podium-card,
.podium-card h3,
.podium-card p,
.podium-card small {
    color: #111827 !important;
}

.live-ranking-item {
    background: #ffffff;
}

.current-player-rank,
.podium-card.current-player-rank {
    background: #dcfce7 !important;
    border-color: #86efac !important;
    color: #111827 !important;
}

.podium-card h3 {
    color: #111827 !important;
}

.podium-card small {
    color: #374151 !important;
}
/* Player Dashboard */

.dashboard-link {
    min-height: 150px;
}

.dashboard-link h3 {
    color: #111827 !important;
}

.dashboard-link p {
    font-size: 15px;
    font-weight: 500;
    color: #4b5563 !important;
    line-height: 1.5;
}

#player-summary .dashboard-card p {
    font-size: 30px;
}

#player-summary .dashboard-card {
    min-height: 130px;
}

.player-welcome {
    font-size: 18px;
    margin-bottom: 22px;
}

.player-options-title {
    margin-top: 34px;
    margin-bottom: 12px;
}

.player-dashboard-container {
    max-width: 1200px;
}

.player-dashboard-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin: 10px 0 24px;
    padding: 18px 20px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 22px;
    background:
        radial-gradient(circle at 12% 22%, rgba(91, 92, 232, 0.22), transparent 34%),
        linear-gradient(135deg, rgba(15, 23, 42, 0.72), rgba(30, 41, 59, 0.48));
}

.player-dashboard-hero h1 {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 4px 0 0;
    text-align: left;
    font-size: clamp(28px, 3vw, 38px);
}

.player-dashboard-hero h1 svg {
    color: #8b5cf6;
}

.player-dashboard-container .player-welcome {
    margin: 0;
    color: #cbd5e1 !important;
    font-size: 15px;
}

.player-dashboard-container .player-welcome strong {
    color: #ffffff;
}

.player-hero-action {
    min-height: 50px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    padding: 12px 18px;
    border-radius: 999px;
    background: linear-gradient(135deg, #5b5ce8, #14b8a6);
    color: #ffffff !important;
    font-weight: 900;
    text-decoration: none !important;
    box-shadow: 0 14px 30px rgba(20, 184, 166, 0.24);
}

.player-hero-action svg {
    width: 20px;
    height: 20px;
    padding: 3px;
    border-radius: 50%;
    color: #fef08a !important;
    background: rgba(15, 23, 42, 0.22);
    stroke-width: 2.8;
    filter:
        drop-shadow(0 0 5px rgba(254, 240, 138, 0.65))
        drop-shadow(0 2px 4px rgba(15, 23, 42, 0.22));
}

.player-summary-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-top: 0;
}

.player-summary-grid .player-stat-card {
    min-height: 126px !important;
    position: relative;
    overflow: hidden;
    padding: 18px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 20px;
    background:
        radial-gradient(circle at 85% 18%, var(--stat-glow, rgba(91, 92, 232, 0.22)), transparent 34%),
        linear-gradient(135deg, rgba(248, 250, 252, 0.96), rgba(226, 232, 240, 0.9));
}

.player-summary-grid .player-stat-card h3 {
    margin-top: 4px;
    color: #334155 !important;
}

.player-summary-grid .player-stat-card p {
    color: #0f172a !important;
}

.player-stat-icon {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    color: var(--stat-color, #5b5ce8);
    background: color-mix(in srgb, currentColor 14%, transparent);
}

.player-stat-icon svg {
    width: 19px;
    height: 19px;
}

.stat-games {
    --stat-color: #5b5ce8;
    --stat-glow: rgba(91, 92, 232, 0.26);
}

.stat-score {
    --stat-color: #f59e0b;
    --stat-glow: rgba(245, 158, 11, 0.28);
}

.stat-accuracy {
    --stat-color: #10b981;
    --stat-glow: rgba(16, 185, 129, 0.26);
}

.stat-difficulty {
    --stat-color: #ef4444;
    --stat-glow: rgba(239, 68, 68, 0.22);
}

.player-actions-section {
    margin-top: 28px;
}

.player-section-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 14px;
}

.player-section-heading .player-options-title {
    margin: 0;
}

.player-section-heading span {
    color: #cbd5e1;
    font-size: 14px;
    font-weight: 700;
}

.player-actions-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-top: 0;
}

.player-action-card {
    min-height: 148px;
    position: relative;
    display: grid;
    align-content: start;
    gap: 10px;
    padding: 20px;
    overflow: hidden;
    border-radius: 20px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    background:
        radial-gradient(circle at 88% 12%, var(--action-glow, rgba(91, 92, 232, 0.2)), transparent 34%),
        linear-gradient(135deg, rgba(248, 250, 252, 0.96), rgba(226, 232, 240, 0.9));
}

.player-action-card::after {
    content: "";
    position: absolute;
    inset: auto 18px 16px 18px;
    height: 3px;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--action-color, #5b5ce8), transparent);
    opacity: 0.72;
}

.player-action-card h3 {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    margin: 0;
    text-align: left;
}

.player-action-card h3 svg {
    color: var(--action-color, #5b5ce8);
}

.player-action-card p {
    margin: 0;
    text-align: left;
}

.action-play {
    --action-color: #5b5ce8;
    --action-glow: rgba(91, 92, 232, 0.23);
}

.action-room {
    --action-color: #14b8a6;
    --action-glow: rgba(20, 184, 166, 0.23);
}

.action-history {
    --action-color: #2563eb;
    --action-glow: rgba(37, 99, 235, 0.22);
}

.action-ranking {
    --action-color: #f59e0b;
    --action-glow: rgba(245, 158, 11, 0.26);
}

.action-public {
    --action-color: #22c55e;
    --action-glow: rgba(34, 197, 94, 0.2);
}

.action-profile {
    --action-color: #ec4899;
    --action-glow: rgba(236, 72, 153, 0.2);
}

:root[data-theme="light"] .player-dashboard-hero {
    background:
        radial-gradient(circle at 12% 22%, rgba(91, 92, 232, 0.16), transparent 34%),
        linear-gradient(135deg, #eef2ff, #f8fafc);
    border-color: #cbd5e1;
}

:root[data-theme="light"] .player-dashboard-container .player-welcome,
:root[data-theme="light"] .player-section-heading span {
    color: #475569 !important;
}

:root[data-theme="light"] .player-dashboard-container .player-welcome strong {
    color: #0f172a;
}

@media (max-width: 980px) {
    .player-summary-grid,
    .player-actions-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .player-dashboard-hero,
    .player-section-heading {
        align-items: stretch;
        flex-direction: column;
    }

    .player-hero-action {
        width: 100%;
    }

    .player-summary-grid,
    .player-actions-grid {
        grid-template-columns: 1fr;
    }
}

/* Better links/buttons inside dark containers */

.subtitle-text,
.page-intro {
    color: rgba(255,255,255,0.92) !important;
    text-align: center;
    margin-left: auto;
    margin-right: auto;
}

.game-container a:not(.primary-btn):not(.logout-btn):not(.dashboard-link):not(.admin-login-link) {
    color: #e0e7ff;
    font-weight: 700;
    text-decoration: none;
}

.game-container a:not(.primary-btn):not(.logout-btn):not(.dashboard-link):not(.admin-login-link):hover {
    color: white;
    text-decoration: underline;
}

/* Room admin controls */

.admin-room-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.admin-room-controls button {
    width: 100%;
}

.admin-room-controls .primary-btn,
.admin-room-controls .secondary-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    width: 100%;
    margin: 0;
    text-align: center;
}

/* Status labels */

.status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    padding: 6px 12px;
    border-radius: 999px;

    font-size: 13px;
    font-weight: 800;

    background: rgba(91,92,226,0.12);
    color: #4f46e5;
}

.room-meta,
.room-info-summary {
    text-align: center;
    color: rgba(255,255,255,0.94) !important;
}

.admin-section h2,
.admin-section h3 {
    text-align: center;
}

.admin-tools-list .tool-card {
    min-height: 72px;
}

.admin-tools-list .tool-card h3 {
    color: white !important;
}

/* Better HUD contrast */

.hud,
.game-info {
    background: rgba(255,255,255,0.94);
    color: #111827;
}

.hud p,
.game-info p {
    color: #111827 !important;
}

/* Feedback readability */

#feedback {
    color: white;
    line-height: 1.6;
}

.question-box h2 {
    line-height: 1.35;
}

/* Mobile landing/header */

@media (max-width: 650px) {
    .hero-title {
        flex-direction: column;
        text-align: center;
    }

    .landing-container .hero-logo {
        width: 64px;
        height: 64px;
    }

    .landing-container .hero-title h1 {
        font-size: 2rem;
        text-align: center;
    }

    .dashboard-card {
        padding: 18px;
    }

    .dashboard-card p {
        font-size: 26px;
    }
}

@media (max-width: 650px) {
    .admin-container,
    .room-play-container {
        width: 100%;
        margin: 0;
        padding: 14px;
        border-radius: 0;
        border-left: 0;
        border-right: 0;
    }

    .game-container:not(.auth-container) > h1 {
        font-size: 25px;
        line-height: 1.18;
        text-align: left;
        margin-bottom: 12px;
    }

    .page-intro,
    .subtitle-text {
        text-align: left !important;
        font-size: 14px;
    }

    .dashboard-grid,
    .admin-tools-list,
    .analytics-layout,
    .insights-grid,
    .badges-grid,
    .admin-room-controls,
    .form-grid {
        grid-template-columns: 1fr !important;
        gap: 12px;
    }

    .dashboard-grid {
        margin-top: 14px;
    }

    .dashboard-card,
    .tool-card,
    .chart-card,
    .insight-card,
    .badge-card,
    .mistake-card,
    .question-stat-card,
    .admin-section {
        border-radius: 14px;
        padding: 14px;
    }

    .dashboard-card {
        min-height: auto;
        text-align: left;
    }

    .dashboard-card h3,
    .tool-card h3,
    .chart-card h3,
    .admin-section h2,
    .admin-section h3 {
        text-align: left;
        font-size: 16px;
        line-height: 1.25;
    }

    .dashboard-card p,
    #player-summary .dashboard-card p,
    #profile-summary .dashboard-card p {
        font-size: 23px;
        line-height: 1.18;
    }

    .dashboard-link {
        min-height: 96px;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }

    .admin-section + .admin-section,
    .dashboard-grid + .admin-section,
    .admin-section + .dashboard-grid,
    .analytics-layout + .admin-section {
        margin-top: 14px;
    }

    .admin-section-heading {
        grid-template-columns: 28px 1fr;
        gap: 10px;
        padding: 2px 0;
    }

    .admin-section-heading h2 {
        font-size: 16px;
    }

    .admin-section-heading > span:not(.accordion-icon) {
        grid-column: 2;
        font-size: 12px;
        text-align: left;
    }

    .admin-section-body {
        padding-top: 12px;
    }

    .admin-table {
        display: block;
        width: 100%;
        max-width: 100%;
        overflow: visible;
        -webkit-overflow-scrolling: touch;
        border-radius: 12px;
        white-space: normal;
    }

    .admin-table th,
    .admin-table td {
        padding: 9px 10px;
        font-size: 13px;
    }

    .admin-table .table-input,
    .admin-table input,
    .admin-table select {
        min-width: 140px;
        min-height: 40px;
        font-size: 13px;
    }

    .table-btn,
    .report-view-btn,
    .logout-btn,
    .secondary-form-btn {
        min-height: 42px;
        padding: 10px 12px;
        font-size: 13px;
    }

    .top-actions {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }

    .top-links {
        display: grid;
        grid-template-columns: 1fr;
        width: 100%;
    }

    .top-links .primary-btn,
    .top-links .logout-btn,
    .game-container > .logout-btn,
    .game-container > .primary-btn {
        width: 100%;
        text-align: center;
    }

    .chart-card canvas {
        max-height: 240px;
    }

    .mistake-option {
        grid-template-columns: 30px 1fr;
    }

    .mistake-option em {
        grid-column: 2;
        width: fit-content;
    }

    .badge-card {
        align-items: flex-start;
    }

    .badge-icon {
        font-size: 34px;
    }

    .profile-display-card {
        flex-direction: column;
    }

    .profile-display-heading {
        align-items: center;
    }

    .profile-detail-grid {
        grid-template-columns: 1fr;
    }

    .profile-social-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .room-config-table {
        display: block;
    }

    .question-stat-card summary {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .question-stat-card summary em {
        justify-self: start;
    }
}
/* Player Profile */

.mistake-card {
    background: white;
    color: #111827;
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 18px;
    margin-bottom: 14px;
    box-shadow: var(--shadow-soft);
}

.mistake-card h3 {
    color: #111827 !important;
    font-size: 17px;
    margin-bottom: 10px;
}

.mistake-card p {
    color: #374151 !important;
    margin: 8px 0;
}

.mistake-card small {
    color: #6b7280;
}

.mistake-options-list {
    display: grid;
    gap: 8px;
    padding: 0;
    margin: 14px 0;
    list-style: none;
}

.mistake-option {
    display: grid;
    grid-template-columns: 34px 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid #dbe3ef;
    border-radius: 12px;
    background: #f8fafc;
    color: #111827;
}

.mistake-option strong {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: white;
    color: #111827;
    font-weight: 800;
}

.mistake-option span {
    min-width: 0;
    color: #1f2937;
    line-height: 1.4;
}

.mistake-option em {
    padding: 5px 8px;
    border-radius: 999px;
    font-style: normal;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.mistake-option.is-selected {
    border-color: #fca5a5;
    background: #fef2f2;
}

.mistake-option.is-selected em {
    background: #fee2e2;
    color: #991b1b;
}

.mistake-option.is-correct {
    border-color: #86efac;
    background: #ecfdf5;
}

.mistake-option.is-correct em {
    background: #dcfce7;
    color: #166534;
}

#profile-summary .dashboard-card p {
    font-size: 28px;
}

.chart-card {
    background: white;
    border-radius: 18px;
    padding: 20px;
    box-shadow: var(--shadow-soft);
    color: #111827;
}

.chart-card h3 {
    color: #111827 !important;
    margin-bottom: 15px;
}

.chart-card canvas {
    max-height: 320px;
}

.insights-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
}

.insight-card {
    background: white;
    border-radius: 18px;
    padding: 20px;
    box-shadow: var(--shadow-soft);
    border-left: 5px solid var(--primary);
}

.insight-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.insight-header h3 {
    margin: 0;
    font-size: 18px;
    color: #111827;
}

.insight-card p {
    color: #4b5563;
    line-height: 1.5;
}

.badges-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
}

.badge-card {
    background: white;
    border-radius: 18px;
    padding: 18px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: var(--shadow-soft);
}

.badge-icon {
    font-size: 42px;
}

.badge-content h3 {
    margin: 0 0 8px;
    color: #111827;
}

.badge-content p {
    margin: 0 0 10px;
    color: #4b5563;
    line-height: 1.4;
}

.badge-content small {
    color: #9ca3af;
}

.teacher-badges-section {
    margin-top: 24px;
}

.teacher-badges-grid {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.teacher-badge-card {
    align-items: flex-start;
    text-align: left;
}

.teacher-badge-card .badge-icon {
    width: 52px;
    min-width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    border-radius: 16px;
    background: #eef2ff;
    border: 1px solid #c7d2fe;
    font-size: 28px;
}

.teacher-badge-card .badge-content h3 {
    font-size: 17px;
    line-height: 1.25;
}

.teacher-badge-card .badge-content p {
    font-size: 14px;
}

.teacher-badge-card .badge-content small {
    color: #6b7280;
    font-weight: 700;
}
.badge-popup {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.72);
    display: grid;
    place-items: center;
    z-index: 9999;
    animation: fadeIn 0.25s ease;
}

.badge-popup-content {
    width: min(480px, calc(100% - 32px));
    background: white;
    color: #111827;
    border-radius: 24px;
    padding: 28px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.35);
    animation: podiumPop 0.35s ease;
}

.badge-popup-content h2 {
    color: #111827 !important;
    margin-bottom: 18px;
}

.badge-popup-item {
    padding: 14px;
    border-radius: 16px;
    background: #f8fafc;
    margin-bottom: 12px;
}

.badge-popup-item strong {
    display: block;
    font-size: 18px;
    color: #111827;
}

.badge-popup-item p {
    color: #4b5563 !important;
    margin: 6px 0 0;
}

@media (max-width: 650px) {
    .admin-question-nav {
        grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
        gap: 8px;
    }

    .admin-question-nav a {
        min-height: 40px;
        padding: 8px 10px;
        font-size: 12px;
    }

    .admin-section-heading {
        gap: 8px;
    }

    .admin-section-heading h2 {
        min-width: 0;
        font-size: 20px;
    }

    .admin-section-heading > span:not(.accordion-icon) {
        min-height: 26px;
        padding: 5px 8px;
        font-size: 11px;
    }

    .accordion-icon {
        width: 30px;
        height: 30px;
        min-height: 30px;
        font-size: 18px;
    }

    .language-pill {
        align-self: flex-start;
        max-width: 100%;
        padding: 7px 11px;
        gap: 8px;
        font-size: 13px;
        flex: 0 0 auto;
    }

    .language-pill a,
    .language-pill span {
        line-height: 1;
    }
}

/* Admin readability and responsive tables */

.game-container:has(.admin-section),
.game-container:has(.analytics-layout),
.game-container:has(.admin-table) {
    width: min(1520px, calc(100% - 32px));
    max-width: 1520px;
}

.admin-section,
.chart-card,
.dashboard-card,
.tool-card,
.insight-card,
.badge-card,
.mistake-card,
.question-stat-card {
    color: #111827;
}

.admin-section p,
.chart-card p,
.dashboard-card p,
.tool-card p,
.insight-card p,
.badge-card p,
.mistake-card p,
.question-stat-card p {
    color: #374151 !important;
}

.admin-section-heading > span:not(.accordion-icon),
.status-chip,
.difficulty-chip,
.category-chip,
.source-chip {
    background: #e0f2fe;
    border: 1px solid #0284c7;
    color: #0c4a6e !important;
}

.admin-table {
    table-layout: fixed;
}

.admin-table th,
.admin-table td {
    overflow-wrap: anywhere;
    word-break: normal;
}

.admin-table td:last-child {
    white-space: normal;
}

.open-rooms-table th:last-child,
.open-rooms-table td:last-child {
    width: 190px;
    min-width: 190px;
}

.open-rooms-table .report-view-btn {
    width: 100%;
    min-width: 0;
    white-space: normal;
    text-align: center;
}

.avatar-picker {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
    gap: 10px;
}

.avatar-choice {
    display: grid;
    place-items: center;
    gap: 6px;
    min-height: 104px;
    padding: 10px;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    background: #ffffff;
    color: #111827;
    cursor: pointer;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.avatar-choice input {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: 0;
    opacity: 0;
    pointer-events: none;
}

.avatar-choice:has(input:checked) {
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.18);
}

.avatar-choice:hover {
    transform: translateY(-1px);
    border-color: #6366f1;
}

.avatar-choice em {
    color: #334155;
    font-style: normal;
    font-size: 12px;
    font-weight: 800;
}

.profile-avatar {
    display: inline-grid;
    place-items: center;
    width: 54px;
    height: 54px;
    border-radius: 18px;
    color: white;
    font-size: 28px;
    box-shadow: 0 12px 22px rgba(15, 23, 42, 0.18);
}

.avatar-pulse { background: linear-gradient(135deg, #e11d48, #4f46e5); }
.avatar-brain { background: linear-gradient(135deg, #7c3aed, #0ea5e9); }
.avatar-trophy { background: linear-gradient(135deg, #f59e0b, #ef4444); }
.avatar-rocket { background: linear-gradient(135deg, #2563eb, #14b8a6); }
.avatar-leaf { background: linear-gradient(135deg, #16a34a, #84cc16); }
.avatar-star { background: linear-gradient(135deg, #facc15, #f97316); }

.profile-editor-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 18px;
}

.profile-editor-header .profile-avatar {
    width: 76px;
    height: 76px;
    border-radius: 24px;
    font-size: 38px;
    flex: 0 0 auto;
}

.profile-form textarea {
    min-height: 110px;
}

.profile-display-card {
    display: flex;
    gap: 18px;
    align-items: flex-start;
}

.game-container > h1 + a.primary-btn,
.game-container > h1 + a.primary-btn + a.primary-btn {
    display: none !important;
}

.profile-display-card .profile-avatar {
    width: 92px;
    height: 92px;
    border-radius: 26px;
    font-size: 44px;
    flex: 0 0 auto;
}

.profile-avatar-image {
    overflow: hidden;
    background: #e2e8f0;
}

.profile-avatar-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-display-main {
    min-width: 0;
    width: 100%;
}

.profile-display-heading {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: flex-start;
    margin-bottom: 16px;
}

.profile-display-heading h2 {
    margin: 0 0 4px;
    color: #111827;
}

.profile-display-heading p {
    margin: 0;
    color: #475569 !important;
}

.icon-action-btn {
    width: 44px;
    height: 44px;
    display: inline-grid;
    place-items: center;
    border-radius: 999px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #111827;
    font-size: 20px;
    font-weight: 900;
    cursor: pointer;
}

.icon-action-btn:hover {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.16);
}

.profile-edit-text-btn {
    width: auto;
    min-width: 88px;
    padding: 0 16px;
    font-size: 14px;
    border-radius: 999px;
}

.profile-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 12px;
}

.profile-social-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(90px, 1fr));
    gap: 10px;
    margin: 14px 0 16px;
}

.profile-social-stats div {
    text-align: center;
    padding: 10px 8px;
    border-radius: 12px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
}

.profile-social-stats strong {
    display: block;
    color: #111827;
    font-size: 20px;
    line-height: 1.1;
}

.profile-social-stats span {
    display: block;
    margin-top: 4px;
    color: #64748b;
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.profile-detail-grid div {
    padding: 12px;
    border-radius: 12px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
}

.profile-detail-grid span {
    display: block;
    margin-bottom: 4px;
    color: #64748b;
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.profile-detail-grid strong {
    color: #111827;
    font-size: 15px;
}

.profile-display-bio {
    margin: 14px 0 0;
    color: #334155 !important;
    line-height: 1.55;
}

.profile-edit-panel {
    margin-top: 22px;
    padding-top: 20px;
    border-top: 1px solid #cbd5e1;
}

.profile-editor-section > .profile-editor-header {
    display: none;
}

.profile-export-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin: 14px 0;
}

.profile-export-actions .primary-btn {
    text-align: center;
    text-decoration: none;
}

.teacher-profile-container .profile-display-card {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr);
    align-items: start;
    gap: 18px 22px;
    max-width: 1180px;
    margin: 0 auto;
    padding: 22px;
    border-radius: 18px;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.96), rgba(239, 244, 251, 0.94));
    border: 1px solid rgba(203, 213, 225, 0.9);
    box-shadow: 0 18px 44px rgba(15, 23, 42, 0.08);
}

.teacher-profile-container .profile-display-card .profile-avatar {
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.14);
}

.teacher-profile-container .profile-display-heading {
    align-items: center;
    margin-bottom: 14px;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(203, 213, 225, 0.8);
}

.teacher-profile-container .profile-display-heading h2 {
    font-size: clamp(1.35rem, 2vw, 1.9rem);
}

.teacher-profile-container .profile-social-stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin: 0 0 14px;
    padding: 10px;
    border-radius: 16px;
    background: rgba(226, 232, 240, 0.52);
    border: 1px solid rgba(203, 213, 225, 0.72);
}

.teacher-profile-container .profile-social-stats div {
    min-height: 70px;
    display: grid;
    place-items: center;
    align-content: center;
    background: rgba(255, 255, 255, 0.92);
    border-color: rgba(203, 213, 225, 0.74);
}

.teacher-profile-container .profile-detail-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.teacher-profile-container .profile-detail-grid div {
    min-height: 68px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.teacher-profile-container .profile-detail-grid strong {
    overflow-wrap: anywhere;
}

.teacher-profile-container .profile-display-bio {
    margin-top: 14px;
    padding: 14px 16px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(203, 213, 225, 0.78);
}

.teacher-profile-container .profile-display-bio:empty {
    display: none;
}

:root[data-theme="dark"] .teacher-profile-container .profile-display-card {
    background: linear-gradient(145deg, rgba(24, 36, 56, 0.96), rgba(15, 23, 42, 0.94));
    border-color: rgba(148, 163, 184, 0.24);
    box-shadow: 0 18px 44px rgba(2, 6, 23, 0.28);
}

:root[data-theme="dark"] .teacher-profile-container .profile-display-heading {
    border-bottom-color: rgba(148, 163, 184, 0.22);
}

:root[data-theme="dark"] .teacher-profile-container .profile-social-stats {
    background: rgba(15, 23, 42, 0.5);
    border-color: rgba(148, 163, 184, 0.22);
}

:root[data-theme="dark"] .teacher-profile-container .profile-social-stats div,
:root[data-theme="dark"] .teacher-profile-container .profile-detail-grid div,
:root[data-theme="dark"] .teacher-profile-container .profile-display-bio {
    background: rgba(30, 41, 59, 0.82);
    border-color: rgba(148, 163, 184, 0.22);
}

:root[data-theme="dark"] .teacher-profile-container .profile-display-heading h2,
:root[data-theme="dark"] .teacher-profile-container .profile-social-stats strong,
:root[data-theme="dark"] .teacher-profile-container .profile-detail-grid strong {
    color: #f8fafc;
}

:root[data-theme="dark"] .teacher-profile-container .profile-display-heading p,
:root[data-theme="dark"] .teacher-profile-container .profile-display-bio {
    color: #cbd5e1 !important;
}

@media (max-width: 960px) {
    .teacher-profile-container .profile-detail-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.form-actions-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.form-actions-inline .primary-btn,
.form-actions-inline .secondary-form-btn {
    margin: 0;
}

.field-hint {
    display: block;
    margin-top: 7px;
    color: #475569;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.35;
}

.user-menu {
    position: relative;
    z-index: 20;
}

.user-menu summary {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 46px;
    padding: 7px 12px 7px 8px;
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 999px;
    background: rgba(255,255,255,0.08);
    color: #ffffff;
    cursor: pointer;
    list-style: none;
    box-shadow: 0 10px 22px rgba(0,0,0,0.12);
}

.user-menu summary::-webkit-details-marker {
    display: none;
}

.user-menu-avatar {
    display: inline-grid;
    place-items: center;
    width: 32px;
    height: 32px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: linear-gradient(135deg, #5b5ce2, #14b8a6);
    color: #ffffff;
    font-size: 14px;
    font-weight: 900;
}

.user-menu-copy {
    display: grid;
    min-width: 0;
    text-align: left;
}

.user-menu-copy strong {
    max-width: 170px;
    overflow: hidden;
    color: #ffffff;
    font-size: 14px;
    line-height: 1.1;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-menu-copy small {
    color: rgba(255,255,255,0.72);
    font-size: 11px;
    font-weight: 800;
    line-height: 1.1;
}

.user-menu-chevron {
    color: rgba(255,255,255,0.8);
    font-size: 16px;
    font-weight: 900;
}

.user-menu[open] .user-menu-chevron {
    transform: rotate(180deg);
}

.user-menu-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    display: grid;
    min-width: 220px;
    padding: 8px;
    border: 1px solid #dbe3ef;
    border-radius: 14px;
    background: #ffffff;
    box-shadow: 0 18px 36px rgba(15, 23, 42, 0.22);
}

.user-menu-panel a {
    display: block;
    padding: 10px 12px;
    border-radius: 10px;
    color: #111827 !important;
    font-size: 14px;
    font-weight: 800;
    text-decoration: none;
}

.user-menu-panel a:hover {
    background: #eef2ff;
    color: #3730a3 !important;
}

.user-menu-panel .user-menu-danger {
    color: #b91c1c !important;
}

.user-menu-panel .user-menu-danger:hover {
    background: #fee2e2;
    color: #991b1b !important;
}

.hero-title {
    justify-content: flex-start;
    text-align: left;
}

.landing-container .hero-title {
    justify-content: center;
    text-align: center;
}

.hero-section {
    text-align: left;
}

.game-page-container > h1 {
    display: flex;
    align-items: center;
    gap: 12px;
    text-align: left;
}

.game-page-container > h1::before {
    content: "";
    width: 52px;
    height: 52px;
    flex: 0 0 auto;
    background: url("../icons/icon.svg") center / contain no-repeat;
}

@media (max-width: 900px) {
    .game-container:has(.admin-section),
    .game-container:has(.analytics-layout),
    .game-container:has(.admin-table) {
        width: min(100% - 20px, 1520px);
        padding: 18px;
    }
}

@media (max-width: 650px) {
    .hero-title,
    .landing-container .hero-title {
        flex-direction: row;
        justify-content: center;
        align-items: center;
        text-align: left;
        gap: 10px;
    }

    .landing-container .hero-title h1,
    .hero-title h1 {
        text-align: left;
        line-height: 1.05;
    }

    .landing-container .landing-actions {
        width: 100%;
        max-width: none;
        margin: 22px auto 0;
    }

    .landing-container .landing-btn {
        max-width: none;
    }

    .game-page-container > h1 {
        font-size: 25px;
        line-height: 1.1;
    }

    .game-page-container > h1::before {
        width: 46px;
        height: 46px;
    }

    .responsive-card-table,
    .responsive-card-table thead,
    .responsive-card-table tbody,
    .responsive-card-table tr,
    .responsive-card-table th,
    .responsive-card-table td {
        display: block;
        width: 100%;
    }

    .responsive-card-table {
        border: 0;
        background: transparent;
        box-shadow: none;
        overflow: visible;
        min-width: 0 !important;
    }

    .responsive-card-table thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }

    .responsive-card-table tbody tr {
        margin: 0 0 12px;
        padding: 12px;
        border: 1px solid #cbd5e1;
        border-radius: 12px;
        background: #ffffff;
        box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
    }

    .responsive-card-table tbody tr:last-child {
        margin-bottom: 0;
    }

    .responsive-card-table td {
        display: grid;
        grid-template-columns: minmax(92px, 38%) 1fr;
        align-items: start;
        gap: 10px;
        padding: 9px 0;
        border: 0 !important;
        border-bottom: 1px solid #e2e8f0 !important;
        background: transparent !important;
        color: #111827 !important;
        font-size: 13px;
    }

    .responsive-card-table td:last-child {
        border-bottom: 0 !important;
    }

    .responsive-card-table td::before {
        content: attr(data-label);
        color: #475569;
        font-weight: 900;
        text-transform: uppercase;
        font-size: 11px;
        line-height: 1.3;
    }

    .responsive-card-table td[colspan] {
        display: block;
        text-align: center;
    }

    .responsive-card-table td[colspan]::before {
        content: none;
    }

    .responsive-card-table .table-input,
    .responsive-card-table input,
    .responsive-card-table select,
    .responsive-card-table .report-view-btn,
    .responsive-card-table .table-btn {
        width: 100%;
        min-width: 0;
    }

    .admin-section {
        overflow: visible;
    }
}

@media (max-width: 650px) {
    .profile-display-card {
        flex-direction: column;
        gap: 14px;
    }

    .profile-display-heading {
        flex-direction: column;
        align-items: flex-start;
    }

    .profile-social-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }

    .teacher-profile-container .top-actions {
        flex-wrap: wrap;
        gap: 12px;
    }

    .teacher-profile-container .top-links {
        width: 100%;
    }

    .profile-edit-text-btn {
        align-self: flex-start;
    }

    .teacher-profile-container .profile-display-card {
        grid-template-columns: 1fr;
        justify-items: center;
        padding: 18px;
    }

    .teacher-profile-container .profile-display-main {
        width: 100%;
    }

    .teacher-profile-container .profile-display-heading {
        width: 100%;
        align-items: center;
        text-align: center;
    }

    .teacher-profile-container .profile-edit-text-btn {
        align-self: center;
    }

    .teacher-profile-container .profile-detail-grid {
        grid-template-columns: 1fr;
    }

    .user-menu,
    .user-menu summary {
        width: 100%;
    }

    .user-menu summary {
        justify-content: flex-start;
    }

    .user-menu-copy {
        flex: 1;
    }

    .user-menu-copy strong {
        max-width: none;
    }

    .user-menu-panel {
        left: 0;
        right: 0;
        min-width: 0;
    }
}

/* Refined teacher profile */

.teacher-profile-container {
    max-width: 1520px;
}

.teacher-profile-section.admin-section {
    max-width: 1240px;
    margin: 28px auto 0;
    padding: 0;
    overflow: visible;
    background: transparent;
    border: 0;
    box-shadow: none;
}

.teacher-profile-card {
    display: grid !important;
    grid-template-columns: minmax(240px, 300px) minmax(0, 1fr) !important;
    gap: 0 !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden;
    border-radius: 24px !important;
    background: linear-gradient(135deg, #f8fafc 0%, #eef4fb 100%) !important;
    border: 1px solid rgba(148, 163, 184, 0.34) !important;
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.18) !important;
}

.teacher-profile-identity {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    min-height: 380px;
    padding: 34px 24px;
    text-align: center;
    background:
        radial-gradient(circle at 30% 15%, rgba(91, 92, 232, 0.24), transparent 34%),
        linear-gradient(180deg, #172033 0%, #111827 100%);
    color: #f8fafc;
}

.teacher-profile-identity .profile-avatar {
    width: 112px !important;
    height: 112px !important;
    border-radius: 28px !important;
    border: 3px solid rgba(255, 255, 255, 0.72);
    box-shadow: 0 18px 40px rgba(2, 6, 23, 0.35) !important;
}

.teacher-profile-nameblock h2 {
    margin: 0;
    color: #ffffff !important;
    font-size: clamp(1.45rem, 2vw, 2rem);
    line-height: 1.1;
}

.teacher-profile-nameblock p {
    max-width: 240px;
    margin: 8px auto 0;
    color: #cbd5e1 !important;
    font-size: 14px;
    overflow-wrap: anywhere;
}

.teacher-profile-identity .profile-edit-text-btn {
    min-width: 112px;
    min-height: 44px;
    margin-top: 6px;
    border-color: rgba(255, 255, 255, 0.26);
    background: #ffffff;
    color: #0f172a;
    box-shadow: 0 10px 26px rgba(2, 6, 23, 0.18);
}

.teacher-profile-card .profile-display-main {
    display: grid;
    gap: 18px;
    padding: 28px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0.52));
}

.teacher-profile-container .profile-social-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 12px;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
}

.teacher-profile-container .profile-social-stats div {
    min-height: 92px;
    padding: 18px 12px;
    border-radius: 18px;
    background: #ffffff;
    border: 1px solid rgba(203, 213, 225, 0.9);
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.06);
}

.teacher-profile-container .profile-social-stats strong {
    color: #111827;
    font-size: 28px;
}

.teacher-profile-container .profile-social-stats span {
    color: #64748b;
    font-size: 12px;
    letter-spacing: 0.02em;
}

.teacher-profile-container .profile-detail-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.teacher-profile-container .profile-detail-grid div {
    min-height: 74px;
    padding: 14px 16px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.74);
    border: 1px solid rgba(203, 213, 225, 0.88);
}

.teacher-profile-container .profile-detail-grid span {
    color: #64748b;
    font-size: 12px;
}

.teacher-profile-container .profile-detail-grid strong {
    color: #111827;
    font-size: 15px;
}

.teacher-profile-container .profile-display-bio {
    margin: 0;
    padding: 16px 18px;
    border-radius: 18px;
    background: #ffffff;
    border: 1px solid rgba(203, 213, 225, 0.88);
    color: #334155 !important;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.05);
}

.teacher-badges-section.admin-section {
    max-width: 1240px;
    margin: 22px auto 0;
    border-radius: 24px;
}

:root[data-theme="dark"] .teacher-profile-card {
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.96), rgba(30, 41, 59, 0.94)) !important;
    border-color: rgba(148, 163, 184, 0.24) !important;
    box-shadow: 0 24px 70px rgba(2, 6, 23, 0.38) !important;
}

:root[data-theme="dark"] .teacher-profile-card .profile-display-main {
    background:
        linear-gradient(180deg, rgba(30, 41, 59, 0.78), rgba(15, 23, 42, 0.58));
}

:root[data-theme="dark"] .teacher-profile-container .profile-social-stats div,
:root[data-theme="dark"] .teacher-profile-container .profile-detail-grid div,
:root[data-theme="dark"] .teacher-profile-container .profile-display-bio {
    background: rgba(15, 23, 42, 0.62);
    border-color: rgba(148, 163, 184, 0.24);
    box-shadow: none;
}

:root[data-theme="dark"] .teacher-profile-container .profile-social-stats strong,
:root[data-theme="dark"] .teacher-profile-container .profile-detail-grid strong {
    color: #f8fafc;
}

:root[data-theme="dark"] .teacher-profile-container .profile-social-stats span,
:root[data-theme="dark"] .teacher-profile-container .profile-detail-grid span,
:root[data-theme="dark"] .teacher-profile-container .profile-display-bio {
    color: #cbd5e1 !important;
}

@media (max-width: 960px) {
    .teacher-profile-card {
        grid-template-columns: 1fr !important;
    }

    .teacher-profile-identity {
        min-height: auto;
        padding: 28px 22px;
    }

    .teacher-profile-card .profile-display-main {
        padding: 22px;
    }

    .teacher-profile-container .profile-detail-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 650px) {
    .teacher-profile-section.admin-section,
    .teacher-badges-section.admin-section {
        width: 100%;
        margin-top: 18px;
    }

    .teacher-profile-card {
        border-radius: 18px !important;
    }

    .teacher-profile-identity {
        padding: 24px 18px;
    }

    .teacher-profile-identity .profile-avatar {
        width: 96px !important;
        height: 96px !important;
    }

    .teacher-profile-container .profile-social-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }

    .teacher-profile-container .profile-detail-grid {
        grid-template-columns: 1fr;
    }

    .teacher-profile-card .profile-display-main {
        padding: 16px;
    }
}

.ranking-table {
    border: 0 !important;
    border-radius: 0;
    border-collapse: separate;
    border-spacing: 0;
    background: rgba(15, 23, 42, 0.28) !important;
    box-shadow: none;
    overflow: visible;
}

.ranking-table th,
.ranking-table td {
    border: 0 !important;
    border-bottom: 1px solid rgba(226, 232, 240, 0.24) !important;
    border-right: 1px solid rgba(226, 232, 240, 0.18) !important;
}

.ranking-table th:last-child,
.ranking-table td:last-child {
    border-right: 0 !important;
}

.ranking-table tbody tr:last-child td {
    border-bottom: 0 !important;
}

.ranking-table th {
    background: rgba(15, 23, 42, 0.72) !important;
    color: #ffffff !important;
}

.ranking-table td {
    background: rgba(255, 255, 255, 0.08) !important;
    color: #f8fafc !important;
}

.ranking-table tr:nth-child(even) td {
    background: rgba(255, 255, 255, 0.12) !important;
}

.ranking-table tr:hover td {
    background: rgba(99, 102, 241, 0.24) !important;
}

.ranking-table .current-player-rank td,
.ranking-table tr.current-player-rank td {
    background: rgba(34, 197, 94, 0.2) !important;
    color: #ecfdf5 !important;
    font-weight: 900;
}

@media (max-width: 650px) {
    .ranking-table.responsive-card-table tbody tr {
        border: 0;
        background: rgba(255, 255, 255, 0.08);
        box-shadow: inset 0 0 0 1px rgba(226, 232, 240, 0.18);
    }

    .ranking-table.responsive-card-table td {
        color: #f8fafc !important;
        border-bottom-color: rgba(226, 232, 240, 0.2) !important;
    }

    .ranking-table.responsive-card-table td::before {
        color: #cbd5e1;
    }
}

/* Unified theme and table surface */

:root,
:root[data-theme="dark"] {
    --theme-body-bg: linear-gradient(135deg,#1e293b 0%,#0f172a 50%,#111827 100%);
    --theme-container-bg: linear-gradient(135deg, rgba(30,41,59,0.92), rgba(15,23,42,0.92));
    --theme-container-border: rgba(255,255,255,0.08);
    --theme-heading: #ffffff;
    --theme-text: #f8fafc;
    --theme-muted: #cbd5e1;
    --theme-section-bg: rgba(248,250,252,0.94);
    --theme-section-text: #111827;
    --theme-section-muted: #374151;
    --theme-table-bg: rgba(15, 23, 42, 0.28);
    --theme-table-head-bg: rgba(15, 23, 42, 0.72);
    --theme-table-cell-bg: rgba(255, 255, 255, 0.08);
    --theme-table-cell-alt-bg: rgba(255, 255, 255, 0.12);
    --theme-table-hover-bg: rgba(99, 102, 241, 0.24);
    --theme-table-line: rgba(226, 232, 240, 0.2);
    --theme-table-text: #f8fafc;
    --theme-table-label: #cbd5e1;
    --theme-control-bg: rgba(255,255,255,0.08);
    --theme-control-border: rgba(255,255,255,0.18);
}

:root[data-theme="light"] {
    --theme-body-bg: linear-gradient(135deg,#e8eef8 0%,#f8fafc 52%,#edf2f7 100%);
    --theme-container-bg: linear-gradient(135deg, rgba(255,255,255,0.94), rgba(241,245,249,0.94));
    --theme-container-border: rgba(15,23,42,0.1);
    --theme-heading: #0f172a;
    --theme-text: #111827;
    --theme-muted: #475569;
    --theme-section-bg: rgba(255,255,255,0.78);
    --theme-section-text: #111827;
    --theme-section-muted: #475569;
    --theme-table-bg: rgba(255,255,255,0.42);
    --theme-table-head-bg: rgba(15,23,42,0.88);
    --theme-table-cell-bg: rgba(255,255,255,0.36);
    --theme-table-cell-alt-bg: rgba(241,245,249,0.6);
    --theme-table-hover-bg: rgba(99,102,241,0.14);
    --theme-table-line: rgba(71,85,105,0.24);
    --theme-table-text: #111827;
    --theme-table-label: #475569;
    --theme-control-bg: rgba(15,23,42,0.06);
    --theme-control-border: rgba(15,23,42,0.14);
}

body {
    background: var(--theme-body-bg);
    color: var(--theme-text);
}

.game-container {
    background: var(--theme-container-bg);
    border-color: var(--theme-container-border);
    color: var(--theme-text);
}

.game-container h1,
.game-container h2,
.game-container h3 {
    color: var(--theme-heading);
}

.game-container p,
.page-intro,
.subtitle-text,
.player-welcome,
.room-meta {
    color: var(--theme-muted) !important;
}

.language-pill,
.user-menu summary,
.theme-toggle {
    background: var(--theme-control-bg);
    border-color: var(--theme-control-border);
    color: var(--theme-heading);
}

.theme-toggle {
    display: inline-grid;
    place-items: center;
    width: 62px;
    height: 34px;
    min-height: 34px;
    padding: 0;
    border: 1px solid var(--theme-control-border);
    border-radius: 999px;
    color: var(--theme-heading);
    cursor: pointer;
}

.theme-toggle-track {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    width: 100%;
    height: 100%;
    padding: 0 9px;
}

.theme-toggle-icon {
    z-index: 1;
    color: var(--theme-muted);
    font-size: 14px;
    font-weight: 900;
    line-height: 1;
}

.theme-toggle-light {
    text-align: right;
}

.theme-toggle-thumb {
    position: absolute;
    left: 4px;
    top: 4px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #5b5ce2;
    box-shadow: 0 8px 14px rgba(15, 23, 42, 0.26);
    transition: transform 0.18s ease, background 0.18s ease;
}

.theme-toggle.is-light .theme-toggle-thumb {
    transform: translateX(28px);
    background: #f59e0b;
}

.landing-topbar .theme-toggle,
.top-actions .theme-toggle,
.top-links .theme-toggle {
    flex: 0 0 auto;
}

.theme-toggle-fixed {
    position: fixed;
    right: 18px;
    top: 18px;
    z-index: 1000;
}

.admin-section,
.chart-card,
.dashboard-card,
.tool-card,
.insight-card,
.badge-card,
.mistake-card,
.question-stat-card {
    background: var(--theme-section-bg);
    color: var(--theme-section-text);
}

.admin-section p,
.chart-card p,
.dashboard-card p,
.tool-card p,
.insight-card p,
.badge-card p,
.mistake-card p,
.question-stat-card p {
    color: var(--theme-section-muted) !important;
}

.admin-section h2,
.admin-section h3,
.chart-card h2,
.chart-card h3,
.dashboard-card h3,
.tool-card h3,
.dashboard-link h3,
.insight-card h3,
.badge-card h3,
.mistake-card h3,
.question-stat-card h3 {
    color: var(--theme-section-text) !important;
}

.dashboard-link,
.dashboard-link h3,
.dashboard-link p {
    color: var(--theme-section-text) !important;
}

.dashboard-link p {
    color: var(--theme-section-muted) !important;
}

.admin-table,
.ranking-table {
    border: 0 !important;
    border-radius: 0;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--theme-table-bg) !important;
    box-shadow: none;
    overflow: visible;
    color: var(--theme-table-text);
}

.admin-table th,
.admin-table td,
.ranking-table th,
.ranking-table td {
    border: 0 !important;
    border-bottom: 1px solid var(--theme-table-line) !important;
    border-right: 1px solid var(--theme-table-line) !important;
}

.admin-table th:last-child,
.admin-table td:last-child,
.ranking-table th:last-child,
.ranking-table td:last-child {
    border-right: 0 !important;
}

.admin-table tbody tr:last-child td,
.ranking-table tbody tr:last-child td {
    border-bottom: 0 !important;
}

.admin-table th,
.ranking-table th {
    background: var(--theme-table-head-bg) !important;
    color: #ffffff !important;
}

.admin-table td,
.ranking-table td {
    background: var(--theme-table-cell-bg) !important;
    color: var(--theme-table-text) !important;
}

.admin-table tr:nth-child(even) td,
.ranking-table tr:nth-child(even) td {
    background: var(--theme-table-cell-alt-bg) !important;
}

.admin-table tr:hover td,
.ranking-table tr:hover td {
    background: var(--theme-table-hover-bg) !important;
}

.admin-table tr.current-player-rank td,
.ranking-table tr.current-player-rank td {
    background: rgba(34, 197, 94, 0.2) !important;
    color: var(--theme-table-text) !important;
    font-weight: 900;
}

@media (max-width: 650px) {
    .responsive-card-table tbody tr,
    .admin-table.responsive-card-table tbody tr,
    .ranking-table.responsive-card-table tbody tr {
        border: 0 !important;
        background: var(--theme-table-cell-bg) !important;
        box-shadow: inset 0 0 0 1px var(--theme-table-line);
    }

    .responsive-card-table td,
    .admin-table.responsive-card-table td,
    .ranking-table.responsive-card-table td {
        color: var(--theme-table-text) !important;
        border-bottom-color: var(--theme-table-line) !important;
    }

    .responsive-card-table td::before,
    .admin-table.responsive-card-table td::before,
    .ranking-table.responsive-card-table td::before {
        color: var(--theme-table-label);
    }
}

:root[data-theme="light"] .language-pill a,
:root[data-theme="light"] .language-pill span {
    color: #1f2937 !important;
}

:root[data-theme="light"] .language-pill a:hover {
    color: #3730a3 !important;
}

:root[data-theme="light"] .admin-login-link {
    background: rgba(255, 255, 255, 0.5);
    border-color: rgba(15, 23, 42, 0.14);
    color: #111827 !important;
}

:root[data-theme="light"] .admin-login-link:hover {
    background: rgba(99, 102, 241, 0.12);
    color: #3730a3 !important;
}

:root[data-theme="light"] .game-container a:not(.primary-btn):not(.logout-btn):not(.dashboard-link):not(.admin-login-link) {
    color: #3730a3 !important;
}

:root[data-theme="light"] .game-container a:not(.primary-btn):not(.logout-btn):not(.dashboard-link):not(.admin-login-link):hover {
    color: #1e1b4b !important;
}

:root[data-theme="light"] .user-menu-copy strong,
:root[data-theme="light"] .user-menu-copy small,
:root[data-theme="light"] .user-menu-chevron {
    color: #111827 !important;
}

:root[data-theme="light"] .theme-toggle-icon {
    color: #475569;
}

:root[data-theme="light"] .field-hint {
    color: #475569 !important;
}

:root[data-theme="light"] .game-container .dashboard-link,
:root[data-theme="light"] .game-container .dashboard-link h3 {
    color: #111827 !important;
}

:root[data-theme="light"] .game-container .dashboard-link p {
    color: #475569 !important;
}

@media (max-width: 650px) {
    .ranking-table,
    .ranking-table thead,
    .ranking-table tbody {
        display: table !important;
        width: 100% !important;
    }

    .ranking-table tr {
        display: table-row !important;
        width: auto !important;
    }

    .ranking-table th,
    .ranking-table td {
        display: table-cell !important;
        padding: 7px 5px !important;
        font-size: 10px !important;
        line-height: 1.25 !important;
        text-align: center;
        overflow-wrap: anywhere;
    }

    .ranking-table td::before {
        content: none !important;
    }

    .ranking-table th:nth-child(2),
    .ranking-table td:nth-child(2) {
        text-align: left;
    }
}

.question-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(3, 8, 18, 0.62);
    backdrop-filter: blur(6px);
}

.question-modal-backdrop[hidden] {
    display: none;
}

.question-edit-dialog {
    width: min(1040px, 100%);
    max-height: min(90vh, 860px);
    display: grid;
    grid-template-rows: auto 1fr auto;
    overflow: hidden;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    box-shadow: 0 28px 70px rgba(0, 0, 0, 0.34);
}

.question-edit-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 22px 28px;
    background: linear-gradient(135deg, #2563eb, #3b82f6);
    color: #fff;
}

.question-edit-header > div {
    display: flex;
    align-items: center;
    gap: 14px;
}

.question-edit-header h2,
.question-options-heading h3 {
    margin: 0;
}

.question-edit-icon {
    font-size: 1.45rem;
    font-weight: 800;
}

.question-modal-close {
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
}

.question-edit-body {
    overflow: auto;
    padding: 26px 30px;
}

.modal-field {
    display: grid;
    gap: 8px;
    color: var(--text);
    font-weight: 700;
}

.modal-field input,
.modal-field select,
.modal-field textarea,
.question-option-card input[type="text"] {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--input-bg);
    color: var(--text);
    padding: 12px 14px;
    font: inherit;
}

.question-modal-grid,
.question-modal-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    margin-top: 18px;
}

.question-options-editor {
    margin: 26px 0;
    padding: 22px;
    border-radius: 12px;
    background: var(--surface-muted);
}

.question-options-heading p {
    margin: 6px 0 0;
    color: var(--muted);
}

.question-option-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-top: 18px;
}

.question-option-card {
    display: grid;
    gap: 12px;
    padding: 16px;
    border: 2px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
}

.question-option-card span {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
}

.question-option-card.is-correct {
    border-color: #22c55e;
    background: color-mix(in srgb, #22c55e 12%, var(--surface));
}

.question-edit-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 18px 28px;
    border-top: 1px solid var(--border);
    background: var(--surface);
}

.modal-message {
    min-height: 20px;
    color: var(--muted);
    font-weight: 700;
}

@media (max-width: 720px) {
    .question-modal-backdrop {
        padding: 0;
        align-items: stretch;
    }

    .question-edit-dialog {
        width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }

    .question-edit-header,
    .question-edit-body,
    .question-edit-footer {
        padding-inline: 18px;
    }

    .question-modal-grid,
    .question-modal-meta,
    .question-option-grid {
        grid-template-columns: 1fr;
    }
}

.admin-tools-panel {
    text-align: center;
}

.admin-tools-panel h2 {
    margin-bottom: 18px;
    text-align: center;
}

.admin-tools-panel .admin-tools-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
}

.admin-tools-panel .tool-card {
    width: min(100%, 195px);
    min-height: 72px;
    border-radius: 20px;
    background: rgba(15, 23, 42, 0.72) !important;
    border: 1px solid rgba(148, 163, 184, 0.32) !important;
    color: #ffffff !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.admin-tools-panel .tool-card:hover {
    background: rgba(37, 99, 235, 0.72) !important;
    border-color: rgba(191, 219, 254, 0.62) !important;
}

.admin-tools-panel .tool-card h3 {
    color: #ffffff !important;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.35);
}

.admin-tools-panel .tool-card h3 {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    width: 100%;
}

.admin-tools-panel .tool-card h3 svg {
    width: 20px;
    height: 20px;
    flex: 0 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.admin-tools-panel .tool-card h3 span {
    min-width: 0;
}

:root[data-theme="light"] .admin-tools-panel {
    background: #e8eef8;
    border-color: #cbd5e1;
}

:root[data-theme="light"] .admin-tools-panel h2 {
    color: #0f172a !important;
}

:root[data-theme="light"] .admin-tools-panel .tool-card {
    background: #ffffff !important;
    border-color: #cbd5e1 !important;
    color: #0f172a !important;
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.08);
}

:root[data-theme="light"] .admin-tools-panel .tool-card h3 {
    color: #0f172a !important;
    text-shadow: none;
}

/* Admin dashboard composition */

.admin-dashboard-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(340px, 430px);
    gap: 18px;
    margin-top: 24px;
    align-items: start;
    margin-bottom: 24px;
}

.admin-container > .top-actions {
    margin-top: 8px;
    margin-bottom: 28px;
}

.admin-dashboard-layout > .admin-section {
    margin-top: 0;
}

.dashboard-summary-section,
.admin-tools-panel {
    min-height: 100%;
}

.dashboard-summary-section h2,
.admin-tools-panel h2 {
    margin-bottom: 16px;
    text-align: center;
}

.dashboard-summary-section #admin-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-top: 0;
}

.dashboard-summary-section .dashboard-card {
    min-height: 104px;
    display: grid;
    align-content: center;
    gap: 8px;
    padding: 16px 14px;
    border-radius: 18px;
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.12);
    overflow: hidden;
    position: relative;
}

.dashboard-summary-section .dashboard-card h3 {
    min-height: 38px;
    display: grid;
    place-items: center;
    margin: 0;
    padding-inline: 18px;
    font-size: 14px;
    line-height: 1.18;
}

.dashboard-summary-section .dashboard-card p {
    font-size: clamp(25px, 2.1vw, 34px);
    line-height: 1;
}

.metric-card-icon {
    position: absolute;
    top: 13px;
    right: 13px;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: color-mix(in srgb, currentColor 12%, transparent);
    color: #4f46e5;
    opacity: 0.9;
    pointer-events: none;
}

.metric-card-icon svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.metric-users {
    color: #2563eb;
}

.metric-questions {
    color: #db2777;
}

.metric-games {
    color: #7c3aed;
}

.metric-rooms {
    color: #0891b2;
}

.metric-waiting {
    color: #f59e0b;
}

.metric-score {
    color: #eab308;
}

.metric-verified {
    color: #16a34a;
}

.metric-pending {
    color: #ef4444;
}

.metric-difficulty {
    color: #f97316;
}

:root[data-theme="dark"] .metric-card-icon {
    background: color-mix(in srgb, currentColor 18%, transparent);
}

.admin-tools-panel {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    border-radius: 22px;
    padding: 20px;
}

.admin-tools-panel .admin-tools-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.admin-tools-panel .tool-card {
    width: 100%;
    min-height: 64px;
    padding: 12px;
    border-radius: 16px;
    position: relative;
    overflow: hidden;
    isolation: isolate;
}

.admin-tools-panel .tool-card h3 {
    gap: 8px;
    font-size: 13px;
    position: relative;
    z-index: 1;
}

.admin-tools-panel .tool-card h3 svg {
    width: 18px;
    height: 18px;
}

.admin-tools-panel .tool-card::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    opacity: 0.22;
    background:
        radial-gradient(circle at 16% 18%, var(--tool-glow, #60a5fa), transparent 34%),
        linear-gradient(135deg, var(--tool-start, #1d4ed8), var(--tool-end, #0f172a));
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.admin-tools-panel .tool-card:hover::before {
    opacity: 0.36;
    transform: scale(1.03);
}

.admin-tools-panel .tool-card:nth-child(1) {
    --tool-start: #ec4899;
    --tool-end: #7c3aed;
    --tool-glow: #f9a8d4;
    color: #fce7f3 !important;
}

.admin-tools-panel .tool-card:nth-child(2) {
    --tool-start: #14b8a6;
    --tool-end: #2563eb;
    --tool-glow: #5eead4;
    color: #ccfbf1 !important;
}

.admin-tools-panel .tool-card:nth-child(3) {
    --tool-start: #f59e0b;
    --tool-end: #dc2626;
    --tool-glow: #fde68a;
    color: #fffbeb !important;
}

.admin-tools-panel .tool-card:nth-child(4) {
    --tool-start: #6366f1;
    --tool-end: #0ea5e9;
    --tool-glow: #a5b4fc;
    color: #e0e7ff !important;
}

.admin-tools-panel .tool-card:nth-child(5) {
    --tool-start: #22c55e;
    --tool-end: #0f766e;
    --tool-glow: #86efac;
    color: #dcfce7 !important;
}

.admin-tools-panel .tool-card:nth-child(6) {
    --tool-start: #38bdf8;
    --tool-end: #4f46e5;
    --tool-glow: #bae6fd;
    color: #e0f2fe !important;
}

.admin-tools-panel .tool-card:nth-child(7) {
    --tool-start: #a855f7;
    --tool-end: #db2777;
    --tool-glow: #e9d5ff;
    color: #f3e8ff !important;
}

.admin-tools-panel .tool-card:nth-child(8) {
    --tool-start: #06b6d4;
    --tool-end: #0891b2;
    --tool-glow: #67e8f9;
    color: #cffafe !important;
}

.admin-tools-panel .tool-card:nth-child(9) {
    --tool-start: #f97316;
    --tool-end: #be123c;
    --tool-glow: #fed7aa;
    color: #fff7ed !important;
}

.admin-tools-panel .tool-card h3,
.admin-tools-panel .tool-card h3 span,
.admin-tools-panel .tool-card h3 svg {
    color: currentColor !important;
}

.admin-tools-panel .tool-card h3 svg {
    filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.28));
}

.admin-tools-panel .tool-card {
    justify-content: center !important;
}

.admin-tools-panel .tool-card h3 {
    width: auto !important;
    max-width: 100%;
    display: inline-grid !important;
    grid-template-columns: auto auto;
    align-items: center;
    justify-content: center;
    column-gap: 8px;
    text-align: left !important;
}

.admin-tools-panel .tool-card h3 svg {
    width: 22px !important;
    height: 22px !important;
    justify-self: center;
}

.admin-tools-panel .tool-card h3 span {
    max-width: 118px;
    text-align: left;
    line-height: 1.15;
}

.admin-tools-panel .tool-card .tool-pending-badge {
    position: absolute;
    top: -8px;
    right: -14px;
    min-width: 24px;
    height: 24px;
    padding: 0 7px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: #ef4444;
    color: #ffffff !important;
    border: 2px solid rgba(255, 255, 255, 0.9);
    box-shadow: 0 10px 22px rgba(239, 68, 68, 0.38);
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
}

.admin-container > .teacher-badges-section.admin-section {
    width: 100%;
    max-width: none;
    margin: 0 0 26px;
}

@media (max-width: 1180px) {
    .admin-dashboard-layout {
        grid-template-columns: 1fr;
        margin-bottom: 20px;
    }

    .admin-tools-panel .admin-tools-list {
        grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    }
}

@media (max-width: 760px) {
    .dashboard-summary-section #admin-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 520px) {
    .dashboard-summary-section #admin-summary,
    .admin-tools-panel .admin-tools-list {
        grid-template-columns: 1fr;
    }
}

.player-dashboard-container .player-hero-action .ui-icon,
.player-dashboard-container .player-hero-action svg {
    width: 20px !important;
    height: 20px !important;
    padding: 3px !important;
    border-radius: 50% !important;
    color: #fef08a !important;
    stroke: currentColor !important;
    stroke-width: 2.8 !important;
    background: rgba(15, 23, 42, 0.24) !important;
    filter:
        drop-shadow(0 0 6px rgba(254, 240, 138, 0.72))
        drop-shadow(0 2px 4px rgba(15, 23, 42, 0.26)) !important;
}

.player-dashboard-container .player-hero-action .ui-icon-zap {
    fill: #fef08a !important;
    stroke: #fef08a !important;
}

:where(.player-profile-container, .teacher-profile-container) .profile-edit-panel {
    border-top-color: rgba(203, 213, 225, 0.42) !important;
}

:where(.player-profile-container, .teacher-profile-container) .profile-edit-panel .profile-editor-header h2,
:where(.player-profile-container, .teacher-profile-container) .profile-edit-panel .form-group label {
    color: #f8fafc !important;
    font-weight: 900;
    text-shadow: 0 1px 2px rgba(2, 6, 23, 0.34);
}

:where(.player-profile-container, .teacher-profile-container) .profile-edit-panel .profile-editor-header p,
:where(.player-profile-container, .teacher-profile-container) .profile-edit-panel .field-hint {
    color: #cbd5e1 !important;
}

:where(.player-profile-container, .teacher-profile-container) .profile-edit-panel .field-hint {
    display: block;
    margin-top: 7px;
    font-size: 12px;
    line-height: 1.45;
}

:root[data-theme="light"] :where(.player-profile-container, .teacher-profile-container) .profile-edit-panel {
    border-top-color: rgba(100, 116, 139, 0.28) !important;
}

:root[data-theme="light"] :where(.player-profile-container, .teacher-profile-container) .profile-edit-panel .profile-editor-header h2,
:root[data-theme="light"] :where(.player-profile-container, .teacher-profile-container) .profile-edit-panel .form-group label {
    color: #0f172a !important;
    text-shadow: none;
}

:root[data-theme="light"] :where(.player-profile-container, .teacher-profile-container) .profile-edit-panel .profile-editor-header p,
:root[data-theme="light"] :where(.player-profile-container, .teacher-profile-container) .profile-edit-panel .field-hint {
    color: #475569 !important;
}

.admin-table {
    border-radius: 16px;
    overflow: hidden;
}

.admin-table thead th:first-child {
    border-top-left-radius: 16px;
}

.admin-table thead th:last-child {
    border-top-right-radius: 16px;
}

.admin-table tbody tr:last-child td:first-child {
    border-bottom-left-radius: 16px;
}

.admin-table tbody tr:last-child td:last-child {
    border-bottom-right-radius: 16px;
}

.question-modal-backdrop {
    background: rgba(2, 6, 23, 0.72) !important;
    backdrop-filter: blur(8px) saturate(0.92) !important;
}

.question-edit-dialog {
    width: min(960px, calc(100vw - 36px)) !important;
    max-height: min(88vh, 820px) !important;
    border-radius: 22px !important;
    border: 1px solid rgba(148, 163, 184, 0.22) !important;
    background:
        linear-gradient(180deg, rgba(24, 34, 54, 0.98), rgba(15, 23, 42, 0.98)) !important;
    color: #f8fafc !important;
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.42) !important;
}

.question-edit-header {
    padding: 22px 28px 12px !important;
    background: transparent !important;
    color: #f8fafc !important;
    border-bottom: 1px solid rgba(148, 163, 184, 0.16);
}

.question-edit-header h2 {
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(1.1rem, 2vw, 1.45rem);
    letter-spacing: 0;
}

.question-edit-icon {
    width: 42px;
    height: 42px;
    display: inline-grid;
    place-items: center;
    border-radius: 14px;
    background: rgba(99, 102, 241, 0.18);
    color: #c7d2fe;
    font-size: 1.15rem !important;
}

.question-modal-close {
    background: rgba(255, 255, 255, 0.08) !important;
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #e2e8f0 !important;
}

.question-modal-close:hover {
    background: rgba(239, 68, 68, 0.22) !important;
    color: #fff !important;
}

.question-edit-body {
    padding: 22px 28px !important;
}

.modal-field {
    color: #e2e8f0 !important;
}

.modal-field span,
.question-options-heading h3 {
    color: #f8fafc !important;
}

.modal-field input,
.modal-field select,
.modal-field textarea,
.question-option-card input[type="text"] {
    border: 1px solid rgba(148, 163, 184, 0.34) !important;
    background: rgba(15, 23, 42, 0.76) !important;
    color: #f8fafc !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.modal-field input:focus,
.modal-field select:focus,
.modal-field textarea:focus,
.question-option-card input[type="text"]:focus {
    outline: none;
    border-color: #818cf8 !important;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.22);
}

.question-options-editor {
    background: rgba(15, 23, 42, 0.38) !important;
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 18px !important;
}

.question-options-heading p {
    color: #94a3b8 !important;
}

.question-option-card {
    border: 1px solid rgba(148, 163, 184, 0.24) !important;
    border-radius: 16px !important;
    background: rgba(30, 41, 59, 0.72) !important;
    color: #f8fafc !important;
}

.question-option-card span {
    color: #e2e8f0 !important;
}

.question-option-card.is-correct {
    border-color: #22c55e !important;
    background:
        linear-gradient(135deg, rgba(34, 197, 94, 0.2), rgba(30, 41, 59, 0.78)) !important;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.12);
}

.question-edit-footer {
    padding: 16px 28px 22px !important;
    border-top: 1px solid rgba(148, 163, 184, 0.16) !important;
    background: rgba(15, 23, 42, 0.96) !important;
}

.question-edit-footer .secondary-form-btn {
    background: rgba(148, 163, 184, 0.18) !important;
    color: #f8fafc !important;
    border: 1px solid rgba(148, 163, 184, 0.18);
}

.question-edit-footer .primary-btn {
    background: #5b5cf0 !important;
    color: #fff !important;
}

.modal-message {
    color: #cbd5e1 !important;
}

#users-body tr {
    background: rgba(30, 41, 59, 0.72);
}

#users-body tr:nth-child(even) {
    background: rgba(51, 65, 85, 0.62);
}

#users-body tr:hover td {
    background: rgba(79, 70, 229, 0.18) !important;
}

#users-body td {
    color: #f8fafc;
    vertical-align: middle;
}

.user-id-cell,
.user-created-cell {
    color: #dbeafe !important;
    font-weight: 800;
    white-space: nowrap;
}

.user-created-cell {
    font-size: 13px;
    color: #cbd5e1 !important;
}

.user-table-input,
.user-table-select {
    min-height: 42px !important;
    border-radius: 12px !important;
    border: 1px solid rgba(148, 163, 184, 0.28) !important;
    background: rgba(15, 23, 42, 0.72) !important;
    color: #f8fafc !important;
    padding: 9px 11px !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.user-table-input:focus,
.user-table-select:focus {
    outline: none;
    border-color: #818cf8 !important;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.22);
}

.user-table-select option {
    color: #111827;
    background: #ffffff;
}

.user-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.table-btn.icon-only {
    width: 38px;
    min-width: 38px;
    height: 38px;
    min-height: 38px;
    display: inline-grid;
    place-items: center;
    padding: 0 !important;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    color: #ffffff !important;
    text-decoration: none;
}

.table-btn.icon-only span {
    display: grid;
    place-items: center;
    line-height: 1;
}

.table-btn.icon-only svg,
.sound-toggle-btn svg {
    width: 18px;
    height: 18px;
    display: block;
    fill: currentColor;
}

.table-btn.profile-btn {
    background: rgba(99, 102, 241, 0.86) !important;
}

.table-btn.edit-btn {
    background: rgba(16, 185, 129, 0.86) !important;
}

.table-btn.key-btn {
    background: rgba(245, 158, 11, 0.9) !important;
}

.table-btn.delete-btn {
    background: rgba(239, 68, 68, 0.9) !important;
}

.table-btn.icon-only:hover {
    transform: translateY(-1px);
    filter: brightness(1.08);
}

:root[data-theme="light"] #users-body tr {
    background: #f8fafc;
}

:root[data-theme="light"] #users-body tr:nth-child(even) {
    background: #eef2f7;
}

:root[data-theme="light"] #users-body td {
    color: #0f172a;
}

:root[data-theme="light"] .user-id-cell,
:root[data-theme="light"] .user-created-cell {
    color: #334155 !important;
}

:root[data-theme="light"] .user-table-input,
:root[data-theme="light"] .user-table-select {
    background: #ffffff !important;
    color: #0f172a !important;
    border-color: #cbd5e1 !important;
}

.profile-achievements-section {
    overflow: visible;
}

.profile-achievements-layout {
    display: grid;
    grid-template-columns: minmax(230px, 0.65fr) minmax(0, 1.9fr);
    gap: 20px;
    align-items: start;
}

.profile-streaks-panel,
.profile-badges-panel {
    min-width: 0;
}

.profile-streaks-panel h2,
.profile-badges-panel h2 {
    margin-top: 0;
    text-align: center;
}

.profile-streaks-panel > p {
    margin: 0 0 14px;
    text-align: center;
    color: #475569 !important;
}

.profile-streaks-list {
    display: grid;
    gap: 12px;
}

.streak-card {
    display: grid;
    gap: 4px;
    padding: 16px 14px;
    border-radius: 16px;
    border: 1px solid #c7d2fe;
    background:
        linear-gradient(135deg, rgba(99, 102, 241, 0.16), rgba(14, 165, 233, 0.1)),
        #ffffff;
    text-align: center;
}

.streak-card strong {
    color: #312e81;
    font-size: 34px;
    line-height: 1;
    font-family: 'Orbitron', sans-serif;
}

.streak-card span {
    color: #0f172a;
    font-weight: 900;
}

.streak-card small {
    color: #64748b;
    font-weight: 700;
    line-height: 1.35;
}

.profile-badges-panel .badges-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 14px;
}

.profile-badges-panel .badge-card {
    min-height: 172px;
    display: grid;
    grid-template-columns: 1fr;
    justify-items: center;
    align-content: start;
    gap: 10px;
    padding: 18px 14px 16px;
    position: relative;
    overflow: hidden;
    border-radius: 22px;
    border: 1px solid rgba(203, 213, 225, 0.86);
    background:
        radial-gradient(circle at 50% 0%, var(--badge-glow, rgba(245, 158, 11, 0.18)), transparent 42%),
        linear-gradient(180deg, #ffffff, #f8fafc);
    box-shadow: 0 14px 32px rgba(15, 23, 42, 0.08);
    text-align: center;
}

.profile-badges-panel .badge-card::before {
    content: "";
    position: absolute;
    top: -38px;
    width: 96px;
    height: 96px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--badge-color, #f59e0b) 16%, transparent);
}

.profile-badges-panel .badge-icon {
    width: 62px;
    height: 62px;
    display: grid;
    place-items: center;
    position: relative;
    z-index: 1;
    border-radius: 50%;
    color: var(--badge-color, #f59e0b);
    background:
        linear-gradient(180deg, rgba(255,255,255,0.96), rgba(248,250,252,0.92));
    border: 2px solid color-mix(in srgb, currentColor 32%, transparent);
    box-shadow:
        0 10px 22px color-mix(in srgb, currentColor 18%, transparent),
        inset 0 1px 0 rgba(255,255,255,0.9);
}

.profile-badges-panel .badge-icon svg {
    width: 31px;
    height: 31px;
}

.profile-badges-panel .badge-content {
    display: grid;
    gap: 5px;
    justify-items: center;
}

.profile-badges-panel .badge-content h3 {
    margin: 0;
    color: #0f172a;
    font-size: 14px;
    line-height: 1.22;
}

.profile-badges-panel .badge-content p {
    margin: 0;
    max-width: 170px;
    color: #475569 !important;
    font-size: 12px;
    line-height: 1.35;
}

.profile-badges-panel .badge-content small {
    color: #94a3b8;
    font-size: 11px;
    font-weight: 800;
}

.profile-badges-panel .badge-card:nth-child(1),
.profile-badges-panel .badge-card:nth-child(5n + 1) {
    --badge-color: #f59e0b;
    --badge-glow: rgba(245, 158, 11, 0.2);
}

.profile-badges-panel .badge-card:nth-child(2),
.profile-badges-panel .badge-card:nth-child(5n + 2) {
    --badge-color: #8b5cf6;
    --badge-glow: rgba(139, 92, 246, 0.18);
}

.profile-badges-panel .badge-card:nth-child(3),
.profile-badges-panel .badge-card:nth-child(5n + 3) {
    --badge-color: #2563eb;
    --badge-glow: rgba(37, 99, 235, 0.18);
}

.profile-badges-panel .badge-card:nth-child(4),
.profile-badges-panel .badge-card:nth-child(5n + 4) {
    --badge-color: #10b981;
    --badge-glow: rgba(16, 185, 129, 0.18);
}

.profile-badges-panel .badge-card:nth-child(5n) {
    --badge-color: #ef4444;
    --badge-glow: rgba(239, 68, 68, 0.18);
}

:root[data-theme="dark"] .streak-card {
    border-color: rgba(129, 140, 248, 0.38);
    background:
        linear-gradient(135deg, rgba(99, 102, 241, 0.28), rgba(14, 165, 233, 0.12)),
        rgba(15, 23, 42, 0.72);
}

:root[data-theme="dark"] .profile-badges-panel .badge-card {
    border-color: rgba(148, 163, 184, 0.24);
    background:
        radial-gradient(circle at 50% 0%, var(--badge-glow, rgba(245, 158, 11, 0.2)), transparent 44%),
        linear-gradient(180deg, rgba(30, 41, 59, 0.86), rgba(15, 23, 42, 0.78));
    box-shadow: 0 16px 34px rgba(2, 6, 23, 0.26);
}

:root[data-theme="dark"] .profile-badges-panel .badge-icon {
    background: rgba(15, 23, 42, 0.74);
    border-color: color-mix(in srgb, currentColor 46%, transparent);
}

:root[data-theme="dark"] .profile-badges-panel .badge-content h3 {
    color: #f8fafc;
}

:root[data-theme="dark"] .profile-badges-panel .badge-content p {
    color: #cbd5e1 !important;
}

:root[data-theme="dark"] .streak-card strong,
:root[data-theme="dark"] .streak-card span {
    color: #f8fafc;
}

:root[data-theme="dark"] .streak-card small,
:root[data-theme="dark"] .profile-streaks-panel > p {
    color: #cbd5e1 !important;
}

@media (max-width: 820px) {
    .profile-achievements-layout {
        grid-template-columns: 1fr;
    }

    .profile-streaks-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .profile-badges-panel .badges-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 520px) {
    .profile-streaks-list {
        grid-template-columns: 1fr;
    }

    .profile-badges-panel .badges-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .profile-badges-panel .badge-card {
        min-height: 154px;
        padding: 16px 10px 14px;
    }

    .profile-badges-panel .badge-icon {
        width: 54px;
        height: 54px;
    }

    .profile-badges-panel .badge-icon svg {
        width: 27px;
        height: 27px;
    }

    .profile-badges-panel .badge-content h3 {
        font-size: 12px;
    }

    .profile-badges-panel .badge-content p {
        font-size: 11px;
    }
}

.sound-toggle-btn {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 1100;
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    border: 1px solid rgba(148, 163, 184, 0.34);
    background: rgba(15, 23, 42, 0.78);
    color: #ffffff;
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.28);
    cursor: pointer;
}

.sound-toggle-btn:hover {
    transform: translateY(-1px);
    background: rgba(79, 70, 229, 0.86);
}

.sound-toggle-btn.is-muted {
    opacity: 0.72;
}

.sound-test-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 12px;
    align-items: stretch;
}

.sound-test-grid .primary-btn {
    width: 100%;
    min-width: 0;
    min-height: 54px;
    margin: 0 !important;
}

.confetti-layer {
    position: fixed;
    inset: 0;
    z-index: 1200;
    pointer-events: none;
    overflow: hidden;
}

.confetti-piece {
    position: absolute;
    top: -18px;
    width: 10px;
    height: 16px;
    border-radius: 2px;
    opacity: 0.95;
    animation: confetti-fall var(--fall-duration, 2200ms) linear forwards;
}

.confetti-layer.is-side-burst .confetti-piece {
    top: var(--start-y, 50vh);
    left: var(--start-x, 0);
    animation: confetti-side-burst var(--fall-duration, 1900ms) cubic-bezier(0.16, 0.82, 0.34, 1) forwards;
}

@keyframes confetti-fall {
    0% {
        transform: translate3d(0, -20px, 0) rotate(0deg);
    }
    100% {
        transform: translate3d(var(--drift, 0px), 110vh, 0) rotate(var(--spin, 540deg));
    }
}

@keyframes confetti-side-burst {
    0% {
        opacity: 0;
        transform: translate3d(0, 0, 0) rotate(0deg) scale(0.8);
    }
    12% {
        opacity: 1;
    }
    100% {
        opacity: 0;
        transform:
            translate3d(var(--travel-x, 45vw), var(--travel-y, 20vh), 0)
            rotate(var(--spin, 720deg))
            scale(1);
    }
}

.feedback-reading-note {
    display: none !important;
}

.feedback-card.correct,
.game-container .feedback-card.correct {
    background: #e8fff4 !important;
    border-color: #22c55e !important;
    color: #102018 !important;
}

.feedback-card.incorrect,
.game-container .feedback-card.incorrect {
    background: #fff1f2 !important;
    border-color: #ef4444 !important;
    color: #261014 !important;
}

.game-container .feedback-card h3,
.game-container .feedback-card p,
.game-container .feedback-card strong {
    color: #102018 !important;
}

.game-container .feedback-card.incorrect h3,
.game-container .feedback-card.incorrect p,
.game-container .feedback-card.incorrect strong {
    color: #261014 !important;
}

.game-container .feedback-eyebrow {
    color: #334155 !important;
}

.feedback-actions {
    justify-content: flex-end !important;
}

.admin-table,
.ranking-table {
    border-radius: 16px !important;
    overflow: hidden !important;
}

.admin-table thead th:first-child,
.ranking-table thead th:first-child {
    border-top-left-radius: 16px !important;
}

.admin-table thead th:last-child,
.ranking-table thead th:last-child {
    border-top-right-radius: 16px !important;
}

.admin-table tbody tr:last-child td:first-child,
.ranking-table tbody tr:last-child td:first-child {
    border-bottom-left-radius: 16px !important;
}

.admin-table tbody tr:last-child td:last-child,
.ranking-table tbody tr:last-child td:last-child {
    border-bottom-right-radius: 16px !important;
}

.profile-export-actions,
.export-actions,
.report-export-actions {
    align-items: center;
}

.report-export-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    margin: 16px auto 20px;
}

.profile-export-actions .primary-btn,
.export-actions .primary-btn,
.report-export-actions .primary-btn {
    min-height: 54px;
    margin: 0 !important;
}

.report-export-actions .primary-btn {
    width: min(260px, 100%);
    text-align: center;
    text-decoration: none;
}

.report-row-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    justify-content: center;
}

.report-row-actions .table-btn {
    margin: 0;
    min-width: 112px;
    text-align: center;
}

.csv-template-link {
    width: fit-content;
    margin: 0 0 14px;
}

.email-log-filters {
    align-items: end;
}

.email-status-sent {
    background: rgba(34, 197, 94, 0.16) !important;
    border-color: rgba(34, 197, 94, 0.45) !important;
    color: #166534 !important;
}

.email-status-failed {
    background: rgba(239, 68, 68, 0.16) !important;
    border-color: rgba(239, 68, 68, 0.45) !important;
    color: #991b1b !important;
}

:root[data-theme="dark"] .email-status-sent {
    color: #bbf7d0 !important;
}

:root[data-theme="dark"] .email-status-failed {
    color: #fecaca !important;
}

.notification-list {
    display: grid;
    gap: 12px;
}

.notification-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
    padding: 12px 14px;
    border: 1px solid rgba(148, 163, 184, 0.32);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.72);
}

.notification-toolbar p {
    margin: 0;
    color: #334155 !important;
    font-weight: 800;
}

.notification-toolbar form {
    margin: 0;
}

.notification-toolbar .secondary-form-btn {
    width: auto;
    margin: 0;
}

.notification-card {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    padding: 14px 16px;
    border: 1px solid rgba(148, 163, 184, 0.45);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.78);
    position: relative;
    overflow: hidden;
}

.notification-card::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 5px;
    background: #94a3b8;
}

.notification-card.notification-unread {
    border-color: rgba(91, 92, 226, 0.58);
    background:
        linear-gradient(90deg, rgba(91, 92, 226, 0.12), transparent 38%),
        rgba(255, 255, 255, 0.9);
    box-shadow: 0 16px 34px rgba(91, 92, 226, 0.12);
}

.notification-card.notification-unread::before {
    background: #5b5ce2;
}

.notification-card.notification-read {
    opacity: 0.76;
}

.notification-card.notification-read::before {
    background: #94a3b8;
}

.notification-card-heading {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}

.notification-card h2 {
    margin: 0;
    color: #111827;
    font-size: 17px;
}

.notification-status-pill {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 4px 10px;
    border-radius: 999px;
    background: #e2e8f0;
    color: #334155;
    font-size: 12px;
    font-weight: 800;
}

.notification-unread .notification-status-pill {
    background: #eef2ff;
    color: #4f46e5;
}

.notification-card p {
    margin: 0 0 6px;
    color: #334155 !important;
}

.notification-card small {
    color: #64748b;
    font-weight: 700;
}

:root[data-theme="dark"] .notification-card {
    background: rgba(15, 23, 42, 0.72);
    border-color: rgba(148, 163, 184, 0.3);
}

:root[data-theme="dark"] .notification-toolbar {
    background: rgba(15, 23, 42, 0.72);
    border-color: rgba(148, 163, 184, 0.3);
}

:root[data-theme="dark"] .notification-toolbar p {
    color: #e5e7eb !important;
}

:root[data-theme="dark"] .notification-card.notification-unread {
    border-color: rgba(129, 140, 248, 0.66);
    background:
        linear-gradient(90deg, rgba(129, 140, 248, 0.2), transparent 42%),
        rgba(15, 23, 42, 0.78);
}

:root[data-theme="dark"] .notification-card h2,
:root[data-theme="dark"] .notification-card p {
    color: #e5e7eb !important;
}

:root[data-theme="dark"] .notification-status-pill {
    background: rgba(148, 163, 184, 0.18);
    color: #cbd5e1;
}

:root[data-theme="dark"] .notification-unread .notification-status-pill {
    background: rgba(129, 140, 248, 0.22);
    color: #c7d2fe;
}

@media (max-width: 640px) {
    .notification-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .notification-toolbar .secondary-form-btn {
        width: 100%;
    }

    .notification-card {
        align-items: stretch;
        flex-direction: column;
    }
}

.question-bank-filters {
    display: grid;
    grid-template-columns: minmax(260px, 1.7fr) repeat(6, minmax(118px, 1fr)) auto;
    gap: 10px;
    align-items: end;
    margin-bottom: 16px;
    padding: 12px;
    border-radius: 16px;
    background: rgba(15, 23, 42, 0.08);
    border: 1px solid rgba(148, 163, 184, 0.22);
}

.question-filter-field {
    display: grid;
    gap: 6px;
    min-width: 0;
}

.question-filter-field span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
}

.question-filter-field input,
.question-filter-field select {
    min-height: 40px;
    width: 100%;
    min-width: 0;
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--input-bg);
    color: var(--text);
    font-size: 13px;
}

.question-bank-filters .secondary-form-btn {
    min-height: 40px;
    margin: 0;
    padding: 8px 12px;
    white-space: nowrap;
}

.ai-progress-panel {
    display: grid;
    gap: 12px;
    margin-top: 14px;
    padding: 14px;
    border: 1px solid rgba(99, 102, 241, 0.28);
    border-radius: 16px;
    background:
        linear-gradient(135deg, rgba(99, 102, 241, 0.12), rgba(20, 184, 166, 0.1)),
        rgba(255, 255, 255, 0.72);
}

.ai-progress-panel[hidden] {
    display: none;
}

.ai-progress-track {
    width: 100%;
    height: 10px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.12);
}

.ai-progress-track span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #5b5fee, #22c7c7);
    box-shadow: 0 0 18px rgba(34, 199, 199, 0.38);
    transition: width 420ms ease;
}

.ai-progress-steps {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.ai-progress-steps li {
    display: flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
    color: var(--muted);
    font-size: 12px;
    font-weight: 850;
}

.ai-progress-steps li::before {
    content: "";
    width: 10px;
    height: 10px;
    flex: 0 0 10px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.65);
}

.ai-progress-steps li.is-current {
    color: var(--text);
}

.ai-progress-steps li.is-current::before {
    background: #5b5fee;
    box-shadow: 0 0 0 5px rgba(91, 95, 238, 0.16);
}

.ai-progress-steps li.is-complete::before {
    background: #14b8a6;
}

.ai-review-generated-btn {
    justify-self: start;
}

:root[data-theme="dark"] .ai-progress-panel {
    background:
        linear-gradient(135deg, rgba(91, 95, 238, 0.18), rgba(20, 184, 166, 0.12)),
        rgba(15, 23, 42, 0.76);
    border-color: rgba(148, 163, 184, 0.26);
}

:root[data-theme="dark"] .ai-progress-track {
    background: rgba(226, 232, 240, 0.13);
}

.questions-admin-table {
    table-layout: fixed !important;
}

.questions-admin-table th,
.questions-admin-table td {
    padding: 10px 12px !important;
    font-size: 13px;
    line-height: 1.35;
    vertical-align: top;
}

.questions-admin-table .col-id {
    width: 58px;
}

.questions-admin-table .col-question {
    width: 34%;
}

.questions-admin-table .col-correct {
    width: 74px;
}

.questions-admin-table .col-difficulty {
    width: 84px;
}

.questions-admin-table .col-language {
    width: 66px;
}

.questions-admin-table .col-category {
    width: 14%;
}

.questions-admin-table .col-status,
.questions-admin-table .col-origin,
.questions-admin-table .col-active {
    width: 92px;
}

.questions-admin-table .col-actions {
    width: 154px;
}

.question-text-cell {
    color: var(--theme-table-text) !important;
    font-weight: 750;
    overflow-wrap: anywhere;
    word-break: normal;
}

.question-row-actions {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    align-items: center;
}

.question-row-actions .table-btn {
    min-width: 0;
    min-height: 34px;
    margin: 0 !important;
    padding: 8px 10px !important;
    border-radius: 10px;
    font-size: 12px;
    line-height: 1;
}

/* Responsive polish pass: keep admin data readable before columns collapse. */
.admin-table th,
.admin-table td,
.ranking-table th,
.ranking-table td {
    overflow-wrap: break-word;
    word-break: normal;
    hyphens: auto;
}

@media (max-width: 1180px) {
    .questions-admin-table th,
    .questions-admin-table td {
        padding: 9px 8px !important;
        font-size: 12px;
    }

    .questions-admin-table .col-question {
        width: 30%;
    }

    .questions-admin-table .col-category {
        width: 12%;
    }

    .questions-admin-table .col-status,
    .questions-admin-table .col-origin,
    .questions-admin-table .col-active {
        width: 78px;
    }
}

@media (max-width: 900px) {
    .question-bank-filters {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .question-bank-filters .question-search-field,
    .question-bank-filters #question-clear-filters {
        grid-column: 1 / -1;
    }

    .questions-admin-table.responsive-card-table,
    .questions-admin-table.responsive-card-table thead,
    .questions-admin-table.responsive-card-table tbody,
    .questions-admin-table.responsive-card-table tr,
    .questions-admin-table.responsive-card-table th,
    .questions-admin-table.responsive-card-table td {
        display: block !important;
        width: 100% !important;
    }

    .questions-admin-table.responsive-card-table {
        border: 0 !important;
        border-radius: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
        overflow: visible !important;
        min-width: 0 !important;
    }

    .questions-admin-table.responsive-card-table thead {
        position: absolute;
        width: 1px !important;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }

    .questions-admin-table.responsive-card-table tbody tr {
        display: grid !important;
        gap: 0;
        margin: 0 0 14px;
        padding: 14px;
        border: 1px solid var(--theme-table-line) !important;
        border-radius: 14px !important;
        background: var(--theme-table-cell-bg) !important;
        box-shadow: 0 12px 24px rgba(15, 23, 42, 0.08);
    }

    .questions-admin-table.responsive-card-table td {
        display: grid !important;
        grid-template-columns: minmax(112px, 34%) minmax(0, 1fr);
        align-items: start;
        gap: 12px;
        padding: 9px 0 !important;
        border: 0 !important;
        border-bottom: 1px solid var(--theme-table-line) !important;
        background: transparent !important;
        color: var(--theme-table-text) !important;
        line-height: 1.45;
        overflow-wrap: break-word;
        word-break: normal;
    }

    .questions-admin-table.responsive-card-table td:last-child {
        border-bottom: 0 !important;
    }

    .questions-admin-table.responsive-card-table td::before {
        content: attr(data-label);
        color: var(--theme-table-label);
        font-size: 11px;
        font-weight: 900;
        line-height: 1.25;
        text-transform: uppercase;
    }

    .questions-admin-table .question-text-cell {
        font-weight: 800;
        overflow-wrap: break-word;
    }

    .question-row-actions {
        flex-wrap: wrap;
    }

    .question-row-actions .table-btn {
        flex: 1 1 96px;
        min-height: 40px;
    }
}

@media (max-width: 820px) {
    .game-container:has(.admin-section),
    .game-container:has(.analytics-layout),
    .game-container:has(.admin-table) {
        width: min(100% - 16px, 1520px);
        padding: 16px;
    }

    .responsive-card-table:not(.ranking-table),
    .responsive-card-table:not(.ranking-table) thead,
    .responsive-card-table:not(.ranking-table) tbody,
    .responsive-card-table:not(.ranking-table) tr,
    .responsive-card-table:not(.ranking-table) th,
    .responsive-card-table:not(.ranking-table) td {
        display: block !important;
        width: 100% !important;
    }

    .responsive-card-table:not(.ranking-table) {
        border: 0 !important;
        border-radius: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
        overflow: visible !important;
        min-width: 0 !important;
    }

    .responsive-card-table:not(.ranking-table) thead {
        position: absolute;
        width: 1px !important;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }

    .responsive-card-table:not(.ranking-table) tbody tr {
        margin: 0 0 12px;
        padding: 13px;
        border: 1px solid var(--theme-table-line) !important;
        border-radius: 14px !important;
        background: var(--theme-table-cell-bg) !important;
        box-shadow: 0 10px 22px rgba(15, 23, 42, 0.08);
    }

    .responsive-card-table:not(.ranking-table) td {
        display: grid !important;
        grid-template-columns: minmax(104px, 36%) minmax(0, 1fr);
        gap: 10px;
        align-items: start;
        padding: 9px 0 !important;
        border: 0 !important;
        border-bottom: 1px solid var(--theme-table-line) !important;
        background: transparent !important;
        color: var(--theme-table-text) !important;
        overflow-wrap: break-word;
        word-break: normal;
    }

    .responsive-card-table:not(.ranking-table) td:last-child {
        border-bottom: 0 !important;
    }

    .responsive-card-table:not(.ranking-table) td::before {
        content: attr(data-label);
        color: var(--theme-table-label);
        font-size: 11px;
        font-weight: 900;
        line-height: 1.25;
        text-transform: uppercase;
    }

    .responsive-card-table:not(.ranking-table) td[colspan] {
        display: block !important;
        text-align: center;
    }

    .responsive-card-table:not(.ranking-table) td[colspan]::before {
        content: none !important;
    }
}

@media (max-width: 560px) {
    .question-bank-filters,
    .form-grid,
    .dashboard-grid,
    .analytics-layout {
        grid-template-columns: 1fr !important;
    }

    .responsive-card-table:not(.ranking-table) td,
    .questions-admin-table.responsive-card-table td {
        grid-template-columns: 1fr !important;
        gap: 4px;
    }

    .responsive-card-table:not(.ranking-table) td::before,
    .questions-admin-table.responsive-card-table td::before {
        margin-bottom: 2px;
    }

    .top-actions,
    .top-links,
    .admin-room-controls,
    .report-export-actions,
    .profile-export-actions {
        width: 100%;
        align-items: stretch;
    }

    .top-links,
    .admin-room-controls,
    .report-export-actions,
    .profile-export-actions {
        flex-direction: column;
    }

    .top-links .logout-btn,
    .top-links .primary-btn,
    .admin-room-controls .primary-btn,
    .report-export-actions .primary-btn,
    .profile-export-actions .primary-btn {
        width: 100%;
    }
}

.app-confirm-dialog {
    width: min(440px, calc(100vw - 32px));
    overflow: hidden;
    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, 0.34);
    background: #ffffff;
    color: #111827;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
}

.app-confirm-dialog header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 18px 22px;
    border-bottom: 0;
    background: linear-gradient(135deg, #4f46e5, #6366f1);
    color: #ffffff;
}

.app-confirm-dialog h2 {
    margin: 0;
    font-size: 1.05rem;
    color: #ffffff;
}

.app-confirm-dialog p {
    margin: 0;
    padding: 22px;
    color: #1f2937 !important;
    line-height: 1.5;
    background: #ffffff;
}

.user-action-body {
    display: grid;
    gap: 12px;
    padding: 22px;
    background: #ffffff;
}

.user-action-body p {
    padding: 0;
}

.user-action-body input {
    min-height: 46px;
}

.app-confirm-dialog footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 0 22px 22px;
    background: #ffffff;
}

.app-confirm-dialog .primary-btn,
.app-confirm-dialog .secondary-form-btn {
    width: auto;
    min-width: 120px;
    min-height: 42px;
    margin: 0 !important;
}

.app-confirm-dialog .question-modal-close {
    background: rgba(255, 255, 255, 0.18);
    color: #ffffff;
}

:root[data-theme="dark"] .app-confirm-dialog {
    background: #111827;
    color: #f9fafb;
    border-color: rgba(148, 163, 184, 0.38);
}

:root[data-theme="dark"] .app-confirm-dialog p,
:root[data-theme="dark"] .app-confirm-dialog footer,
:root[data-theme="dark"] .user-action-body {
    background: #111827;
}

:root[data-theme="dark"] .app-confirm-dialog p {
    color: #e5e7eb !important;
}

@media (max-width: 1180px) {
    .question-bank-filters {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .question-search-field {
        grid-column: 1 / -1;
    }
}

@media (max-width: 720px) {
    .question-bank-filters {
        grid-template-columns: 1fr;
    }

    .question-row-actions {
        flex-wrap: wrap;
    }
}

/* Unified profile showcase for players, teachers and admin profile views */

:where(.player-profile-container, .teacher-profile-container) .profile-page-section,
:where(.player-profile-container, .teacher-profile-container) .teacher-profile-section {
    max-width: 1240px;
    margin: 28px auto 0;
    padding: 0;
    overflow: visible;
    background: transparent;
    border: 0;
    box-shadow: none;
}

:where(.player-profile-container, .teacher-profile-container) .profile-showcase-card {
    display: grid !important;
    grid-template-columns: minmax(250px, 300px) minmax(0, 1fr) !important;
    gap: 0 !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden;
    border-radius: 24px !important;
    background: linear-gradient(135deg, #f8fafc 0%, #eef4fb 100%) !important;
    border: 1px solid rgba(148, 163, 184, 0.34) !important;
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.18) !important;
}

:where(.player-profile-container, .teacher-profile-container) .profile-showcase-identity {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    min-height: 380px;
    padding: 34px 24px;
    text-align: center;
    background:
        radial-gradient(circle at 28% 12%, rgba(91, 92, 232, 0.28), transparent 34%),
        linear-gradient(180deg, #172033 0%, #101827 100%);
    color: #f8fafc !important;
}

:where(.player-profile-container, .teacher-profile-container) .profile-showcase-identity .profile-avatar {
    width: 112px !important;
    height: 112px !important;
    border-radius: 28px !important;
    border: 3px solid rgba(255, 255, 255, 0.72);
    box-shadow: 0 18px 40px rgba(2, 6, 23, 0.35) !important;
}

:where(.player-profile-container, .teacher-profile-container) .profile-showcase-nameblock h2,
:where(.player-profile-container, .teacher-profile-container) .teacher-profile-nameblock h2 {
    margin: 0;
    color: #ffffff !important;
    font-size: clamp(1.45rem, 2vw, 2rem);
    line-height: 1.12;
    text-shadow: 0 2px 12px rgba(2, 6, 23, 0.38);
    overflow-wrap: anywhere;
}

:where(.player-profile-container, .teacher-profile-container) .profile-showcase-nameblock p,
:where(.player-profile-container, .teacher-profile-container) .teacher-profile-nameblock p {
    max-width: 240px;
    margin: 8px auto 0;
    color: #dbe4f0 !important;
    font-size: 14px;
    overflow-wrap: anywhere;
}

:where(.player-profile-container, .teacher-profile-container) .profile-showcase-identity .profile-edit-text-btn {
    display: inline-flex;
    width: auto;
    min-width: 112px;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 6px;
    padding: 0 18px;
    border-color: rgba(255, 255, 255, 0.26);
    background: #ffffff;
    color: #0f172a !important;
    box-shadow: 0 10px 26px rgba(2, 6, 23, 0.18);
}

:where(.player-profile-container, .teacher-profile-container) .profile-showcase-card .profile-display-main {
    display: grid;
    gap: 18px;
    padding: 28px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0.52));
}

:where(.player-profile-container, .teacher-profile-container) .profile-social-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 12px;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
}

:where(.player-profile-container, .teacher-profile-container) .profile-social-stats div {
    min-height: 92px;
    padding: 18px 12px;
    border-radius: 18px;
    background: #ffffff;
    border: 1px solid rgba(203, 213, 225, 0.9);
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.06);
}

:where(.player-profile-container, .teacher-profile-container) .profile-social-stats strong {
    color: #111827;
    font-size: 28px;
}

:where(.player-profile-container, .teacher-profile-container) .profile-social-stats span {
    color: #64748b;
    font-size: 12px;
    letter-spacing: 0.02em;
}

:where(.player-profile-container, .teacher-profile-container) .profile-detail-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

:where(.player-profile-container, .teacher-profile-container) .profile-detail-grid div {
    min-height: 74px;
    padding: 14px 16px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.74);
    border: 1px solid rgba(203, 213, 225, 0.88);
}

:where(.player-profile-container, .teacher-profile-container) .profile-detail-grid span {
    color: #64748b !important;
    font-size: 12px;
}

:where(.player-profile-container, .teacher-profile-container) .profile-detail-grid strong {
    color: #111827 !important;
    font-size: 15px;
}

:where(.player-profile-container, .teacher-profile-container) .profile-display-bio {
    margin: 0;
    padding: 16px 18px;
    border-radius: 18px;
    background: #ffffff;
    border: 1px solid rgba(203, 213, 225, 0.88);
    color: #334155 !important;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.05);
}

:where(.player-profile-container, .teacher-profile-container) .profile-display-bio:empty {
    display: none;
}

:root[data-theme="dark"] :where(.player-profile-container, .teacher-profile-container) .profile-showcase-card {
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.96), rgba(30, 41, 59, 0.94)) !important;
    border-color: rgba(148, 163, 184, 0.24) !important;
    box-shadow: 0 24px 70px rgba(2, 6, 23, 0.38) !important;
}

:root[data-theme="dark"] :where(.player-profile-container, .teacher-profile-container) .profile-showcase-card .profile-display-main {
    background:
        linear-gradient(180deg, rgba(30, 41, 59, 0.78), rgba(15, 23, 42, 0.58));
}

:root[data-theme="dark"] :where(.player-profile-container, .teacher-profile-container) .profile-social-stats div,
:root[data-theme="dark"] :where(.player-profile-container, .teacher-profile-container) .profile-detail-grid div,
:root[data-theme="dark"] :where(.player-profile-container, .teacher-profile-container) .profile-display-bio {
    background: rgba(15, 23, 42, 0.62);
    border-color: rgba(148, 163, 184, 0.24);
    box-shadow: none;
}

:root[data-theme="dark"] :where(.player-profile-container, .teacher-profile-container) .profile-social-stats strong,
:root[data-theme="dark"] :where(.player-profile-container, .teacher-profile-container) .profile-detail-grid strong {
    color: #f8fafc !important;
}

:root[data-theme="dark"] :where(.player-profile-container, .teacher-profile-container) .profile-social-stats span,
:root[data-theme="dark"] :where(.player-profile-container, .teacher-profile-container) .profile-detail-grid span,
:root[data-theme="dark"] :where(.player-profile-container, .teacher-profile-container) .profile-display-bio {
    color: #cbd5e1 !important;
}

@media (max-width: 960px) {
    :where(.player-profile-container, .teacher-profile-container) .profile-showcase-card {
        grid-template-columns: 1fr !important;
    }

    :where(.player-profile-container, .teacher-profile-container) .profile-showcase-identity {
        min-height: auto;
        padding: 28px 22px;
    }

    :where(.player-profile-container, .teacher-profile-container) .profile-showcase-card .profile-display-main {
        padding: 22px;
    }

    :where(.player-profile-container, .teacher-profile-container) .profile-detail-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 650px) {
    :where(.player-profile-container, .teacher-profile-container) .profile-page-section,
    :where(.player-profile-container, .teacher-profile-container) .teacher-profile-section {
        width: 100%;
        margin-top: 18px;
    }

    :where(.player-profile-container, .teacher-profile-container) .profile-showcase-card {
        border-radius: 18px !important;
    }

    :where(.player-profile-container, .teacher-profile-container) .profile-showcase-identity {
        padding: 24px 18px;
    }

    :where(.player-profile-container, .teacher-profile-container) .profile-showcase-identity .profile-avatar {
        width: 96px !important;
        height: 96px !important;
    }

    :where(.player-profile-container, .teacher-profile-container) .profile-social-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }

    :where(.player-profile-container, .teacher-profile-container) .profile-detail-grid {
        grid-template-columns: 1fr;
    }

    :where(.player-profile-container, .teacher-profile-container) .profile-showcase-card .profile-display-main {
        padding: 16px;
    }
}

/* Mobile tables stay as real comparison tables */

.mobile-table-shell {
    width: 100%;
    max-width: 100%;
}

@media (max-width: 900px) {
    .admin-section:has(.admin-table),
    .chart-card:has(.admin-table) {
        overflow-x: hidden;
        overflow-y: visible;
        background: #eef2f7;
    }

    .mobile-table-shell {
        width: 100%;
        max-width: 100%;
        overflow-x: auto;
        overflow-y: visible;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
        border-radius: 14px;
        border: 1px solid rgba(148, 163, 184, 0.35);
        background: #f8fafc;
    }

    .admin-table,
    .ranking-table,
    .responsive-card-table,
    .questions-admin-table.responsive-card-table {
        display: table !important;
        width: max-content !important;
        min-width: min(760px, calc(100vw - 40px)) !important;
        max-width: none !important;
        table-layout: auto !important;
        border-collapse: separate !important;
        border-spacing: 0 !important;
        overflow: hidden !important;
        background: #f8fafc !important;
        border-radius: 14px !important;
        box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08) !important;
    }

    .questions-admin-table {
        min-width: 940px !important;
    }

    .responsive-card-table thead,
    .responsive-card-table tbody,
    .responsive-card-table tr,
    .responsive-card-table th,
    .responsive-card-table td,
    .questions-admin-table.responsive-card-table thead,
    .questions-admin-table.responsive-card-table tbody,
    .questions-admin-table.responsive-card-table tr,
    .questions-admin-table.responsive-card-table th,
    .questions-admin-table.responsive-card-table td {
        display: revert !important;
        width: auto !important;
    }

    .responsive-card-table thead,
    .questions-admin-table.responsive-card-table thead {
        position: static !important;
        width: auto !important;
        height: auto !important;
        clip: auto !important;
        overflow: visible !important;
        white-space: normal !important;
    }

    .admin-table th,
    .admin-table td,
    .responsive-card-table th,
    .responsive-card-table td,
    .questions-admin-table.responsive-card-table th,
    .questions-admin-table.responsive-card-table td {
        display: table-cell !important;
        padding: 8px 9px !important;
        border-bottom: 1px solid #d8dee8 !important;
        border-right: 1px solid #d8dee8 !important;
        font-size: 11.5px !important;
        line-height: 1.32 !important;
        white-space: normal !important;
        overflow-wrap: break-word !important;
        word-break: normal !important;
        background: #f8fafc !important;
        color: #0f172a !important;
    }

    .admin-table th,
    .responsive-card-table th,
    .questions-admin-table.responsive-card-table th {
        position: sticky;
        top: 0;
        z-index: 2;
        background: #374151 !important;
        color: #ffffff !important;
        font-size: 11px !important;
        font-weight: 900 !important;
    }

    .responsive-card-table td::before,
    .questions-admin-table.responsive-card-table td::before {
        content: none !important;
        display: none !important;
    }

    .responsive-card-table tbody tr,
    .questions-admin-table.responsive-card-table tbody tr {
        display: table-row !important;
        margin: 0 !important;
        padding: 0 !important;
        border: 0 !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        background: transparent !important;
    }

    .admin-table tbody tr:nth-child(even) td,
    .responsive-card-table tbody tr:nth-child(even) td,
    .questions-admin-table.responsive-card-table tbody tr:nth-child(even) td {
        background: #eef2f7 !important;
    }

    .admin-table td *,
    .responsive-card-table td *,
    .questions-admin-table .question-text-cell {
        color: inherit !important;
    }

    .admin-table td .table-btn,
    .admin-table td .report-view-btn,
    .admin-table td button {
        color: #ffffff !important;
    }

    .admin-table td .edit-btn {
        color: #0f172a !important;
    }

    .admin-table td a:not(.table-btn):not(.report-view-btn) {
        color: #2563eb !important;
    }

    .questions-admin-table .col-id {
        width: 46px !important;
    }

    .questions-admin-table .col-question {
        width: 290px !important;
    }

    .questions-admin-table .col-correct {
        width: 66px !important;
    }

    .questions-admin-table .col-difficulty {
        width: 74px !important;
    }

    .questions-admin-table .col-language {
        width: 58px !important;
    }

    .questions-admin-table .col-category {
        width: 128px !important;
    }

    .questions-admin-table .col-status,
    .questions-admin-table .col-origin,
    .questions-admin-table .col-active {
        width: 82px !important;
    }

    .questions-admin-table .col-actions {
        width: 120px !important;
    }

    .questions-admin-table td.question-text-cell,
    .questions-admin-table .question-text-cell,
    .questions-admin-table.responsive-card-table td.question-text-cell,
    .questions-admin-table.responsive-card-table .question-text-cell {
        color: #0f172a !important;
        background: inherit !important;
        font-weight: 800 !important;
        text-shadow: none !important;
    }

    .questions-admin-table td:not(th) {
        color: #0f172a !important;
    }

    .questions-admin-table .table-btn,
    .questions-admin-table button.table-btn {
        color: #ffffff !important;
    }

    .questions-admin-table .edit-btn {
        color: #0f172a !important;
    }

    .admin-table .table-input,
    .admin-table input,
    .admin-table select {
        min-width: 82px !important;
        min-height: 34px !important;
        padding: 6px 7px !important;
        font-size: 11.5px !important;
    }

    .admin-table .table-btn,
    .admin-table .report-view-btn,
    .question-row-actions .table-btn {
        min-height: 34px !important;
        padding: 7px 9px !important;
        font-size: 11.5px !important;
        white-space: nowrap !important;
    }

    .admin-table .history-stats-btn {
        min-width: 44px !important;
        width: 44px !important;
        padding: 7px !important;
        border-radius: 12px !important;
    }

    .admin-table .history-stats-btn span {
        display: none !important;
    }

    .question-row-actions {
        display: flex !important;
        flex-wrap: nowrap !important;
        gap: 6px !important;
    }
}

@media (max-width: 520px) {
    .admin-section:has(.admin-table),
    .chart-card:has(.admin-table) {
        margin-inline: -4px;
        padding-inline: 10px;
    }

    .mobile-table-shell {
        border-radius: 12px;
    }

    .admin-table,
    .ranking-table,
    .responsive-card-table {
        min-width: 680px !important;
    }

    .questions-admin-table {
        min-width: 900px !important;
    }

    .admin-table th,
    .admin-table td,
    .responsive-card-table th,
    .responsive-card-table td {
        padding: 7px 8px !important;
        font-size: 11px !important;
    }
}
