:root {
    --primary: #1d4f91;
    --primary-dark: #143a6d;
    --text: #1f2933;
    --muted: #6b7280;
    --bg: #f4f6f5;
    --card-bg: #ffffff;
    --border: #e2e6e4;
    --danger: #c0392b;
    --radius: 12px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

.wrap {
    max-width: 640px;
    margin: 0 auto;
    padding: 16px;
}

header.site-header {
    text-align: center;
    padding: 20px 16px 8px;
}

header.site-header .logo-text {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary-dark);
}

.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 20px 16px;
    margin-bottom: 16px;
}

h1, h2 { color: var(--primary-dark); }

.step-indicator {
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 8px;
}

.timer {
    display: inline-block;
    background: var(--primary);
    color: #fff;
    font-weight: 700;
    padding: 6px 14px;
    border-radius: 999px;
    margin-bottom: 16px;
    font-variant-numeric: tabular-nums;
}

.timer.timer-warning { background: var(--danger); }

.question-block {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.question-block:last-of-type { border-bottom: none; }

.conditions { background: #eef7e6; border: 1px solid #cfe8b8; border-radius: 12px; padding: 14px 18px; margin-bottom: 18px; }
.conditions h2 { font-size: 17px; margin: 0 0 8px; color: #2f5b10; }
.conditions ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
@media (min-width: 640px) { .conditions ul { grid-template-columns: 1fr 1fr; } }
.conditions li::before { content: "✓"; color: #56921f; font-weight: 700; margin-right: 8px; }
.form-grid { display: grid; gap: 0 16px; }
@media (min-width: 640px) { .form-grid { grid-template-columns: 1fr 1fr; } .form-grid .span-2 { grid-column: span 2; } }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.chip { display: inline-flex; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span { padding: 9px 14px; border: 1px solid var(--border); border-radius: 999px; font-size: 14px; cursor: pointer; background: #fff; }
.chip input:checked + span { background: var(--primary); border-color: var(--primary); color: #fff; }
.chip input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }
.photo-drop {
    border: 2px dashed #b8c4d0; border-radius: 12px; padding: 18px; text-align: center; background: #f8fafc;
    display: flex; flex-direction: column; align-items: center; gap: 10px; cursor: pointer;
}
.photo-drop.is-drag { border-color: var(--primary); background: #eef3fb; }
.photo-drop.has-photo { border-style: solid; border-color: #56921f; }
.photo-drop img { width: 140px; height: 140px; object-fit: cover; border-radius: 50%; }
.photo-icon { width: 48px; height: 48px; color: var(--primary); }
.photo-drop.has-photo .photo-icon { display: none; }
.photo-text { display: flex; flex-direction: column; gap: 4px; }
.photo-ok { color: #2f5b10; font-size: 14px; }
.photo-buttons { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.photo-buttons .btn-site { margin-top: 0; }
html:not(.is-touch) .only-touch, html:not(.is-mouse) .only-mouse { display: none; }
html:not(.is-touch):not(.is-mouse) .only-mouse { display: inline; }

.test-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.test-top > div:first-child { flex: 1; }
.test-top .timer { margin-bottom: 0; font-size: 18px; }
.progress { height: 6px; background: var(--border); border-radius: 999px; overflow: hidden; margin-top: 6px; }
.progress span { display: block; height: 100%; background: var(--primary); border-radius: 999px; }
.sheet-wrap { overflow-x: auto; margin: 6px 0 8px; }
.sheet { border-collapse: collapse; width: 100%; font-size: 15px; font-variant-numeric: tabular-nums; }
.sheet th, .sheet td { border: 1px solid #c9d1d9; padding: 8px 10px; }
.sheet thead th { background: #eef1f4; color: var(--muted); font-weight: 600; text-align: center; font-size: 13px; }
.sheet tbody th { background: #eef1f4; color: var(--muted); font-weight: 600; width: 34px; text-align: center; font-size: 13px; }
.sheet td:last-child { text-align: right; min-width: 150px; }
.sheet .sheet-answer td { background: #fffbea; font-weight: 600; }
.sheet-input {
    width: 100%; box-sizing: border-box; padding: 8px; font-size: 16px; text-align: left;
    font-family: Consolas, "Courier New", monospace; border: 2px solid var(--primary); border-radius: 6px;
}
code { background: #eef1f4; padding: 1px 5px; border-radius: 4px; font-family: Consolas, "Courier New", monospace; }

.q-number { font-size: 13px; font-weight: 700; color: var(--primary); margin: 0 0 6px; text-transform: uppercase; letter-spacing: .03em; }
.passage-label { font-size: 14px; color: var(--muted); margin: 0 0 6px; }
.passage {
    margin: 0 0 14px; padding: 14px 16px; background: #f3f6fa; border-left: 4px solid var(--primary);
    border-radius: 8px; font-size: 15px; line-height: 1.7; color: var(--text);
}

.question-text {
    font-weight: 600;
    margin-bottom: 10px;
}

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

.option {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
}

.option input { margin-top: 3px; }

.answer-input, .answer-textarea, input[type=text], input[type=tel], input[type=number], select {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-top: 4px;
}

label.field-label {
    display: block;
    font-weight: 600;
    margin: 14px 0 4px;
}

.btn {
    display: inline-block;
    padding: 12px 20px;
    border-radius: 999px;
    border: none;
    font-size: 16px;
    font-weight: 700;
    text-decoration: none;
    text-align: center;
    cursor: pointer;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    width: 100%;
    margin-top: 12px;
}

.btn-primary:active { background: var(--primary-dark); }

.muted { color: var(--muted); font-size: 14px; }

table.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    font-size: 14px;
}

table.admin-table th, table.admin-table td {
    padding: 10px 8px;
    border-bottom: 1px solid var(--border);
    text-align: left;
}

table.admin-table th { background: #f0f2f1; }

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.badge-correct { background: #dcf5e6; color: #14532d; }
.badge-wrong { background: #fde2e1; color: #7f1d1d; }
.badge-pending { background: #fef3c7; color: #78350f; }

.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--primary-dark);
    color: #fff;
}

.top-nav a { color: #fff; text-decoration: none; font-weight: 600; }

.admin-nav { flex-wrap: wrap; gap: 8px; }
.admin-brand { font-weight: 700; }
.admin-links { display: flex; flex-wrap: wrap; gap: 4px; }
.admin-links a { padding: 6px 10px; border-radius: 6px; font-size: 14px; }
.admin-links a:hover, .admin-links a.is-active { background: rgba(255, 255, 255, .18); }
.form-hint { font-size: 13px; color: var(--muted); margin: 2px 0 0; }
.notice-ok { background: #dcf5e6; color: #14532d; padding: 10px 12px; border-radius: 8px; }
.notice-err { background: #fde2e1; color: #7f1d1d; padding: 10px 12px; border-radius: 8px; }
textarea { width: 100%; box-sizing: border-box; padding: 12px; font-size: 16px; border: 1px solid var(--border); border-radius: 8px; font-family: inherit; }
fieldset.admin-group { border: 1px solid var(--border); border-radius: 10px; padding: 8px 16px 16px; margin: 0 0 18px; }
fieldset.admin-group legend { font-weight: 700; padding: 0 6px; color: var(--primary-dark); }

@media (max-width: 480px) {
    .wrap { padding: 12px; }
    .card { padding: 16px 12px; }
}
