/* ============================
   Game Edukasi Anemia - CSS
   Mobile-First Design
   ============================ */

@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@300;400;500;600;700&family=Nunito:wght@400;600;700;800&display=swap');

:root {
    --primary: #6c5ce7;
    --primary-light: #a29bfe;
    --primary-dark: #4834d4;
    --secondary: #00cec9;
    --accent: #fd79a8;
    --success: #00b894;
    --danger: #ff7675;
    --warning: #ffeaa7;
    --dark: #0a0a2e;
    --darker: #06061a;
    --card-bg: rgba(255,255,255,0.06);
    --card-border: rgba(255,255,255,0.1);
    --text: #f0f0f0;
    --text-muted: #b0b0cc;
    --glow-primary: 0 0 20px rgba(108, 92, 231, 0.4);
    --glow-success: 0 0 20px rgba(0, 184, 148, 0.4);
    --glow-danger: 0 0 20px rgba(255, 118, 117, 0.4);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Nunito', sans-serif;
    background: var(--darker);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Animated background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(108, 92, 231, 0.12) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(0, 206, 201, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 80%, rgba(253, 121, 168, 0.08) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--darker); }
::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 3px; }

/* ---- LOGIN PAGE ---- */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1rem;
    position: relative;
    z-index: 1;
}

.login-card {
    background: linear-gradient(135deg, rgba(108, 92, 231, 0.15), rgba(0, 206, 201, 0.1));
    border: 1px solid var(--card-border);
    border-radius: 24px;
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 420px;
    text-align: center;
    backdrop-filter: blur(20px);
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: fadeInUp 0.6s ease-out;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

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

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes glow {
    0%, 100% { box-shadow: 0 0 5px rgba(108, 92, 231, 0.3); }
    50% { box-shadow: 0 0 20px rgba(108, 92, 231, 0.6); }
}

.login-icon {
    font-size: 4rem;
    margin-bottom: 0.5rem;
    animation: float 3s ease-in-out infinite;
}

.login-card h1 {
    font-family: 'Fredoka', sans-serif;
    font-size: 1.8rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-light), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.3rem;
}

.login-card .subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
    text-align: left;
}

.form-group label {
    display: block;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.form-input {
    width: 100%;
    padding: 0.9rem 1.2rem;
    background: rgba(255,255,255,0.06);
    border: 2px solid var(--card-border);
    border-radius: 14px;
    color: var(--text);
    font-family: 'Nunito', sans-serif;
    font-size: 1rem;
    transition: all 0.3s ease;
    outline: none;
}

.form-input:focus {
    border-color: var(--primary);
    box-shadow: var(--glow-primary);
    background: rgba(255,255,255,0.1);
}

.form-input::placeholder {
    color: rgba(255,255,255,0.3);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.9rem 2rem;
    border: none;
    border-radius: 14px;
    font-family: 'Fredoka', sans-serif;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    text-decoration: none;
    color: #fff;
}

.btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.4s, height 0.4s;
}

.btn:active::after {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    box-shadow: 0 4px 15px rgba(108, 92, 231, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(108, 92, 231, 0.5);
}

.btn-success {
    background: linear-gradient(135deg, var(--success), #00a884);
    box-shadow: 0 4px 15px rgba(0, 184, 148, 0.4);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(0, 184, 148, 0.5);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger), #e55039);
    box-shadow: 0 4px 15px rgba(255, 118, 117, 0.4);
}

.btn-secondary {
    background: linear-gradient(135deg, #636e72, #2d3436);
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.btn-accent {
    background: linear-gradient(135deg, var(--accent), #e84393);
    box-shadow: 0 4px 15px rgba(253, 121, 168, 0.4);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary-light);
}

.btn-outline:hover {
    background: var(--primary);
    color: #fff;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    border-radius: 10px;
}

.btn-block {
    width: 100%;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* ---- GAME PAGE ---- */
.game-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(10, 10, 46, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--card-border);
    padding: 0.5rem 1rem;
}

.game-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
}

.stat-item .icon {
    font-size: 1rem;
}

.stat-item .value {
    color: var(--text);
    font-family: 'Fredoka', sans-serif;
}

.stat-item.score .value { color: var(--warning); }
.stat-item.lives .value { color: var(--danger); }
.stat-item.level .value { color: var(--secondary); }

.game-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem;
    position: relative;
    z-index: 1;
}

.quiz-banner {
    background: linear-gradient(135deg, rgba(108, 92, 231, 0.2), rgba(0, 206, 201, 0.15));
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 1rem;
    margin: 0.5rem 0;
    width: 100%;
    max-width: 420px;
    text-align: center;
    animation: fadeInUp 0.4s ease-out;
}

.quiz-banner .quiz-number {
    font-size: 0.75rem;
    color: var(--primary-light);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 0.3rem;
}

.quiz-banner .question {
    font-family: 'Fredoka', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.4;
    color: var(--text);
}

.quiz-banner .hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
    font-style: italic;
}

.canvas-container {
    position: relative;
    margin: 0.5rem 0;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0,0,0,0.4);
    border: 2px solid rgba(108, 92, 231, 0.3);
}

#gameCanvas {
    display: block;
    max-width: 100%;
    height: auto;
    cursor: pointer;
    touch-action: none;
}

/* Touch Controls (D-Pad) */
.touch-controls {
    display: grid;
    grid-template-areas:
        ". up ."
        "left . right"
        ". down .";
    gap: 6px;
    margin: 0.8rem auto;
    width: fit-content;
}

.touch-btn {
    width: 56px;
    height: 56px;
    border: none;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(108, 92, 231, 0.3), rgba(108, 92, 231, 0.1));
    border: 1px solid rgba(108, 92, 231, 0.3);
    color: var(--text);
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
    -webkit-user-select: none;
    user-select: none;
    touch-action: manipulation;
}

.touch-btn:active {
    background: var(--primary);
    transform: scale(0.92);
    box-shadow: var(--glow-primary);
}

.touch-btn[data-dir="up"] { grid-area: up; }
.touch-btn[data-dir="left"] { grid-area: left; }
.touch-btn[data-dir="right"] { grid-area: right; }
.touch-btn[data-dir="down"] { grid-area: down; }

/* Answer legend */
.answer-legend {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
    justify-content: center;
    margin: 0.5rem 0;
    padding: 0.6rem;
    background: var(--card-bg);
    border-radius: 12px;
    border: 1px solid var(--card-border);
    max-width: 420px;
    width: 100%;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.7rem;
    color: var(--text-muted);
    max-width: 48%;
}

.legend-box {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

/* Quiz feedback overlay */
.quiz-feedback {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(5px);
    animation: fadeInUp 0.3s ease-out;
}

.feedback-card {
    background: linear-gradient(135deg, var(--dark), var(--darker));
    border: 2px solid var(--card-border);
    border-radius: 20px;
    padding: 2rem;
    max-width: 360px;
    width: 90%;
    text-align: center;
    animation: fadeInUp 0.4s ease-out;
}

.feedback-card.correct {
    border-color: var(--success);
    box-shadow: var(--glow-success);
}

.feedback-card.wrong {
    border-color: var(--danger);
    box-shadow: var(--glow-danger);
}

.feedback-icon {
    font-size: 3.5rem;
    margin-bottom: 0.5rem;
}

.feedback-title {
    font-family: 'Fredoka', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.feedback-explanation {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

/* Game Over / Level Complete */
.result-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    background: rgba(0,0,0,0.85);
    backdrop-filter: blur(8px);
    animation: fadeInUp 0.3s ease-out;
}

.result-card {
    background: linear-gradient(135deg, rgba(108, 92, 231, 0.15), rgba(0, 206, 201, 0.1));
    border: 1px solid var(--card-border);
    border-radius: 24px;
    padding: 2rem 1.5rem;
    max-width: 400px;
    width: 90%;
    text-align: center;
    animation: fadeInUp 0.5s ease-out;
}

.result-card h2 {
    font-family: 'Fredoka', sans-serif;
    font-size: 2rem;
    margin-bottom: 1rem;
}

.result-card h2.win {
    background: linear-gradient(135deg, var(--warning), #fdcb6e);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.result-card h2.lose {
    color: var(--danger);
}

.result-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.8rem;
    margin: 1.5rem 0;
}

.result-stat {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 0.8rem;
}

.result-stat .label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.result-stat .value {
    font-family: 'Fredoka', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    margin-top: 0.2rem;
}

.result-actions {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    margin-top: 1.5rem;
}

/* ---- ADMIN PAGE ---- */
.admin-container {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    padding: 1rem;
    padding-bottom: 80px;
}

.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 0;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--card-border);
}

.admin-header h1 {
    font-family: 'Fredoka', sans-serif;
    font-size: 1.4rem;
    background: linear-gradient(135deg, var(--primary-light), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.admin-login-card {
    max-width: 400px;
    margin: 3rem auto;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 2rem;
    text-align: center;
}

.admin-login-card h2 {
    font-family: 'Fredoka', sans-serif;
    margin-bottom: 1.5rem;
}

/* Tabs */
.admin-tabs {
    display: flex;
    gap: 0.3rem;
    background: var(--card-bg);
    border-radius: 14px;
    padding: 0.3rem;
    margin-bottom: 1.5rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.admin-tab {
    flex: 1;
    min-width: fit-content;
    padding: 0.7rem 0.8rem;
    border: none;
    border-radius: 11px;
    background: transparent;
    color: var(--text-muted);
    font-family: 'Fredoka', sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.admin-tab.active {
    background: var(--primary);
    color: #fff;
    box-shadow: var(--glow-primary);
}

.admin-tab:hover:not(.active) {
    background: rgba(255,255,255,0.05);
}

.tab-content {
    display: none;
    animation: fadeInUp 0.3s ease-out;
}

.tab-content.active {
    display: block;
}

/* Summary cards */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.8rem;
    margin-bottom: 1.5rem;
}

.summary-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 1rem;
    text-align: center;
    transition: all 0.3s ease;
}

.summary-card:hover {
    transform: translateY(-2px);
    border-color: var(--primary);
}

.summary-card .icon {
    font-size: 1.8rem;
    margin-bottom: 0.3rem;
}

.summary-card .label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.summary-card .value {
    font-family: 'Fredoka', sans-serif;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text);
    margin-top: 0.2rem;
}

/* Tables */
.data-table-container {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid var(--card-border);
    margin-bottom: 1rem;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.data-table th {
    background: rgba(108, 92, 231, 0.2);
    padding: 0.7rem 0.5rem;
    text-align: left;
    font-weight: 700;
    color: var(--primary-light);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    white-space: nowrap;
}

.data-table td {
    padding: 0.6rem 0.5rem;
    border-top: 1px solid var(--card-border);
    color: var(--text-muted);
    vertical-align: middle;
}

.data-table tr:hover td {
    background: rgba(255,255,255,0.03);
}

.data-table .actions {
    display: flex;
    gap: 0.3rem;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
    animation: fadeInUp 0.2s ease-out;
}

.modal {
    background: linear-gradient(135deg, var(--dark), var(--darker));
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 2rem 1.5rem;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    animation: fadeInUp 0.3s ease-out;
}

.modal h3 {
    font-family: 'Fredoka', sans-serif;
    font-size: 1.3rem;
    margin-bottom: 1.5rem;
    color: var(--primary-light);
}

.modal-actions {
    display: flex;
    gap: 0.8rem;
    margin-top: 1.5rem;
    justify-content: flex-end;
}

/* Quiz form */
.quiz-form .answer-group {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 0.8rem;
    margin-bottom: 0.8rem;
}

.quiz-form .answer-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
}

.quiz-form .answer-group input[type="checkbox"] {
    accent-color: var(--success);
    width: 18px;
    height: 18px;
}

/* Share link */
.share-section {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 1rem;
    margin-top: 1rem;
}

.share-link-input,
.share-link-box {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.share-link-input input,
.share-link-box input {
    flex: 1;
    padding: 0.6rem;
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    color: var(--text);
    font-size: 0.8rem;
}

/* Share Modal extras */
.share-modal {
    text-align: center;
    max-width: 420px;
}

.share-modal h3 {
    margin-bottom: 0.5rem;
}

.share-icon {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.share-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.share-link-box {
    margin-bottom: 1rem;
}

.share-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.6rem;
    margin-bottom: 1rem;
}

.share-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    padding: 0.8rem 0.4rem;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 14px;
    color: var(--text);
    font-family: 'Nunito', sans-serif;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.share-option:hover {
    background: rgba(108, 92, 231, 0.15);
    border-color: var(--primary-light);
    transform: translateY(-2px);
}

.share-option:active {
    transform: translateY(0);
}

.share-opt-icon {
    font-size: 1.4rem;
}

.share-hint {
    background: rgba(255, 221, 0, 0.08);
    border: 1px solid rgba(255, 221, 0, 0.25);
    border-radius: 10px;
    padding: 0.6rem 0.8rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.4;
    margin-bottom: 1rem;
}

.share-hint strong {
    color: var(--warning);
}

@media (max-width: 380px) {
    .share-options {
        grid-template-columns: 1fr;
    }
}

/* Export buttons */
.export-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin: 1rem 0;
}

/* ---- SHARED RESULTS PAGE ---- */
.shared-container {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    padding: 1rem;
}

.shared-header {
    text-align: center;
    padding: 2rem 0;
}

.shared-header h1 {
    font-family: 'Fredoka', sans-serif;
    font-size: 1.6rem;
    background: linear-gradient(135deg, var(--primary-light), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.shared-header p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 0.3rem;
}

/* Footer navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(10, 10, 46, 0.95);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--card-border);
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    padding: 0.6rem 1rem;
    z-index: 100;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.65rem;
    font-weight: 600;
    transition: all 0.2s ease;
    padding: 0.3rem 1rem;
    border-radius: 10px;
}

.nav-item:hover, .nav-item.active {
    color: var(--primary-light);
    background: rgba(108, 92, 231, 0.1);
}

.nav-item .nav-icon {
    font-size: 1.3rem;
}

/* Toast notifications */
.toast {
    position: fixed;
    top: 1rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--dark);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 0.8rem 1.2rem;
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    animation: fadeInUp 0.3s ease-out;
    max-width: 90%;
}

.toast.success { border-color: var(--success); }
.toast.error { border-color: var(--danger); }
.toast.info { border-color: var(--primary); }

/* Filter bar */
.filter-bar {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.filter-bar select, .filter-bar input {
    padding: 0.5rem 0.8rem;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    color: var(--text);
    font-size: 0.8rem;
    font-family: 'Nunito', sans-serif;
}

.filter-bar select {
    min-width: 120px;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.empty-state .icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state p {
    font-size: 0.9rem;
}

/* Loading */
.loading-spinner {
    display: inline-block;
    width: 30px;
    height: 30px;
    border: 3px solid var(--card-border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Sound toggle */
.sound-toggle {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.3rem;
    transition: all 0.2s;
}

.sound-toggle:hover {
    color: var(--text);
}

/* Responsive */
@media (min-width: 768px) {
    .summary-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .result-stats {
        grid-template-columns: repeat(4, 1fr);
    }

    .touch-controls {
        display: none;
    }

    .data-table {
        font-size: 0.85rem;
    }
}

@media (max-width: 380px) {
    .login-card {
        padding: 1.5rem 1rem;
    }

    .login-card h1 {
        font-size: 1.4rem;
    }

    .touch-btn {
        width: 48px;
        height: 48px;
    }

    .admin-tabs {
        gap: 0.15rem;
    }

    .admin-tab {
        padding: 0.5rem 0.5rem;
        font-size: 0.7rem;
    }
}

/* Puzzle badge styles */
.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 8px;
    font-size: 0.7rem;
    font-weight: 700;
}

.badge-success { background: rgba(0, 184, 148, 0.2); color: var(--success); }
.badge-danger { background: rgba(255, 118, 117, 0.2); color: var(--danger); }
.badge-primary { background: rgba(108, 92, 231, 0.2); color: var(--primary-light); }
.badge-warning { background: rgba(255, 234, 167, 0.2); color: #fdcb6e; }

/* Instructions */
.instructions {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.instructions h3 {
    font-family: 'Fredoka', sans-serif;
    font-size: 1rem;
    color: var(--primary-light);
    margin-bottom: 0.5rem;
}

.instructions p, .instructions li {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.6;
}

.instructions ul {
    padding-left: 1.2rem;
}

/* Date badge */
.date-badge {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
}

/* ═══════════════════════════════════════════
   TUTORIAL TOOLTIP - First-time user overlay
   ═══════════════════════════════════════════ */

#tutorialOverlay {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.tutorial-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(6, 6, 26, 0.88);
    backdrop-filter: blur(8px);
}

.tutorial-card {
    position: relative;
    z-index: 1;
    background: linear-gradient(145deg, #13133a, #0d0d2e);
    border: 1.5px solid rgba(162, 155, 254, 0.35);
    border-radius: 24px;
    padding: 2rem 1.75rem 1.5rem;
    width: 100%;
    max-width: 360px;
    text-align: center;
    box-shadow: 0 0 60px rgba(108, 92, 231, 0.25), 0 20px 40px rgba(0,0,0,0.5);
    animation: tutSlideIn 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes tutSlideIn {
    from { opacity: 0; transform: scale(0.82) translateY(20px); }
    to   { opacity: 1; transform: scale(1)    translateY(0); }
}

/* Step dots */
.tutorial-steps {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-bottom: 1.5rem;
}

.tstep {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(162, 155, 254, 0.25);
    transition: all 0.35s ease;
}

.tstep.active {
    background: var(--primary-light);
    width: 22px;
    border-radius: 4px;
    box-shadow: 0 0 8px rgba(162, 155, 254, 0.6);
}

/* Tutorial page content */
.tutorial-page {
    animation: tutFadeIn 0.3s ease-out;
}

@keyframes tutFadeIn {
    from { opacity: 0; transform: translateX(12px); }
    to   { opacity: 1; transform: translateX(0); }
}

.tutorial-emoji {
    font-size: 3rem;
    margin-bottom: 0.6rem;
    display: block;
    animation: tutBounce 2s ease-in-out infinite;
}

@keyframes tutBounce {
    0%, 100% { transform: translateY(0); }
    50%       { transform: translateY(-6px); }
}

.tutorial-card h3 {
    font-family: 'Fredoka', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-light), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.tutorial-card p {
    font-size: 0.92rem;
    color: var(--text-muted);
    line-height: 1.55;
    margin-bottom: 1rem;
}

.tutorial-card p strong {
    color: var(--text);
    -webkit-text-fill-color: var(--text);
}

/* Maze preview - 4 mini rooms */
.tutorial-maze-preview {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin: 1rem auto 0;
    max-width: 260px;
}

.troom {
    background: rgba(108, 92, 231, 0.15);
    border: 1.5px solid rgba(162, 155, 254, 0.3);
    border-radius: 10px;
    padding: 0.5rem 0.4rem 0.4rem;
    font-family: 'Fredoka', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary-light);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    transition: all 0.3s ease;
}

.troom span {
    font-family: 'Nunito', sans-serif;
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-muted);
    -webkit-text-fill-color: var(--text-muted);
}

.troom.correct {
    background: rgba(0, 184, 148, 0.2);
    border-color: var(--success);
    color: var(--success);
    box-shadow: 0 0 14px rgba(0, 184, 148, 0.25);
    animation: tutPulse 1.8s ease-in-out infinite;
}

.troom.correct span {
    color: rgba(0, 184, 148, 0.8);
    -webkit-text-fill-color: rgba(0, 184, 148, 0.8);
}

@keyframes tutPulse {
    0%, 100% { box-shadow: 0 0 10px rgba(0, 184, 148, 0.2); }
    50%       { box-shadow: 0 0 22px rgba(0, 184, 148, 0.5); }
}

/* Controls grid */
.tutorial-controls {
    margin-top: 0.5rem;
}

/* Section label (Mobile / Desktop) */
.tctrl-section {
    margin-bottom: 0.9rem;
}

.tctrl-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--primary-light);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
}

/* ── Mobile touch diagram ── */
.tctrl-touch-diagram {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 14px;
    padding: 0.7rem 0.5rem 0.5rem;
}

.ttouch-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
    max-width: 220px;
    margin: 0 auto 0.5rem;
}

.ttouch-cell {
    height: 46px;
    border-radius: 9px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
}

.ttouch-active {
    background: rgba(108, 92, 231, 0.18);
    border: 1.5px solid rgba(162, 155, 254, 0.35);
    cursor: default;
    transition: background 0.2s;
}

.ttouch-pacman {
    background: rgba(255, 221, 0, 0.12);
    border: 1.5px solid rgba(255, 221, 0, 0.35);
    font-size: 1.3rem;
}

.ttouch-arrow {
    font-size: 1.1rem;
    color: var(--primary-light);
    line-height: 1;
}

.ttouch-dir {
    font-size: 0.55rem;
    color: var(--text-muted);
    font-family: 'Nunito', sans-serif;
    line-height: 1;
}

.ttouch-note {
    font-size: 0.75rem !important;
    color: var(--text-muted);
    text-align: center;
    margin: 0 !important;
    line-height: 1.5;
}

/* ── Desktop keyboard section ── */
.tctrl-desktop {
    padding-top: 0.7rem;
    border-top: 1px solid rgba(255,255,255,0.06);
}

.tctrl-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.tctrl-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
}

.tctrl-item span {
    font-size: 0.62rem;
    color: var(--text-muted);
}

.tctrl-sep {
    font-size: 0.7rem;
    color: var(--text-muted);
    padding: 0 2px;
}

kbd {
    display: inline-block;
    padding: 5px 9px;
    background: rgba(255,255,255,0.06);
    border: 1.5px solid rgba(255,255,255,0.15);
    border-bottom-width: 3px;
    border-radius: 8px;
    font-family: 'Fredoka', sans-serif;
    font-size: 0.82rem;
    color: var(--primary-light);
    white-space: nowrap;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}


/* Tips list */
.tutorial-tips {
    list-style: none;
    padding: 0;
    margin: 0.5rem 0 0;
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    text-align: left;
}

.tutorial-tips li {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 10px;
    padding: 0.55rem 0.75rem;
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.tutorial-tips li strong {
    color: var(--text);
}

/* Navigation buttons */
.tutorial-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.5rem;
    gap: 0.5rem;
}

.tbtn {
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 12px;
    font-family: 'Fredoka', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
}

.tbtn-skip {
    background: rgba(255,255,255,0.06);
    color: var(--text-muted);
    border: 1px solid rgba(255,255,255,0.1);
}

.tbtn-skip:hover {
    background: rgba(255,255,255,0.1);
    color: var(--text);
}

.tbtn-next {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    box-shadow: 0 4px 15px rgba(108, 92, 231, 0.45);
    flex: 1;
}

.tbtn-next:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 22px rgba(108, 92, 231, 0.6);
}

.tbtn-next:active {
    transform: translateY(0);
}

