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

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background:
        linear-gradient(rgba(18, 24, 18, 0.46), rgba(18, 24, 18, 0.56)),
        url('background.webp') center / cover no-repeat fixed;
    min-height: 100vh;
    min-height: 100svh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    position: relative;
}

.language-selector {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

.language-selector select {
    padding: 8px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background: white;
    color: #333;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 16px;
    padding-right: 32px;
}

.language-selector select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.option-btn:focus-visible,
.submit-btn:focus-visible,
.nationality-combobox input:focus-visible,
.nationality-region-btn:focus-visible,
.language-selector select:focus-visible {
    outline: 3px solid #1a73e8;
    outline-offset: 3px;
}

.container {
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    max-width: 500px;
    width: 100%;
    padding: 40px;
}

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

header {
    text-align: center;
    margin-bottom: 30px;
}

h1 {
    color: #333;
    font-size: 2rem;
    margin-bottom: 10px;
}

.description {
    color: #666;
    font-size: 0.95rem;
    line-height: 1.5;
}

.question h2 {
    color: #333;
    font-size: 1.3rem;
    text-align: center;
    margin-bottom: 30px;
}

.options {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 25px;
}

.option-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px 24px;
    border: 2px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1rem;
    width: 100%;
    -webkit-tap-highlight-color: transparent;
    position: relative;
}

.option-btn:disabled {
    cursor: not-allowed;
    opacity: 0.6;
    box-shadow: none;
    transform: none;
}

.option-btn[data-value="1"] {
    background: linear-gradient(135deg, #bfdbfe 0%, #60a5fa 100%);
    border-color: #3b82f6;
}

.option-btn[data-value="2"] {
    background: linear-gradient(135deg, #bbf7d0 0%, #4ade80 100%);
    border-color: #22c55e;
}

.option-btn[data-value="3"] {
    background: linear-gradient(135deg, #fef3c7 0%, #facc15 100%);
    border-color: #eab308;
}

.option-btn[data-value="4"] {
    background: linear-gradient(135deg, #fed7aa 0%, #fb923c 100%);
    border-color: #f97316;
}

.option-btn[data-value="5"] {
    background: linear-gradient(135deg, #fecaca 0%, #ef4444 100%);
    border-color: #dc2626;
}

.option-btn:active {
    transform: none;
}

.option-btn.selected {
    border-width: 2px;
    border-color: #111;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.6);
    transform: none;
}

.options.has-selection .option-btn:not(.selected) {
    opacity: 0.7;
    filter: saturate(0.4);
}

.options.has-selection .option-btn:not(.selected):focus-visible {
    opacity: 0.9;
    filter: saturate(0.75);
}

.option-btn .label {
    color: #2d3436;
    font-weight: 600;
    text-align: center;
}

.nationality-section {
    margin: 8px 0 4px;
    padding-top: 24px;
    border-top: 1px solid rgba(45, 52, 54, 0.16);
}

.nationality-section h2 {
    color: #333;
    font-size: 1.15rem;
    text-align: center;
    margin-bottom: 14px;
}

.nationality-region-label {
    margin-bottom: 8px;
    color: #596168;
    font-size: 0.82rem;
    font-weight: 700;
}

.nationality-regions {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-bottom: 14px;
}

.nationality-region-btn {
    min-height: 36px;
    padding: 7px 10px;
    border: 1px solid #aeb6bf;
    border-radius: 6px;
    background: #fff;
    color: #343a40;
    font: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
}

.nationality-region-btn[aria-pressed="true"] {
    border-color: #1769aa;
    background: #e3f2fd;
    color: #0d47a1;
}

.nationality-region-btn:active {
    transform: translateY(1px);
}

.nationality-combobox {
    position: relative;
}

.nationality-combobox input {
    width: 100%;
    min-height: 48px;
    padding: 12px 14px;
    border: 2px solid #b8c0c8;
    border-radius: 8px;
    background: #fff;
    color: #202428;
    font: inherit;
}

.nationality-combobox input::placeholder {
    color: #687078;
}

.nationality-combobox input[aria-expanded="true"] {
    border-color: #1a73e8;
}

.nationality-combobox input[aria-invalid="true"] {
    border-color: #c62828;
}

.nationality-listbox {
    position: absolute;
    z-index: 20;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    max-height: min(280px, 45vh);
    overflow-y: auto;
    margin: 0;
    padding: 6px;
    list-style: none;
    background: #fff;
    border: 1px solid #aeb6bf;
    border-radius: 8px;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.22);
}

.nationality-option,
.nationality-no-results {
    padding: 11px 12px;
    border-radius: 5px;
    color: #202428;
    line-height: 1.35;
}

.nationality-option {
    cursor: pointer;
}

.nationality-option:hover,
.nationality-option.active {
    background: #e8f0fe;
}

.nationality-option[aria-selected="true"] {
    color: #0b57d0;
    font-weight: 700;
}

.nationality-no-results {
    color: #687078;
    cursor: default;
}

.nationality-purpose {
    margin-top: 10px;
    color: #596168;
    font-size: 0.8rem;
    line-height: 1.5;
}

.nationality-error {
    min-height: 1.3em;
    margin-top: 6px;
    color: #b71c1c;
    font-size: 0.82rem;
    font-weight: 600;
}

.submit-btn {
    width: 100%;
    padding: 16px;
    margin-top: 20px;
    background: #1a73e8;
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    -webkit-tap-highlight-color: transparent;
}

.submit-btn:disabled {
    background: #e0e0e0;
    color: #9e9e9e;
    cursor: not-allowed;
}

.submit-btn:not(:disabled):active {
    transform: scale(0.98);
    box-shadow: 0 2px 12px rgba(26, 115, 232, 0.3);
}

.location-notice {
    text-align: center;
    margin-top: 20px;
    padding: 12px;
    background: #e3f2fd;
    border-radius: 8px;
    border: 1px solid #90caf9;
}

.location-notice p {
    color: #1565c0;
    font-size: 0.85rem;
    margin: 0;
}

.location-notice-title {
    font-weight: 700;
    margin-bottom: 6px;
}

.location-notice-detail {
    line-height: 1.5;
}

.location-notice-detail + .location-notice-detail {
    margin-top: 8px;
}

.message {
    text-align: center;
    padding: 15px;
    border-radius: 8px;
    margin-top: 20px;
    display: none;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
    display: block;
}

.message.error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    display: block;
}

.message.warning {
    background: #fff3cd;
    border: 1px solid #ffeeba;
    color: #856404;
    display: block;
}

.loader {
    display: none;
    text-align: center;
    margin: 20px 0;
}

.loader:after {
    content: "";
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.thank-you {
    text-align: center;
    animation: fadeIn 0.5s ease-in;
}

.thank-you-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 3rem;
    color: white;
    animation: scaleIn 0.5s ease-out;
}

@keyframes scaleIn {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.thank-you h2 {
    color: #667eea;
    font-size: 1.8rem;
    margin-bottom: 8px;
    font-weight: 600;
}

.thank-you h3 {
    color: #764ba2;
    font-size: 1.5rem;
    margin-bottom: 20px;
    font-weight: 600;
}

.thank-you p {
    color: #666;
    font-size: 1rem;
}

.hidden {
    display: none;
}

@media (prefers-reduced-motion: reduce) {
    .container,
    .thank-you,
    .thank-you-icon,
    .message,
    .loader:after {
        animation: none !important;
    }
}

@media (max-width: 600px) {
    body {
        background:
            linear-gradient(rgba(18, 24, 18, 0.44), rgba(18, 24, 18, 0.58)),
            url('background.webp') center top / cover no-repeat;
        background-attachment: scroll;
    }

    .language-selector {
        top: 10px;
        right: 10px;
    }
    
    .language-selector select {
        font-size: 0.85rem;
        padding: 6px 10px;
        padding-right: 28px;
    }
    
    .container {
        padding: 30px 20px;
    }

    h1 {
        font-size: 1.5rem;
    }

    .question h2 {
        font-size: 1.1rem;
    }

    .option-btn {
        padding: 15px 20px;
    }

    .option-btn .label {
        font-size: 0.95rem;
    }
    
    .thank-you-icon {
        width: 60px;
        height: 60px;
        font-size: 2rem;
    }
    
    .thank-you h2 {
        font-size: 1.3rem;
    }
    
    .thank-you h3 {
        font-size: 1.1rem;
    }
}
