:root {
    color-scheme: light;
    --ink: #173b3a;
    --ink-soft: #315b59;
    --muted: #637b78;
    --paper: #fffef9;
    --cream: #fff8e9;
    --line: #d7e8e3;
    --teal: #07877f;
    --teal-dark: #056963;
    --teal-soft: #ddf7ee;
    --mint: #a8e9d5;
    --sun: #ffc83d;
    --sun-soft: #fff4bf;
    --coral: #ff775d;
    --coral-dark: #d85540;
    --coral-soft: #fff0e9;
    --sky: #dff4ff;
    --purple: #7765d8;
    --danger: #b23d4c;
    --success: #208367;
    --shadow-small: 0 10px 28px rgb(22 84 78 / 10%);
    --shadow: 0 24px 64px rgb(22 84 78 / 14%);
    --radius-small: 16px;
    --radius: 28px;
    --radius-large: 38px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

[hidden] {
    display: none !important;
}

body {
    min-width: 280px;
    min-height: 100vh;
    margin: 0;
    padding:
        max(22px, env(safe-area-inset-top))
        max(16px, env(safe-area-inset-right))
        max(40px, env(safe-area-inset-bottom))
        max(16px, env(safe-area-inset-left));
    overflow-x: hidden;
    color: var(--ink);
    background:
        radial-gradient(circle at 8% 8%, rgb(255 119 93 / 18%), transparent 24rem),
        radial-gradient(circle at 92% 18%, rgb(255 200 61 / 26%), transparent 28rem),
        radial-gradient(circle at 75% 92%, rgb(7 135 127 / 15%), transparent 30rem),
        linear-gradient(145deg, #fffaf0 0%, #f5fbf7 48%, #fff7e6 100%);
    font-family: ui-rounded, "Arial Rounded MT Bold", Nunito, Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.5;
}

body::before {
    position: fixed;
    z-index: -2;
    inset: 0;
    content: "";
    opacity: 0.35;
    pointer-events: none;
    background-image: radial-gradient(rgb(7 135 127 / 22%) 1.3px, transparent 1.3px);
    background-size: 28px 28px;
    mask-image: linear-gradient(to bottom, black, transparent 75%);
}

button,
input,
select {
    font: inherit;
}

button,
label,
select {
    -webkit-tap-highlight-color: transparent;
}

button {
    touch-action: manipulation;
}

.page-decor {
    position: fixed;
    z-index: -1;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

.page-decor span {
    position: absolute;
    display: block;
    border-radius: 50%;
    opacity: 0.7;
}

.page-decor span:nth-child(1) {
    top: 7%;
    left: 4%;
    width: 18px;
    height: 18px;
    background: var(--sun);
    box-shadow: 34px 20px 0 -5px var(--coral);
}

.page-decor span:nth-child(2) {
    top: 13%;
    right: 5%;
    width: 22px;
    height: 22px;
    border: 6px solid var(--teal);
    background: transparent;
}

.page-decor span:nth-child(3) {
    top: 48%;
    left: 2%;
    width: 15px;
    height: 54px;
    border-radius: 999px;
    background: var(--purple);
    transform: rotate(28deg);
}

.page-decor span:nth-child(4) {
    right: 2%;
    bottom: 24%;
    width: 20px;
    height: 20px;
    background: var(--coral);
    box-shadow: -27px 23px 0 -4px var(--sun);
}

.page-decor span:nth-child(5) {
    bottom: 5%;
    left: 11%;
    width: 28px;
    height: 28px;
    border: 7px solid var(--mint);
    background: transparent;
}

.app-shell {
    width: min(1160px, 100%);
    margin: 0 auto;
}

.auth-shell {
    display: grid;
    width: min(1120px, 100%);
    min-height: calc(100vh - 62px);
    margin: 0 auto;
    gap: clamp(30px, 6vw, 78px);
    align-items: center;
    grid-template-columns: minmax(0, 1.08fr) minmax(350px, 0.78fr);
}

.brand-lockup {
    display: inline-flex;
    gap: 10px;
    margin-bottom: clamp(36px, 8vh, 78px);
    align-items: center;
    color: var(--ink);
    font-size: 1.05rem;
    font-weight: 900;
    letter-spacing: -0.02em;
    text-decoration: none;
}

.brand-badge {
    display: grid;
    width: 40px;
    height: 40px;
    place-items: center;
    border: 3px solid white;
    border-radius: 14px;
    color: var(--ink);
    background: var(--sun);
    box-shadow: 0 7px 0 rgb(220 159 21 / 22%);
    transform: rotate(-4deg);
}

.eyebrow,
.section-kicker {
    margin: 0 0 10px;
    color: var(--coral-dark);
    font-size: 0.76rem;
    font-weight: 900;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

h1,
h2,
p {
    margin-top: 0;
}

h1,
h2 {
    text-wrap: balance;
}

h1 {
    max-width: 720px;
    margin-bottom: 20px;
    font-size: clamp(3rem, 7.6vw, 5.8rem);
    font-weight: 950;
    letter-spacing: -0.065em;
    line-height: 0.96;
    overflow-wrap: break-word;
}

h2 {
    margin-bottom: 7px;
    font-size: clamp(1.8rem, 4vw, 2.55rem);
    font-weight: 950;
    letter-spacing: -0.045em;
    line-height: 1.05;
}

.title-highlight {
    position: relative;
    display: inline-block;
    color: var(--teal);
    white-space: nowrap;
}

.title-highlight::after {
    position: absolute;
    z-index: -1;
    right: -3px;
    bottom: 0.03em;
    left: -3px;
    height: 0.17em;
    content: "";
    border-radius: 999px;
    background: var(--sun);
    transform: rotate(-1.5deg);
}

.intro {
    max-width: 640px;
    margin-bottom: 0;
    color: var(--ink-soft);
    font-family: Inter, ui-sans-serif, system-ui, sans-serif;
    font-size: clamp(1rem, 2.3vw, 1.2rem);
    line-height: 1.65;
}

.auth-buddy {
    position: relative;
    display: flex;
    max-width: 470px;
    gap: 12px;
    margin-top: 26px;
    padding: 12px 52px 12px 10px;
    align-items: center;
    border: 2px solid rgb(7 135 127 / 16%);
    border-radius: 25px;
    background: rgb(255 255 255 / 80%);
    box-shadow: var(--shadow-small);
    backdrop-filter: blur(12px);
}

.auth-buddy img {
    width: 82px;
    height: 94px;
    flex: 0 0 auto;
    object-fit: contain;
    filter: drop-shadow(0 8px 8px rgb(23 59 58 / 16%));
    animation: buddy-float 3.6s ease-in-out infinite;
}

.auth-buddy p,
.result-cheer p {
    display: grid;
    min-width: 0;
    gap: 3px;
    margin: 0;
    font-family: Inter, ui-sans-serif, system-ui, sans-serif;
}

.auth-buddy strong,
.result-cheer strong {
    color: var(--teal-dark);
    font-family: ui-rounded, "Arial Rounded MT Bold", system-ui, sans-serif;
    font-size: 1.02rem;
}

.auth-buddy p span,
.result-cheer p span {
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.4;
}

.buddy-wave {
    position: absolute;
    top: -14px;
    right: -9px;
    display: grid;
    width: 48px;
    height: 48px;
    place-items: center;
    border: 3px solid white;
    border-radius: 50%;
    background: var(--sun);
    box-shadow: var(--shadow-small);
    font-size: 1.25rem;
    animation: wave 2s ease-in-out infinite;
}

.mission-perks {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 18px;
}

.mission-perks span,
.hero-chips > span {
    display: inline-flex;
    gap: 7px;
    padding: 8px 12px;
    align-items: center;
    border: 1px solid rgb(7 135 127 / 13%);
    border-radius: 999px;
    color: var(--ink-soft);
    background: rgb(255 255 255 / 72%);
    box-shadow: 0 5px 14px rgb(22 84 78 / 6%);
    font-size: 0.78rem;
    font-weight: 800;
}

.card {
    position: relative;
    margin-bottom: 30px;
    padding: clamp(24px, 5vw, 48px);
    overflow: hidden;
    border: 2px solid rgb(255 255 255 / 90%);
    border-radius: var(--radius-large);
    background: rgb(255 254 249 / 93%);
    box-shadow: var(--shadow);
    backdrop-filter: blur(12px);
}

.auth-card {
    margin: 30px 0;
    padding: clamp(24px, 4vw, 38px);
    border-top: 7px solid var(--sun);
}

.auth-card::after,
.upload-card::after,
.results-card::after {
    position: absolute;
    z-index: -1;
    top: -55px;
    right: -58px;
    width: 150px;
    height: 150px;
    content: "";
    border-radius: 50%;
    background: rgb(255 200 61 / 15%);
}

.auth-card-heading {
    display: flex;
    gap: 13px;
    margin-bottom: 23px;
    align-items: center;
}

.auth-card-heading .eyebrow {
    margin-bottom: 4px;
}

.auth-card-heading h2 {
    margin: 0;
    font-size: clamp(1.55rem, 4vw, 2rem);
}

.mini-star {
    display: grid;
    width: 46px;
    height: 46px;
    flex: 0 0 46px;
    place-items: center;
    border-radius: 15px;
    color: white;
    background: var(--coral);
    box-shadow: 0 7px 0 rgb(196 68 47 / 16%);
    transform: rotate(-4deg);
}

.auth-tabs {
    display: grid;
    gap: 5px;
    margin-bottom: 22px;
    padding: 5px;
    border-radius: 17px;
    background: var(--teal-soft);
    grid-template-columns: 1fr 1fr;
}

button.auth-tab {
    min-height: 48px;
    margin: 0;
    padding: 0 10px;
    justify-content: center;
    border-radius: 13px;
    color: var(--teal-dark);
    background: transparent;
    box-shadow: none;
    font-size: 0.88rem;
}

button.auth-tab.active {
    color: white;
    background: linear-gradient(125deg, var(--teal), var(--teal-dark));
    box-shadow: 0 7px 16px rgb(7 105 99 / 20%);
}

button.auth-tab:hover:not(:disabled):not(.active) {
    color: var(--teal-dark);
    background: rgb(255 255 255 / 65%);
    transform: none;
}

.auth-form,
#tidy-form {
    display: grid;
    gap: 15px;
}

.input-group,
.field-block {
    display: grid;
    gap: 7px;
}

.input-group label,
.field-block > label,
.file-picker legend {
    color: var(--ink);
    font-size: 0.78rem;
    font-weight: 900;
    letter-spacing: 0.055em;
    text-transform: uppercase;
}

.auth-form input,
select {
    width: 100%;
    min-width: 0;
    min-height: 54px;
    border: 2px solid var(--line);
    border-radius: 15px;
    outline: none;
    color: var(--ink);
    background: #fff;
    font-family: Inter, ui-sans-serif, system-ui, sans-serif;
    transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.auth-form input {
    padding: 0 15px;
}

.auth-form input::placeholder {
    color: #9aaba8;
}

.auth-form input:focus-visible,
select:focus-visible {
    border-color: var(--teal);
    outline: none;
    box-shadow: 0 0 0 4px rgb(7 135 127 / 14%);
}

.auth-reassurance {
    margin: 18px 0 0;
    color: var(--muted);
    font-family: Inter, ui-sans-serif, system-ui, sans-serif;
    font-size: 0.75rem;
    text-align: center;
}

.account-bar {
    position: sticky;
    z-index: 20;
    top: max(10px, env(safe-area-inset-top));
    display: flex;
    margin-top: 2px;
    padding: 9px 11px 9px 9px;
    align-items: center;
    justify-content: space-between;
    border: 2px solid rgb(255 255 255 / 90%);
    border-radius: 22px;
    background: rgb(255 254 249 / 90%);
    box-shadow: var(--shadow-small);
    backdrop-filter: blur(18px);
}

.account-person {
    display: flex;
    min-width: 0;
    gap: 10px;
    align-items: center;
}

.account-person > span:last-child {
    display: grid;
    min-width: 0;
    gap: 1px;
}

.account-person strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-avatar {
    display: grid;
    width: 46px;
    height: 46px;
    flex: 0 0 46px;
    overflow: hidden;
    place-items: center;
    border-radius: 15px;
    background: linear-gradient(145deg, var(--teal-soft), var(--sun-soft));
}

.account-avatar img {
    width: 43px;
    height: 43px;
    object-fit: contain;
}

.account-label {
    color: var(--muted);
    font-size: 0.66rem;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.account-actions {
    display: flex;
    gap: 8px;
}

button.account-nav-button {
    width: auto;
    min-height: 40px;
    margin: 0;
    padding: 0 13px;
    gap: 6px;
    justify-content: center;
    border: 2px solid transparent;
    border-radius: 13px;
    color: var(--ink-soft);
    background: transparent;
    box-shadow: none;
    font-size: 0.76rem;
}

button.account-nav-button:hover:not(:disabled),
button.account-nav-button.active {
    border-color: rgb(7 135 127 / 18%);
    color: var(--teal-dark);
    background: var(--teal-soft);
    box-shadow: none;
    transform: none;
}

button.text-button {
    width: auto;
    min-height: 40px;
    margin: 0;
    padding: 0 14px;
    justify-content: center;
    border: 2px solid var(--coral-soft);
    border-radius: 13px;
    color: var(--coral-dark);
    background: var(--coral-soft);
    box-shadow: none;
    font-size: 0.78rem;
}

button.text-button:hover:not(:disabled) {
    color: white;
    background: var(--coral-dark);
}

.mobile-bottom-nav {
    display: none;
}

button.mobile-nav-button {
    width: 100%;
    min-width: 0;
    min-height: 60px;
    margin: 0;
    padding: 6px 4px;
    gap: 3px;
    align-items: center;
    flex-direction: column;
    justify-content: center;
    border: 1px solid transparent;
    border-radius: 20px;
    color: #55716e;
    background: transparent;
    box-shadow: none;
    font-size: 0.64rem;
    font-weight: 900;
    line-height: 1;
}

.mobile-nav-icon {
    display: grid;
    width: 29px;
    height: 29px;
    place-items: center;
}

.mobile-nav-icon svg {
    width: 27px;
    height: 27px;
    fill: currentColor;
    filter: drop-shadow(0 1px 2px rgb(18 75 70 / 14%));
    transition: transform 180ms ease, filter 180ms ease;
}

button.mobile-nav-button:hover:not(:disabled),
button.mobile-nav-button:active:not(:disabled) {
    filter: none;
    box-shadow: none;
    transform: none;
}

button.mobile-nav-button.active {
    border-color: rgb(7 135 127 / 14%);
    color: var(--teal-dark);
    background: linear-gradient(180deg, rgb(255 255 255 / 62%), rgb(209 248 239 / 48%));
    box-shadow:
        inset 0 1px 0 rgb(255 255 255 / 78%),
        0 6px 16px rgb(7 112 105 / 10%);
}

button.mobile-nav-button.active .mobile-nav-icon svg {
    filter: drop-shadow(0 3px 5px rgb(7 135 127 / 18%));
    transform: translateY(-1px);
}

.app-page {
    padding-top: clamp(32px, 6vw, 62px);
    padding-bottom: 30px;
}

.page-view-heading {
    position: relative;
    display: flex;
    min-height: 230px;
    margin-bottom: 28px;
    padding: clamp(28px, 5vw, 48px);
    overflow: hidden;
    align-items: center;
    justify-content: space-between;
    border: 3px solid white;
    border-radius: var(--radius-large);
    background: linear-gradient(125deg, rgb(221 247 238 / 96%), rgb(255 244 191 / 92%));
    box-shadow: var(--shadow);
}

.page-view-heading::after {
    position: absolute;
    right: 16%;
    bottom: -55px;
    width: 145px;
    height: 145px;
    content: "";
    border: 25px solid rgb(255 255 255 / 42%);
    border-radius: 50%;
}

.page-view-heading > div:first-child {
    position: relative;
    z-index: 1;
    max-width: 720px;
}

.page-view-heading h1 {
    margin-bottom: 12px;
    font-size: clamp(2.7rem, 6vw, 5rem);
}

.page-view-heading p:last-child {
    max-width: 680px;
    margin-bottom: 0;
    color: var(--ink-soft);
    font-family: Inter, ui-sans-serif, system-ui, sans-serif;
    font-size: clamp(0.95rem, 2vw, 1.13rem);
}

.profile-heading {
    background: linear-gradient(125deg, rgb(223 244 255 / 96%), rgb(255 240 233 / 94%));
}

.admin-heading {
    background: linear-gradient(125deg, rgb(221 247 238 / 97%), rgb(223 244 255 / 94%));
}

.page-buddy {
    position: relative;
    z-index: 1;
    width: 180px;
    height: 150px;
    flex: 0 0 180px;
}

.page-buddy img {
    position: absolute;
    right: 4px;
    bottom: -25px;
    width: 145px;
    height: 170px;
    object-fit: contain;
    filter: drop-shadow(0 14px 15px rgb(23 59 58 / 18%));
}

.page-buddy span {
    position: absolute;
    z-index: 2;
    top: -8px;
    left: 3px;
    display: grid;
    width: 58px;
    height: 58px;
    place-items: center;
    border: 4px solid white;
    border-radius: 20px;
    background: var(--sun);
    box-shadow: var(--shadow-small);
    font-size: 1.7rem;
    transform: rotate(-7deg);
}

.history-toolbar {
    display: flex;
    margin-bottom: 22px;
    padding: 17px 20px;
    gap: 18px;
    align-items: center;
    justify-content: space-between;
    border: 2px solid var(--line);
    border-radius: 22px;
    background: rgb(255 255 255 / 80%);
}

.history-toolbar p {
    display: grid;
    gap: 2px;
    margin: 0;
}

.history-toolbar p span {
    color: var(--muted);
    font-family: Inter, ui-sans-serif, system-ui, sans-serif;
    font-size: 0.76rem;
}

button.compact-button {
    min-height: 42px;
    padding: 0 15px;
    font-size: 0.76rem;
}

.page-loading {
    display: flex;
    min-height: 100px;
    gap: 13px;
    align-items: center;
    justify-content: center;
    color: var(--teal-dark);
    font-weight: 900;
}

.history-list {
    display: grid;
    gap: 24px;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 470px), 1fr));
}

.history-card {
    padding: 18px;
    overflow: hidden;
    border: 3px solid white;
    border-radius: 30px;
    background: rgb(255 254 249 / 94%);
    box-shadow: var(--shadow);
}

.history-card-header {
    display: flex;
    margin-bottom: 14px;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
}

.history-room {
    display: flex;
    gap: 10px;
    align-items: center;
}

.history-room > span {
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;
    border-radius: 15px;
    background: var(--teal-soft);
    font-size: 1.3rem;
}

.history-room strong,
.history-room small {
    display: block;
}

.history-room small {
    color: var(--muted);
    font-family: Inter, ui-sans-serif, system-ui, sans-serif;
    font-size: 0.68rem;
}

.history-score {
    display: grid;
    min-width: 66px;
    min-height: 56px;
    padding: 7px 10px;
    place-items: center;
    border: 2px solid #ffe187;
    border-radius: 17px;
    color: var(--ink);
    background: var(--sun-soft);
    line-height: 1;
}

.history-score strong {
    font-size: 1.15rem;
}

.history-score small {
    color: var(--muted);
    font-size: 0.6rem;
    text-transform: uppercase;
}

.history-images {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.history-image {
    position: relative;
    min-height: 180px;
    overflow: hidden;
    border-radius: 20px;
    background: linear-gradient(135deg, #e7f3ef, #fff4d2);
}

.history-image img {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 180px;
    max-height: 260px;
    object-fit: cover;
}

.history-image span {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 5px 9px;
    border: 2px solid rgb(255 255 255 / 80%);
    border-radius: 999px;
    color: white;
    background: rgb(23 59 58 / 82%);
    font-size: 0.62rem;
    font-weight: 950;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.history-image.unavailable {
    display: grid;
    place-items: center;
}

.history-image.unavailable p {
    margin: 0;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 900;
}

.history-image.after span {
    color: var(--ink);
    background: rgb(255 200 61 / 93%);
}

.history-card-footer {
    display: flex;
    margin-top: 13px;
    gap: 8px;
    align-items: center;
    justify-content: space-between;
    color: var(--muted);
    font-family: Inter, ui-sans-serif, system-ui, sans-serif;
    font-size: 0.7rem;
}

.history-rating {
    color: var(--teal-dark);
    font-weight: 900;
}

.empty-history {
    text-align: center;
}

.empty-history > span {
    display: block;
    margin-bottom: 8px;
    font-size: 3.5rem;
}

.empty-history p {
    max-width: 520px;
    margin-right: auto;
    margin-left: auto;
    color: var(--muted);
}

.empty-history button {
    width: min(300px, 100%);
    margin-right: auto;
    margin-left: auto;
}

.profile-layout {
    display: grid;
    gap: 26px;
    align-items: stretch;
    grid-template-columns: minmax(280px, 0.85fr) minmax(0, 1.15fr);
}

.profile-layout .card {
    margin-bottom: 0;
}

.profile-card {
    text-align: center;
}

.profile-avatar {
    display: grid;
    width: 130px;
    height: 130px;
    margin: 0 auto 18px;
    overflow: hidden;
    place-items: center;
    border: 7px solid white;
    border-radius: 40px;
    background: linear-gradient(145deg, var(--teal-soft), var(--sun-soft));
    box-shadow: 0 12px 0 rgb(7 135 127 / 10%);
    transform: rotate(-2deg);
}

.profile-avatar img {
    width: 118px;
    height: 118px;
    object-fit: contain;
}

.profile-email {
    margin-bottom: 22px;
    color: var(--teal-dark);
    font-family: Inter, ui-sans-serif, system-ui, sans-serif;
    overflow-wrap: anywhere;
}

.profile-details {
    display: grid;
    margin: 0;
    gap: 10px;
    text-align: left;
}

.profile-details div {
    padding: 12px 14px;
    border: 2px solid var(--line);
    border-radius: 16px;
    background: #fbfdfa;
}

.profile-details dt {
    color: var(--muted);
    font-size: 0.65rem;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.profile-details dd {
    margin: 2px 0 0;
    font-weight: 900;
    overflow-wrap: anywhere;
}

.profile-details .profile-status {
    display: flex;
    align-items: center;
    gap: 7px;
    color: var(--teal-dark);
}

.profile-status span {
    width: 9px;
    height: 9px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: #20b486;
    box-shadow: 0 0 0 4px rgb(32 180 134 / 14%);
}

.profile-status.disabled {
    color: var(--danger);
}

.profile-status.disabled span {
    background: var(--danger);
    box-shadow: 0 0 0 4px rgb(178 61 76 / 12%);
}

.profile-privacy,
.achievement-note {
    margin: 20px 0 0;
    padding: 13px 15px;
    border-radius: 16px;
    color: var(--muted);
    background: var(--sky);
    font-family: Inter, ui-sans-serif, system-ui, sans-serif;
    font-size: 0.72rem;
}

.achievement-card {
    background: linear-gradient(150deg, rgb(255 254 249 / 96%), rgb(255 248 225 / 96%));
}

.profile-stats {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.profile-stats div {
    display: grid;
    min-height: 150px;
    padding: 18px;
    place-items: center;
    border: 3px solid white;
    border-radius: 24px;
    background: var(--teal-soft);
    box-shadow: 0 8px 0 rgb(7 135 127 / 8%);
    text-align: center;
}

.profile-stats div:nth-child(2),
.profile-stats div:nth-child(3) {
    background: var(--sun-soft);
}

.profile-stats span {
    font-size: 1.55rem;
}

.profile-stats strong {
    font-size: clamp(2rem, 5vw, 3rem);
    line-height: 1;
}

.profile-stats small {
    color: var(--ink-soft);
    font-size: 0.68rem;
    font-weight: 900;
    text-transform: uppercase;
}

.admin-toolbar {
    display: flex;
    margin-bottom: 22px;
    padding: 17px 20px;
    gap: 18px;
    align-items: center;
    justify-content: space-between;
    border: 2px solid var(--line);
    border-radius: 22px;
    background: rgb(255 255 255 / 80%);
}

.admin-toolbar p {
    display: grid;
    gap: 2px;
    margin: 0;
}

.admin-toolbar p span,
.admin-panel-heading p {
    color: var(--muted);
    font-family: Inter, ui-sans-serif, system-ui, sans-serif;
    font-size: 0.76rem;
}

.admin-stats {
    display: grid;
    margin-bottom: 24px;
    gap: 16px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.admin-stats article {
    display: grid;
    min-height: 145px;
    padding: 18px;
    place-items: center;
    border: 3px solid white;
    border-radius: 25px;
    background: linear-gradient(145deg, var(--teal-soft), #f6fffc);
    box-shadow: var(--shadow-small);
    text-align: center;
}

.admin-stats article:nth-child(2),
.admin-stats article:nth-child(4) {
    background: linear-gradient(145deg, var(--sun-soft), #fffdf4);
}

.admin-stats article > span {
    font-size: 1.5rem;
}

.admin-stats strong {
    font-size: clamp(2rem, 4vw, 2.8rem);
    line-height: 1;
}

.admin-stats small {
    color: var(--ink-soft);
    font-size: 0.67rem;
    font-weight: 900;
    text-transform: uppercase;
}

.admin-users-panel {
    margin-bottom: 0;
}

.admin-panel-heading {
    display: flex;
    margin-bottom: 22px;
    gap: 20px;
    align-items: end;
    justify-content: space-between;
}

.admin-panel-heading h2,
.admin-panel-heading p {
    margin-bottom: 0;
}

.admin-search {
    display: grid;
    width: min(330px, 100%);
    gap: 6px;
    color: var(--ink-soft);
    font-size: 0.7rem;
    font-weight: 900;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.admin-search input {
    width: 100%;
    min-height: 47px;
    padding: 0 14px;
    border: 2px solid var(--line);
    border-radius: 14px;
    outline: none;
    color: var(--ink);
    background: white;
    font-family: Inter, ui-sans-serif, system-ui, sans-serif;
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: normal;
    text-transform: none;
}

.admin-search input:focus-visible {
    border-color: var(--teal);
    box-shadow: 0 0 0 4px rgb(7 135 127 / 14%);
}

.admin-user-list {
    display: grid;
    gap: 14px;
}

.admin-user-card {
    display: grid;
    padding: 17px;
    gap: 15px 18px;
    align-items: center;
    grid-template-columns: minmax(210px, 1fr) auto;
    border: 2px solid var(--line);
    border-radius: 22px;
    background: #fbfdfa;
}

.admin-user-identity {
    display: flex;
    min-width: 0;
    gap: 12px;
    align-items: center;
}

.admin-user-avatar {
    display: grid;
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    place-items: center;
    border-radius: 16px;
    color: white;
    background: linear-gradient(145deg, var(--teal), var(--teal-dark));
    box-shadow: 0 6px 0 rgb(7 105 99 / 12%);
    font-size: 1.1rem;
}

.admin-user-identity > div {
    min-width: 0;
}

.admin-user-identity h3,
.admin-user-identity p {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.admin-user-identity h3 {
    margin: 0;
    font-size: 1rem;
}

.admin-user-identity p {
    margin: 2px 0 0;
    color: var(--muted);
    font-family: Inter, ui-sans-serif, system-ui, sans-serif;
    font-size: 0.76rem;
}

.admin-user-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    justify-content: flex-end;
}

.admin-role-badge,
.admin-status-badge,
.admin-protected-label {
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 0.64rem;
    font-weight: 900;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.admin-role-badge {
    color: var(--teal-dark);
    background: var(--teal-soft);
}

.admin-role-badge.admin {
    color: #5744be;
    background: #eeeaff;
}

.admin-status-badge.active {
    color: var(--success);
    background: #e5faef;
}

.admin-status-badge.disabled {
    color: var(--danger);
    background: #fff0f1;
}

.admin-user-facts {
    display: grid;
    margin: 0;
    gap: 9px;
    grid-column: 1 / -1;
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.admin-user-facts div {
    padding: 10px 12px;
    border-radius: 13px;
    background: white;
}

.admin-user-facts dt {
    color: var(--muted);
    font-size: 0.6rem;
    font-weight: 900;
    text-transform: uppercase;
}

.admin-user-facts dd {
    margin: 2px 0 0;
    overflow-wrap: anywhere;
    font-size: 0.76rem;
    font-weight: 900;
}

.admin-user-actions {
    display: flex;
    grid-column: 1 / -1;
    justify-content: flex-end;
}

.admin-user-actions button {
    width: auto;
    min-height: 39px;
    margin: 0;
    padding: 0 14px;
    justify-content: center;
    border-radius: 12px;
    box-shadow: none;
    font-size: 0.7rem;
}

.admin-user-actions button.admin-disable-button {
    color: var(--danger);
    background: #fff0f1;
}

.admin-user-actions button.admin-activate-button {
    color: white;
    background: var(--teal);
}

.admin-protected-label {
    color: #5744be;
    background: #eeeaff;
}

.admin-users-empty {
    padding: 35px 20px;
    color: var(--muted);
    text-align: center;
}

.admin-users-empty > span {
    font-size: 2rem;
}

.admin-privacy {
    margin: 20px 0 0;
    padding: 13px 15px;
    border-radius: 16px;
    color: var(--muted);
    background: var(--sky);
    font-family: Inter, ui-sans-serif, system-ui, sans-serif;
    font-size: 0.72rem;
}

.hero {
    display: grid;
    padding: clamp(46px, 8vw, 88px) clamp(4px, 2vw, 20px) clamp(34px, 6vw, 62px);
    gap: clamp(30px, 6vw, 78px);
    align-items: center;
    grid-template-columns: minmax(0, 1fr) minmax(290px, 410px);
}

.hero-copy {
    max-width: 720px;
}

.hero-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    margin-top: 24px;
}

.hero-chips > span {
    padding: 8px 13px 8px 8px;
}

.hero-chips b {
    display: grid;
    width: 26px;
    height: 26px;
    place-items: center;
    border-radius: 50%;
    color: white;
    background: var(--teal);
    font-size: 0.7rem;
}

.hero-chips span:nth-child(2) b {
    color: var(--ink);
    background: var(--sun);
}

.hero-chips span:nth-child(3) b {
    background: var(--coral);
}

.buddy-card {
    position: relative;
    display: grid;
    min-height: 320px;
    padding: 15px 18px 19px;
    place-items: center;
    border: 3px solid rgb(255 255 255 / 90%);
    border-radius: 38px 38px 38px 12px;
    background:
        radial-gradient(circle at 83% 16%, rgb(255 200 61 / 44%) 0 9%, transparent 9.5%),
        radial-gradient(circle at 14% 24%, rgb(255 119 93 / 22%) 0 8%, transparent 8.5%),
        linear-gradient(145deg, #ffffff 0%, #eafcf5 58%, #fff6ce 100%);
    box-shadow: var(--shadow);
}

.buddy-card::before,
.buddy-card::after {
    position: absolute;
    content: "";
    border-radius: 50%;
    background: var(--teal);
}

.buddy-card::before {
    top: 28px;
    left: 28px;
    width: 10px;
    height: 10px;
    box-shadow: 15px -12px 0 -2px var(--coral), 31px 5px 0 -3px var(--sun);
}

.buddy-card::after {
    right: 26px;
    bottom: 83px;
    width: 8px;
    height: 8px;
    box-shadow: -14px 10px 0 -2px var(--purple);
}

.buddy-visual {
    position: relative;
    display: grid;
    width: 100%;
    min-height: 220px;
    place-items: center;
}

.buddy-visual img {
    display: block;
    width: clamp(180px, 22vw, 255px);
    max-height: 240px;
    object-fit: contain;
    filter: drop-shadow(0 15px 13px rgb(23 59 58 / 19%));
    animation: buddy-float 3.6s ease-in-out infinite;
}

.mascot-emote {
    position: absolute;
    z-index: 2;
    top: 2px;
    right: 8%;
    display: grid;
    width: 55px;
    height: 55px;
    place-items: center;
    border: 4px solid white;
    border-radius: 50%;
    background: var(--sun);
    box-shadow: 0 9px 20px rgb(23 59 58 / 18%);
    font-size: 1.5rem;
    animation: emote-pop 2.8s ease-in-out infinite;
}

.buddy-speech {
    position: relative;
    display: grid;
    width: 100%;
    gap: 3px;
    padding: 14px 16px;
    border: 2px solid rgb(7 135 127 / 10%);
    border-radius: 19px;
    color: var(--muted);
    background: white;
    box-shadow: 0 9px 22px rgb(22 84 78 / 10%);
    font-family: Inter, ui-sans-serif, system-ui, sans-serif;
    font-size: 0.85rem;
    line-height: 1.4;
}

.buddy-speech::before {
    position: absolute;
    top: -9px;
    left: 50%;
    width: 18px;
    height: 18px;
    content: "";
    border-top: 2px solid rgb(7 135 127 / 10%);
    border-left: 2px solid rgb(7 135 127 / 10%);
    background: white;
    transform: translateX(-50%) rotate(45deg);
}

.buddy-speech strong,
.buddy-speech span {
    position: relative;
}

.buddy-speech strong {
    color: var(--teal-dark);
    font-family: ui-rounded, "Arial Rounded MT Bold", system-ui, sans-serif;
    font-size: 1rem;
}

.buddy-card[data-state="loading"] {
    border-color: rgb(255 200 61 / 80%);
}

.buddy-card[data-state="loading"] .buddy-visual img {
    animation: buddy-bounce 850ms ease-in-out infinite;
}

.buddy-card[data-state="success"] {
    border-color: var(--sun);
    box-shadow: 0 24px 64px rgb(255 200 61 / 22%);
}

.buddy-card[data-state="error"] {
    border-color: rgb(255 119 93 / 65%);
}

.upload-card {
    border-top: 7px solid var(--teal);
}

.results-card {
    border-top: 7px solid var(--sun);
}

.section-heading {
    display: flex;
    gap: 17px;
    margin-bottom: 32px;
    align-items: flex-start;
}

.section-heading > div {
    min-width: 0;
}

.section-heading p:not(.section-kicker) {
    margin-bottom: 0;
    color: var(--muted);
    font-family: Inter, ui-sans-serif, system-ui, sans-serif;
    line-height: 1.5;
}

.section-kicker {
    margin-bottom: 4px;
}

.step-number {
    display: grid;
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    place-items: center;
    border: 4px solid white;
    border-radius: 17px;
    color: white;
    background: var(--teal);
    box-shadow: 0 7px 0 rgb(5 105 99 / 20%);
    font-size: 1rem;
    font-weight: 950;
    transform: rotate(-3deg);
}

.success-step {
    color: var(--ink);
    background: var(--sun);
    box-shadow: 0 7px 0 rgb(214 157 23 / 19%);
}

.field-block {
    margin-bottom: 4px;
}

.select-wrap {
    position: relative;
}

.select-wrap::after {
    position: absolute;
    top: 50%;
    right: 18px;
    content: "\2304";
    pointer-events: none;
    color: var(--teal-dark);
    font-size: 1.2rem;
    font-weight: 950;
    transform: translateY(-58%);
}

.select-icon {
    position: absolute;
    z-index: 1;
    top: 50%;
    left: 15px;
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border-radius: 11px;
    background: var(--teal-soft);
    transform: translateY(-50%);
}

select {
    padding: 0 48px 0 60px;
    appearance: none;
    cursor: pointer;
    font-weight: 750;
}

select:focus-visible,
.file-action:focus-within,
button:focus-visible {
    outline: 4px solid rgb(255 200 61 / 50%);
    outline-offset: 3px;
}

input[type="file"] {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
}

.file-picker {
    min-width: 0;
    margin: 10px 0 0;
    padding: 0;
    border: 0;
}

.file-picker legend {
    margin-bottom: 11px;
    padding: 0;
}

.file-actions {
    display: grid;
    gap: 13px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.file-action {
    position: relative;
    display: flex;
    min-height: 128px;
    gap: 14px;
    padding: 20px;
    cursor: pointer;
    align-items: center;
    border: 2px dashed rgb(7 135 127 / 42%);
    border-radius: 22px;
    background: linear-gradient(145deg, #f4fffb, #e4f9f1);
    text-align: left;
    transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.file-action.secondary {
    border-color: rgb(226 157 14 / 48%);
    border-style: solid;
    background: linear-gradient(145deg, #fffdf6, #fff3c9);
}

.file-action:hover {
    border-color: var(--teal);
    box-shadow: 0 12px 26px rgb(22 84 78 / 12%);
    transform: translateY(-3px) rotate(-0.4deg);
}

.file-action.secondary:hover {
    border-color: #e29d0e;
    transform: translateY(-3px) rotate(0.4deg);
}

.action-icon {
    display: grid;
    width: 52px;
    height: 52px;
    flex: 0 0 52px;
    place-items: center;
    border: 3px solid white;
    border-radius: 17px;
    background: var(--teal);
    box-shadow: 0 7px 0 rgb(5 105 99 / 18%);
    font-size: 1.45rem;
    transform: rotate(-3deg);
}

.file-action.secondary .action-icon {
    background: var(--sun);
    box-shadow: 0 7px 0 rgb(214 157 23 / 18%);
    transform: rotate(3deg);
}

.file-action-copy {
    display: grid;
    gap: 3px;
}

.file-action-copy strong {
    color: var(--ink);
    font-size: 0.92rem;
    line-height: 1.25;
}

.file-action-copy small {
    color: var(--muted);
    font-family: Inter, ui-sans-serif, system-ui, sans-serif;
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1.35;
}

.file-selection {
    display: flex;
    gap: 10px;
    margin-top: 12px;
    padding: 11px 13px;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 15px;
    background: #f9fcfa;
}

.file-selection > span:last-child {
    display: grid;
    min-width: 0;
}

.file-check {
    display: grid;
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    place-items: center;
    border-radius: 10px;
    color: var(--teal-dark);
    background: var(--teal-soft);
    font-weight: 950;
}

.file-name {
    margin: 0;
    overflow-wrap: anywhere;
    color: var(--ink);
    font-size: 0.84rem;
}

.file-selection small {
    color: var(--muted);
    font-family: Inter, ui-sans-serif, system-ui, sans-serif;
    font-size: 0.72rem;
}

.preview-wrap {
    position: relative;
    max-height: 430px;
    margin-top: 4px;
    overflow: hidden;
    border: 4px solid white;
    border-radius: 24px;
    background: var(--teal-soft);
    box-shadow: 0 10px 28px rgb(22 84 78 / 13%);
}

.preview-wrap img {
    display: block;
    width: 100%;
    max-height: 430px;
    object-fit: contain;
}

.preview-label {
    position: absolute;
    z-index: 1;
    top: 12px;
    left: 12px;
    padding: 7px 11px;
    border: 2px solid rgb(255 255 255 / 72%);
    border-radius: 999px;
    color: white;
    background: rgb(5 105 99 / 88%);
    font-size: 0.68rem;
    font-weight: 900;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    backdrop-filter: blur(8px);
}

.capture-guidance {
    display: flex;
    gap: 12px;
    margin: 5px 0 0;
    padding: 13px 15px;
    align-items: flex-start;
    border: 2px solid rgb(119 101 216 / 13%);
    border-radius: 17px;
    color: var(--muted);
    background: #f4f1ff;
    font-family: Inter, ui-sans-serif, system-ui, sans-serif;
    font-size: 0.82rem;
    line-height: 1.5;
}

.guidance-icon {
    font-size: 1.25rem;
}

.capture-guidance strong {
    display: block;
    color: #5947b8;
    font-family: ui-rounded, "Arial Rounded MT Bold", system-ui, sans-serif;
}

button {
    display: flex;
    width: 100%;
    min-height: 58px;
    margin-top: 10px;
    padding: 0 20px;
    cursor: pointer;
    align-items: center;
    justify-content: space-between;
    border: 0;
    border-radius: 17px;
    color: white;
    background: linear-gradient(120deg, var(--teal), var(--teal-dark));
    box-shadow: 0 9px 0 rgb(5 93 87 / 22%), 0 15px 26px rgb(7 105 99 / 17%);
    font-weight: 900;
    transition: filter 160ms ease, transform 160ms ease, opacity 160ms ease, box-shadow 160ms ease;
}

button:hover:not(:disabled) {
    filter: saturate(1.1) brightness(1.04);
    transform: translateY(-2px);
}

button:active:not(:disabled) {
    box-shadow: 0 4px 0 rgb(5 93 87 / 22%), 0 8px 15px rgb(7 105 99 / 14%);
    transform: translateY(3px);
}

button:disabled {
    cursor: wait;
    opacity: 0.58;
}

body.loading-active {
    overflow: hidden;
}

.loading-screen {
    position: fixed;
    z-index: 100;
    inset: 0;
    display: grid;
    min-height: 100dvh;
    padding:
        max(18px, env(safe-area-inset-top))
        max(14px, env(safe-area-inset-right))
        max(18px, env(safe-area-inset-bottom))
        max(14px, env(safe-area-inset-left));
    place-items: center;
    overflow-y: auto;
    isolation: isolate;
    background:
        radial-gradient(circle at 14% 16%, rgb(255 119 93 / 34%), transparent 25rem),
        radial-gradient(circle at 86% 12%, rgb(255 200 61 / 42%), transparent 27rem),
        radial-gradient(circle at 76% 88%, rgb(7 135 127 / 24%), transparent 29rem),
        linear-gradient(145deg, #fff6e7 0%, #eafff8 52%, #fff8dc 100%);
}

.loading-screen::before {
    position: absolute;
    z-index: -2;
    inset: 0;
    content: "";
    opacity: 0.42;
    background-image: radial-gradient(rgb(7 135 127 / 34%) 1.5px, transparent 1.5px);
    background-size: 27px 27px;
    mask-image: linear-gradient(to bottom, black, transparent 88%);
}

.loading-stage-card {
    position: relative;
    width: min(700px, 100%);
    margin: auto;
    padding: clamp(22px, 4vw, 38px);
    overflow: hidden;
    border: 4px solid rgb(255 255 255 / 82%);
    border-radius: clamp(28px, 5vw, 46px);
    text-align: center;
    background: rgb(255 254 249 / 90%);
    box-shadow: 0 30px 80px rgb(17 92 84 / 20%), inset 0 0 0 2px rgb(255 200 61 / 20%);
    backdrop-filter: blur(16px);
}

.loading-stage-card::after {
    position: absolute;
    z-index: -1;
    right: -80px;
    bottom: -100px;
    width: 240px;
    height: 240px;
    content: "";
    border-radius: 50%;
    background: rgb(255 200 61 / 16%);
}

.loading-eyebrow {
    display: inline-flex;
    gap: 7px;
    margin: 0 0 5px;
    padding: 7px 13px;
    align-items: center;
    border-radius: 999px;
    color: var(--coral-dark);
    background: var(--coral-soft);
    font-size: 0.72rem;
    font-weight: 950;
    letter-spacing: 0.11em;
    text-transform: uppercase;
}

.clown-stage {
    position: relative;
    width: min(270px, 58vw);
    height: clamp(255px, 38vh, 385px);
    margin: 2px auto -8px;
}

.clown-stage img {
    position: relative;
    z-index: 3;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 17px 16px rgb(20 88 81 / 19%));
    animation: clown-tidy-float 2.15s ease-in-out infinite;
}

.clown-shadow {
    position: absolute;
    z-index: 1;
    right: 18%;
    bottom: 4%;
    left: 18%;
    height: 20px;
    border-radius: 50%;
    background: rgb(15 76 71 / 18%);
    filter: blur(6px);
    animation: clown-shadow-pulse 2.15s ease-in-out infinite;
}

.clown-orbit {
    position: absolute;
    z-index: 0;
    border: 3px dashed rgb(7 135 127 / 21%);
    border-radius: 50%;
    animation: clown-orbit-spin 9s linear infinite;
}

.orbit-one {
    inset: 13% -9% 17%;
}

.orbit-two {
    inset: 23% 1% 7%;
    border-color: rgb(255 119 93 / 20%);
    animation-direction: reverse;
    animation-duration: 7s;
}

.clown-spark {
    position: absolute;
    z-index: 4;
    color: var(--sun);
    text-shadow: 0 2px 0 white;
    animation: clown-spark-pop 1.4s ease-in-out infinite;
}

.spark-one {
    top: 25%;
    left: -2%;
    font-size: 1.8rem;
}

.spark-two {
    top: 7%;
    right: 0;
    color: var(--coral);
    font-size: 1.25rem;
    animation-delay: 420ms;
}

.spark-three {
    right: -5%;
    bottom: 27%;
    color: var(--teal);
    font-size: 1.6rem;
    animation-delay: 760ms;
}

.loading-room-label {
    display: inline-flex;
    margin: 0 0 9px;
    padding: 5px 11px;
    border: 2px solid rgb(7 135 127 / 13%);
    border-radius: 999px;
    color: var(--teal-dark);
    background: var(--teal-soft);
    font-size: 0.75rem;
    font-weight: 900;
}

.loading-stage-card h1 {
    max-width: none;
    margin: 0 0 10px;
    color: var(--ink);
    font-size: clamp(2rem, 6.5vw, 3.5rem);
    letter-spacing: -0.05em;
    line-height: 1;
}

.loading-stage-message {
    min-height: 1.6em;
    margin: 0 auto 17px;
    color: var(--ink-soft);
    font-size: clamp(0.95rem, 2.7vw, 1.12rem);
    font-weight: 750;
}

.magic-progress {
    position: relative;
    width: min(500px, 100%);
    height: 15px;
    margin: 0 auto 18px;
    overflow: hidden;
    border: 3px solid white;
    border-radius: 999px;
    background: #e2eee9;
    box-shadow: inset 0 2px 5px rgb(17 76 70 / 12%), 0 4px 0 rgb(7 135 127 / 8%);
}

#loading-progress-fill {
    position: absolute;
    inset: 0 auto 0 0;
    display: block;
    width: 16%;
    overflow: hidden;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--teal), #37c9a0 55%, var(--sun));
    transition: width 700ms cubic-bezier(0.22, 1, 0.36, 1);
}

#loading-progress-fill::after {
    position: absolute;
    inset: 0;
    content: "";
    background: linear-gradient(100deg, transparent 15%, rgb(255 255 255 / 65%) 48%, transparent 80%);
    transform: translateX(-110%);
    animation: loading-shimmer 1.5s ease-in-out infinite;
}

.loading-steps {
    display: grid;
    width: min(540px, 100%);
    margin: 0 auto;
    padding: 0;
    gap: 9px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    list-style: none;
}

.loading-steps li {
    display: flex;
    min-width: 0;
    padding: 9px 7px;
    gap: 5px;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--line);
    border-radius: 14px;
    color: var(--muted);
    background: white;
    font-size: 0.7rem;
    transition: color 220ms ease, border-color 220ms ease, background 220ms ease, transform 220ms ease;
}

.loading-steps li.active {
    border-color: rgb(7 135 127 / 30%);
    color: var(--teal-dark);
    background: var(--teal-soft);
    transform: translateY(-2px);
}

.loading-steps li.complete {
    border-color: rgb(255 200 61 / 40%);
    color: #7c5700;
    background: var(--sun-soft);
}

.loading-tip {
    margin: 15px 0 0;
    color: var(--muted);
    font-family: Inter, ui-sans-serif, system-ui, sans-serif;
    font-size: 0.76rem;
}

.loading-confetti span {
    position: absolute;
    z-index: -1;
    display: block;
    width: 15px;
    height: 37px;
    border-radius: 999px;
    background: var(--coral);
    animation: loading-confetti-drift 4s ease-in-out infinite;
}

.loading-confetti span:nth-child(1) { top: 12%; left: 8%; transform: rotate(24deg); }
.loading-confetti span:nth-child(2) { top: 25%; right: 9%; width: 20px; height: 20px; border-radius: 50%; background: var(--sun); animation-delay: 480ms; }
.loading-confetti span:nth-child(3) { right: 14%; bottom: 13%; background: var(--teal); transform: rotate(-34deg); animation-delay: 950ms; }
.loading-confetti span:nth-child(4) { bottom: 19%; left: 11%; width: 22px; height: 22px; border: 6px solid var(--purple); background: transparent; animation-delay: 1.3s; }
.loading-confetti span:nth-child(5) { top: 8%; right: 28%; width: 12px; height: 29px; background: var(--purple); transform: rotate(50deg); animation-delay: 1.7s; }
.loading-confetti span:nth-child(6) { top: 44%; left: 4%; width: 18px; height: 18px; border-radius: 50%; background: var(--mint); animation-delay: 2s; }

#submit-button {
    min-height: 64px;
    margin-top: 7px;
    border: 3px solid rgb(255 255 255 / 45%);
    background: linear-gradient(110deg, var(--coral), #f45c56 46%, var(--teal) 110%);
    box-shadow: 0 9px 0 rgb(186 67 55 / 20%), 0 16px 30px rgb(255 119 93 / 23%);
    font-size: 1rem;
}

.button-arrow {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border-radius: 11px;
    background: rgb(255 255 255 / 18%);
    font-size: 1.3rem;
}

.status {
    margin: 5px 0 0;
    padding: 14px 16px;
    border-radius: 16px;
    font-family: Inter, ui-sans-serif, system-ui, sans-serif;
    font-size: 0.88rem;
    line-height: 1.45;
}

.status.success {
    border: 2px solid rgb(32 131 103 / 14%);
    color: var(--success);
    background: #e9faf2;
}

.loading {
    display: flex;
    gap: 11px;
    align-items: center;
    border: 2px solid rgb(7 135 127 / 12%);
    color: var(--teal-dark);
    background: linear-gradient(105deg, var(--teal-soft), #f3fff9);
    font-weight: 750;
}

.spinner {
    width: 21px;
    height: 21px;
    flex: 0 0 auto;
    border: 3px solid rgb(7 135 127 / 20%);
    border-top-color: var(--teal);
    border-radius: 50%;
    animation: spin 800ms linear infinite;
}

.loading-dots {
    display: flex;
    gap: 4px;
    margin-left: auto;
}

.loading-dots i {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--teal);
    animation: dot-hop 1s ease-in-out infinite;
}

.loading-dots i:nth-child(2) {
    animation-delay: 140ms;
}

.loading-dots i:nth-child(3) {
    animation-delay: 280ms;
}

.error {
    border: 2px solid rgb(178 61 76 / 12%);
    color: var(--danger);
    background: #fff0f1;
    font-weight: 650;
}

.result-meta {
    display: inline-flex;
    margin-top: 10px !important;
    padding: 6px 10px;
    border-radius: 999px;
    color: var(--teal-dark) !important;
    background: var(--teal-soft);
    font-size: 0.75rem;
    font-weight: 800;
}

.result-cheer {
    position: relative;
    display: flex;
    gap: 14px;
    margin: -8px 0 28px;
    padding: 13px 115px 13px 10px;
    align-items: center;
    overflow: hidden;
    border: 2px solid rgb(255 200 61 / 46%);
    border-radius: 24px;
    background: linear-gradient(110deg, #fff9d9, #fffdf4);
}

.result-cheer img {
    width: 76px;
    height: 80px;
    flex: 0 0 auto;
    object-fit: contain;
    animation: buddy-bounce 1.4s ease-in-out infinite;
}

.cheer-stars {
    position: absolute;
    right: 24px;
    color: var(--coral);
    font-size: 1.25rem;
    letter-spacing: 5px;
    animation: emote-pop 2.4s ease-in-out infinite;
}

.comparison {
    display: grid;
    gap: 22px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.comparison.has-clean-result {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

figure {
    min-width: 0;
    margin: 0;
}

.image-frame {
    position: relative;
    overflow: hidden;
    border: 4px solid white;
    border-radius: 24px;
    background: #e8f0ed;
    box-shadow: 0 12px 28px rgb(22 84 78 / 14%);
}

.image-frame img,
#after-image-slot img {
    display: block;
    width: 100%;
    height: auto;
}

.after-frame {
    border-color: var(--sun-soft);
    box-shadow: 0 12px 28px rgb(215 158 20 / 18%);
}

.clean-frame {
    border-color: #a8e6cf;
    box-shadow: 0 12px 28px rgb(7 135 127 / 19%);
}

.clean-frame .image-label {
    color: white;
    background: rgb(7 135 127 / 92%);
}

.image-label {
    position: absolute;
    z-index: 4;
    top: 13px;
    left: 13px;
    padding: 7px 12px;
    border: 2px solid rgb(255 255 255 / 62%);
    border-radius: 999px;
    color: white;
    background: rgb(23 59 58 / 82%);
    font-size: 0.7rem;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    backdrop-filter: blur(8px);
}

.after-frame .image-label {
    color: var(--ink);
    background: rgb(255 200 61 / 92%);
}

.detection-overlay {
    position: absolute;
    z-index: 3;
    inset: 0;
    pointer-events: none;
}

.detection-box {
    position: absolute;
    min-width: 12px;
    min-height: 12px;
    border: 3px solid var(--teal);
    border-radius: 9px;
    background: rgb(7 135 127 / 7%);
    box-shadow: 0 0 0 2px rgb(255 255 255 / 72%), 0 5px 15px rgb(23 59 58 / 20%);
}

.detection-box.blanket {
    border-color: var(--coral);
    background: rgb(255 119 93 / 8%);
}

button.detection-box {
    display: block;
    min-width: 12px;
    min-height: 12px;
    margin: 0;
    padding: 0;
    cursor: pointer;
    pointer-events: auto;
    touch-action: manipulation;
    border-radius: 9px;
    color: inherit;
    background: rgb(7 135 127 / 7%);
    box-shadow: 0 0 0 2px rgb(255 255 255 / 72%), 0 5px 15px rgb(23 59 58 / 20%);
    user-select: none;
    -webkit-user-select: none;
}

button.detection-box.blanket {
    background: rgb(255 119 93 / 8%);
}

button.detection-box::after {
    position: absolute;
    top: 50%;
    left: 50%;
    width: max(100%, 44px);
    height: max(100%, 44px);
    content: "";
    transform: translate(-50%, -50%);
}

button.detection-box:hover:not(:disabled),
button.detection-box:active:not(:disabled) {
    filter: brightness(1.06);
    transform: none;
}

button.detection-box.is-selected {
    z-index: 2;
    border-width: 5px;
    box-shadow: 0 0 0 4px rgb(255 255 255 / 86%), 0 0 0 10px rgb(255 200 61 / 76%);
    animation: selected-detection-pulse 700ms ease-in-out infinite alternate;
}

button.detection-box.is-unmatched {
    border-color: #f2a900;
    box-shadow: 0 0 0 4px rgb(255 255 255 / 86%), 0 0 0 9px rgb(242 169 0 / 58%);
}

.detection-box span {
    position: absolute;
    top: 4px;
    left: 4px;
    max-width: calc(100% - 8px);
    padding: 4px 7px;
    overflow: hidden;
    border: 2px solid rgb(255 255 255 / 80%);
    border-radius: 8px;
    color: white;
    background: rgb(5 105 99 / 94%);
    box-shadow: 0 3px 8px rgb(23 59 58 / 22%);
    font-family: Inter, ui-sans-serif, system-ui, sans-serif;
    font-size: clamp(0.56rem, 1.5vw, 0.7rem);
    font-weight: 900;
    line-height: 1;
    text-overflow: ellipsis;
    text-transform: capitalize;
    white-space: nowrap;
}

.detection-box.blanket span {
    background: rgb(216 85 64 / 95%);
}

.after-object-highlight {
    position: absolute;
    border: 5px solid var(--teal);
    border-radius: 12px;
    background: rgb(7 135 127 / 10%);
    box-shadow: 0 0 0 4px rgb(255 255 255 / 84%), 0 0 0 11px rgb(7 135 127 / 48%);
    animation: after-object-glow 650ms ease-in-out infinite alternate;
}

.after-object-highlight.blanket {
    border-color: var(--coral);
    background: rgb(255 119 93 / 11%);
    box-shadow: 0 0 0 4px rgb(255 255 255 / 84%), 0 0 0 11px rgb(255 119 93 / 52%);
}

.after-object-highlight span {
    position: absolute;
    right: 6px;
    bottom: 6px;
    padding: 5px 8px;
    border: 2px solid white;
    border-radius: 9px;
    color: white;
    background: rgb(5 105 99 / 94%);
    font-family: Inter, ui-sans-serif, system-ui, sans-serif;
    font-size: clamp(0.58rem, 1.5vw, 0.72rem);
    font-weight: 900;
    line-height: 1;
    text-transform: capitalize;
    white-space: nowrap;
}

.after-object-highlight.blanket span {
    background: rgb(216 85 64 / 95%);
}

.detection-tools {
    display: flex;
    gap: 20px;
    margin-top: 24px;
    padding: 17px 18px;
    align-items: center;
    justify-content: space-between;
    border: 2px solid rgb(7 135 127 / 15%);
    border-radius: 22px;
    background: linear-gradient(110deg, #effdf8, #fffaf0);
}

.detection-heading {
    display: flex;
    min-width: 0;
    gap: 11px;
    align-items: center;
}

.detection-heading strong {
    display: block;
    margin-bottom: 2px;
    color: var(--ink);
    font-size: 0.92rem;
}

.detection-heading p {
    margin: 0;
    color: var(--muted);
    font-family: Inter, ui-sans-serif, system-ui, sans-serif;
    font-size: 0.74rem;
    line-height: 1.4;
}

.detection-icon {
    display: grid;
    width: 43px;
    height: 43px;
    flex: 0 0 43px;
    place-items: center;
    border: 2px solid white;
    border-radius: 14px;
    color: white;
    background: var(--teal);
    box-shadow: 0 5px 0 rgb(7 135 127 / 14%);
    font-size: 1.4rem;
    font-weight: 900;
}

.detection-controls {
    display: flex;
    flex: 0 0 auto;
    gap: 14px;
    align-items: center;
}

.detection-legend {
    display: flex;
    gap: 9px;
    color: var(--ink-soft);
    font-size: 0.68rem;
    font-weight: 850;
}

.detection-legend span {
    display: inline-flex;
    gap: 5px;
    align-items: center;
}

.detection-legend i {
    display: block;
    width: 11px;
    height: 11px;
    border: 3px solid var(--teal);
    border-radius: 3px;
}

.detection-legend .legend-blanket {
    border-color: var(--coral);
}

button.detection-toggle {
    width: auto;
    min-height: 48px;
    margin: 0;
    padding: 11px 15px;
    gap: 8px;
    justify-content: center;
    border: 2px solid var(--teal);
    color: white;
    background: var(--teal);
    box-shadow: 0 6px 0 rgb(7 135 127 / 15%);
    font-size: 0.75rem;
    white-space: nowrap;
}

button.detection-toggle[aria-pressed="true"] {
    color: var(--teal-dark);
    background: white;
}

button.detection-toggle:disabled {
    color: var(--muted);
    border-color: var(--line);
    background: #eef3f1;
    box-shadow: none;
    cursor: not-allowed;
}

figcaption {
    padding: 12px 6px 0;
    color: var(--ink-soft);
    font-size: 0.85rem;
    font-weight: 800;
}

.clean-mission {
    position: relative;
    margin-top: 30px;
    padding: 23px;
    overflow: hidden;
    border: 3px solid rgb(255 200 61 / 48%);
    border-radius: 28px;
    background:
        radial-gradient(circle at 94% 12%, rgb(255 200 61 / 24%), transparent 23%),
        linear-gradient(125deg, #fffdf2, #effdf8);
}

.clean-mission::after {
    position: absolute;
    z-index: 0;
    right: -22px;
    bottom: -36px;
    width: 125px;
    height: 125px;
    border: 20px solid rgb(7 135 127 / 7%);
    border-radius: 50%;
    content: "";
}

.clean-mission-copy {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 15px;
    align-items: center;
}

.clean-mission-copy h3,
.score-card h3 {
    margin: 2px 0 5px;
    color: var(--ink);
    font-size: clamp(1.4rem, 3vw, 2.1rem);
}

.clean-mission-copy p:not(.section-kicker) {
    max-width: 720px;
    margin: 0;
    color: var(--muted);
    font-family: Inter, ui-sans-serif, system-ui, sans-serif;
    font-size: 0.82rem;
    line-height: 1.5;
}

.clean-mission-copy > img {
    width: 78px;
    height: 86px;
    object-fit: contain;
    animation: buddy-bounce 1.5s ease-in-out infinite;
}

.clean-step {
    display: grid;
    width: 48px;
    height: 48px;
    place-items: center;
    border: 3px solid white;
    border-radius: 17px;
    color: var(--ink);
    background: var(--sun);
    box-shadow: 0 6px 0 rgb(215 158 20 / 16%);
    font-family: Inter, ui-sans-serif, system-ui, sans-serif;
    font-weight: 950;
}

.clean-room-form {
    position: relative;
    z-index: 1;
    margin-top: 20px;
}

#clean-room-image,
#clean-room-camera {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
}

.clean-upload-actions {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.clean-upload-button {
    display: flex;
    min-height: 84px;
    gap: 13px;
    padding: 16px;
    align-items: center;
    border: 2px solid rgb(7 135 127 / 20%);
    border-radius: 19px;
    color: var(--teal-dark);
    background: white;
    box-shadow: 0 7px 0 rgb(7 135 127 / 9%);
    cursor: pointer;
    transition: transform 160ms ease, border-color 160ms ease;
}

.clean-upload-button.camera {
    color: #9b4d18;
    border-color: rgb(255 119 93 / 24%);
    box-shadow: 0 7px 0 rgb(255 119 93 / 9%);
}

.clean-upload-button:hover {
    border-color: var(--teal);
    transform: translateY(-2px);
}

.clean-upload-button > span:first-child {
    display: grid;
    width: 46px;
    height: 46px;
    flex: 0 0 46px;
    place-items: center;
    border-radius: 15px;
    background: var(--teal-soft);
    font-size: 1.45rem;
}

.clean-upload-button.camera > span:first-child {
    background: #fff1e9;
}

.clean-upload-button strong,
.clean-upload-button small,
.clean-file-selection strong,
.clean-file-selection small,
.clean-score-loading strong,
.clean-score-loading small {
    display: block;
}

.clean-upload-button strong {
    margin-bottom: 3px;
    font-size: 0.85rem;
}

.clean-upload-button small,
.clean-file-selection small,
.clean-score-loading small {
    color: var(--muted);
    font-family: Inter, ui-sans-serif, system-ui, sans-serif;
    font-size: 0.7rem;
    line-height: 1.35;
}

.clean-file-selection {
    display: flex;
    gap: 13px;
    margin-top: 15px;
    padding: 11px;
    align-items: center;
    border: 2px solid rgb(7 135 127 / 14%);
    border-radius: 18px;
    background: rgb(255 255 255 / 75%);
}

.clean-file-selection[hidden] {
    display: none;
}

.clean-file-selection img {
    width: 72px;
    height: 56px;
    flex: 0 0 auto;
    border-radius: 12px;
    object-fit: cover;
}

button.check-clean-button {
    min-height: 58px;
    margin-top: 16px;
    border: 3px solid rgb(255 255 255 / 46%);
    background: linear-gradient(110deg, var(--teal), #08a189 58%, #f2aa24 130%);
    box-shadow: 0 8px 0 rgb(7 135 127 / 16%), 0 14px 25px rgb(7 135 127 / 15%);
}

.clean-score-loading {
    display: flex;
    gap: 12px;
    margin-top: 15px;
    padding: 14px 16px;
    align-items: center;
    border: 2px solid rgb(7 135 127 / 14%);
    border-radius: 18px;
    color: var(--teal-dark);
    background: white;
}

.clean-score-loading[hidden] {
    display: none;
}

.score-card {
    position: relative;
    margin-top: 26px;
    padding: 25px;
    overflow: hidden;
    border: 3px solid rgb(7 135 127 / 18%);
    border-radius: 28px;
    background: linear-gradient(135deg, #effdf8, white 48%, #fff9dc);
    box-shadow: 0 15px 35px rgb(22 84 78 / 13%);
}

.score-celebration {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 20px;
    align-items: center;
}

.score-celebration p:not(.section-kicker) {
    margin: 0;
    color: var(--muted);
    font-family: Inter, ui-sans-serif, system-ui, sans-serif;
    font-size: 0.84rem;
    line-height: 1.5;
}

.score-ring {
    display: grid;
    width: 118px;
    height: 118px;
    place-content: center;
    border: 10px solid var(--sun);
    border-radius: 50%;
    color: var(--teal-dark);
    background: white;
    box-shadow: 0 0 0 6px rgb(255 200 61 / 18%), 0 12px 25px rgb(22 84 78 / 15%);
    text-align: center;
}

.score-ring strong {
    display: block;
    font-size: 2.5rem;
    line-height: 0.95;
}

.score-ring span {
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 850;
}

.score-stars {
    color: var(--coral);
    font-size: 1.4rem;
    letter-spacing: 4px;
    animation: emote-pop 2s ease-in-out infinite;
}

.score-breakdown {
    display: grid;
    gap: 13px 18px;
    margin-top: 24px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.score-breakdown > div > span {
    display: flex;
    margin-bottom: 7px;
    align-items: center;
    justify-content: space-between;
    color: var(--ink-soft);
    font-family: Inter, ui-sans-serif, system-ui, sans-serif;
    font-size: 0.72rem;
}

.score-breakdown b {
    color: var(--teal-dark);
}

.score-breakdown i {
    display: block;
    height: 12px;
    overflow: hidden;
    border-radius: 999px;
    background: #e5efec;
}

.score-breakdown em {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--teal), var(--sun));
    transition: width 800ms cubic-bezier(.2, .8, .2, 1);
}

.score-note {
    margin: 20px 0 0;
    padding-top: 16px;
    border-top: 2px dashed var(--line);
    color: var(--muted);
    font-family: Inter, ui-sans-serif, system-ui, sans-serif;
    font-size: 0.74rem;
}

.result-actions {
    display: flex;
    gap: 18px;
    margin-top: 30px;
    padding-top: 24px;
    align-items: center;
    border-top: 2px dashed var(--line);
}

button.secondary-button {
    width: auto;
    min-height: 48px;
    margin: 0;
    gap: 8px;
    justify-content: center;
    border: 2px solid var(--teal);
    color: var(--teal-dark);
    background: white;
    box-shadow: 0 6px 0 rgb(7 135 127 / 12%);
    white-space: nowrap;
}

button.secondary-button:hover:not(:disabled) {
    color: white;
    background: var(--teal);
}

.result-actions p {
    margin: 0;
    color: var(--muted);
    font-family: Inter, ui-sans-serif, system-ui, sans-serif;
    font-size: 0.8rem;
    line-height: 1.45;
}

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

@keyframes buddy-float {
    0%, 100% { transform: translateY(0) rotate(-1deg); }
    50% { transform: translateY(-9px) rotate(1deg); }
}

@keyframes buddy-bounce {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-7px) scale(1.025); }
}

@keyframes emote-pop {
    0%, 100% { transform: scale(1) rotate(-5deg); }
    50% { transform: scale(1.09) rotate(5deg); }
}

@keyframes wave {
    0%, 100% { transform: rotate(-8deg); }
    50% { transform: rotate(12deg) scale(1.06); }
}

@keyframes dot-hop {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.45; }
    30% { transform: translateY(-5px); opacity: 1; }
}

@keyframes clown-tidy-float {
    0%, 100% { transform: translateY(2px) rotate(-1.2deg); }
    50% { transform: translateY(-10px) rotate(1.2deg); }
}

@keyframes clown-shadow-pulse {
    0%, 100% { opacity: 0.55; transform: scaleX(1); }
    50% { opacity: 0.3; transform: scaleX(0.82); }
}

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

@keyframes clown-spark-pop {
    0%, 100% { opacity: 0.35; transform: scale(0.75) rotate(-12deg); }
    50% { opacity: 1; transform: scale(1.14) rotate(10deg); }
}

@keyframes loading-shimmer {
    55%, 100% { transform: translateX(110%); }
}

@keyframes loading-confetti-drift {
    0%, 100% { translate: 0 0; }
    50% { translate: 0 -12px; }
}

@keyframes selected-detection-pulse {
    from { filter: brightness(1); }
    to { filter: brightness(1.15); }
}

@keyframes after-object-glow {
    from { filter: brightness(1); opacity: 0.86; }
    to { filter: brightness(1.12); opacity: 1; }
}

@media (max-width: 820px) {
    .auth-shell {
        display: block;
        width: min(560px, 100%);
    }

    .auth-intro {
        padding: 28px 4px 0;
    }

    .brand-lockup {
        margin-bottom: 38px;
    }

    .auth-card {
        margin-top: 28px;
    }

    .hero {
        grid-template-columns: 1fr;
    }

    .hero-copy {
        text-align: center;
    }

    .hero-copy .intro {
        margin-right: auto;
        margin-left: auto;
    }

    .hero-chips {
        justify-content: center;
    }

    .buddy-card {
        width: min(440px, 100%);
        margin: 0 auto;
    }

    .file-action {
        padding: 17px;
    }

    .comparison.has-clean-result {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .profile-layout {
        grid-template-columns: 1fr;
    }

    .admin-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .admin-user-facts {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    body {
        padding-right: 11px;
        padding-bottom: calc(108px + env(safe-area-inset-bottom));
        padding-left: 11px;
    }

    h1 {
        font-size: clamp(2.75rem, 14vw, 4.35rem);
    }

    .loading-screen {
        align-items: start;
    }

    .loading-stage-card {
        padding: 20px 16px 22px;
    }

    .clown-stage {
        width: min(230px, 62vw);
        height: clamp(235px, 37vh, 330px);
    }

    .loading-stage-card h1 {
        font-size: clamp(2rem, 10vw, 3rem);
    }

    .loading-steps li {
        align-items: center;
        flex-direction: column;
        line-height: 1.2;
    }

    .auth-buddy {
        max-width: 100%;
        padding-right: 40px;
    }

    .auth-buddy img {
        width: 70px;
        height: 80px;
    }

    .mission-perks {
        gap: 6px;
    }

    .mission-perks span {
        padding: 7px 9px;
        font-size: 0.7rem;
    }

    .card {
        padding: 22px 17px;
        border-radius: 27px;
    }

    .auth-card {
        padding: 22px 18px;
    }

    .account-bar {
        flex-wrap: nowrap;
        gap: 8px;
        border-radius: 18px;
    }

    .account-person {
        max-width: calc(100% - 88px);
    }

    .account-actions {
        width: auto;
        margin-left: auto;
    }

    .account-actions button.account-nav-button {
        display: none;
    }

    .account-actions button.text-button {
        width: auto;
        min-height: 38px;
        flex: 0 0 auto;
        padding: 0 11px;
        font-size: 0.65rem;
    }

    .mobile-bottom-nav {
        position: fixed;
        z-index: 70;
        right: auto;
        bottom: calc(10px + env(safe-area-inset-bottom));
        left: 50%;
        display: grid;
        width: min(420px, calc(100% - 20px));
        min-height: 76px;
        padding: 7px 9px;
        overflow: hidden;
        gap: 7px;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        border: 1px solid rgb(255 255 255 / 76%);
        border-radius: 30px;
        background:
            linear-gradient(135deg, rgb(255 255 255 / 70%), rgb(235 251 247 / 48%));
        box-shadow:
            inset 0 1px 0 rgb(255 255 255 / 88%),
            inset 0 -1px 0 rgb(7 135 127 / 7%),
            0 18px 42px rgb(23 91 84 / 18%),
            0 4px 12px rgb(31 76 72 / 9%);
        backdrop-filter: blur(28px) saturate(1.55);
        -webkit-backdrop-filter: blur(28px) saturate(1.55);
        transform: translateX(-50%);
    }

    .mobile-bottom-nav.admin-only {
        width: min(210px, calc(100% - 20px));
        grid-template-columns: minmax(0, 1fr);
    }

    .mobile-bottom-nav::before {
        position: absolute;
        top: 0;
        right: 9%;
        left: 9%;
        height: 1px;
        content: "";
        background: linear-gradient(90deg, transparent, rgb(255 255 255 / 92%), transparent);
        pointer-events: none;
    }

    .account-avatar {
        width: 41px;
        height: 41px;
        flex-basis: 41px;
    }

    .account-avatar img {
        width: 39px;
        height: 39px;
    }

    .app-page {
        padding-top: 28px;
    }

    .page-view-heading {
        min-height: 210px;
        padding: 25px 20px;
    }

    .page-view-heading h1 {
        font-size: clamp(2.45rem, 13vw, 3.8rem);
    }

    .page-buddy {
        width: 100px;
        flex-basis: 100px;
    }

    .page-buddy img {
        right: -21px;
        width: 108px;
        height: 130px;
    }

    .page-buddy span {
        left: 0;
        width: 46px;
        height: 46px;
        font-size: 1.25rem;
    }

    .history-card {
        padding: 13px;
        border-radius: 24px;
    }

    .history-image,
    .history-image img {
        min-height: 145px;
    }

    .profile-stats div {
        min-height: 132px;
        padding: 13px;
    }

    .hero {
        padding: 48px 3px 38px;
        gap: 28px;
    }

    .buddy-card {
        min-height: 276px;
        border-radius: 30px 30px 30px 10px;
    }

    .buddy-visual {
        min-height: 182px;
    }

    .buddy-visual img {
        max-height: 196px;
    }

    .section-heading {
        gap: 12px;
        margin-bottom: 25px;
    }

    .step-number {
        width: 43px;
        height: 43px;
        flex-basis: 43px;
        border-radius: 15px;
    }

    .file-actions,
    .comparison,
    .comparison.has-clean-result,
    .clean-upload-actions,
    .score-breakdown {
        grid-template-columns: 1fr;
    }

    .file-action {
        min-height: 108px;
    }

    .result-cheer {
        padding-right: 14px;
    }

    .detection-tools,
    .detection-controls {
        align-items: stretch;
        flex-direction: column;
    }

    .detection-tools {
        gap: 15px;
    }

    .detection-controls {
        gap: 11px;
    }

    .detection-legend {
        justify-content: center;
    }

    button.detection-toggle {
        width: 100%;
    }

    .cheer-stars {
        display: none;
    }

    .result-actions {
        align-items: stretch;
        flex-direction: column;
    }

    button.secondary-button {
        width: 100%;
    }

    .clean-mission {
        padding: 19px 16px;
    }

    .clean-mission-copy {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .clean-mission-copy > img {
        display: none;
    }

    .score-celebration {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .score-stars {
        display: none;
    }

    .score-ring {
        width: 92px;
        height: 92px;
        border-width: 8px;
    }

    .score-ring strong {
        font-size: 2rem;
    }
}

@media (max-width: 390px) {
    .account-actions button.text-button {
        font-size: 0.59rem;
    }

    .mobile-bottom-nav {
        width: calc(100% - 16px);
        gap: 4px;
        padding-right: 7px;
        padding-left: 7px;
        border-radius: 25px;
    }

    .page-buddy {
        display: none;
    }

    .history-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    button.compact-button {
        width: 100%;
    }

    .history-images {
        grid-template-columns: 1fr;
    }

    .history-image,
    .history-image img {
        min-height: 195px;
    }

    .profile-stats {
        grid-template-columns: 1fr;
    }

    .admin-toolbar,
    .admin-panel-heading {
        align-items: stretch;
        flex-direction: column;
    }

    .admin-search {
        width: 100%;
    }

    .admin-user-card {
        grid-template-columns: 1fr;
    }

    .admin-user-badges {
        justify-content: flex-start;
    }

    .admin-user-facts {
        grid-template-columns: 1fr;
    }

    .admin-user-actions {
        justify-content: stretch;
    }

    .admin-user-actions button {
        width: 100%;
    }

    .loading-eyebrow {
        font-size: 0.62rem;
    }

    .clown-stage {
        height: min(285px, 36vh);
    }

    .loading-tip {
        font-size: 0.7rem;
    }

    .auth-buddy p span,
    .result-cheer p span {
        font-size: 0.8rem;
    }

    .auth-tabs button {
        font-size: 0.8rem;
    }

    .file-action {
        align-items: flex-start;
        flex-direction: column;
    }

    .result-cheer img {
        width: 62px;
        height: 68px;
    }
}

@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;
    }
}
