
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Manrope:wght@400;500;600;700;800&display=swap');

:root {
    --bg-0: #f7f4ee;
    --bg-1: #eef2f5;
    --bg-2: #dde5eb;
    --panel: rgba(255, 255, 255, 0.9);
    --panel-strong: rgba(248, 250, 252, 0.98);
    --line: rgba(53, 73, 94, 0.12);
    --line-strong: rgba(53, 73, 94, 0.22);
    --text-1: #162333;
    --text-2: #4c6177;
    --text-3: #76889c;
    --accent: #325c85;
    --accent-strong: #244764;
    --accent-soft: rgba(50, 92, 133, 0.12);
    --accent-alt: #8b6b46;
    --danger: #b84f4f;
    --danger-soft: rgba(184, 79, 79, 0.14);
    --success: #3f8761;
    --shadow-sm: 0 2px 8px rgba(46, 67, 88, 0.05);
    --shadow-lg: 0 8px 18px rgba(33, 53, 72, 0.08);
    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --nav-h: 72px;
    --surface-0: rgba(255, 255, 255, 0.88);
    --surface-1: rgba(248, 250, 252, 0.94);
    --surface-2: rgba(249, 251, 253, 0.92);
    --surface-3: rgba(250, 252, 253, 0.92);
    --surface-field: rgba(255, 255, 255, 0.92);
    --surface-row: rgba(255, 255, 255, 0.72);
    --surface-overlay: rgba(26, 39, 53, 0.32);
    --surface-overlay-strong: rgba(26, 39, 53, 0.42);
    --hero-glow-a: rgba(50, 92, 133, 0.12);
    --hero-glow-b: rgba(139, 107, 70, 0.1);
    color-scheme: light;
}

:root[data-theme="dark"] {
    --bg-0: #08111c;
    --bg-1: #0e1a29;
    --bg-2: #162638;
    --panel: rgba(14, 24, 36, 0.9);
    --panel-strong: rgba(18, 31, 46, 0.97);
    --line: rgba(151, 183, 210, 0.16);
    --line-strong: rgba(151, 183, 210, 0.28);
    --text-1: #edf4fb;
    --text-2: #bdd0e2;
    --text-3: #90a6ba;
    --accent: #86b9eb;
    --accent-strong: #5e94c7;
    --accent-soft: rgba(134, 185, 235, 0.16);
    --accent-alt: #e4b36b;
    --danger: #e07b7b;
    --danger-soft: rgba(224, 123, 123, 0.16);
    --success: #72c695;
    --shadow-sm: 0 3px 10px rgba(0, 0, 0, 0.16);
    --shadow-lg: 0 10px 24px rgba(0, 0, 0, 0.22);
    --surface-0: rgba(18, 31, 46, 0.84);
    --surface-1: rgba(20, 34, 50, 0.92);
    --surface-2: rgba(10, 19, 31, 0.92);
    --surface-3: rgba(23, 37, 55, 0.92);
    --surface-field: rgba(14, 24, 36, 0.94);
    --surface-row: rgba(20, 34, 50, 0.74);
    --surface-overlay: rgba(2, 8, 14, 0.62);
    --surface-overlay-strong: rgba(2, 8, 14, 0.78);
    --hero-glow-a: rgba(134, 185, 235, 0.12);
    --hero-glow-b: rgba(228, 179, 107, 0.1);
    color-scheme: dark;
}

:root[data-theme="dark"] .stats-card {
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

:root[data-theme="dark"] .stats-hour-bar.is-login,
:root[data-theme="dark"] .stats-legend-login { color: #86b9eb; }
:root[data-theme="dark"] .stats-hour-bar.is-login { background: #86b9eb; }
:root[data-theme="dark"] .stats-hour-bar.is-view,
:root[data-theme="dark"] .stats-legend-view { color: #e4b36b; }
:root[data-theme="dark"] .stats-hour-bar.is-view { background: #e4b36b; }
:root[data-theme="dark"] .stats-hour-bar.is-submit,
:root[data-theme="dark"] .stats-legend-submit { color: #72c695; }
:root[data-theme="dark"] .stats-hour-bar.is-submit { background: #72c695; }

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

body {
    min-height: 100vh;
    background: var(--bg-1);
    color: var(--text-1);
    font-family: Manrope, "Segoe UI", sans-serif;
    line-height: 1.55;
    padding-top: var(--nav-h);
    transition: background 0.25s ease, color 0.25s ease;
}

h1, h2, h3, h4, h5, h6 {
    margin-top: 0;
    font-family: "Space Grotesk", "Segoe UI", sans-serif;
    line-height: 1.25;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
input, select, textarea, button { font: inherit; color: inherit; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: rgba(53, 73, 94, 0.08); }
::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 999px; }

.container { width: min(1200px, calc(100% - 2rem)); margin-inline: auto; }
.page-shell { min-height: calc(100vh - var(--nav-h)); padding: 1.25rem 0 2rem; }

.panel, .auth-card, .simple-card, .admin-card, .qc-card, .question-card, .container-404, .container-error {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(10px);
}

.btn, .button {
    border: 1px solid transparent;
    border-radius: 999px;
    padding: 0.7rem 1.2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    white-space: nowrap;
}

.btn-primary, .button, .button.primary {
    background: var(--accent);
    color: #f8fbff;
    box-shadow: 0 1px 4px rgba(50, 92, 133, 0.08);
}

.btn-primary:hover, .button:hover, .button.primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(50, 92, 133, 0.10);
}

.btn-ghost, .button.secondary {
    background: var(--surface-field);
    border-color: var(--line);
    color: var(--text-2);
}

.btn-ghost:hover, .button.secondary:hover { border-color: var(--line-strong); color: var(--text-1); }
.btn-danger, .button.danger { background: var(--danger-soft); color: var(--danger); border-color: rgba(184, 79, 79, 0.24); }
.btn-sm, .button.small { padding: 0.5rem 0.9rem; font-size: 0.86rem; }
.btn-block, .button.full-width { width: 100%; }
.btn:disabled, .button:disabled, .btn.is-disabled, .button.is-disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
    box-shadow: none;
    transform: none;
}

.icon-btn {
    width: 40px; height: 40px; border-radius: 999px; border: 1px solid var(--line);
    background: var(--surface-field); color: var(--text-2); display: inline-flex;
    align-items: center; justify-content: center; cursor: pointer;
}
.icon-btn:hover { border-color: var(--line-strong); color: var(--text-1); }
.icon-btn.has-alert { color: var(--accent-alt); border-color: rgba(139, 107, 70, 0.24); background: rgba(139, 107, 70, 0.06); }
.theme-toggle.is-active { background: var(--accent-soft); color: var(--accent); border-color: rgba(50, 92, 133, 0.24); }

@keyframes pulseBell {
    0%, 100% { box-shadow: 0 0 0 0 rgba(139, 107, 70, 0.24); }
    50% { box-shadow: 0 0 0 8px rgba(139, 107, 70, 0); }
}

.field, .form-group, .setting-item { display: flex; flex-direction: column; gap: 0.4rem; }
label { font-size: 0.86rem; font-weight: 600; color: var(--text-2); }

.input, input, select, textarea, .input-text, .input-select {
    width: 100%; border-radius: var(--radius-sm); border: 1px solid var(--line);
    background: var(--surface-field); color: var(--text-1); padding: 0.7rem 0.85rem;
    outline: none;
}

.input:focus, input:focus, select:focus, textarea:focus, .input-text:focus, .input-select:focus {
    border-color: var(--accent); box-shadow: 0 0 0 2px rgba(50, 92, 133, 0.08);
}

input::placeholder, textarea::placeholder { color: var(--text-3); }
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); }

.badge {
    display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.2rem 0.55rem;
    border-radius: 999px; font-size: 0.74rem; font-weight: 700; text-transform: uppercase;
    background: var(--accent-soft); color: var(--accent); border: 1px solid rgba(50, 92, 133, 0.22);
}

.table-wrap, .table-responsive, .qc-table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 14px; }
.table, .users-table, .qc-table { width: 100%; border-collapse: collapse; min-width: 760px; }
.table th, .table td, .users-table th, .users-table td, .qc-table th, .qc-table td {
    border-bottom: 1px solid rgba(158, 196, 213, 0.17); padding: 0.8rem 0.85rem; text-align: left; vertical-align: top;
}
.table th, .users-table th, .qc-table th {
    font-size: 0.73rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-3);
    background: var(--surface-1); position: sticky; top: 0; z-index: 2;
}

.site-nav {
    position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
    border-bottom: 1px solid var(--line);
    background: var(--surface-2);
    backdrop-filter: blur(14px);
}

.nav-wrap { height: var(--nav-h); display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.nav-brand { display: inline-flex; align-items: center; gap: 0.7rem; min-width: 0; }
.nav-brand img { width: 38px; height: 38px; }
.nav-brand span { font-family: "Space Grotesk", sans-serif; font-weight: 700; font-size: 1.08rem; }

.nav-links { display: none; align-items: center; gap: 0.25rem; }
.nav-links a {
    padding: 0.45rem 0.7rem; border-radius: 999px; color: var(--text-2);
    font-size: 0.9rem; font-weight: 600;
}
.nav-links a:hover, .nav-links a.active { background: var(--accent-soft); color: var(--accent); }

.nav-actions { display: flex; align-items: center; gap: 0.45rem; }
.nav-toggle {
    width: 40px; height: 40px; border-radius: 999px; border: 1px solid var(--line);
    background: var(--surface-field); color: var(--text-1); display: inline-flex;
    align-items: center; justify-content: center; cursor: pointer;
}

.mobile-menu { border-top: 1px solid var(--line); background: var(--surface-2); }
.mobile-menu-inner { padding: 0.65rem 0 0.95rem; display: grid; gap: 0.25rem; }
.mobile-menu-inner a { padding: 0.6rem 0.25rem; border-radius: 10px; color: var(--text-2); font-weight: 600; }
.mobile-menu-inner a.active, .mobile-menu-inner a:hover { background: var(--accent-soft); color: var(--accent); }
.mobile-menu-inner a.danger-link { color: var(--danger); }
.mobile-theme-toggle {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface-field);
    color: var(--text-2);
    padding: 0.65rem 0.7rem;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    font-weight: 700;
    cursor: pointer;
}
.mobile-theme-toggle__icon {
    width: 28px;
    height: 28px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(118, 136, 156, 0.08);
}
.mobile-theme-toggle:hover,
.mobile-theme-toggle.is-active {
    border-color: var(--line-strong);
    color: var(--accent);
    background: var(--accent-soft);
}

.report-overlay {
    position: fixed;
    inset: 0;
    z-index: 1100;
    align-items: flex-start;
    justify-content: flex-end;
    padding: calc(var(--nav-h) + 0.75rem) clamp(0.6rem, 2vw, 1rem) 0.75rem;
    background: transparent;
}
.report-overlay[hidden] { display: none !important; }
.report-overlay:not([hidden]) { display: flex; }
.report-dropdown {
    width: min(420px, 100%);
    max-height: calc(100vh - var(--nav-h) - 1.5rem);
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: var(--panel);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    backdrop-filter: blur(14px);
}
.report-dropdown-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.85rem 0.95rem;
    border-bottom: 1px solid var(--line);
}
.report-dropdown-head h4 { margin: 0; font-size: 1rem; }
.report-dropdown-head p { margin: 0.2rem 0 0; color: var(--text-2); font-size: 0.82rem; }
.report-dropdown-footer {
    padding: 0.8rem 0.95rem 0.95rem;
    border-top: 1px solid var(--line);
    background: rgba(118, 136, 156, 0.04);
}
.report-list {
    list-style: none;
    margin: 0;
    padding: 0.85rem;
    max-height: 100%;
    overflow: auto;
    display: grid;
    gap: 0.7rem;
}
.report-item, .report-empty {
    padding: 0.8rem;
    border: 1px solid rgba(158, 196, 213, 0.15);
    border-radius: 14px;
    background: var(--surface-0);
}
.report-empty {
    color: var(--text-2);
    text-align: center;
}
.report-item-head {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    align-items: flex-start;
    margin-bottom: 0.35rem;
    font-size: 0.85rem;
}
.report-user { margin: 0; color: var(--accent); font-size: 0.8rem; font-weight: 700; }
.report-text { margin: 0.35rem 0 0; color: var(--text-2); font-size: 0.82rem; line-height: 1.55; }
.report-delete {
    border: 1px solid transparent;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: var(--danger-soft);
    color: var(--danger);
    cursor: pointer;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}
.report-delete:hover { border-color: rgba(184, 79, 79, 0.24); }

.site-footer { margin-top: 2rem; border-top: 1px solid var(--line); background: var(--surface-2); }
.site-footer-inner {
    min-height: 70px; display: flex; align-items: center; justify-content: space-between;
    gap: 1rem; font-size: 0.84rem; color: var(--text-3);
}
.site-footer-links { display: inline-flex; align-items: center; gap: 1rem; }
.home-hero { display: grid; gap: 1.25rem; }
.home-hero-top {
    padding: 1.4rem; border-radius: var(--radius-lg); border: 1px solid var(--line);
    background: var(--surface-0);
}
.home-hero-top h1 { margin-bottom: 0.55rem; font-size: clamp(1.9rem, 4.5vw, 3rem); }
.home-hero-top p { margin: 0; max-width: 720px; color: var(--text-2); }
.home-grid { display: grid; gap: 0.9rem; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.quick-card {
    padding: 1rem; border: 1px solid var(--line); border-radius: var(--radius-md);
    background: var(--surface-0); display: flex; flex-direction: column; gap: 0.55rem;
}
.quick-card i {
    width: 42px; height: 42px; border-radius: 12px; display: inline-flex; align-items: center;
    justify-content: center; background: var(--accent-soft); color: var(--accent);
}
.quick-card h3 { margin: 0; font-size: 1.04rem; }
.quick-card p { margin: 0; color: var(--text-2); font-size: 0.9rem; }

.auth-shell {
    min-height: calc(100vh - var(--nav-h) - 130px);
    display: flex; align-items: center; justify-content: center;
}
.auth-card { width: min(520px, 100%); padding: 1.35rem; display: grid; gap: 1rem; }
.auth-card h1 { margin: 0; font-size: 1.65rem; }
.auth-card .sub { margin: -0.45rem 0 0; color: var(--text-2); font-size: 0.9rem; }
.auth-form, .login { display: grid; gap: 0.85rem; }
.auth-row {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    font-size: 0.88rem; color: var(--text-2);
}
.inline-link { color: var(--accent); font-weight: 700; }
.inline-link:hover { text-decoration: underline; }
.password-wrap, .password { position: relative; }
.password-wrap .show-password, .password .show-password, .show-password {
    position: absolute; right: 0.75rem; top: 50%; transform: translateY(-50%);
    color: var(--text-3); cursor: pointer;
}

.simple-page {
    min-height: calc(100vh - var(--nav-h) - 160px);
    display: flex; align-items: center; justify-content: center;
}
.simple-card, .container-404, .container-error {
    width: min(700px, 100%); padding: 1.35rem; text-align: center;
}
.simple-card p, .container-404 p, .container-error p { color: var(--text-2); }
.simple-actions, .error-buttons {
    display: flex; justify-content: center; gap: 0.6rem; flex-wrap: wrap; margin-top: 1rem;
}
.code {
    display: inline-flex; align-items: center; gap: 0.45rem; font-size: 0.95rem;
    color: var(--accent-alt); margin-bottom: 0.6rem;
}

.about-page, .contact-page, .reg-page, .rules-page { display: grid; gap: 1rem; }
.container-about, .container-contact, .reg-container, .rules-container {
    width: min(980px, calc(100% - 2rem)); margin: 0 auto; padding: 1.2rem;
    border-radius: var(--radius-md); border: 1px solid var(--line); background: var(--surface-0);
}
.about-columns, .contact-elements { display: grid; gap: 1rem; }
.about-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.65rem; }
.about-list li { display: grid; grid-template-columns: 28px 1fr; gap: 0.5rem; color: var(--text-2); }
.about-list i { color: var(--accent); margin-top: 0.2rem; }
.contact-elements { grid-template-columns: 1.2fr 1fr; align-items: start; }
.contact-elements ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 0.6rem; color: var(--text-2); }
.contact-elements li i { color: var(--accent); margin-right: 0.45rem; }
.contactimg img { border-radius: 14px; border: 1px solid var(--line); }
.reg-box { padding: 1rem; border-radius: 14px; border: 1px solid var(--line); background: var(--surface-1); }
.regulamin__text { white-space: pre-wrap; line-height: 1.65; color: var(--text-2); }
.reg-editable { cursor: text; }
.reg-editing { outline: 2px solid rgba(50, 92, 133, 0.22); }

.ranking-page { width: min(980px, calc(100% - 2rem)); margin: 0 auto; display: grid; gap: 1rem; }
.ranking-header { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; }
.search-wrapper { position: relative; }
.search-wrapper input { padding-left: 2.5rem; }
.search-wrapper i { position: absolute; left: 0.8rem; top: 50%; transform: translateY(-50%); color: var(--text-3); }
.ranking-list { display: grid; gap: 0.6rem; }
.ranking-item {
    display: grid; grid-template-columns: auto auto 1fr auto auto; align-items: center; gap: 0.85rem;
    padding: 0.75rem 0.85rem; border-radius: 14px; border: 1px solid var(--line); background: var(--surface-0);
}
.col-rank { width: 30px; text-align: center; font-weight: 800; color: var(--text-3); }
.col-avatar { width: 46px; height: 46px; }
.col-avatar canvas { width: 100%; height: 100%; border-radius: 999px; }
.col-info { min-width: 0; }
.info-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.info-meta { font-size: 0.82rem; color: var(--text-3); display: flex; gap: 0.6rem; }
.col-points-desktop { font-weight: 800; color: var(--accent); }
.col-arrow { color: var(--text-3); }
.item-top-1 { border-color: rgba(139, 107, 70, 0.28); background: rgba(139, 107, 70, 0.1); }
.item-top-2 { border-color: rgba(115, 136, 156, 0.28); }
.item-top-3 { border-color: rgba(50, 92, 133, 0.24); }

.profile { width: min(980px, calc(100% - 2rem)); margin: 0 auto; }
.profile-container { display: grid; gap: 1rem; }
.profile-header {
    display: grid; gap: 1rem; grid-template-columns: auto 1fr; align-items: center;
    padding: 1rem; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-0);
}
.profile-avatar, .avatar-circle {
    width: 120px; height: 120px; border-radius: 999px; border: 2px solid rgba(50, 92, 133, 0.2); overflow: hidden;
}
.profile-avatar canvas, .avatar-circle canvas { width: 100%; height: 100%; }
.profile-info h1 { margin: 0; }
.profile-info h3 { margin: 0.2rem 0 0; color: var(--text-2); font-weight: 600; }
.profile-stats, .stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0.8rem; }
.stat-box, .stat-card {
    padding: 1rem; border: 1px solid var(--line); border-radius: 14px;
    background: var(--surface-0); text-align: center;
}
.stat-value { font-size: 1.7rem; font-weight: 800; }
.stat-label { font-size: 0.78rem; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.06em; }

.actualquestion { width: min(920px, calc(100% - 2rem)); margin: 0 auto; }
.question-card { padding: 1.25rem; display: grid; gap: 0.9rem; }
.question-meta { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.question-meta .badge.category { background: rgba(139, 107, 70, 0.1); color: var(--accent-alt); border-color: rgba(139, 107, 70, 0.22); }
.timer-line { width: 100%; height: 8px; border-radius: 999px; background: rgba(118, 136, 156, 0.16); overflow: hidden; }
.timer-line span { display: block; width: 100%; height: 100%; background: var(--accent); transition: width 1s linear; }
.question-title { margin: 0; font-size: clamp(1.28rem, 2.7vw, 1.9rem); }
.question-image { border-radius: 14px; border: 1px solid var(--line); overflow: hidden; background: rgba(118, 136, 156, 0.08); }
.answer-grid { display: grid; gap: 0.65rem; }
.answer-option, .actualanswer {
    width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 0.7rem 0.85rem;
    background: var(--surface-field); cursor: pointer;
}
.answer-option.selected, .actualanswer.selected { border-color: rgba(50, 92, 133, 0.34); background: rgba(50, 92, 133, 0.08); }
.answer-option p, .actualanswer p { margin: 0; }
.question-actions { display: flex; flex-wrap: wrap; gap: 0.55rem; }

#confirmOverlay, .confirm-overlay, #qcConfirmOverlay, #adminConfirmOverlay {
    position: fixed; inset: 0; background: var(--surface-overlay); backdrop-filter: blur(5px);
    display: none; align-items: center; justify-content: center; z-index: 1200; padding: 1rem;
}
#confirmOverlay.active, .confirm-overlay.active, #qcConfirmOverlay.active, #adminConfirmOverlay.active { display: flex; }
#confirmModal, .confirm-modal, #qcConfirmModal {
    width: min(420px, 100%); border-radius: 14px; border: 1px solid var(--line);
    background: var(--panel); padding: 1rem; box-shadow: var(--shadow-lg);
}
#confirmModal p, .confirm-modal p, #qcConfirmModal p {
    white-space: pre-line;
    color: var(--text-2);
}
.confirm-actions, .qc-confirm-actions { display: flex; gap: 0.6rem; justify-content: flex-end; margin-top: 1rem; }

.fade-in { animation: riseIn 0.35s ease both; }
@keyframes riseIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.admin-layout {
    width: min(1240px, calc(100% - 2rem)); margin: 0 auto; display: grid; gap: 1rem;
    grid-template-columns: 260px 1fr;
}
.admin-sidebar {
    position: sticky; top: calc(var(--nav-h) + 1rem); height: fit-content;
    border: 1px solid var(--line); border-radius: var(--radius-md);
    background: var(--surface-0); padding: 0.8rem;
}
.sidebar-header h2 { margin: 0; font-size: 1.1rem; }
.sidebar-nav { margin-top: 0.85rem; display: grid; gap: 0.35rem; }
.sidebar-nav .nav-item {
    width: 100%; border: 1px solid transparent; background: transparent; color: var(--text-2);
    text-align: left; border-radius: 10px; padding: 0.55rem 0.65rem; font-weight: 600;
    display: flex; align-items: center; gap: 0.55rem; cursor: pointer;
}
.sidebar-nav .nav-item.active, .sidebar-nav .nav-item:hover {
    background: var(--accent-soft); color: var(--accent); border-color: rgba(50, 92, 133, 0.18);
}
.sidebar-nav .nav-item.logout { margin-top: 0.6rem; color: var(--danger); }
.admin-content { display: grid; gap: 1rem; }
.admin-section { display: none; gap: 0.8rem; }
.admin-section.active { display: grid; }
.section-header h1 { margin: 0; }
.section-header p { margin: 0.35rem 0 0; color: var(--text-2); }
.card-toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.7rem; margin-bottom: 0.8rem; }
.search-box { position: relative; min-width: 280px; flex: 1; }
.search-box i { position: absolute; left: 0.8rem; top: 50%; transform: translateY(-50%); color: var(--text-3); }
.search-box input { padding-left: 2.45rem; }
.toolbar-actions { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.icon-only { width: 40px; height: 40px; padding: 0; }
.admin-grid-layout { display: grid; gap: 0.8rem; grid-template-columns: 1fr; }
.admin-grid-layout.two-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.admin-grid-layout.three-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.admin-card { padding: 1rem; }
.admin-card h3 { margin: 0 0 0.8rem; display: flex; align-items: center; gap: 0.45rem; }
.admin-card .card-desc { margin-top: -0.35rem; color: var(--text-2); font-size: 0.88rem; }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.7rem; }
.time-slots-container, .time-slots { display: grid; gap: 0.55rem; margin-bottom: 0.7rem; }
.time-slot-row {
    display: flex; align-items: center; gap: 0.45rem; border: 1px solid var(--line);
    border-radius: 12px; padding: 0.55rem; background: var(--surface-3);
}
.time-slot-row .slot-controls { display: flex; align-items: center; gap: 0.45rem; width: 100%; }
.time-slot-row .slot-remove {
    border: none; width: 34px; height: 34px; border-radius: 10px;
    background: var(--danger-soft); color: var(--danger); cursor: pointer;
}
.button-group { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.action-footer { margin-top: 1rem; }
.hover-card { display: block; }
.card-icon {
    width: 46px; height: 46px; border-radius: 14px; background: var(--accent-soft);
    color: var(--accent); display: inline-flex; align-items: center; justify-content: center; font-size: 1.2rem;
}
.link-text { font-weight: 700; color: var(--accent); font-size: 0.9rem; }
.empty-state { margin: 0; color: var(--text-2); font-style: italic; }
.admin-modal-wide {
    width: min(980px, 100%);
    max-height: 90vh;
    overflow: auto;
}
.credentials-table code {
    display: inline-block;
    padding: 0.2rem 0.45rem;
    border-radius: 8px;
    background: var(--surface-1);
    border: 1px solid var(--line);
    color: var(--text-1);
    font-size: 0.8rem;
}
.credentials-status {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.03em;
}
.credentials-status.created {
    background: rgba(63, 135, 97, 0.12);
    border: 1px solid rgba(63, 135, 97, 0.18);
    color: var(--success);
}
.credentials-status.exists {
    background: rgba(139, 107, 70, 0.12);
    border: 1px solid rgba(139, 107, 70, 0.18);
    color: var(--accent-alt);
}
.credentials-status.reset {
    background: rgba(50, 92, 133, 0.12);
    border: 1px solid rgba(50, 92, 133, 0.18);
    color: var(--accent);
}
.danger-zone-card {
    margin-top: 1rem;
    border-color: rgba(184, 79, 79, 0.22);
}
.danger-zone-card .button-group {
    margin-top: 0.8rem;
}
.mail-mode-switch {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.8rem;
}
.mail-mode-switch .button.active {
    background: var(--accent);
    color: #f8fbff;
    border-color: transparent;
}
.mail-compose {
    display: grid;
    gap: 0.85rem;
    margin-top: 0.75rem;
}
.mail-compose textarea {
    min-height: 180px;
    resize: vertical;
}
.mail-toolbar {
    margin: 1rem 0 0.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    color: var(--text-2);
}
.mail-recipient-list {
    display: grid;
    gap: 0.35rem;
    max-height: 320px;
    overflow: auto;
    padding: 0.35rem;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface-1);
}
.mail-recipient {
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
    padding: 0.7rem 0.75rem;
    border-radius: 12px;
    cursor: pointer;
}
.mail-recipient:hover {
    background: rgba(50, 92, 133, 0.05);
}
.mail-recipient input {
    margin-top: 0.15rem;
    flex: 0 0 auto;
}
.mail-recipient-body {
    display: grid;
    gap: 0.2rem;
}
.mail-recipient-meta {
    color: var(--text-3);
    font-size: 0.82rem;
}
.stats-note-card {
    color: var(--text-2);
    border-style: dashed;
    background: var(--surface-1);
}
.stats-overview-grid {
    display: grid;
    gap: 0.8rem;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}
.stats-card {
    padding: 0.95rem;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface-1);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}
.stats-card.is-primary {
    border-color: rgba(50, 92, 133, 0.18);
    background: rgba(50, 92, 133, 0.12);
}
.stats-card.is-success {
    border-color: rgba(63, 135, 97, 0.18);
    background: rgba(63, 135, 97, 0.12);
}
.stats-card.is-warning {
    border-color: rgba(139, 107, 70, 0.18);
    background: rgba(139, 107, 70, 0.12);
}
.stats-card-label {
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-3);
}
.stats-card-value {
    margin-top: 0.35rem;
    font-size: 1.9rem;
    line-height: 1.05;
    font-weight: 800;
    color: var(--text-1);
}
.stats-card p {
    margin: 0.45rem 0 0;
    color: var(--text-2);
    font-size: 0.84rem;
    line-height: 1.5;
}
.stats-hourly-chart {
    display: grid;
    grid-template-columns: repeat(24, minmax(0, 1fr));
    gap: 0.35rem;
    min-height: 220px;
    margin-top: 1rem;
    padding: 0.9rem 0.75rem 0.75rem;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: var(--surface-1);
    align-items: end;
}
.stats-hour-column {
    display: grid;
    gap: 0.45rem;
    align-items: end;
    justify-items: center;
    min-width: 0;
}
.stats-hour-bars {
    width: 100%;
    min-height: 160px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 0.12rem;
}
.stats-hour-bar {
    width: min(9px, 28%);
    min-height: 2px;
    border-radius: 999px 999px 4px 4px;
}
.stats-hour-bar.is-login, .stats-legend-login { color: #325c85; }
.stats-hour-bar.is-login { background: #325c85; }
.stats-hour-bar.is-view, .stats-legend-view { color: #8b6b46; }
.stats-hour-bar.is-view { background: #8b6b46; }
.stats-hour-bar.is-submit, .stats-legend-submit { color: #3f8761; }
.stats-hour-bar.is-submit { background: #3f8761; }
.stats-hour-column small {
    font-size: 0.68rem;
    color: var(--text-3);
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    letter-spacing: 0.04em;
}
.stats-chart-legend {
    margin-top: 0.9rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    color: var(--text-2);
    font-size: 0.82rem;
}
.stats-chart-legend span {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}
.stats-performance-grid {
    display: grid;
    gap: 0.65rem;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    margin-top: 0.9rem;
}
.stats-mini-card {
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 0.75rem 0.8rem;
    background: var(--surface-1);
    display: grid;
    gap: 0.35rem;
}
.stats-mini-card span {
    color: var(--text-3);
    font-size: 0.76rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.stats-mini-card strong {
    font-size: 1.2rem;
    line-height: 1.2;
    color: var(--text-1);
}
.stats-table td { white-space: nowrap; }
.stats-timeline {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.55rem;
}
.stats-timeline-item {
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 0.8rem;
    background: var(--surface-1);
    display: grid;
    gap: 0.35rem;
}
.stats-timeline-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
}
.stats-timeline-head time {
    color: var(--text-3);
    font-size: 0.78rem;
}
.stats-timeline-item strong {
    font-size: 0.95rem;
}
.stats-timeline-item p {
    margin: 0;
    color: var(--text-2);
    font-size: 0.84rem;
}
.stats-event-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.22rem 0.55rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.stats-event-badge.is-login {
    background: rgba(50, 92, 133, 0.12);
    color: var(--accent);
}
.stats-event-badge.is-view {
    background: rgba(139, 107, 70, 0.12);
    color: var(--accent-alt);
}
.stats-event-badge.is-submit {
    background: rgba(63, 135, 97, 0.12);
    color: var(--success);
}

.question-creator { width: min(1560px, calc(100% - 2rem)); margin: 0 auto; display: grid; gap: 1rem; }
.qc-header {
    padding: 1.1rem; border-radius: var(--radius-md); border: 1px solid var(--line);
    background: var(--surface-0);
}
.qc-header h1 { margin: 0; }
.qc-header p { margin: 0.4rem 0 0; color: var(--text-2); }
.qc-layout { display: grid; gap: 0.9rem; grid-template-columns: minmax(300px, 360px) minmax(0, 1fr); }
.qc-form-card, .qc-list-card {
    min-width: 0;
    padding: 1rem; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-0);
}
.qc-form-group { display: grid; gap: 0.35rem; }
.qc-form-row { display: grid; gap: 0.7rem; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.qc-answers-section {
    border: 1px solid var(--line); border-radius: 12px; padding: 0.75rem; background: var(--surface-1);
}
.qc-answers-section h4 { margin-bottom: 0.7rem; }
.qc-section-note {
    margin: -0.25rem 0 0.75rem;
    color: var(--text-3);
    font-size: 0.84rem;
}
.answer { display: flex; align-items: center; gap: 0.55rem; margin-bottom: 0.45rem; }
.answer:last-child { margin-bottom: 0; }
.answer input[type="text"] { flex: 1; }
.qc-image-upload { display: grid; gap: 0.55rem; }
.qc-image-upload label {
    border: 1px dashed var(--line-strong); border-radius: 12px; padding: 0.75rem;
    color: var(--text-2); background: var(--surface-1); display: inline-flex; align-items: center; gap: 0.5rem; cursor: pointer;
}
.qc-image-upload input[type="file"] { display: none; }
.qc-image-preview { display: grid; gap: 0.45rem; }
.qc-image-preview img { max-height: 150px; width: auto; border-radius: 10px; border: 1px solid var(--line); }
.qc-submit-btn {
    width: 100%; margin-top: 0.9rem; border: none; border-radius: 12px;
    background: var(--accent);
    color: #f8fbff; padding: 0.85rem; font-weight: 800; cursor: pointer;
}
.qc-actions-bar { display: grid; gap: 0.45rem; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 0.75rem; }
.qc-action-btn {
    border: 1px solid var(--line); background: var(--surface-1); color: var(--text-2);
    border-radius: 12px; padding: 0.6rem; font-weight: 700; display: inline-flex;
    align-items: center; justify-content: center; gap: 0.4rem; cursor: pointer;
}
.qc-search-bar { position: relative; margin-bottom: 0.75rem; }
.qc-search-bar::before {
    content: '\f002'; font-family: 'Font Awesome 6 Free'; font-weight: 900;
    position: absolute; left: 0.8rem; top: 50%; transform: translateY(-50%); color: var(--text-3);
}
.qc-search-bar input { padding-left: 2.45rem; }
.qc-panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.45rem;
}
.qc-panel-head h3 { margin: 0; font-size: 1rem; }
.qc-panel-intro {
    margin: 0.35rem 0 0;
    color: var(--text-2);
    font-size: 0.86rem;
}
.qc-summary-badge {
    min-width: 92px;
    padding: 0.7rem 0.8rem;
    border-radius: 14px;
    border: 1px solid rgba(50, 92, 133, 0.14);
    background: var(--surface-1);
    text-align: center;
}
.qc-summary-badge span {
    display: block;
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--accent);
    line-height: 1;
}
.qc-summary-badge small {
    display: block;
    margin-top: 0.25rem;
    color: var(--text-3);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.qc-list-meta {
    display: grid;
    gap: 0.45rem;
    margin-bottom: 0.85rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
.qc-list-meta span {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.65rem 0.75rem;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: var(--surface-1);
    color: var(--text-2);
    font-size: 0.82rem;
}
.qc-list-meta i { color: var(--accent); }
.qc-questions-list { display: grid; gap: 0.6rem; }
.qc-question-card {
    border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2);
    padding: 0.75rem; display: grid; gap: 0.55rem;
}
.qc-question-card-header { display: flex; justify-content: space-between; gap: 0.7rem; align-items: center; }
.qc-question-id {
    font-size: 0.74rem; border: 1px solid rgba(50, 92, 133, 0.2);
    border-radius: 999px; color: var(--accent); padding: 0.15rem 0.55rem;
}
.qc-question-category {
    font-size: 0.72rem; border: 1px solid rgba(139, 107, 70, 0.2); border-radius: 999px;
    color: var(--accent-alt); padding: 0.15rem 0.55rem; text-transform: uppercase;
}
.qc-question-text { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.qc-question-meta { display: flex; gap: 0.45rem; flex-wrap: wrap; }
.qc-question-meta span { font-size: 0.74rem; border: 1px solid var(--line); border-radius: 999px; padding: 0.15rem 0.5rem; color: var(--text-2); background: var(--surface-field); }
.qc-question-answers { padding: 0.55rem; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-field); }
.qc-question-answers p { margin: 0 0 0.2rem; color: var(--text-2); font-size: 0.84rem; overflow-wrap: anywhere; }
.qc-question-answers p.correct { color: var(--success); }
.qc-question-answers .answer-key {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    margin-right: 0.45rem;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 0.72rem;
    font-weight: 800;
}
.qc-question-image { max-width: 120px; border-radius: 8px; border: 1px solid var(--line); cursor: pointer; }
.qc-question-actions { display: flex; gap: 0.45rem; }
.qc-question-actions button { flex: 1; }
.qc-btn-edit { background: rgba(50, 92, 133, 0.1); border-color: rgba(50, 92, 133, 0.22); color: var(--accent); }
.qc-btn-delete { background: rgba(184, 79, 79, 0.1); border-color: rgba(184, 79, 79, 0.22); color: var(--danger); }
.qc-table-wrapper {
    display: none;
    margin-top: 0.45rem;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 14px;
}
.qc-table {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
}
.qc-table th {
    white-space: nowrap;
    overflow-wrap: normal;
    word-break: normal;
}
.qc-table td {
    white-space: normal;
    overflow-wrap: break-word;
    word-break: normal;
}
.qc-table th, .qc-table td { padding: 0.65rem 0.55rem; }
.qc-table th:nth-child(1), .qc-table td:nth-child(1) { width: 5%; }
.qc-table th:nth-child(2), .qc-table td:nth-child(2) { width: 23%; }
.qc-table th:nth-child(3), .qc-table td:nth-child(3) { width: 13%; }
.qc-table th:nth-child(4), .qc-table td:nth-child(4) { width: 10%; }
.qc-table th:nth-child(5), .qc-table td:nth-child(5) { width: 18%; }
.qc-table th:nth-child(6), .qc-table td:nth-child(6) { width: 5%; }
.qc-table th:nth-child(7), .qc-table td:nth-child(7) { width: 6%; }
.qc-table th:nth-child(8), .qc-table td:nth-child(8) { width: 10%; }
.qc-table th:nth-child(9), .qc-table td:nth-child(9) { width: 10%; }
.qc-table td p { margin: 0 0 0.2rem; font-size: 0.8rem; line-height: 1.4; }
.qc-table td img {
    width: 100%;
    max-width: 52px;
    margin: 0 auto;
    border-radius: 8px;
    border: 1px solid var(--line);
    cursor: pointer;
}
.qc-table td:last-child .button {
    display: flex;
    width: 100%;
    margin-bottom: 0.35rem;
    padding: 0.36rem 0.4rem;
    border-radius: 10px;
    font-size: 0.74rem;
    box-shadow: none;
}
.qc-table td:last-child .button:last-child { margin-bottom: 0; }
.qc-table td:last-child .button:hover {
    transform: none;
    box-shadow: none;
}
.qc-table tr.editing { background: rgba(50, 92, 133, 0.08); }
.qc-table tbody tr:hover { background: rgba(50, 92, 133, 0.04); }
.qc-table tbody tr.is-hidden td { color: var(--text-3); background: rgba(118, 136, 156, 0.04); }
.qc-table tbody tr.is-visible td { background: var(--surface-row); }

.qc-image-modal, .modal {
    position: fixed; inset: 0; z-index: 1300; background: var(--surface-overlay-strong);
    display: none; align-items: center; justify-content: center; padding: 1rem;
}
.qc-image-modal.active, .modal.active { display: flex; }
.qc-image-modal { flex-direction: column; gap: 0.75rem; }
.qc-image-modal img, .modal .modal__content img {
    max-width: 92vw; max-height: 78vh; border-radius: 12px; border: 1px solid var(--line);
}

.report-panel-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.report-panel-item {
    border: 1px solid var(--line); border-radius: 10px; padding: 0.65rem;
    background: rgba(249, 251, 253, 0.94); display: grid; gap: 0.3rem;
}
.report-panel-item-head { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; }
.report-panel-item p { margin: 0; color: var(--text-2); font-size: 0.85rem; }

@media (min-width: 980px) {
    .nav-links { display: flex; }
    .nav-toggle, .mobile-menu { display: none; }
}

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

@media (max-width: 1080px) {
    .admin-layout { grid-template-columns: 1fr; }
    .admin-sidebar { position: static; }
    .sidebar-nav { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
    .admin-grid-layout.two-columns, .admin-grid-layout.three-columns { grid-template-columns: 1fr; }
    .qc-layout { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
    :root { --nav-h: 64px; }
    body { padding-top: 64px; }
    .contact-elements { grid-template-columns: 1fr; }
    .qc-form-row { grid-template-columns: 1fr; }
    .qc-actions-bar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .qc-list-meta { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .search-box { min-width: 0; }
    .stats-hourly-chart { display: flex; gap: 0.5rem; overflow-x: auto; }
    .stats-hour-column { min-width: 26px; flex: 0 0 26px; }
}

@media (max-width: 700px) {
    .container { width: calc(100% - 1.1rem); }
    .page-shell { padding-top: 0.9rem; }
    .auth-card, .admin-card, .qc-form-card, .qc-list-card, .question-card,
    .simple-card, .container-about, .container-contact, .reg-container, .rules-container,
    .container-404, .container-error { padding: 0.9rem; }
    .site-footer-inner { min-height: auto; padding: 0.7rem 0; flex-direction: column; align-items: flex-start; }
    .profile-header { grid-template-columns: 1fr; text-align: center; justify-items: center; }
    .qc-panel-head { flex-direction: column; }
    .mail-toolbar { align-items: stretch; }
    .ranking-item { grid-template-columns: auto auto 1fr auto; }
    .col-points-desktop { display: none; }
    .mobile-meta-only { display: inline; }
    .stats-timeline-head { flex-direction: column; align-items: flex-start; }
    .stats-card-value { font-size: 1.6rem; }
    .report-overlay { padding: calc(var(--nav-h) + 0.45rem) 0.55rem 0.55rem; }
    .report-dropdown { width: 100%; max-height: calc(100vh - var(--nav-h) - 1rem); }
    .report-dropdown-head { padding: 0.8rem 0.85rem; }
    .report-dropdown-footer { padding: 0.7rem 0.85rem 0.85rem; }
    .report-list { padding: 0.75rem; }
    .report-item, .report-empty { padding: 0.7rem; }
}

@media (min-width: 701px) {
    .mobile-meta-only { display: none; }
}

@media (min-width: 1020px) {
    .qc-questions-list { display: none; }
    .qc-table-wrapper { display: block; }
}

