body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: #f6f7fb;
    color: #1f2430;
}

.container {
    max-width: 820px;
    margin: 24px auto;
    background: #fff;
    padding: 24px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.container-results-wide {
    max-width: 1480px;
}

h1, h2 {
    margin-top: 0;
}

.form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

input[type="text"],
input[type="password"],
input[type="file"] {
    padding: 10px;
    border: 1px solid #cfd5e3;
    border-radius: 6px;
}

button, .link-btn {
    display: inline-block;
    border: 0;
    border-radius: 6px;
    padding: 10px 14px;
    background: #2f6feb;
    color: #fff;
    cursor: pointer;
    text-decoration: none;
}

.submit-btn-animate-out {
    animation: submit-press-out 0.32s ease forwards;
    pointer-events: none;
}

@keyframes submit-press-out {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    35% {
        transform: scale(1.08);
        opacity: 1;
    }
    100% {
        transform: scale(0.86);
        opacity: 0;
    }
}

.buttons {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

@media (max-width: 900px) {
    .buttons {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .buttons {
        grid-template-columns: 1fr;
    }
}

.test-select-btn {
    width: 100%;
    text-align: left;
    line-height: 1.25;
}

.test-select-btn:hover {
    animation: test-shake 0.35s ease-in-out;
}

@keyframes test-shake {
    0% { transform: translateX(0); }
    20% { transform: translateX(-2px); }
    40% { transform: translateX(2px); }
    60% { transform: translateX(-2px); }
    80% { transform: translateX(2px); }
    100% { transform: translateX(0); }
}

.test-select-title {
    font-weight: 700;
    font-size: 18px;
}

.test-select-meta {
    opacity: 0.95;
    font-size: 14px;
}

.question-block {
    margin: 12px 0;
    padding: 12px;
    border: 1px solid #e0e6f2;
    border-radius: 8px;
}

.question-image {
    max-width: 100%;
    border-radius: 6px;
    margin: 8px 0;
}

.multi-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.multi-option-item {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    padding: 6px 8px;
    border: 1px solid transparent;
    border-radius: 8px;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.multi-option-item.option-selected {
    background: #eaf2ff;
    border-color: #9ec1ff;
}

.multi-option-item.option-picked {
    animation: option-pick-pop 0.22s ease;
}

@keyframes option-pick-pop {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

.question-nav-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 10px 0 12px;
}

.question-nav-item {
    min-width: 32px;
    height: 32px;
    border: 1px solid #cfd5e3;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: #1f2430;
    background: #fff;
    font-size: 13px;
}

.question-nav-current {
    background: #2f6feb;
    color: #fff;
    border-color: #2f6feb;
}

.question-nav-answered {
    background: #e7f9ed;
    border-color: #9ad9b0;
}

.question-nav-deferred {
    background: #ffe4e6;
    border-color: #f2a8af;
    color: #8a1c2a;
}

.question-nav-disabled {
    background: #f3f4f6;
    color: #9aa2b1;
    border-color: #dde2ea;
    pointer-events: none;
}

.question-nav-current-exit {
    animation: nav-current-spin-out 0.36s ease forwards;
}

.question-nav-target-enter {
    animation: nav-target-spin-grow 0.34s ease forwards;
}

.question-nav-spin-out-cw {
    animation: nav-seq-spin-out-cw 0.28s ease forwards;
}

.question-nav-spin-out-ccw {
    animation: nav-seq-spin-out-ccw 0.28s ease forwards;
}

@keyframes nav-current-spin-out {
    0% {
        transform: rotate(0deg) scale(1);
        opacity: 1;
    }
    65% {
        transform: rotate(250deg) scale(1.05);
        opacity: 1;
    }
    100% {
        transform: rotate(360deg) scale(0.6);
        opacity: 0;
    }
}

@keyframes nav-target-spin-grow {
    0% {
        transform: scale(1);
        opacity: 1;
        box-shadow: 0 0 0 0 rgba(47, 111, 235, 0.35);
    }
    65% {
        transform: scale(1.24);
        opacity: 1;
        box-shadow: 0 0 0 12px rgba(47, 111, 235, 0);
    }
    100% {
        transform: scale(0.78);
        opacity: 0;
        box-shadow: 0 0 0 0 rgba(47, 111, 235, 0);
    }
}

@keyframes nav-seq-spin-out-cw {
    0% {
        transform: rotate(0deg) scale(1);
        opacity: 1;
    }
    100% {
        transform: rotate(220deg) scale(0.72);
        opacity: 0;
    }
}

@keyframes nav-seq-spin-out-ccw {
    0% {
        transform: rotate(0deg) scale(1);
        opacity: 1;
    }
    100% {
        transform: rotate(-220deg) scale(0.72);
        opacity: 0;
    }
}

.source {
    color: #4a5568;
    font-size: 14px;
}

.error {
    background: #ffe4e6;
    color: #8a1c2a;
    padding: 8px 10px;
    border-radius: 6px;
    margin-bottom: 10px;
}

.success {
    background: #e7f9ed;
    color: #176033;
    padding: 8px 10px;
    border-radius: 6px;
    margin-bottom: 10px;
}

.helper-line {
    margin-top: 14px;
}

.tabs {
    display: flex;
    gap: 10px;
    margin: 10px 0 14px;
    flex-wrap: wrap;
}

.tab-link {
    text-decoration: none;
    color: #1f2430;
    background: #eceff5;
    padding: 7px 11px;
    border-radius: 6px;
    font-size: 14px;
}

.tab-link-active {
    background: #2f6feb;
    color: #fff;
}

.table-wrap {
    overflow-x: auto;
    margin-top: 10px;
}

.codes-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.codes-table th,
.codes-table td {
    border: 1px solid #d8deea;
    padding: 8px;
    text-align: left;
    vertical-align: top;
}

.codes-table th {
    background: #eef3ff;
}

.row-free {
    background: #f2fbf5;
}

.row-active {
    background: #fff8e8;
}

.row-used {
    background: #f7f7f7;
}

.row-ip-changed {
    background: #e6f0ff;
}

.score-low {
    background: #ffe4e6;
}

.score-high {
    background: #e7f9ed;
}

.score-ip-changed {
    background: #dbeafe;
}

.danger-btn {
    background: #c62828;
}

.bulk-action-btn {
    min-width: 130px;
}

.bulk-actions-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.muted-text {
    color: #7a8599;
    font-size: 13px;
}

.checkbox-cell {
    text-align: center !important;
    vertical-align: middle !important;
}

.upload-row {
    display: flex;
    align-items: stretch;
    gap: 10px;
}

.upload-dropzone {
    flex: 1;
    min-height: 74px;
    display: flex;
    align-items: center;
    border: 2px dashed #b9c7e5;
    border-radius: 8px;
    background: #f7f9ff;
    padding: 12px;
}

.upload-dropzone input[type="file"] {
    width: 100%;
    border: 0;
    background: transparent;
    padding: 8px 6px;
}

.upload-submit-btn {
    white-space: nowrap;
}

.upload-side-panel {
    width: 320px;
    min-width: 320px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 10px;
}

.upload-expire-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.upload-mail-fs-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.92rem;
}

.checkbox-inline {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    cursor: pointer;
    line-height: 1.35;
}

.checkbox-inline input[type="checkbox"] {
    margin-top: 3px;
    flex-shrink: 0;
}

.upload-attention-btn {
    background: #c62828 !important;
    animation: upload-attention-shake 0.45s ease;
}

.upload-attention-expire {
    animation: upload-attention-pulse 0.55s ease;
}

@keyframes upload-attention-shake {
    0% { transform: translateX(0); }
    20% { transform: translateX(-4px); }
    40% { transform: translateX(4px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
    100% { transform: translateX(0); }
}

@keyframes upload-attention-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.06); }
    100% { transform: scale(1); }
}

.search-row {
    display: flex;
    gap: 10px;
    align-items: center;
    margin: 10px 0 12px;
}

.search-row input[type="text"] {
    flex: 1;
}

.top-actions {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 10px;
}

.admin-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.admin-top-tabs {
    margin: 0;
}

.admin-header-actions {
    display: flex;
    flex-direction: row;
    align-items: flex-end;
}

.admin-subheader-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin: 10px 0 14px;
}

.admin-sub-tabs {
    margin: 0;
}

.admin-login-floating-btn {
    position: fixed;
    right: -130px;
    bottom: 18px;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transition: right 0.2s ease;
}

.admin-login-floating-btn:hover {
    right: -1px;
}

.result-fx-layer {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 999;
}

.result-fx-fade {
    opacity: 0;
    transition: opacity 0.8s ease;
}

.fx-confetti {
    position: absolute;
    top: -20px;
    width: 10px;
    height: 16px;
    border-radius: 2px;
    opacity: 0.95;
    animation: fx-confetti-fall linear forwards;
}

.fx-firework {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 200, 0, 0.95);
    box-shadow:
        0 0 0 0 rgba(255, 200, 0, 0.8),
        0 0 0 0 rgba(47, 111, 235, 0.7),
        0 0 0 0 rgba(244, 63, 94, 0.7);
    animation: fx-firework-burst 1s ease-out forwards;
}

.fx-sad-emoji {
    position: absolute;
    font-size: 24px;
    opacity: 0;
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.25));
    animation: fx-sad-fly ease-in forwards;
}

@keyframes fx-confetti-fall {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 0.95;
    }
    100% {
        transform: translateY(110vh) rotate(720deg);
        opacity: 0;
    }
}

@keyframes fx-firework-burst {
    0% {
        transform: scale(0.4);
        opacity: 0.9;
    }
    100% {
        transform: scale(1.1);
        opacity: 0;
        box-shadow:
            0 -26px 0 3px rgba(255, 200, 0, 0),
            22px 14px 0 3px rgba(47, 111, 235, 0),
            -20px 16px 0 3px rgba(244, 63, 94, 0),
            0 28px 0 3px rgba(34, 197, 94, 0),
            26px -10px 0 3px rgba(139, 92, 246, 0),
            -24px -8px 0 3px rgba(255, 159, 64, 0);
    }
}

@keyframes fx-sad-fly {
    0% {
        transform: translate(0, 0) scale(0.9);
        opacity: 0;
    }
    20% {
        opacity: 1;
    }
    100% {
        transform: translate(-120px, 110px) scale(0.75);
        opacity: 0;
    }
}
