:root {
    --primary: #1f4d7e;
    --primary-strong: #173b61;
    --accent: #4cdda1;
    --background: #f5f6f8;
    --card: #ffffff;
    --text: #1f2328;
    --text-soft: #59636e;
    --border: #dfe4ea;
    --danger: #a82d2d;
    --radius: 14px;
    --shadow: 0 16px 44px rgba(16, 24, 40, 0.08);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--background);
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--text);
    background:
        radial-gradient(circle at top right, rgba(76, 221, 161, 0.12), transparent 38%),
        var(--background);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.45;
}

button,
input {
    font: inherit;
}

button {
    -webkit-tap-highlight-color: transparent;
}

[hidden] {
    display: none !important;
}

.survey-shell {
    width: min(100%, 620px);
    min-height: 100vh;
    margin: 0 auto;
    padding: max(18px, env(safe-area-inset-top)) 18px max(24px, env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
}

.brand-header {
    min-height: 58px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-logo {
    display: block;
    width: 148px;
    height: auto;
}

.brand-context {
    padding-left: 12px;
    border-left: 1px solid var(--border);
    color: var(--text-soft);
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.screen {
    width: 100%;
    margin: auto 0;
    padding: 28px 0;
}

.screen h1 {
    margin: 12px 0 0;
    font-size: clamp(1.65rem, 7vw, 2.35rem);
    line-height: 1.16;
    letter-spacing: -0.025em;
}

.eyebrow {
    margin: 0;
    color: var(--primary);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.intro-copy {
    margin: 18px 0 0;
    color: var(--text-soft);
    font-size: 1.02rem;
}

.intro-mark,
.success-mark {
    width: 58px;
    height: 58px;
    margin-bottom: 28px;
    border-radius: 18px;
    display: grid;
    place-items: center;
    color: var(--primary);
    background: rgba(76, 221, 161, 0.2);
    font-size: 1.7rem;
    font-weight: 900;
}

.primary-button,
.secondary-button,
.text-button {
    min-height: 54px;
    border-radius: 12px;
    font-weight: 800;
    letter-spacing: 0.025em;
    cursor: pointer;
}

.primary-button {
    width: 100%;
    margin-top: 30px;
    padding: 14px 22px;
    border: 1px solid var(--primary);
    color: #fff;
    background: var(--primary);
    box-shadow: 0 10px 24px rgba(31, 77, 126, 0.2);
}

.primary-button:hover,
.primary-button:focus-visible {
    background: var(--primary-strong);
}

.secondary-button {
    padding: 12px 18px;
    border: 1px solid var(--primary);
    color: var(--primary);
    background: #fff;
}

.text-button {
    padding: 10px 12px;
    border: 0;
    color: var(--text-soft);
    background: transparent;
}

.primary-button:focus-visible,
.secondary-button:focus-visible,
.text-button:focus-visible,
.answer-card:focus-visible,
.back-button:focus-visible,
input:focus-visible {
    outline: 3px solid rgba(31, 77, 126, 0.22);
    outline-offset: 2px;
}

.progress-row {
    display: flex;
    align-items: center;
    gap: 13px;
    margin-bottom: 30px;
}

.back-button {
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--primary);
    background: #fff;
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
}

.progress-copy {
    width: 100%;
    color: var(--text-soft);
    font-size: 0.84rem;
    font-weight: 750;
}

.progress-track {
    width: 100%;
    height: 5px;
    margin-top: 7px;
    overflow: hidden;
    border-radius: 999px;
    background: #e3e7eb;
}

.progress-fill {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--primary), #558fcc);
}

.progress-fill-1 { width: 14.29%; }
.progress-fill-2 { width: 28.57%; }
.progress-fill-3 { width: 42.86%; }
.progress-fill-4 { width: 57.14%; }
.progress-fill-5 { width: 71.43%; }
.progress-fill-6 { width: 85.71%; }
.progress-fill-7 { width: 100%; }

.answer-list {
    display: grid;
    gap: 11px;
    margin-top: 28px;
}

.answer-card {
    width: 100%;
    min-height: 64px;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 13px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    background: var(--card);
    box-shadow: 0 3px 12px rgba(16, 24, 40, 0.035);
    text-align: left;
    font-weight: 650;
    line-height: 1.3;
    cursor: pointer;
    transition: border-color 120ms ease, background-color 120ms ease, transform 120ms ease;
}

.answer-card:hover,
.answer-card.is-selected {
    border-color: var(--primary);
    background: #f3f7fc;
}

.answer-card:active {
    transform: scale(0.99);
}

.answer-card:disabled {
    cursor: default;
}

.answer-code {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    color: var(--primary);
    background: #edf3f9;
    font-size: 0.86rem;
    font-weight: 900;
}

.sync-screen,
.final-screen {
    text-align: center;
}

.sync-screen .secondary-button {
    width: 100%;
    margin-top: 28px;
}

.spinner {
    width: 52px;
    height: 52px;
    margin: 0 auto 28px;
    border: 5px solid #dce4ec;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.final-screen .success-mark {
    margin-right: auto;
    margin-left: auto;
}

.final-screen p {
    margin: 10px 0 0;
    color: var(--text-soft);
    font-size: 1.08rem;
}

.local-status {
    position: fixed;
    right: 14px;
    bottom: max(14px, env(safe-area-inset-bottom));
    left: 14px;
    max-width: 520px;
    margin: 0 auto;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-soft);
    background: rgba(255, 255, 255, 0.96);
    box-shadow: var(--shadow);
    text-align: center;
    font-size: 0.82rem;
}

.admin-body {
    padding: 18px;
}

.admin-login-card {
    width: min(100%, 430px);
    margin: min(13vh, 110px) auto 0;
    padding: 30px 24px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: #fff;
    box-shadow: var(--shadow);
}

.admin-login-card h1 {
    margin: 9px 0 0;
    font-size: 1.8rem;
}

.admin-logo {
    width: 145px;
    margin-bottom: 28px;
}

.admin-login-form {
    margin-top: 26px;
}

.admin-login-form label {
    display: block;
    margin-top: 16px;
}

.admin-login-form label span {
    display: block;
    margin-bottom: 7px;
    color: var(--text-soft);
    font-size: 0.84rem;
    font-weight: 750;
}

.admin-login-form input {
    width: 100%;
    min-height: 50px;
    padding: 11px 13px;
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    background: #fff;
}

.alert-error {
    margin: 18px 0 0;
    padding: 11px 13px;
    border: 1px solid #eac5c5;
    border-radius: 10px;
    color: var(--danger);
    background: #fff6f6;
}

.admin-shell {
    width: min(100%, 1100px);
    margin: 0 auto;
    padding-bottom: 50px;
}

.admin-topbar {
    padding: 12px 0 26px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    border-bottom: 1px solid var(--border);
}

.admin-topbar p {
    margin: -17px 0 0;
    color: var(--text-soft);
}

.admin-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.admin-actions form {
    margin: 0;
}

.total-card {
    margin: 26px 0;
    padding: 24px;
    border-radius: 16px;
    color: #fff;
    background: linear-gradient(135deg, var(--primary), #558fcc);
    box-shadow: var(--shadow);
}

.total-card span {
    display: block;
    font-size: 0.88rem;
    font-weight: 700;
}

.total-card strong {
    display: block;
    margin-top: 4px;
    font-size: 2.4rem;
}

.question-results {
    display: grid;
    gap: 18px;
}

.result-card {
    padding: 22px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 5px 20px rgba(16, 24, 40, 0.04);
}

.result-card h2 {
    margin: 8px 0 20px;
    font-size: 1.15rem;
    line-height: 1.35;
}

.result-table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

th,
td {
    padding: 11px 9px;
    border-top: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}

th {
    color: var(--text-soft);
    font-size: 0.75rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

th:nth-child(n + 2),
td:nth-child(n + 2) {
    width: 110px;
    text-align: right;
}

@media (min-width: 700px) {
    .survey-shell {
        min-height: calc(100vh - 48px);
        margin-top: 24px;
        margin-bottom: 24px;
        padding: 28px 42px 40px;
        border: 1px solid rgba(223, 228, 234, 0.8);
        border-radius: 24px;
        background: rgba(255, 255, 255, 0.82);
        box-shadow: var(--shadow);
    }

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

    .total-card {
        width: 310px;
    }
}

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