:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-light: #a5b4fc;
    --accent-pink: #ec4899;
    --accent-green: #10b981;
    --accent-orange: #f59e0b;
    --danger: #ef4444;
    --success: #10b981;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-soft: #cbd5e1;
    --bg-color: #0f172a;
    --surface: rgba(30, 41, 59, 0.82);
    --surface-strong: rgba(15, 23, 42, 0.92);
    --surface-soft: rgba(51, 65, 85, 0.62);
    --border: rgba(255, 255, 255, 0.11);
    --border-strong: rgba(165, 180, 252, 0.36);
    --gradient-primary: linear-gradient(135deg, #6366f1 0%, #8b5cf6 52%, #ec4899 100%);
    --gradient-card: linear-gradient(135deg, rgba(255, 255, 255, 0.11), rgba(255, 255, 255, 0.045));
    --transition: all 0.24s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.18);
    --shadow-md: 0 12px 34px rgba(0, 0, 0, 0.25);
    --shadow-lg: 0 24px 70px rgba(0, 0, 0, 0.38);
    --shadow-glow: 0 0 42px rgba(99, 102, 241, 0.32);
}

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

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--text-main);
    background:
        radial-gradient(ellipse at 15% 10%, rgba(99, 102, 241, 0.18), transparent 42%),
        radial-gradient(ellipse at 82% 78%, rgba(236, 72, 153, 0.12), transparent 44%),
        linear-gradient(145deg, #0f172a 0%, #111827 50%, #1e1b4b 100%);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -3;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
    background-size: 44px 44px;
    mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.6), transparent 78%);
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.svg-sprite {
    position: absolute;
    visibility: hidden;
}

.line-icon {
    fill: none;
    stroke: currentColor;
    stroke-width: 2.4;
    stroke-linecap: round;
    stroke-linejoin: round;
}

svg.line-icon,
.decor-icon,
.decor-icon use,
.hero-icon svg,
.hero-icon use,
.mascot-runner svg,
.mascot-runner use,
.finish-flag,
.finish-flag use {
    fill: none;
    stroke: currentColor;
    stroke-width: 2.4;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.line-icon.thin,
.thin {
    stroke-width: 1.6;
}

.fill-soft {
    fill: currentColor;
    opacity: 0.08;
}

.bg-decor {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -2;
    overflow: hidden;
}

.bg-gradient {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(120deg, rgba(99, 102, 241, 0.14), transparent 34%),
        linear-gradient(300deg, rgba(16, 185, 129, 0.10), transparent 38%);
}

.decor-icon {
    position: absolute;
    color: rgba(248, 250, 252, 0.2);
    filter: drop-shadow(0 0 24px rgba(99, 102, 241, 0.2));
    animation: equipmentFloat 16s ease-in-out infinite;
}

.d-icon-1 { width: 138px; top: 10%; left: 6%; color: rgba(96, 165, 250, 0.22); animation-delay: -2s; }
.d-icon-2 { width: 160px; top: 13%; right: 9%; color: rgba(251, 191, 36, 0.22); animation-delay: -6s; }
.d-icon-3 { width: 132px; top: 52%; left: 3%; color: rgba(16, 185, 129, 0.18); animation-delay: -10s; }
.d-icon-4 { width: 120px; bottom: 12%; right: 7%; color: rgba(236, 72, 153, 0.2); animation-delay: -4s; }
.d-icon-5 { width: 150px; bottom: 8%; left: 22%; color: rgba(165, 180, 252, 0.18); animation-delay: -12s; }
.d-icon-6 { width: 112px; top: 42%; right: 21%; color: rgba(248, 250, 252, 0.16); animation-delay: -8s; }
.d-icon-7 { width: 104px; top: 36%; left: 21%; color: rgba(251, 191, 36, 0.13); animation-delay: -14s; }

@keyframes equipmentFloat {
    0%, 100% { transform: translate3d(0, 0, 0) rotate(-6deg); }
    25% { transform: translate3d(18px, -24px, 0) rotate(8deg); }
    50% { transform: translate3d(-12px, -42px, 0) rotate(-4deg); }
    75% { transform: translate3d(-24px, -12px, 0) rotate(7deg); }
}

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

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1); }
}

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

.animate-slide-up { animation: slideUp 0.5s ease-out both; }
.animate-scale-in { animation: scaleIn 0.42s ease-out both; }
.pulse-anim { animation: pulse 3s infinite ease-in-out; }

.screen { display: none; }
.screen.active { display: block; }

.app-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.top-nav {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    padding: 16px 5%;
    background: rgba(15, 23, 42, 0.72);
    backdrop-filter: blur(18px);
    border-bottom: 1px solid var(--border);
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--primary-light);
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.logo svg {
    flex: 0 0 auto;
}

.sync-pill {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 5px 10px;
    color: var(--text-muted);
    background: rgba(51, 65, 85, 0.58);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 800;
    white-space: nowrap;
}

.sync-pill.online {
    color: #bbf7d0;
    border-color: rgba(16, 185, 129, 0.34);
}

.sync-pill.offline {
    color: #fed7aa;
    border-color: rgba(245, 158, 11, 0.34);
}

.container {
    width: 100%;
    max-width: 1120px;
    margin: 44px auto;
    padding: 0 20px;
    flex: 1;
}

.modern-card {
    background: var(--gradient-card), var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(20px);
    transition: var(--transition);
}

.modern-card,
.local-spots-container,
.filters {
    color: var(--text-main);
}

.hover-glow:hover {
    transform: translateY(-3px);
    border-color: var(--border-strong);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
}

button {
    cursor: pointer;
    border: 0;
    border-radius: 12px;
    font-family: inherit;
    font-weight: 700;
    transition: var(--transition);
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    padding: 13px 24px;
    color: #fff;
    background: var(--gradient-primary);
    box-shadow: var(--shadow-glow);
    text-decoration: none;
}

.btn-primary:hover {
    transform: translateY(-2px);
    filter: brightness(1.06);
}

.btn-large {
    width: 100%;
    min-height: 56px;
    margin-top: 6px;
    font-size: 1.04rem;
}

.btn-secondary {
    min-height: 48px;
    padding: 13px 24px;
    color: var(--text-main);
    background: rgba(51, 65, 85, 0.78);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    border-color: var(--border-strong);
    background: rgba(71, 85, 105, 0.82);
    transform: translateY(-2px);
}

.btn-danger {
    min-height: 40px;
    padding: 10px 14px;
    color: #fecaca;
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.35);
}

.btn-danger:hover {
    color: #fff;
    background: rgba(239, 68, 68, 0.75);
}

.btn-text {
    padding: 9px 14px;
    color: var(--text-muted);
    background: transparent;
}

.btn-text.outline-hover:hover {
    color: var(--text-main);
    background: rgba(99, 102, 241, 0.14);
}

.input-group {
    margin-bottom: 20px;
    text-align: left;
}

label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-soft);
    font-size: 0.94rem;
    font-weight: 700;
}

input,
select {
    width: 100%;
    min-height: 50px;
    padding: 13px 15px;
    border: 2px solid var(--border);
    border-radius: 12px;
    color: var(--text-main);
    background: rgba(15, 23, 42, 0.5);
    font: inherit;
    outline: none;
    transition: var(--transition);
}

select {
    appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%), linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
    background-position: calc(100% - 20px) 21px, calc(100% - 14px) 21px;
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
}

input::placeholder {
    color: rgba(148, 163, 184, 0.72);
}

input:focus,
select:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2);
    background-color: rgba(15, 23, 42, 0.75);
}

option {
    color: #0f172a;
}

.auth-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
    gap: 56px;
    align-items: center;
    min-height: calc(100vh - 190px);
}

.auth-info {
    max-width: 610px;
}

.hero-icon {
    width: 92px;
    height: 92px;
    display: grid;
    place-items: center;
    margin-bottom: 26px;
    color: #fff;
    background: var(--gradient-primary);
    border-radius: 22px;
    box-shadow: var(--shadow-glow);
}

.auth-info h1 {
    margin-bottom: 18px;
    font-size: clamp(2.15rem, 4vw, 4.25rem);
    font-weight: 800;
    line-height: 1.02;
    letter-spacing: 0;
}

.auth-info p {
    max-width: 560px;
    color: var(--text-soft);
    font-size: 1.12rem;
    line-height: 1.7;
}

#auth-form {
    padding: 30px;
}

.quiz-card {
    max-width: 820px;
    margin: 0 auto;
    padding: 32px;
}

.quiz-header {
    margin-bottom: 30px;
}

.step-info {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

#q-current {
    color: var(--primary-light);
    font-size: 1.2rem;
}

.mascot-track-container {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 28px;
    align-items: center;
    gap: 16px;
    width: 100%;
    height: 36px;
    margin-top: 12px;
}

.progress-container {
    position: relative;
    height: 8px;
    overflow: visible;
    background: rgba(51, 65, 85, 0.8);
    border-radius: 999px;
}

#progress-bar {
    width: 0%;
    height: 100%;
    background: var(--gradient-primary);
    border-radius: 999px;
    transition: width 0.48s cubic-bezier(0.4, 0, 0.2, 1);
}

.mascot-runner {
    position: absolute;
    top: 50%;
    left: 0;
    z-index: 2;
    display: flex;
    padding: 6px;
    color: #fff;
    background: var(--gradient-primary);
    border-radius: 50%;
    box-shadow: var(--shadow-sm);
    transform: translate(-50%, -50%);
    transition: left 0.48s cubic-bezier(0.4, 0, 0.2, 1);
}

.finish-flag {
    display: block;
    width: 28px;
    height: 28px;
    color: var(--text-main);
}

.question-text {
    margin-bottom: 28px;
    color: var(--text-main);
    font-size: clamp(1.25rem, 2.2vw, 1.65rem);
    font-weight: 800;
    line-height: 1.42;
}

.options-stack {
    display: grid;
    gap: 13px;
}

.opt-card {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 62px;
    padding: 18px 20px;
    overflow: hidden;
    color: var(--text-main);
    background: rgba(51, 65, 85, 0.55);
    border: 2px solid transparent;
    border-radius: 14px;
    cursor: pointer;
    font-size: 1.02rem;
    font-weight: 600;
    transition: var(--transition);
}

.opt-card::before {
    content: '';
    position: absolute;
    inset: 0;
    width: 0%;
    background: var(--gradient-primary);
    opacity: 0.12;
    transition: width 0.25s ease;
}

.opt-card:hover,
.opt-card:focus {
    border-color: var(--primary-light);
    background: rgba(51, 65, 85, 0.84);
    transform: translateX(5px);
    outline: none;
}

.opt-card:hover::before,
.opt-card:focus::before {
    width: 100%;
}

.opt-card.selected {
    border-color: var(--primary-light);
    background: rgba(99, 102, 241, 0.16);
    box-shadow: 0 0 28px rgba(99, 102, 241, 0.18);
}

.opt-card.selected::before {
    width: 100%;
}

.quiz-next {
    margin-top: 22px;
}

.result-card {
    max-width: 900px;
    margin: 0 auto;
    padding: 38px;
    text-align: center;
}

.result-header {
    margin-bottom: 18px;
}

.result-badge-top {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    padding: 7px 14px;
    color: var(--primary-light);
    background: rgba(99, 102, 241, 0.16);
    border: 1px solid rgba(165, 180, 252, 0.26);
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

#result-title {
    font-size: clamp(2rem, 4vw, 3.1rem);
    font-weight: 800;
    line-height: 1.1;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.result-description {
    max-width: 680px;
    margin: 0 auto 26px;
    color: var(--text-soft);
    font-size: 1.08rem;
    line-height: 1.72;
}

.chart-container {
    position: relative;
    width: 100%;
    max-width: 480px;
    height: 360px;
    margin: 0 auto 20px;
}

.score-breakdown {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    max-width: 660px;
    margin: 0 auto 28px;
    text-align: left;
}

.score-row {
    padding: 14px;
    background: rgba(51, 65, 85, 0.52);
    border: 1px solid var(--border);
    border-radius: 14px;
}

.score-row-head {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 9px;
    color: var(--text-main);
    font-size: 0.92rem;
    font-weight: 800;
}

.score-track {
    height: 8px;
    overflow: hidden;
    background: rgba(15, 23, 42, 0.78);
    border-radius: 999px;
}

.score-fill {
    height: 100%;
    width: var(--w, 0%);
    border-radius: inherit;
    background: var(--c, var(--gradient-primary));
}

.divider {
    width: 100%;
    height: 1px;
    margin: 28px 0;
    background: var(--border);
}

.result-card h3 {
    margin-bottom: 16px;
    font-size: 1.18rem;
    font-weight: 800;
}

.sports-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    margin-bottom: 28px;
}

.sport-tag {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 48px;
    padding: 10px 16px;
    color: var(--text-main);
    background: rgba(51, 65, 85, 0.58);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 0.98rem;
    font-weight: 800;
    transition: var(--transition);
}

.sport-tag:hover {
    transform: translateY(-2px);
    border-color: var(--border-strong);
    background: rgba(51, 65, 85, 0.82);
}

.sport-icon-svg {
    width: 22px;
    height: 22px;
    color: var(--primary-light);
}

.local-spots-container {
    margin-top: 18px;
    padding: 24px;
    text-align: left;
    background: rgba(15, 23, 42, 0.42);
    border: 1px solid var(--border);
    border-radius: 16px;
}

.spots-list {
    display: grid;
    gap: 10px;
    list-style: none;
}

.spots-list li {
    padding: 14px 16px;
    color: var(--text-soft);
    background: rgba(51, 65, 85, 0.52);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 12px;
    font-weight: 600;
}

.btn-outline-map {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    margin-top: 16px;
    padding: 11px 18px;
    color: var(--primary-light);
    border: 1px solid var(--border-strong);
    border-radius: 12px;
    text-decoration: none;
    font-weight: 800;
    transition: var(--transition);
}

.btn-outline-map:hover {
    color: #fff;
    background: rgba(99, 102, 241, 0.2);
    transform: translateY(-2px);
}

.action-buttons {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 14px;
    margin-top: 28px;
}

.admin-layout {
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
    gap: 26px;
    align-items: start;
}

.admin-sidebar {
    position: sticky;
    top: 92px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 22px;
}

.admin-sidebar h3 {
    font-size: 1.1rem;
}

.admin-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.admin-tab {
    width: 100%;
    padding: 12px 14px;
    color: var(--text-muted);
    background: transparent;
    border-radius: 10px;
    text-align: left;
}

.admin-tab:hover {
    color: var(--text-main);
    background: rgba(51, 65, 85, 0.52);
}

.admin-tab.active {
    color: #fff;
    background: rgba(99, 102, 241, 0.22);
}

.admin-pane {
    display: none;
}

.admin-pane.active {
    display: block;
    animation: scaleIn 0.26s ease both;
}

.admin-header-flex {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 22px;
    flex-wrap: wrap;
}

.admin-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 18px;
}

.dashboard-grid > .stat-card:not(.top-profile-card):not(.pie-card) {
    grid-column: span 2;
}

.stat-card {
    min-width: 0;
    min-height: 150px;
    padding: 22px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
}

.stat-card h4 {
    margin-bottom: 10px;
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.stat-value {
    font-size: clamp(2rem, 4vw, 2.7rem);
    font-weight: 800;
    line-height: 1.05;
    overflow-wrap: anywhere;
}

.top-profile-card {
    grid-column: span 3;
}

.top-profile-card .stat-value {
    font-size: clamp(1.05rem, 1.5vw, 1.35rem);
    line-height: 1.15;
    overflow-wrap: normal;
    word-break: normal;
}

.text-primary {
    color: var(--primary-light);
}

.pie-card {
    grid-column: span 3;
    min-height: 240px;
    height: 240px;
    padding: 16px;
    align-items: center;
}

.pie-card canvas {
    max-width: 100%;
    max-height: 208px;
}

.filters {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 14px;
    padding: 18px;
}

.table-wrapper {
    width: 100%;
    overflow-x: auto;
    border-radius: 16px;
}

table {
    width: 100%;
    min-width: 700px;
    border-collapse: collapse;
}

th,
td {
    padding: 15px 18px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    color: var(--text-muted);
    background: rgba(15, 23, 42, 0.46);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    white-space: nowrap;
}

td {
    color: var(--text-soft);
    font-weight: 600;
}

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

tbody tr:hover {
    background: rgba(51, 65, 85, 0.32);
}

.result-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 12px;
    color: var(--primary-light);
    background: rgba(99, 102, 241, 0.16);
    border: 1px solid rgba(165, 180, 252, 0.22);
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 800;
}

.flex-form {
    display: flex;
    gap: 14px;
    align-items: flex-end;
    padding: 18px;
}

.flex-form input {
    flex: 1;
}

.admin-list {
    list-style: none;
}

.admin-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 15px 18px;
    color: var(--text-soft);
    border-bottom: 1px solid var(--border);
}

.admin-list li:last-child {
    border-bottom: 0;
}

.text-muted {
    color: var(--text-muted);
}

#toast-container {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    max-width: min(420px, calc(100vw - 32px));
    padding: 14px 18px;
    color: var(--text-main);
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid var(--border-strong);
    border-left: 4px solid var(--primary);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    font-weight: 700;
    animation: slideUp 0.25s ease both;
}

.toast.error {
    border-left-color: var(--danger);
}

.share-card-template {
    width: 900px;
    min-height: 520px;
    padding: 54px;
    color: #fff;
    background:
        radial-gradient(circle at 20% 20%, rgba(165, 180, 252, 0.2), transparent 28%),
        var(--gradient-primary);
    border-radius: 28px;
    box-shadow: var(--shadow-lg);
}

.share-header {
    display: flex;
    align-items: center;
    gap: 14px;
    font-weight: 800;
    letter-spacing: 0.08em;
}

.share-card-template h2 {
    margin-top: 70px;
    font-size: 2rem;
}

.share-card-template p {
    margin-top: 22px;
    font-size: 1.4rem;
    opacity: 0.9;
}

.share-highlight {
    margin-top: 10px;
    font-size: 4rem;
    line-height: 1;
}

.share-footer {
    margin-top: 70px;
    font-weight: 700;
    opacity: 0.86;
}

.mt-10 { margin-top: 10px; }
.mt-20 { margin-top: 20px; }
.mb-20 { margin-bottom: 20px; }
.mt-auto { margin-top: auto; }

@media (max-width: 1024px) {
    .auth-layout {
        gap: 34px;
    }

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

    .admin-sidebar {
        position: static;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        flex-wrap: wrap;
    }

    .admin-nav {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .admin-tab {
        width: auto;
        text-align: center;
    }
}

@media (max-width: 820px) {
    .container {
        margin: 24px auto;
        padding: 0 16px;
    }

    .auth-layout {
        min-height: auto;
        grid-template-columns: 1fr;
    }

    .auth-info {
        text-align: center;
        margin: 0 auto;
    }

    .hero-icon {
        margin-inline: auto;
    }

    .auth-info p {
        margin-inline: auto;
    }

    .quiz-card,
    .result-card {
        padding: 24px;
    }

    .dashboard-grid {
        grid-template-columns: 1fr 1fr;
    }

    .dashboard-grid > .stat-card:not(.top-profile-card):not(.pie-card),
    .top-profile-card {
        grid-column: auto;
    }

    .pie-card {
        grid-column: 1 / -1;
    }

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

    .score-breakdown {
        grid-template-columns: 1fr;
    }

    .chart-container {
        height: 320px;
    }

    .admin-layout {
        width: 100%;
        max-width: 100%;
        gap: 14px;
    }

    .admin-sidebar {
        position: static;
        width: 100%;
        padding: 14px;
        display: grid;
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .admin-nav {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .admin-tab {
        width: 100%;
        padding: 11px 10px;
        text-align: center;
        font-size: 0.9rem;
    }

    #close-admin {
        display: flex;
        justify-content: center;
        width: 100%;
        margin-top: 2px;
        padding: 13px 16px;
        color: #fff;
        background: rgba(15, 23, 42, 0.96);
        border: 1px solid var(--border-strong);
        border-radius: 14px;
    }

    .admin-content,
    .admin-pane,
    .table-wrapper {
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }

    .admin-header-flex {
        align-items: stretch;
        gap: 12px;
    }

    .admin-header-flex h2 {
        width: 100%;
        font-size: 1.45rem;
        line-height: 1.2;
    }

    .admin-actions {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr;
    }

    .admin-actions button {
        width: 100%;
        min-height: 52px;
    }

    .pie-card {
        height: 260px;
        min-height: 260px;
        padding: 12px;
    }

    .pie-card canvas {
        max-height: 230px;
    }

    .table-wrapper {
        overflow: visible;
        background: transparent;
        border: 0;
        box-shadow: none;
    }

    table,
    thead,
    tbody,
    tr,
    th,
    td {
        display: block;
        width: 100%;
        min-width: 0;
    }

    thead {
        display: none;
    }

    tr {
        margin-bottom: 12px;
        overflow: hidden;
        background: var(--gradient-card), var(--surface);
        border: 1px solid var(--border);
        border-radius: 16px;
        box-shadow: var(--shadow-sm);
    }

    td {
        display: grid;
        grid-template-columns: minmax(104px, 0.36fr) minmax(0, 1fr);
        gap: 12px;
        align-items: center;
        padding: 13px 14px;
        border-bottom: 1px solid var(--border);
        overflow-wrap: anywhere;
    }

    td:last-child {
        border-bottom: 0;
    }

    td::before {
        content: attr(data-label);
        color: var(--text-muted);
        font-size: 0.72rem;
        font-weight: 800;
        letter-spacing: 0.05em;
        text-transform: uppercase;
    }

    td .result-badge {
        width: fit-content;
        max-width: 100%;
        white-space: normal;
    }

    td .btn-danger {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 560px) {
    html,
    body {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    .top-nav {
        gap: 10px;
        padding: 12px 14px;
    }

    #admin-toggle {
        max-width: 148px;
        overflow: hidden;
        padding: 8px 10px;
        font-size: 0.82rem;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .logo span {
        display: none;
    }

    .sync-pill {
        display: none;
    }

    .container {
        max-width: 100%;
        margin: 18px auto 24px;
        padding: 0 12px;
        overflow-x: hidden;
    }

    .admin-screen {
        padding-bottom: 84px;
    }

    .admin-layout {
        width: 100%;
        max-width: 100%;
        gap: 14px;
    }

    .admin-sidebar {
        width: 100%;
        padding: 14px;
        display: grid;
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .admin-sidebar h3 {
        font-size: 1rem;
    }

    .admin-nav {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .admin-tab {
        width: 100%;
        padding: 11px 10px;
        text-align: center;
        font-size: 0.9rem;
    }

    #close-admin {
        position: static;
        display: flex;
        justify-content: center;
        width: 100%;
        margin-top: 2px;
        padding: 13px 16px;
        color: #fff;
        background: rgba(15, 23, 42, 0.96);
        border: 1px solid var(--border-strong);
        border-radius: 14px;
        box-shadow: none;
    }

    .admin-content,
    .admin-pane,
    .table-wrapper {
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }

    .auth-layout {
        gap: 22px;
        justify-items: center;
    }

    .auth-info {
        max-width: 100%;
    }

    .auth-info h1 {
        max-width: 330px;
        margin-inline: auto;
        font-size: clamp(1.42rem, 6.2vw, 1.52rem);
        line-height: 1.16;
        overflow-wrap: anywhere;
    }

    .auth-info p {
        max-width: 336px;
        font-size: 0.96rem;
        line-height: 1.62;
    }

    #auth-form,
    .quiz-card,
    .result-card {
        width: 100%;
        max-width: 100%;
        padding: 20px;
        border-radius: 16px;
    }

    .question-text {
        font-size: 1.22rem;
    }

    .opt-card {
        min-height: 58px;
        padding: 15px;
        font-size: 0.96rem;
    }

    .chart-container {
        height: 280px;
    }

    .action-buttons {
        flex-direction: column;
    }

    .action-buttons button,
    .action-buttons .btn-primary {
        width: 100%;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .dashboard-grid > .stat-card:not(.top-profile-card):not(.pie-card),
    .top-profile-card,
    .pie-card {
        grid-column: auto;
    }

    .stat-card {
        min-height: auto;
        padding: 16px;
    }

    .stat-value {
        font-size: 2rem;
    }

    .top-profile-card .stat-value {
        font-size: 1.15rem;
    }

    .pie-card {
        height: 260px;
        min-height: 260px;
        padding: 12px;
    }

    .pie-card canvas {
        max-height: 230px;
    }

    .admin-header-flex {
        align-items: stretch;
        gap: 12px;
    }

    .admin-header-flex h2 {
        width: 100%;
        font-size: 1.45rem;
        line-height: 1.2;
    }

    .admin-actions {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr;
    }

    .admin-actions button {
        width: 100%;
        min-height: 52px;
    }

    .filters {
        grid-template-columns: 1fr;
        gap: 10px;
        padding: 14px;
    }

    .filters select,
    .filters input {
        width: 100%;
        min-width: 0;
    }

    .table-wrapper {
        overflow: visible;
        background: transparent;
        border: 0;
        box-shadow: none;
    }

    table,
    thead,
    tbody,
    tr,
    th,
    td {
        display: block;
        width: 100%;
        min-width: 0;
    }

    thead {
        display: none;
    }

    tr {
        margin-bottom: 12px;
        overflow: hidden;
        background: var(--gradient-card), var(--surface);
        border: 1px solid var(--border);
        border-radius: 16px;
        box-shadow: var(--shadow-sm);
    }

    td {
        display: grid;
        grid-template-columns: minmax(96px, 0.42fr) minmax(0, 1fr);
        gap: 12px;
        align-items: center;
        padding: 13px 14px;
        border-bottom: 1px solid var(--border);
        overflow-wrap: anywhere;
    }

    td:last-child {
        border-bottom: 0;
    }

    td::before {
        content: attr(data-label);
        color: var(--text-muted);
        font-size: 0.72rem;
        font-weight: 800;
        letter-spacing: 0.05em;
        text-transform: uppercase;
    }

    td .result-badge {
        width: fit-content;
        max-width: 100%;
        white-space: normal;
    }

    td .btn-danger {
        width: 100%;
        justify-content: center;
    }

    .admin-list li {
        align-items: stretch;
        flex-direction: column;
    }

    .admin-list li button {
        width: 100%;
    }

    .flex-form {
        flex-direction: column;
        align-items: stretch;
    }

    #toast-container {
        right: 16px;
        left: 16px;
        bottom: 16px;
    }

    .decor-icon {
        opacity: 0.55;
    }
}

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