:root {
    --app-bg: #eef3fa;
    --app-bg-dark: #102746;
    --app-bg-dark-2: #1a3a63;
    --shell-x: clamp(14px, 3.5vw, 28px);
    --surface: #ffffff;
    --surface-soft: #f6f9ff;
    --surface-elev: #fcfdff;
    --ink: #0f172a;
    --ink-soft: #2a3c52;
    --muted: #64748b;
    --line: #d6e1ef;
    --primary: #1a73e8;
    --primary-strong: #0f59bf;
    --primary-soft: #e8f1ff;
    --success: #1f8a4c;
}

* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    color: var(--ink);
    background: linear-gradient(to bottom, #173359 calc(100% - 100px), rgba(240, 245, 252, 0.98) calc(100% - 100px));
    font-family: "Manrope", sans-serif;
    line-height: 1.45;
}

h1,
h2,
h3,
h4 {
    font-family: "Sora", sans-serif;
    letter-spacing: -0.01em;
    color: var(--ink);
}

.mobile-shell {
    width: 100%;
    min-height: 100dvh;
    margin: 0;
    display: flex;
    flex-direction: column;
    padding: calc(12px + env(safe-area-inset-top)) var(--shell-x) calc(68px + env(safe-area-inset-bottom));
}

.app-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.92rem;
    padding: 0.72rem 0.86rem;
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.14);
    backdrop-filter: blur(8px);
    box-shadow: 0 8px 20px rgba(9, 27, 52, 0.18);
    position: sticky;
    top: calc(8px + env(safe-area-inset-top));
    z-index: 1;
}

.brand-line {
    margin: 0;
    font-size: 0.93rem;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
    color: #f1f7ff;
}

.token-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.71rem;
    font-weight: 700;
    color: #f1f7ff;
    border: 1px solid rgba(255, 255, 255, 0.32);
    background: rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    padding: 0.32rem 0.64rem;
    white-space: nowrap;
}

.token-chip strong {
    font-size: 0.74rem;
    letter-spacing: 0.02em;
}

.progress-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.45rem;
    font-size: 0.79rem;
    font-weight: 700;
    color: #ebf4ff;
    position: sticky;
    top: calc(70px + env(safe-area-inset-top));
    z-index: 1;
}

.progress {
    height: 0.58rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.24);
    margin-bottom: 1rem;
    position: sticky;
    top: calc(94px + env(safe-area-inset-top));
    z-index: 1;
}

.progress-bar {
    border-radius: 999px;
    background: linear-gradient(90deg, var(--primary-strong), var(--primary));
}

.question-card {
    width: calc(100% + (var(--shell-x) * 2));
    margin: auto calc(var(--shell-x) * -1) 0;
    min-height: clamp(430px, 63dvh, 770px);
    border: 1px solid var(--line);
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
    border-radius: 24px 24px 0 0;
    background: var(--surface-elev);
    box-shadow: 0 -2px 0 rgba(255, 255, 255, 0.2), 0 16px 34px rgba(16, 39, 70, 0.14);
    display: flex;
    overflow: hidden;
    position: relative;
    z-index: 4;
}

.question-card .card-body {
    width: 100%;
    padding: 1.2rem var(--shell-x) calc(104px + env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

body.damage-photo-intro .mobile-shell {
    padding-bottom: 0px;
}

.question-title {
    margin: 0;
    font-size: clamp(1.16rem, 2.2vw, 1.34rem);
    line-height: 1.24;
    font-weight: 700;
}

.question-subtitle {
    margin: -0.25rem 0 0;
    font-size: 0.92rem;
    color: #5b7289;
}

.quick-data {
    margin: 0;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: var(--surface-soft);
    padding: 0.84rem;
}

.quick-data dt {
    margin-bottom: 0.12rem;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6988a7;
}

.quick-data dd {
    margin-bottom: 0.62rem;
    font-size: 0.96rem;
    font-weight: 700;
    color: var(--ink-soft);
}

.quick-data dd:last-child {
    margin-bottom: 0;
}

.option-group {
    display: grid;
    gap: 0.64rem;
}

.option-pill {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 0.72rem;
    width: 100%;
    border: 1px solid #c7d9ec;
    border-left: 4px solid transparent;
    border-radius: 15px;
    padding: 0.9rem 2.92rem 0.9rem 0.9rem;
    background: #fff;
    color: #1b2d44;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease, border-left-color 0.15s ease;
}

.option-pill::after {
    content: "";
    position: absolute;
    right: 0.92rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 50%;
    border: 2px solid #b4c8df;
    background: #fff;
}

.option-pill:hover {
    border-color: #9ebde2;
    background: #fcfeff;
}

.btn-check:checked + .option-pill {
    border-color: #6e9fe6;
    border-left-color: var(--primary);
    background: linear-gradient(180deg, #fcfeff 0%, var(--primary-soft) 100%);
    box-shadow: 0 0 0 3px rgba(61, 124, 222, 0.19);
}

.btn-check:checked + .option-pill::after {
    content: "✓";
    display: grid;
    place-items: center;
    color: #fff;
    font-size: 0.78rem;
    font-weight: 900;
    border-color: var(--primary);
    background: var(--primary);
}

.option-content {
    min-width: 0;
}

.option-title {
    display: block;
    font-size: 0.96rem;
    line-height: 1.28;
    font-weight: 700;
}

.option-description {
    display: block;
    margin-top: 0.24rem;
    color: #576f89;
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.4;
}

.option-icon {
    width: 2rem;
    height: 2rem;
    flex-shrink: 0;
    border-radius: 12px;
    background: #eef4ff;
    border: 1px solid #d4e2f5;
    color: #3763a8;
    display: inline-grid;
    place-items: center;
}

.option-icon i {
    font-size: 0.95rem;
}

.btn-check:checked + .option-pill .option-icon {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.option-pill-damage {
    align-items: center;
}

.soft-box {
    border: 1px solid #d8e6f5;
    border-radius: 13px;
    background: var(--surface-soft);
    padding: 0.88rem;
}

.damage-focus {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.72rem;
    align-items: start;
}

.damage-focus-panel {
    border: 2px solid #8fb3e3;
    background: linear-gradient(180deg, #f9fcff 0%, #edf5ff 100%);
    box-shadow: 0 8px 18px rgba(29, 76, 145, 0.08);
}

.damage-focus-panel .small {
    color: #4f6884 !important;
}

.damage-focus-panel #current-damage-form {
    color: #1a3557;
    font-size: 1.02rem;
}

.damage-focus-icon {
    width: 2.28rem;
    height: 2.28rem;
    border-radius: 12px;
    background: #e8f1ff;
    border: 1px solid #cde0f9;
    color: #1c62cb;
    display: grid;
    place-items: center;
}

.damage-focus-icon i {
    font-size: 0.98rem;
}

.damage-intro-screen {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    min-height: clamp(380px, 58vh, 620px);
    padding: 1rem 0.2rem 1.35rem;
}

.damage-intro-icon {
    width: 4.6rem;
    height: 4.6rem;
    border-radius: 18px;
    border: 1px solid #cadcf5;
    background: linear-gradient(180deg, #eef5ff 0%, #e1edff 100%);
    color: #135bc3;
    display: grid;
    place-items: center;
    margin-bottom: 0.9rem;
}

.damage-intro-icon i {
    font-size: 1.62rem;
}

.damage-intro-caption {
    margin: 0;
    color: #627b95;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
}

.damage-intro-title {
    margin: 0.44rem 0 0.45rem;
    font-size: clamp(1.26rem, 2.3vw, 1.42rem);
    line-height: 1.25;
}

.damage-intro-help {
    margin: 0;
    color: #586f88;
    font-size: 0.95rem;
    line-height: 1.48;
    max-width: 42rem;
}

.damage-intro-note {
    margin-top: 0.95rem;
    display: inline-flex;
    align-items: flex-start;
    gap: 0.48rem;
    text-align: left;
    border: 1px solid #cfe0f6;
    background: #f3f8ff;
    border-radius: 12px;
    padding: 0.62rem 0.72rem;
    color: #4c6683;
    font-size: 0.83rem;
    max-width: 32rem;
}

.damage-intro-note i {
    color: #2969ce;
    margin-top: 0.08rem;
}

.damage-intro-actions {
    width: min(100%, 420px);
    margin-top: 1rem;
    display: block;
}

.damage-intro-actions .btn {
    width: 100%;
    white-space: normal;
    line-height: 1.2;
    font-weight: 700;
    border-radius: 12px;
    padding: 0.72rem 0.8rem;
}

.upload-field {
    border: 2px solid #8fb4e6;
    border-radius: 14px;
    background: linear-gradient(180deg, #fafdff 0%, #f1f7ff 100%);
    padding: 0.85rem;
}

.upload-field.has-files {
    border-color: #5e95de;
    background: linear-gradient(180deg, #f8fbff 0%, #e7f2ff 100%);
}

.upload-copy {
    color: #5d7691;
    font-size: 0.82rem;
    line-height: 1.35;
}

.upload-trigger {
    width: 100%;
    border: 1px solid #b5cde7;
    border-radius: 12px;
    background: #fff;
    color: #294a6d;
    padding: 0.76rem 0.88rem;
    display: flex;
    align-items: center;
    gap: 0.55rem;
    font-weight: 700;
    font-size: 0.93rem;
    transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.upload-trigger-primary {
    border-color: #568ed9;
    background: linear-gradient(180deg, #1d71df 0%, #165fc6 100%);
    color: #ffffff;
    font-weight: 800;
}

.upload-trigger i {
    width: 1.72rem;
    height: 1.72rem;
    border-radius: 10px;
    border: 1px solid #d0dff1;
    background: #eef5ff;
    color: #1f67d1;
    display: grid;
    place-items: center;
    font-size: 0.86rem;
}

.upload-trigger:hover,
.upload-trigger:focus {
    border-color: #9fbee1;
    background: #fbfdff;
    box-shadow: 0 0 0 3px rgba(76, 137, 231, 0.14);
}

.upload-trigger-primary:hover,
.upload-trigger-primary:focus {
    border-color: #497fc9;
    background: linear-gradient(180deg, #236fce 0%, #195bb0 100%);
    box-shadow: 0 0 0 3px rgba(28, 104, 205, 0.22);
}

.upload-trigger-primary i {
    border-color: rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.16);
    color: #ffffff;
}

.upload-list {
    margin-top: 0.55rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.38rem;
}

.upload-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.34rem;
    max-width: 100%;
    border: 1px solid #c3d8f2;
    background: #fff;
    border-radius: 999px;
    padding: 0.28rem 0.6rem;
    color: #3e5f81;
    font-size: 0.76rem;
    font-weight: 700;
}

.upload-chip i {
    color: #2a6ed4;
}

.upload-chip span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.upload-hint {
    margin-top: 0.52rem;
    font-size: 0.82rem;
    color: #607a96;
    font-weight: 600;
    line-height: 1.35;
}

.helper-error {
    margin-top: 0.48rem;
    color: #b83a2b;
    font-size: 0.83rem;
    font-weight: 700;
}

.summary-list {
    margin: 0;
    padding-left: 1.06rem;
}

.summary-list li {
    margin-bottom: 0.34rem;
    font-size: 0.91rem;
}

.form-label {
    margin-bottom: 0.4rem;
    font-size: 0.86rem;
    font-weight: 600;
    color: #334a63;
}

.form-control,
.form-select {
    border-color: var(--line);
    border-radius: 13px;
    font-size: 0.95rem;
    padding-top: 0.7rem;
    padding-bottom: 0.7rem;
    background-color: #fff;
}

.form-control:focus,
.form-select:focus {
    border-color: #8eb6f3;
    box-shadow: 0 0 0 3px rgba(76, 137, 231, 0.18);
}

.form-text {
    font-size: 0.8rem;
    color: #70859d;
}

.sticky-actions {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    z-index: 20;
    background: rgba(240, 245, 252, 0.98);
    border-top: 1px solid #d2dfee;
    backdrop-filter: blur(8px);
    box-shadow: 0 -8px 18px rgba(18, 45, 78, 0.08);
}

.sticky-actions .inner {
    width: 100%;
    display: flex;
    gap: 0.58rem;
    padding: 10px var(--shell-x) calc(12px + env(safe-area-inset-bottom));
}

.sticky-actions .btn {
    border-radius: 12px;
    padding: 0.82rem 0.94rem;
    font-size: 0.92rem;
    font-weight: 800;
    min-width: 0;
    line-height: 1.2;
    white-space: normal;
    overflow-wrap: anywhere;
    text-wrap: balance;
}

.sticky-actions .inner > .btn:first-child {
    flex: 0 0 34%;
}

.sticky-actions .inner > .btn:last-child {
    flex: 1 1 66%;
}

.btn-primary {
    border-color: var(--primary);
    background: var(--primary);
}

.btn-primary:hover,
.btn-primary:focus {
    border-color: var(--primary-strong);
    background: var(--primary-strong);
}

.btn-success {
    border-color: var(--success);
    background: var(--success);
}

.btn-outline-secondary {
    color: #35546f;
    border-color: #bdd0e4;
    background: #fff;
}

.btn-outline-secondary:hover,
.btn-outline-secondary:focus {
    color: #294764;
    border-color: #a8bfd8;
    background: #f8fbff;
}

.empty-state {
    border: 1px dashed #aec3dc;
    border-radius: 12px;
    background: #f4f8ff;
    padding: 0.95rem;
    color: #3c5873;
    font-size: 0.9rem;
}

@media (min-width: 920px) {
    :root {
        --shell-x: clamp(24px, 5vw, 60px);
    }

    .mobile-shell {
        max-width: 100%;
    }
}

body.page-leaving .mobile-shell {
    opacity: 0.72;
    transform: translateY(4px);
    transition: opacity 120ms ease, transform 120ms ease;
    pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
    body.page-leaving .mobile-shell {
        opacity: 1 !important;
        transform: none;
        transition: none;
    }
}
