* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
    font-family: 'Noto Sans', 'Noto Sans Sinhala', 'Noto Sans Tamil', Arial, sans-serif;
    background: #f2f5f7;
    margin: 0;
    padding: 16px;
    color: #1f2d3d;
    line-height: 1.5;
    font-size: 15px;
}
.container {
    max-width: 720px;
    margin: 0 auto;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    padding: 24px 20px 32px;
}
h1 {
    font-size: 20px;
    text-align: center;
    color: #0b6e4f;
    margin-bottom: 4px;
    line-height: 1.3;
}
h2.subtitle {
    font-size: 14px;
    text-align: center;
    font-weight: normal;
    color: #555;
    margin-top: 0;
    margin-bottom: 18px;
}
.intro {
    background: #eaf6f0;
    border-left: 4px solid #0b6e4f;
    padding: 12px 14px;
    border-radius: 6px;
    margin-bottom: 22px;
    font-size: 13.5px;
}
fieldset {
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 16px 14px;
    margin: 0 0 18px;
}
legend {
    font-weight: bold;
    color: #0b6e4f;
    padding: 0 8px;
    font-size: 15px;
}
label { font-weight: 500; }
.field { margin-bottom: 18px; }
.field:last-child { margin-bottom: 0; }
.field label.q-label { display: block; margin-bottom: 8px; }

input[type="number"], input[type="text"], select {
    width: 100%;
    padding: 12px 12px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 16px; /* 16px prevents iOS auto-zoom on focus */
    background: #fff;
    min-height: 46px;
    -webkit-appearance: none;
    appearance: none;
}
select {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23555' stroke-width='2'><polyline points='6 9 12 15 18 9'/></svg>");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 34px;
}
input:focus, select:focus {
    outline: none;
    border-color: #0b6e4f;
    box-shadow: 0 0 0 3px rgba(11,110,79,0.15);
}

/* Radio / checkbox pill groups (sex, token colour, purpose, heard about, overall, recommend) */
.radio-row, .checkbox-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.radio-row label, .checkbox-row label {
    font-weight: normal;
    display: flex;
    align-items: center;
    gap: 7px;
    background: #f7f9fa;
    border: 2px solid #e2e2e2;
    padding: 10px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    min-height: 44px;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
    flex: 1 1 auto;
    justify-content: center;
    text-align: center;
}
.radio-row input[type="radio"], .checkbox-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #0b6e4f;
    flex-shrink: 0;
}
/* Visual feedback for the selected pill (modern browsers) */
.radio-row label:has(input:checked), .checkbox-row label:has(input:checked) {
    background: #0b6e4f;
    border-color: #0b6e4f;
    color: #fff;
    font-weight: 600;
}
.radio-row label:active, .checkbox-row label:active { transform: scale(0.98); }

.other-input { margin-top: 10px; display: none; }
.other-input.show { display: block; }

/* Token colour options — tinted with their actual colour, solid when selected */
.token-option.token-red    { background: #fdecea; border-color: #f3b8b0; color: #922b21; }
.token-option.token-blue   { background: #eaf3fb; border-color: #a9cfec; color: #1b587a; }
.token-option.token-green  { background: #eafaf1; border-color: #a3ddc0; color: #1e7a45; }
.token-option.token-purple { background: #f6eefb; border-color: #d6b3ea; color: #6c3483; }
.token-option.token-yellow { background: #fef9e7; border-color: #f6dd8e; color: #7d6608; }

.token-option.token-red:has(input:checked)    { background: #e74c3c; border-color: #e74c3c; color: #fff; }
.token-option.token-blue:has(input:checked)   { background: #3498db; border-color: #3498db; color: #fff; }
.token-option.token-green:has(input:checked)  { background: #2ecc71; border-color: #2ecc71; color: #fff; }
.token-option.token-purple:has(input:checked) { background: #9b59b6; border-color: #9b59b6; color: #fff; }
.token-option.token-yellow:has(input:checked) { background: #f1c40f; border-color: #f1c40f; color: #3a3000; }

/* ---------------------------------------------
   Service Quality Assessment — mobile-friendly
   card layout (replaces the old wide table)
---------------------------------------------- */
.quality-item {
    border: 1px solid #ececec;
    border-left: 4px solid #ececec;
    border-radius: 10px;
    padding: 12px 14px 14px;
    margin-bottom: 12px;
    background: #fbfcfc;
    transition: background 0.15s ease, border-color 0.15s ease;
}
.quality-item:last-child { margin-bottom: 0; }
.quality-item:has(input[value="needs_improvement"]:checked) {
    border-color: #e74c3c;
    background: #fdf1f0;
}
.quality-item:has(input[value="satisfactory"]:checked) {
    border-color: #f1c40f;
    background: #fefbea;
}
.quality-item:has(input[value="good"]:checked) {
    border-color: #5dade2;
    background: #eff7fc;
}
.quality-item:has(input[value="excellent"]:checked) {
    border-color: #0b6e4f;
    background: #eaf6f0;
}
.quality-text {
    font-size: 14px;
    margin-bottom: 10px;
    font-weight: 500;
}
.quality-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}
@media (min-width: 640px) {
    .quality-options { grid-template-columns: repeat(4, 1fr); }
}
.quality-option {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-align: center;
    border: 2px solid #e2e2e2;
    border-radius: 8px;
    padding: 10px 6px;
    font-size: 12.5px;
    font-weight: 500;
    cursor: pointer;
    min-height: 44px;
    background: #fff;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.quality-option input { position: absolute; opacity: 0; width: 0; height: 0; }
.quality-option:has(input:focus-visible) { outline: 2px solid #0b6e4f; outline-offset: 2px; }

/* Light tint by default so the color is visible before selecting */
.quality-option.level-needs        { background: #fdecea; border-color: #f3b8b0; color: #922b21; }
.quality-option.level-satisfactory { background: #fef9e7; border-color: #f6dd8e; color: #7d6608; }
.quality-option.level-good         { background: #eaf3fb; border-color: #a9cfec; color: #1b587a; }
.quality-option.level-excellent    { background: #eafaf1; border-color: #a3ddc0; color: #0b6e4f; }

/* Solid color once selected */
.quality-option.level-needs:has(input:checked)        { background: #e74c3c; border-color: #e74c3c; color: #fff; }
.quality-option.level-satisfactory:has(input:checked) { background: #f1c40f; border-color: #f1c40f; color: #3a3000; }
.quality-option.level-good:has(input:checked)         { background: #5dade2; border-color: #5dade2; color: #fff; }
.quality-option.level-excellent:has(input:checked)    { background: #0b6e4f; border-color: #0b6e4f; color: #fff; }
.quality-option:active { transform: scale(0.97); }

.quality-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 11.5px;
    color: #666;
    margin: 4px 0 14px;
}
.quality-legend span { display: flex; align-items: center; gap: 4px; }
.quality-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

.required-note { font-size: 12px; color: #888; margin-bottom: 15px; }
.req { color: #c0392b; }

button.submit-btn {
    display: block;
    width: 100%;
    padding: 15px;
    background: #0b6e4f;
    color: #fff;
    font-size: 16px;
    font-weight: bold;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    margin-top: 6px;
    min-height: 50px;
}
button.submit-btn:hover { background: #095c42; }
button.submit-btn:active { transform: scale(0.99); }

.lang-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
    margin-top: 25px;
}
.lang-btn {
    display: block;
    text-decoration: none;
    background: #0b6e4f;
    color: #fff;
    padding: 18px;
    border-radius: 10px;
    text-align: center;
    font-size: 18px;
    font-weight: bold;
    transition: transform 0.1s ease, background 0.2s ease;
    min-height: 44px;
}
.lang-btn:hover { background: #095c42; transform: translateY(-2px); }
.lang-btn:active { transform: scale(0.98); }
.lang-btn small { display:block; font-weight: normal; font-size: 13px; margin-top: 4px; opacity: 0.9; }

.error-box {
    background: #fdecea;
    border-left: 4px solid #c0392b;
    color: #7a1e13;
    padding: 10px 14px;
    border-radius: 6px;
    margin-bottom: 18px;
    font-size: 14px;
}
.thankyou-box {
    text-align: center;
    padding: 40px 10px;
}
.thankyou-box .check {
    font-size: 50px;
    color: #0b6e4f;
}
.back-link {
    display: inline-block;
    margin-top: 20px;
    color: #0b6e4f;
    text-decoration: none;
    font-weight: 500;
}

/* Small phones */
@media (max-width: 380px) {
    body { padding: 10px; font-size: 14px; }
    .container { padding: 18px 14px 26px; border-radius: 10px; }
    h1 { font-size: 18px; }
    fieldset { padding: 12px 10px; }
    .quality-options { grid-template-columns: repeat(2, 1fr); gap: 6px; }
    .quality-option { font-size: 11.5px; padding: 8px 4px; }
}
