/* ============================================================
   STYLELOCK V54 - Stabilization + Premium Polish
   ============================================================ */

:root {
    --app-height: 100dvh;
    --bg-dark: #10241f;
    --bg-deeper: #081713;
    --bg-soft: #17312a;
    --card-dark: #152d27;
    --card-mid: #1b3831;
    --card-bold: #1d3f37;
    --card-clean: #1a332d;
    --card-trending: #21483f;
    --volt: #c8e600;
    --volt-soft: #d7f54c;
    --cream: #f3efe3;
    --cream-dim: rgba(243, 239, 227, 0.68);
    --ink-muted: #9bad9d;
    --line: rgba(243, 239, 227, 0.18);
    --line-strong: rgba(200, 230, 0, 0.35);
    --radius: 16px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html,
body {
    width: 100%;
    min-height: 100%;
    min-height: 100svh;
    min-height: 100dvh;
    overflow-x: hidden;
    overflow-y: hidden;
    font-family: 'Inter', -apple-system, sans-serif;
    background: radial-gradient(110% 90% at 50% 10%, #20483f 0%, var(--bg-dark) 38%, var(--bg-deeper) 100%);
    color: var(--cream);
}

body::before {
    content: '';
    pointer-events: none;
    position: fixed;
    inset: 0;
    background-image: radial-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 3px 3px;
    opacity: 0.16;
    z-index: 1;
}

.screen {
    display: none;
    position: fixed;
    inset: 0;
    width: 100%;
    /* Let `inset: 0` size the screen to the visible viewport. `--app-height`
       is provided by JS via visualViewport for extra precision on iOS/Instagram.
       We avoid `max-height` here so children that need natural scroll flow
       (upload screen) are never clipped from above. */
    height: var(--app-height, 100dvh);
    min-height: var(--app-height, 100dvh);
    overflow-x: hidden;
    overflow-y: hidden;
    z-index: 2;
}

.screen.active {
    display: flex;
    flex-direction: column;
}

.screen[hidden] {
    display: none !important;
}

/* ============================================================
   HOME
   ============================================================ */

.home {
    background: #0d211d;
    height: 100dvh;
    position: relative;
}

.home-bg {
    position: absolute;
    inset: 0;
    background-image: url('/static/images/home-hero-latest.jpg');
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center center;
    background-color: #0d211d;
    z-index: 2;
    display: block;
    visibility: visible;
    opacity: 1;
}

.home::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 11%;
    background: linear-gradient(to top, rgba(8, 18, 15, 0.42), rgba(8, 18, 15, 0));
    pointer-events: none;
    z-index: 3;
}

.home-hotspot {
    position: absolute;
    left: 50%;
    bottom: max(10.2%, calc(9.4% + env(safe-area-inset-bottom, 0px)));
    transform: translateX(-50%);
    width: min(66vw, 300px);
    height: 68px;
    border: none;
    background: transparent;
    border-radius: 10px;
    cursor: pointer;
    pointer-events: auto;
    touch-action: manipulation;
    -webkit-appearance: none;
    z-index: 20;
}

.home-bars {
    position: absolute;
    left: 0;
    right: 0;
    bottom: max(1.7%, calc(1.3% + env(safe-area-inset-bottom, 0px)));
    display: flex;
    justify-content: center;
    gap: 10px;
    z-index: 6;
    pointer-events: none;
}

.home-bar {
    width: 62px;
    height: 3px;
    border-radius: 999px;
    background: rgba(243, 239, 227, 0.2);
    overflow: hidden;
    position: relative;
}

.home-bar::after {
    content: '';
    position: absolute;
    inset: 0;
    width: 45%;
    background: linear-gradient(90deg, var(--volt), #f0ffc1);
    box-shadow: 0 0 10px rgba(200, 230, 0, 0.45);
    animation: homeBar 2.8s ease-in-out infinite;
}

.home-bar:nth-child(2)::after { animation-delay: 0.2s; }
.home-bar:nth-child(3)::after { animation-delay: 0.45s; }

@keyframes homeBar {
    0%, 100% { transform: translateX(-70%); opacity: 0.65; }
    50% { transform: translateX(155%); opacity: 1; }
}

/* ============================================================
   UPLOAD
   ============================================================ */

.upload {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    gap: clamp(8px, 1.25svh, 14px);
    /* The .screen parent constrains us to the visible viewport; within that we
       allow natural top-down content flow and native scrolling if content is
       taller than the viewport (iPhone SE, Instagram in-app browser, etc.). */
    min-height: 100%;
    padding:
        calc(10px + env(safe-area-inset-top, 0px))
        max(20px, env(safe-area-inset-right, 0px))
        calc(24px + env(safe-area-inset-bottom, 0px))
        max(20px, env(safe-area-inset-left, 0px));
    background: radial-gradient(120% 100% at 50% 4%, #1e463c 0%, #102821 43%, #091712 100%);
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    scroll-padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
}

.upload > * {
    flex-shrink: 0;
}

.upload-title {
    font-family: 'Bebas Neue', sans-serif;
    font-size: clamp(52px, 14vw, 104px);
    letter-spacing: 0.02em;
    line-height: 0.9;
    color: rgba(243, 239, 227, 0.95);
    margin-bottom: 0;
    text-align: center;
}

.upload-guide {
    width: min(88vw, 340px);
    display: grid;
    gap: clamp(6px, 1svh, 8px);
    margin-bottom: 0;
}

.upload-guide-copy {
    display: grid;
    gap: 4px;
    text-align: left;
}

.upload-guide-title {
    margin: 0;
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: rgba(243, 239, 227, 0.95);
}

.upload-guide-subtext {
    margin: 0;
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    line-height: 1.45;
    color: rgba(243, 239, 227, 0.72);
}

.upload-guide-card {
    width: clamp(112px, 34vw, 142px);
    margin: 0 auto;
    padding: 6px;
    border-radius: 18px;
    background: rgba(7, 18, 15, 0.52);
    border: 1px solid rgba(243, 239, 227, 0.14);
    box-shadow: 0 16px 34px rgba(0, 0, 0, 0.24);
}

.upload-guide-image {
    display: block;
    width: 100%;
    aspect-ratio: 3 / 4;
    object-fit: cover;
    object-position: center top;
    border-radius: 12px;
}

.upload-frame {
    position: relative;
    width: clamp(172px, 48vw, 214px);
    aspect-ratio: 3 / 4;
    flex: 0 0 auto;
    border-radius: 22px;
    overflow: hidden;
    background: linear-gradient(160deg, rgba(19, 48, 41, 0.82), rgba(10, 26, 22, 0.88));
    box-shadow: inset 0 0 0 1px rgba(243, 239, 227, 0.12), 0 20px 40px rgba(0, 0, 0, 0.32);
}

.upload-frame::after {
    content: '';
    position: absolute;
    inset: 8px;
    border-radius: 16px;
    border: 1px dashed rgba(243, 239, 227, 0.16);
    pointer-events: none;
}

.upload-frame-corners {
    position: absolute;
    inset: 0;
    z-index: 3;
    pointer-events: none;
}

.corner {
    position: absolute;
    width: 26px;
    height: 26px;
    border: 3px solid var(--volt-soft);
    filter: drop-shadow(0 0 6px rgba(200, 230, 0, 0.35));
}

.corner.tl { top: 14px; left: 14px; border-right: 0; border-bottom: 0; }
.corner.tr { top: 14px; right: 14px; border-left: 0; border-bottom: 0; }
.corner.bl { bottom: 14px; left: 14px; border-right: 0; border-top: 0; }
.corner.br { bottom: 14px; right: 14px; border-left: 0; border-top: 0; }

.upload-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.face-outline {
    width: 52%;
    height: 56%;
    border-radius: 48% 48% 45% 45%;
    border: 2px solid rgba(243, 239, 227, 0.15);
    box-shadow: inset 0 0 24px rgba(243, 239, 227, 0.04);
}

.upload-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
}

.upload-preview.visible {
    display: block;
}

.upload-hint {
    margin-top: 8px;
    margin-bottom: 7px;
    font-family: 'Space Mono', monospace;
    font-size: 12px;
    letter-spacing: 0.01em;
    color: rgba(243, 239, 227, 0.82);
    text-align: center;
    max-width: min(88vw, 350px);
}

.upload-note {
    margin-bottom: 10px;
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    letter-spacing: 0.02em;
    color: rgba(215, 245, 76, 0.86);
    text-align: center;
}

.upload-browser-note {
    width: min(88vw, 340px);
    margin: 0;
    font-family: 'Space Mono', monospace;
    font-size: 10px;
    line-height: 1.45;
    text-align: center;
    color: rgba(243, 239, 227, 0.62);
}

.upload-actions {
    width: min(88vw, 340px);
    display: grid;
    gap: clamp(8px, 1.2svh, 10px);
    margin-top: 0;
    padding-bottom: max(6px, env(safe-area-inset-bottom, 0px));
    z-index: 6;
    padding-top: 0;
    background: none;
}

.upload-actions .btn-take-photo,
.upload-actions .btn-upload-photo {
    width: 100%;
}

.btn-take-photo,
.btn-upload-photo,
.btn-select,
.btn-barber,
.btn-save,
.btn-retry {
    width: min(88vw, 340px);
    border-radius: 12px;
    font-family: 'Bebas Neue', sans-serif;
    letter-spacing: 0.08em;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.btn-take-photo:active,
.btn-upload-photo:active,
.btn-select:active,
.btn-barber:active,
.btn-save:active,
.btn-retry:active {
    transform: scale(0.985);
}

.btn-take-photo {
    padding: 16px 20px;
    color: #10221c;
    border: 1px solid rgba(200, 230, 0, 0.68);
    background: linear-gradient(180deg, #d9f74f 0%, #bfde1a 100%);
    box-shadow: 0 10px 18px rgba(0, 0, 0, 0.3), 0 0 18px rgba(200, 230, 0, 0.2);
}

.btn-upload-photo {
    margin-top: 0;
    padding: 12px 20px;
    color: var(--cream);
    border: 1px solid rgba(243, 239, 227, 0.5);
    background: rgba(7, 18, 15, 0.48);
    box-shadow: inset 0 0 0 1px rgba(243, 239, 227, 0.08);
    font-size: 16px;
    margin-bottom: 0;
    display: block;
    visibility: visible;
    opacity: 1;
}

/* ============================================================
   ACTION SHEET
   ============================================================ */

.action-sheet-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 100;
    justify-content: center;
    align-items: flex-end;
    padding: 10px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(2px);
}

.action-sheet-overlay.active {
    display: flex;
}

.action-sheet {
    width: min(100%, 420px);
    animation: rise 0.2s ease;
}

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

.action-sheet-group,
.action-sheet-cancel {
    background: #f0f2ec;
    border-radius: 14px;
    overflow: hidden;
}

.action-sheet-group {
    margin-bottom: 8px;
}

.action-sheet-btn,
.action-sheet-cancel {
    width: 100%;
    border: none;
    cursor: pointer;
    color: #1e2924;
    font-family: 'Inter', sans-serif;
    font-size: 17px;
}

.action-sheet-btn {
    text-align: left;
    padding: 18px 20px;
    background: transparent;
    border-bottom: 1px solid rgba(24, 34, 30, 0.11);
}

.action-sheet-btn:last-child {
    border-bottom: none;
}

.action-sheet-cancel {
    padding: 18px 20px;
    font-weight: 600;
}

/* ============================================================
   LOADING
   ============================================================ */

.loading {
    justify-content: center;
    align-items: center;
    padding: calc(18px + env(safe-area-inset-top, 0px)) 24px calc(38px + env(safe-area-inset-bottom, 0px));
    background: radial-gradient(120% 110% at 50% 4%, #224f44 0%, #112c24 44%, #0b1915 100%);
}

.loading-title {
    font-family: 'Bebas Neue', sans-serif;
    font-size: clamp(92px, 22vw, 154px);
    line-height: 0.82;
    letter-spacing: 0.012em;
    color: rgba(243, 239, 227, 0.96);
    margin-bottom: 14px;
    text-align: center;
    transition: opacity 0.24s ease;
}

.loading-frame {
    position: relative;
    width: min(64vw, 255px);
    aspect-ratio: 3 / 4;
    background: linear-gradient(180deg, #16382f, #10231d);
    border-radius: 0;
    box-shadow: inset 0 0 0 1px rgba(243, 239, 227, 0.08), 0 18px 34px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.loading-selfie {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.loading-script {
    display: none;
}

.loading-status {
    margin-top: 20px;
    margin-bottom: 10px;
}

.loading-text {
    font-family: 'Space Mono', monospace;
    font-size: 15px;
    color: rgba(243, 239, 227, 0.88);
}

.loading-progress {
    width: min(74vw, 308px);
    height: 14px;
    border-radius: 999px;
    background: #74857b;
    padding: 2px;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25);
}

.loading-progress-fill {
    height: 100%;
    width: 0;
    border-radius: inherit;
    background: linear-gradient(90deg, #c3e319 0%, #d9f760 70%, #ebff93 100%);
    box-shadow: 0 0 10px rgba(200, 230, 0, 0.35);
    transition: width 0.7s cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* ============================================================
   ERROR
   ============================================================ */

.error {
    justify-content: center;
    align-items: center;
    text-align: center;
    background: var(--bg-dark);
    padding: 24px;
}

.error-icon {
    width: 66px;
    height: 66px;
    border: 2px solid rgba(255, 115, 115, 0.9);
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 38px;
    color: #ff8b8b;
    margin-bottom: 14px;
}

.error-text {
    margin-bottom: 18px;
    color: rgba(243, 239, 227, 0.86);
    max-width: 320px;
    line-height: 1.45;
}

.btn-retry {
    padding: 14px 20px;
    border: 1px solid rgba(243, 239, 227, 0.38);
    color: var(--cream);
    background: rgba(10, 26, 22, 0.45);
}

/* ============================================================
   RESULTS
   ============================================================ */

.results {
    background: radial-gradient(120% 120% at 50% -10%, #284f44 0%, #132a23 44%, #091711 100%);
}

.results-header {
    display: flex;
    justify-content: flex-start;
    gap: 12px;
    align-items: flex-start;
    padding: calc(8px + env(safe-area-inset-top, 0px)) 18px 2px;
    position: relative;
    z-index: 4;
}

.results-heading {
    display: grid;
    gap: 1px;
}

.results-title {
    font-family: 'Bebas Neue', sans-serif;
    font-size: clamp(24px, 7.6vw, 33px);
    letter-spacing: 0.03em;
    line-height: 0.94;
    max-width: 100%;
    color: rgba(243, 239, 227, 0.95);
}

.results-title .accent {
    color: var(--volt-soft);
}

.results-subtitle {
    font-family: 'Space Mono', monospace;
    font-size: 10px;
    line-height: 1.18;
    letter-spacing: 0.01em;
    color: rgba(243, 239, 227, 0.56);
}

.btn-back {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    border: 1px solid rgba(243, 239, 227, 0.28);
    background: rgba(8, 21, 17, 0.45);
    color: var(--cream);
    font-size: 20px;
    line-height: 1;
}

.btn-back-results {
    width: auto;
    min-height: 42px;
    padding: 0 12px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    letter-spacing: 0.07em;
    white-space: nowrap;
}

.results-carousel-wrap {
    flex: 1;
    position: relative;
    overflow: hidden;
    padding-bottom: 0;
}

.results-carousel {
    display: flex;
    height: 100%;
    transform: none !important;
    transition: none;
}

.results-board {
    display: grid;
    grid-template-rows: minmax(0, 63fr) minmax(0, 37fr);
    align-items: stretch;
    width: min(92vw, 382px);
    margin: 0 auto;
    padding: 0 0 env(safe-area-inset-bottom, 0px);
    gap: 5px;
    height: calc(100dvh - 56px - env(safe-area-inset-top, 0px));
}

.slide-card {
    position: relative;
    width: min(92vw, 370px);
    border-radius: 20px;
    overflow: hidden;
    background: linear-gradient(180deg, var(--card-mid), #132a24);
    border: 1px solid rgba(243, 239, 227, 0.16);
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.34);
}

.slide-card.hero-card {
    width: 100%;
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: 100%;
}

.slide-card.tier-bold {
    background: linear-gradient(160deg, #23463d, #152a24);
}

.slide-card.tier-clean {
    background: linear-gradient(160deg, #1c342d, #122722);
}

.slide-card.tier-trending {
    background: linear-gradient(160deg, #245046, #173028);
}

.slide-image-wrap {
    position: relative;
    width: 100%;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

.slide-image-wrap::after {
    content: '';
    position: absolute;
    inset: auto 0 0;
    height: 30%;
    background: linear-gradient(to top, rgba(9, 20, 17, 0.55), rgba(9, 20, 17, 0));
    pointer-events: none;
}

.slide-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 20%;
    transform: scale(0.85);
    transform-origin: center 21%;
}

.slide-image-placeholder {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    text-align: center;
    padding: 24px;
    color: rgba(243, 239, 227, 0.72);
    font-family: 'Space Mono', monospace;
    font-size: 13px;
    background: linear-gradient(180deg, rgba(8, 17, 15, 0.18), rgba(8, 17, 15, 0.52));
}

.match-badge {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 3;
    min-width: 68px;
    padding: 8px 10px 7px;
    border-radius: 10px;
    background: rgba(8, 21, 17, 0.78);
    border: 1px solid rgba(200, 230, 0, 0.5);
    text-align: center;
    backdrop-filter: blur(4px);
}

.match-badge .pct {
    display: block;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 26px;
    line-height: 0.85;
    color: var(--volt-soft);
}

.match-badge .copy {
    display: block;
    margin-top: 2px;
    font-family: 'Space Mono', monospace;
    font-size: 9px;
    letter-spacing: 0.09em;
    color: rgba(243, 239, 227, 0.75);
}

.slide-tier {
    display: grid;
    gap: 2px;
    padding: 6px 12px 4px;
    border-top: 1px solid rgba(243, 239, 227, 0.1);
}

.slide-tier-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
}

.slide-tier-name {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 25px;
    line-height: 0.86;
    color: var(--volt-soft);
    flex: 0 0 auto;
}

.slide-tier-sub {
    display: none;
}

.slide-note {
    position: absolute;
    right: 18px;
    bottom: 18px;
    color: rgba(204, 238, 79, 0.95);
    font-family: 'Caveat', cursive;
    font-size: 24px;
    transform: rotate(-4deg);
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.34);
    max-width: 48%;
    text-align: right;
}

.slide-info {
    width: min(92vw, 370px);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.info-item {
    min-height: 62px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid rgba(243, 239, 227, 0.16);
    background: rgba(10, 23, 19, 0.42);
}

.info-label {
    font-family: 'Space Mono', monospace;
    font-size: 10px;
    color: rgba(243, 239, 227, 0.62);
    letter-spacing: 0.08em;
    margin-bottom: 4px;
}

.info-value {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 20px;
    line-height: 0.95;
    color: rgba(243, 239, 227, 0.94);
}

.hero-cta {
    width: calc(100% - 24px);
    margin: 0 12px 8px;
    padding: 7px 12px;
    border: 1px solid rgba(200, 230, 0, 0.58);
    color: #11241e;
    background: linear-gradient(180deg, #d8f74e 0%, #bddb1d 100%);
}

.achievable-badge {
    position: absolute;
    top: 16px;
    left: 16px;
    z-index: 4;
    font-family: 'Space Mono', monospace;
    font-size: 9px;
    letter-spacing: 0.08em;
    padding: 7px 10px;
    border-radius: 8px;
    border: 1px solid rgba(200, 230, 0, 0.58);
    color: #e9f9aa;
    background: rgba(8, 20, 16, 0.78);
}

.results-support-grid {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: stretch;
    gap: 5px;
    min-height: 0;
    height: 100%;
}

.support-card {
    border: 1px solid rgba(243, 239, 227, 0.14);
    border-radius: 14px;
    background: rgba(11, 25, 21, 0.56);
    overflow: hidden;
    padding: 0;
    color: var(--cream);
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: 100%;
}

.support-card-image-wrap {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    border-bottom: 1px solid rgba(243, 239, 227, 0.11);
}

.support-card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 22%;
}

.support-match {
    position: absolute;
    right: 8px;
    top: 8px;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 14px;
    line-height: 0.9;
    color: var(--volt-soft);
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}

.support-card-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
    min-width: 0;
}

.support-readiness {
    position: static;
    font-size: 9px;
    padding: 3px 7px;
    background: rgba(8, 20, 16, 0.42);
    border-color: rgba(243, 239, 227, 0.34);
    white-space: nowrap;
    flex: 0 0 auto;
}

.support-card-meta {
    padding: 5px 8px 4px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-height: 0;
    flex: 0 0 auto;
}

.support-tier {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 15px;
    line-height: 0.88;
    color: var(--volt-soft);
}

.support-name {
    margin-top: 1px;
    font-family: 'Space Mono', monospace;
    font-size: 10px;
    color: rgba(243, 239, 227, 0.78);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.support-cta {
    border: 1px solid rgba(243, 239, 227, 0.3);
    background: rgba(9, 21, 17, 0.45);
    color: rgba(243, 239, 227, 0.92);
    border-radius: 8px;
    width: calc(100% - 16px);
    margin: 0 8px 5px;
    font-family: 'Space Mono', monospace;
    font-size: 10px;
    letter-spacing: 0.06em;
    padding: 6px 7px;
    cursor: pointer;
    position: relative;
    z-index: 4;
    pointer-events: auto;
    touch-action: manipulation;
    flex: 0 0 auto;
}

.readiness-tag {
    display: inline-flex;
    width: fit-content;
    font-family: 'Space Mono', monospace;
    font-size: 10px;
    letter-spacing: 0.03em;
    color: rgba(243, 239, 227, 0.86);
    border: 1px solid rgba(243, 239, 227, 0.24);
    border-radius: 999px;
    padding: 3px 8px;
    background: rgba(8, 20, 16, 0.42);
}

.readiness-hero {
    margin-top: 0;
    white-space: nowrap;
    flex: 0 0 auto;
}

.swipe-cue {
    display: none !important;
}

.swipe-cue.hidden {
    display: none !important;
}

@keyframes swipePulse {
    0%, 100% { opacity: 0.62; transform: translateX(-50%) translateY(0); }
    50% { opacity: 1; transform: translateX(-50%) translateY(-2px); }
}

.results-dots {
    display: none !important;
}

.dot {
    width: 9px;
    height: 9px;
    border-radius: 999px;
    background: rgba(243, 239, 227, 0.4);
    transition: all 0.22s ease;
}

.dot.active {
    width: 24px;
    background: var(--volt);
}

/* ============================================================
   CUT CARD
   ============================================================ */

.cutcard {
    background: radial-gradient(120% 110% at 50% -10%, #213e36 0%, #10231d 48%, #0a1814 100%);
    overflow: hidden;
}

.cutcard-header {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: space-between;
    padding: calc(14px + env(safe-area-inset-top, 0px)) 16px 12px;
    position: sticky;
    top: 0;
    z-index: 10;
    backdrop-filter: blur(6px);
    background: rgba(9, 20, 17, 0.78);
    border-bottom: 1px solid rgba(243, 239, 227, 0.14);
}

.cutcard-title {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 22px;
    letter-spacing: 0.05em;
    margin-left: auto;
}

.cutcard-content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 14px 16px 10px;
}

.cutcard-main {
    border-radius: 18px;
    border: 1px solid rgba(243, 239, 227, 0.16);
    background: linear-gradient(180deg, rgba(25, 50, 43, 0.82), rgba(13, 28, 24, 0.9));
    overflow: hidden;
}

.cutcard-media {
    position: relative;
    aspect-ratio: 4 / 4.8;
    background: #10231d;
}

.cutcard-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 14%;
}

.cutcard-look-tag {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 3;
    padding: 7px 10px;
    border-radius: 999px;
    background: rgba(8, 20, 16, 0.7);
    border: 1px solid rgba(243, 239, 227, 0.34);
    font-family: 'Space Mono', monospace;
    font-size: 10px;
    letter-spacing: 0.08em;
    color: rgba(243, 239, 227, 0.92);
}

.cutcard-tier {
    position: absolute;
    left: 12px;
    bottom: 12px;
    padding: 6px 10px;
    border-radius: 9px;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 18px;
    letter-spacing: 0.06em;
    color: #10221c;
    background: linear-gradient(180deg, #d8f74e 0%, #bddb1d 100%);
}

.cutcard-meta {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 7px;
    padding: 10px;
    border-top: 1px solid rgba(243, 239, 227, 0.1);
}

.cut-meta {
    background: rgba(8, 19, 15, 0.48);
    border: 1px solid rgba(243, 239, 227, 0.14);
    border-radius: 10px;
    padding: 8px;
}

.cut-meta-label {
    font-family: 'Space Mono', monospace;
    font-size: 9px;
    color: rgba(243, 239, 227, 0.6);
    margin-bottom: 3px;
}

.cut-meta-value {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 18px;
    line-height: 0.95;
}

.cutcard-sections {
    display: grid;
    gap: 8px;
    padding: 10px;
}

.cutcard-section {
    border: 1px solid rgba(243, 239, 227, 0.14);
    border-radius: 12px;
    padding: 10px;
    background: rgba(7, 17, 14, 0.42);
}

.cutcard-label {
    font-family: 'Space Mono', monospace;
    font-size: 10px;
    color: var(--volt-soft);
    letter-spacing: 0.08em;
    margin-bottom: 6px;
}

.cutcard-value {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 20px;
    letter-spacing: 0.03em;
    margin-bottom: 4px;
}

.cutcard-desc {
    color: rgba(243, 239, 227, 0.74);
    font-size: 13px;
    line-height: 1.45;
}

.cutcard-actions {
    position: relative;
    z-index: 15;
    flex-shrink: 0;
    pointer-events: auto;
    padding: 10px 16px calc(14px + env(safe-area-inset-bottom, 0px));
    background: linear-gradient(to top, rgba(10, 22, 18, 0.98), rgba(10, 22, 18, 0.78));
    border-top: 1px solid rgba(243, 239, 227, 0.12);
}

/* ============================================================
   LOCKED + BARBER
   ============================================================ */

.locked {
    background: var(--bg-dark);
}

.screen-back {
    position: absolute;
    top: calc(12px + env(safe-area-inset-top, 0px));
    left: 12px;
    z-index: 12;
    width: auto;
    min-height: 42px;
    padding: 0 12px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    letter-spacing: 0.07em;
    white-space: nowrap;
}

.locked-photo {
    flex: 1;
    min-height: 0;
}

.locked-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 24%;
}

.locked-badge {
    position: absolute;
    top: calc(12px + env(safe-area-inset-top, 0px));
    right: 12px;
    left: auto;
    transform: rotate(-10deg);
    width: 86px;
    height: 86px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    border: 2px solid rgba(200, 230, 0, 0.72);
    color: var(--volt-soft);
    font-family: 'Bebas Neue', sans-serif;
    font-size: 20px;
    letter-spacing: 0.04em;
    background: rgba(8, 18, 15, 0.6);
}

.locked-actions {
    padding: 12px 16px calc(16px + env(safe-area-inset-bottom, 0px));
    display: grid;
    gap: 10px;
    background: rgba(9, 20, 17, 0.92);
    border-top: 1px solid rgba(243, 239, 227, 0.12);
}

.btn-barber,
.btn-save {
    padding: 14px 20px;
    margin-left: auto;
    margin-right: auto;
}

.btn-barber {
    border: 1px solid rgba(200, 230, 0, 0.58);
    color: #10221c;
    background: linear-gradient(180deg, #d8f74e 0%, #bddb1d 100%);
}

.btn-save {
    border: 1px solid rgba(243, 239, 227, 0.38);
    color: var(--cream);
    background: rgba(7, 18, 15, 0.42);
}

.btn-restart {
    border: none;
    background: transparent;
    color: rgba(243, 239, 227, 0.62);
    font-family: 'Space Mono', monospace;
    font-size: 12px;
    letter-spacing: 0.08em;
    padding: 6px 0;
}

.barber {
    background: radial-gradient(110% 100% at 50% 0%, #1a362f 0%, #10231d 44%, #081612 100%);
    overflow-y: auto;
}

.barber-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: calc(8px + env(safe-area-inset-top, 0px)) 16px 7px;
    position: sticky;
    top: 0;
    z-index: 8;
    background: rgba(9, 18, 15, 0.88);
    border-bottom: 1px solid rgba(243, 239, 227, 0.12);
}

.barber-title {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 25px;
    letter-spacing: 0.05em;
    color: var(--volt-soft);
    margin-left: auto;
}

.barber-content {
    padding: 7px 16px calc(9px + env(safe-area-inset-bottom, 0px));
}

.barber-sheet {
    border-radius: 18px;
    border: 1px solid rgba(243, 239, 227, 0.13);
    overflow: hidden;
    background: linear-gradient(180deg, rgba(22, 43, 37, 0.9), rgba(10, 21, 17, 0.95));
}

.barber-photo {
    width: 100%;
    aspect-ratio: 4 / 3.85;
    object-fit: cover;
    object-position: center 22%;
    border-bottom: 1px solid rgba(243, 239, 227, 0.1);
}

.barber-rows {
    padding: 6px;
    display: grid;
    gap: 4px;
}

.barber-row {
    display: grid;
    grid-template-columns: 95px 1fr;
    gap: 10px;
    padding: 4px 7px;
    border-radius: 10px;
    border: 1px solid rgba(243, 239, 227, 0.11);
    background: rgba(7, 16, 13, 0.4);
}

.barber-label {
    font-family: 'Space Mono', monospace;
    font-size: 10px;
    color: var(--volt-soft);
    letter-spacing: 0.08em;
}

.barber-value {
    color: rgba(243, 239, 227, 0.9);
    font-size: 13px;
    line-height: 1.38;
}

.barber-brand-strip {
    margin-top: 5px;
    padding: 8px 10px;
    border-radius: 0 0 18px 18px;
    background: linear-gradient(90deg, rgba(10, 22, 18, 0.95), rgba(15, 31, 26, 0.95));
    border-top: 1px solid rgba(243, 239, 227, 0.12);
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
}

.brand-lockup {
    display: flex;
    align-items: center;
    gap: 8px;
}

.brand-mark {
    width: 32px;
    height: 38px;
    display: block;
    object-fit: contain;
    background: transparent;
    mix-blend-mode: normal;
    filter: none;
}

.brand-word {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 22px;
    letter-spacing: 0.05em;
    color: rgba(243, 239, 227, 0.95);
}

.brand-sub {
    font-family: 'Space Mono', monospace;
    font-size: 10px;
    color: rgba(243, 239, 227, 0.55);
    letter-spacing: 0.08em;
}

.results-slide .slide-image-placeholder {
    min-height: 100%;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 380px) {
    .results-title {
        font-size: 22px;
    }

    .slide-tier-name {
        font-size: 30px;
    }

    .btn-take-photo,
    .btn-select,
    .btn-barber,
    .btn-save,
    .btn-retry {
        font-size: 20px;
    }
}

@media (max-height: 700px) {
    .upload {
        gap: 8px;
        padding-top: calc(8px + env(safe-area-inset-top, 0px));
        padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px));
    }

    .upload-title {
        font-size: clamp(46px, 12vw, 78px);
        margin-bottom: 0;
    }

    .upload-guide {
        gap: 6px;
        margin-bottom: 0;
    }

    .upload-guide-card {
        width: clamp(96px, 28vw, 116px);
    }

    .upload-frame {
        width: clamp(148px, 38vw, 170px);
    }

    .upload-actions {
        gap: 8px;
        padding-top: 0;
        padding-bottom: max(8px, env(safe-area-inset-bottom, 0px));
        margin-top: 0;
    }

    .btn-take-photo {
        padding: 14px 18px;
    }

    .btn-upload-photo {
        padding: 10px 18px;
    }

    .loading-title {
        margin-bottom: 10px;
    }

    .loading-frame {
        width: min(56vw, 220px);
    }

    .loading-status {
        margin-top: 16px;
        margin-bottom: 8px;
    }
}

@media (max-height: 620px) {
    .upload {
        gap: 6px;
        padding-top: calc(6px + env(safe-area-inset-top, 0px));
        padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
    }

    .upload-title {
        font-size: clamp(40px, 11vw, 64px);
    }

    .upload-guide-card {
        width: clamp(88px, 25vw, 102px);
    }

    .upload-frame {
        width: clamp(132px, 34vw, 150px);
    }

    .upload-browser-note {
        font-size: 9px;
    }

    .btn-take-photo {
        padding: 13px 18px;
    }

    .btn-upload-photo {
        padding: 9px 18px;
    }
}

@media (min-aspect-ratio: 9/16) {
    .home-bg {
        background-size: contain;
        background-position: center top;
    }
}

/* ============================================================
   DESKTOP / TABLET — phone canvas frame
   Every screen (especially .home) is constrained to a centered
   portrait panel; the surrounding viewport shows the body's
   radial gradient as negative canvas. Mobile (<640px) untouched.
   ============================================================ */
@media (min-width: 640px) {
    html, body {
        overflow: hidden;
    }

    body {
        min-height: 100vh;
        min-height: 100dvh;
    }

    html body .screen,
    html body .screen.active {
        position: fixed;
        top: 50%;
        left: 50%;
        right: auto;
        bottom: auto;
        width: min(430px, calc(100vw - 48px));
        height: min(calc(var(--app-height, 100dvh) - 40px), 860px);
        min-height: min(calc(var(--app-height, 100dvh) - 40px), 860px);
        max-height: min(calc(var(--app-height, 100dvh) - 40px), 860px);
        max-width: 430px;
        transform: translate(-50%, -50%);
        border-radius: 28px;
        border: 1px solid rgba(243, 239, 227, 0.12);
        box-shadow:
            0 26px 64px rgba(0, 0, 0, 0.42),
            inset 0 0 0 1px rgba(243, 239, 227, 0.05);
        overflow: hidden;
    }

    html body .home,
    html body .upload,
    html body .loading,
    html body .error,
    html body .results,
    html body .cutcard,
    html body .locked,
    html body .barber {
        height: 100%;
        min-height: 100%;
        width: 100%;
        max-width: 100%;
    }

    html body .home {
        overflow: hidden;
        border-radius: inherit;
    }

    /* Override the global `@media (min-aspect-ratio: 9/16)` rule —
       inside the desktop phone canvas we want cover, not contain. */
    html body .home-bg {
        background-size: cover !important;
        background-position: center center !important;
        border-radius: inherit;
    }
}

.hidden {
    display: none !important;
}
