:root {
    color-scheme: light;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
    font-synthesis: none;
    text-rendering: optimizeLegibility;
    --ink: #1d1d1f;
    --muted-ink: #565653;
    --action: #0066cc;
    --action-focus: #0071e3;
    --neutral-screen: #f5f5f7;
    --bad-screen: #f28fa1;
    --good-screen: #c8f04e;
    --page-background: var(--good-screen);
    --line: rgba(29, 29, 31, 0.34);
    --space-1: 0.5rem;
    --space-2: 0.75rem;
    --space-3: 1rem;
    --space-4: 1.5rem;
    --space-5: 2rem;
    --radius-card: 1.125rem;
    --radius-pill: 9999px;
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    min-height: 100%;
    background: var(--page-background);
}

:root[data-rating="bad"] {
    --page-background: var(--bad-screen);
}

:root[data-rating="good"] {
    --page-background: var(--good-screen);
}

body {
    min-width: 320px;
    min-height: 100vh;
    min-height: 100svh;
    min-height: 100dvh;
    margin: 0;
    color: var(--ink);
    background: var(--page-background);
    transition: background-color 420ms cubic-bezier(0.2, 0.75, 0.25, 1);
}

button,
a,
input {
    font: inherit;
}

a {
    color: inherit;
}

.page-stage {
    display: grid;
    min-height: 100vh;
    min-height: 100svh;
    min-height: 100dvh;
    justify-items: center;
}

.feedback-device {
    display: flex;
    width: min(100%, 36rem);
    min-height: 100vh;
    min-height: 100svh;
    min-height: 100dvh;
    flex-direction: column;
    padding: max(1rem, env(safe-area-inset-top)) clamp(1.25rem, 4vw, 2rem) max(1rem, env(safe-area-inset-bottom));
}

.topbar {
    display: flex;
    min-height: 2.75rem;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.brand {
    display: inline-flex;
    min-height: 2.5rem;
    align-items: center;
    text-decoration: none;
}

.brand-logo {
    display: block;
    width: auto;
    max-width: 100%;
    height: 2rem;
    max-height: 2.25rem;
    object-fit: contain;
    object-position: left center;
}

.language-switch {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--muted-ink);
    font-size: 0.8125rem;
    letter-spacing: 0.015em;
}

.language-switch a {
    display: inline-flex;
    min-height: 2.75rem;
    align-items: center;
    padding: 0.5rem 0.125rem;
    color: inherit;
    text-decoration: none;
}

.language-switch a[aria-current="page"] {
    color: var(--ink);
    font-weight: 700;
}

.language-switch a:focus-visible,
.brand:focus-visible {
    border-radius: 0.25rem;
    outline: 2px solid var(--action-focus);
    outline-offset: 3px;
}

.feedback-content {
    display: flex;
    flex: 1;
    flex-direction: column;
    justify-content: center;
    gap: 0.75rem;
    padding: 1rem 0 0.5rem;
}

.feedback-content h1 {
    max-width: 21rem;
    min-block-size: 3.36em;
    display: grid;
    align-items: center;
    margin: 0 auto;
    font-size: clamp(1.625rem, 7vw, 2rem);
    font-weight: 650;
    line-height: 1.12;
    letter-spacing: -0.045em;
    text-align: center;
}

.expression-stage {
    display: grid;
    flex: 0 0 auto;
    place-items: center;
}

.expression-art {
    display: block;
    width: clamp(10.5rem, 29svh, 14.5rem);
    max-width: 100%;
    height: auto;
    overflow: visible;
}

.expression {
    visibility: hidden;
    transform-box: fill-box;
    transform-origin: center;
    transition: opacity 260ms ease, transform 360ms cubic-bezier(0.2, 0.75, 0.25, 1);
}

.expression-neutral {
    visibility: visible;
    opacity: 1;
}

.expression-bad,
.expression-good {
    opacity: 0;
    transform: translateY(0.3rem) scale(0.94);
}

:root[data-rating="bad"] .expression-neutral,
:root[data-rating="good"] .expression-neutral {
    visibility: hidden;
    opacity: 0;
    transform: translateY(-0.25rem) scale(0.92);
}

:root[data-rating="bad"] .expression-bad,
:root[data-rating="good"] .expression-good {
    visibility: visible;
    opacity: 1;
    transform: translateY(0) scale(1);
}

.face-line,
.face-mouth-fill,
.face-tongue {
    stroke: #25231d;
    stroke-width: 5.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.face-line {
    fill: none;
}

.face-brow {
    stroke-width: 6;
}

.eye-white {
    fill: rgba(255, 255, 255, 0.32);
    stroke: #25231d;
    stroke-width: 5;
}

.pupil {
    fill: #25231d;
}

.face-mouth-fill {
    fill: #25231d;
}

.face-tongue {
    fill: #ef9aaa;
    stroke-width: 3;
}

.face-cheek {
    stroke: rgba(37, 35, 29, 0.65);
    stroke-width: 4;
}

.feedback-form {
    display: grid;
    gap: 1rem;
    width: 100%;
    max-width: 21rem;
    margin: 0 auto;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    clip-path: inset(50%);
    border: 0;
}

.rating-input {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    clip-path: inset(50%);
}

.rating-fieldset {
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.rating-cards {
    position: relative;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

.rating-card {
    position: relative;
    display: flex;
    min-width: 0;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 0.625rem;
    border: 2px solid rgba(29, 29, 31, 0.2);
    border-radius: var(--radius-card);
    background: rgba(255, 255, 255, 0.38);
    color: var(--ink);
    cursor: pointer;
    text-align: center;
    transition: border-color 180ms ease, background-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.rating-card[for="rating-bad"] {
    grid-area: 1 / 1;
}

.rating-card[for="rating-good"] {
    grid-area: 1 / 2;
}

.rating-card:hover {
    border-color: var(--action);
    background: rgba(255, 255, 255, 0.8);
    transform: translateY(-2px);
}

.rating-input:checked + .rating-card {
    border: 2px solid var(--action);
    background: #fff;
    box-shadow: 0 0 0 1px rgba(0, 102, 204, 0.08);
}

.rating-input:focus-visible + .rating-card {
    outline: 3px solid var(--action-focus);
    outline-offset: 3px;
}

.rating-card-face {
    display: grid;
    width: 2.25rem;
    height: 2.25rem;
    flex: 0 0 auto;
    place-items: center;
}

.rating-card-face svg {
    width: 2rem;
    height: 2rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.rating-card-face circle {
    fill: currentColor;
    stroke: none;
}

.rating-card-label {
    max-width: 100%;
    min-block-size: 2.5em;
    display: grid;
    align-items: center;
    font-size: clamp(0.75rem, 3.5vw, 0.875rem);
    font-weight: 600;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.selection-check {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    display: grid;
    width: 1.25rem;
    height: 1.25rem;
    place-items: center;
    border-radius: 50%;
    background: var(--action);
    color: #fff;
    opacity: 0;
    transform: scale(0.75);
    transition: opacity 180ms ease, transform 180ms ease;
}

.selection-check svg {
    width: 0.875rem;
    height: 0.875rem;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
}

.rating-input:checked + .rating-card .selection-check {
    opacity: 1;
    transform: scale(1);
}

.validation-message {
    margin: 0 0 0.75rem;
    color: #7a1426;
    font-size: 0.875rem;
    line-height: 1.4;
    text-align: center;
}

.submit-button {
    display: inline-flex;
    width: 100%;
    min-height: 3.25rem;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
    margin-top: 0;
    padding: 0.75rem 1.375rem;
    border: 0;
    border-radius: var(--radius-pill);
    background: var(--action);
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 180ms ease, transform 180ms ease;
}

.submit-button:hover {
    background: #0057ad;
}

.submit-button:active {
    transform: scale(0.985);
}

.submit-button:focus-visible {
    outline: 3px solid var(--action-focus);
    outline-offset: 3px;
}

@media (max-height: 42rem) and (min-width: 34.01rem) {
    .feedback-device {
        padding-top: 1rem;
        padding-bottom: 1.125rem;
    }

    .feedback-content h1 {
        font-size: 1.625rem;
    }

    .expression-art {
        width: 10.5rem;
    }

    .submit-button {
        min-height: 3rem;
    }
}

@media (max-width: 22.5rem) {
    .feedback-content h1 {
        font-size: 1.5rem;
    }

}

@media (max-height: 42rem) and (max-width: 34rem) {
    .feedback-device {
        padding-top: max(0.75rem, env(safe-area-inset-top));
        padding-bottom: max(0.75rem, env(safe-area-inset-bottom));
    }

    .feedback-content {
        gap: 0.5rem;
        padding: 0.5rem 0 0.25rem;
    }

    .feedback-content h1 {
        font-size: 1.5rem;
    }

    .expression-art {
        width: 9rem;
    }

    .feedback-form {
        gap: 0.75rem;
    }

    .rating-card {
        gap: 0.375rem;
        padding: 0.625rem 0.5rem;
    }
}

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