:root {
    --ink: #33102f;
    --muted: #7b5475;
    --rose: #ff4f9a;
    --fuchsia: #ce35ff;
    --violet: #7b4dff;
    --peach: #ffd0df;
    --paper: rgba(255, 249, 253, 0.78);
    --paper-strong: rgba(255, 255, 255, 0.92);
    --line: rgba(151, 55, 143, 0.18);
    --shadow: 0 28px 80px rgba(118, 36, 133, 0.24);
    --shadow-soft: 0 16px 44px rgba(118, 36, 133, 0.16);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
}

body {
    min-height: 100%;
    margin: 0;
    overflow-x: hidden;
    color: var(--ink);
    font-family: 'Microsoft YaHei UI', 'Microsoft YaHei', 'PingFang SC', 'Hiragino Sans GB', system-ui, sans-serif;
    background:
        radial-gradient(circle at 8% 8%, rgba(255, 111, 177, 0.45), transparent 26rem),
        radial-gradient(circle at 88% 4%, rgba(148, 89, 255, 0.36), transparent 28rem),
        linear-gradient(135deg, #fff0f7 0%, #f3e7ff 48%, #ffe7ef 100%);
    background-attachment: fixed;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.36) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.28) 1px, transparent 1px);
    background-size: 38px 38px;
    mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.7), transparent 72%);
}

h1:focus {
    outline: none;
}

a {
    color: inherit;
}

a,
button,
select,
input,
.mud-button-root,
.mud-icon-button-root {
    touch-action: manipulation;
}

.app-shell {
    min-height: 100dvh;
    padding: clamp(0.65rem, 2.4vw, 1.25rem);
    padding-bottom: clamp(0.65rem, 2.4vw, 1.25rem);
}

.top-nav {
    position: sticky;
    top: clamp(0.45rem, 2vw, 1rem);
    z-index: 20;
    width: min(1180px, 100%);
    margin: 0 auto;
    padding: 0.85rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.brand-link {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    gap: 0.7rem;
    text-decoration: none;
    font-weight: 900;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.brand-mark {
    width: 2.35rem;
    height: 2.35rem;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 0.95rem;
    color: #fff;
    background: linear-gradient(135deg, var(--rose), var(--violet));
    box-shadow: 0 12px 28px rgba(206, 53, 255, 0.32);
    font-family: 'Microsoft YaHei UI', 'Microsoft YaHei', 'PingFang SC', 'Hiragino Sans GB', system-ui, sans-serif;
    font-size: 1.45rem;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    min-width: 0;
}

.nav-links a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0.62rem 0.95rem;
    border-radius: 999px;
    color: var(--muted);
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
    transition: color 160ms ease, background 160ms ease, transform 160ms ease;
}

.nav-links a:hover,
.nav-links a:focus-visible {
    color: var(--ink);
    background: rgba(255, 255, 255, 0.72);
    transform: translateY(-1px);
}

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

.page-container {
    width: min(1180px, calc(100vw - 2rem));
    margin: 0 auto;
    padding: clamp(1rem, 4vw, 5.5rem) 0 clamp(2rem, 5vw, 3rem);
}

.hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
    gap: clamp(1.2rem, 3vw, 2rem);
    align-items: stretch;
}

.glass-card {
    border: 1px solid var(--line);
    border-radius: clamp(1.25rem, 3vw, 2rem);
    background: linear-gradient(145deg, var(--paper-strong), var(--paper));
    box-shadow: var(--shadow);
    backdrop-filter: blur(22px) saturate(140%);
}

.hero-copy {
    padding: clamp(1.4rem, 5vw, 4rem);
    position: relative;
    overflow: hidden;
}

.hero-copy::after {
    content: '';
    position: absolute;
    width: 16rem;
    height: 16rem;
    right: -5rem;
    top: -5rem;
    border-radius: 999px;
    background: radial-gradient(circle, rgba(255, 79, 154, 0.28), transparent 70%);
}

.eyebrow,
.panel-kicker {
    margin: 0 0 0.9rem;
    color: var(--rose);
    font-size: 0.85rem;
    font-weight: 900;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.hero-title {
    margin: 0;
    max-width: 12ch;
    font-size: clamp(2.4rem, 7vw, 5.7rem);
    line-height: 0.96;
    letter-spacing: -0.08em;
    font-weight: 900;
}

.hero-subtitle {
    max-width: 43rem;
    margin: 1.35rem 0 0;
    color: var(--muted);
    font-size: clamp(1rem, 2vw, 1.2rem);
    line-height: 1.85;
}

.cta-row,
.button-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.85rem;
}

.cta-row {
    margin-top: 2rem;
}

.primary-cta,
.secondary-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 3.25rem;
    padding: 0 1.45rem;
    border-radius: 999px;
    font-weight: 900;
    text-decoration: none;
    transition: transform 180ms ease, box-shadow 180ms ease;
}

.primary-cta {
    color: #fff;
    background: linear-gradient(135deg, var(--rose), var(--fuchsia) 52%, var(--violet));
    box-shadow: 0 18px 36px rgba(206, 53, 255, 0.34);
}

.secondary-cta {
    color: var(--ink);
    background: rgba(255, 255, 255, 0.76);
    border: 1px solid var(--line);
}

.primary-cta:hover,
.secondary-cta:hover,
.primary-cta:focus-visible,
.secondary-cta:focus-visible {
    transform: translateY(-2px);
    box-shadow: 0 22px 42px rgba(206, 53, 255, 0.28);
}

.background-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    margin-top: 1.45rem;
}

.color-pill {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 0.48rem 0.78rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.68);
    font-size: 0.9rem;
    font-weight: 800;
    border: 1px solid rgba(255, 255, 255, 0.7);
}

.color-pill.red { box-shadow: inset 0 -4px 0 #d32f2f; }
.color-pill.blue { box-shadow: inset 0 -4px 0 #1e5bff; }
.color-pill.white { box-shadow: inset 0 -4px 0 #fff, 0 0 0 1px rgba(51, 16, 47, 0.08); }

.privacy-note {
    margin: 1.35rem 0 0;
    color: #8b647f;
    font-size: 0.92rem;
    line-height: 1.75;
}

.studio-panel,
.history-panel,
.spec-panel,
.page-heading,
.workflow-card,
.empty-history {
    position: relative;
    overflow: hidden;
}

.studio-panel {
    min-height: 580px;
    padding: clamp(1.1rem, 3vw, 2rem);
    display: grid;
    align-content: center;
    gap: 1rem;
}

.studio-panel::before,
.history-panel::before,
.spec-panel::before,
.page-heading::before,
.workflow-card::before,
.empty-history::before {
    content: '';
    position: absolute;
    inset: auto -20% -45% 18%;
    height: 65%;
    border-radius: 999px;
    background: radial-gradient(circle, rgba(255, 79, 154, 0.2), transparent 68%);
    pointer-events: none;
}

.preview-frame {
    width: min(285px, 78vw);
    aspect-ratio: 3 / 4;
    margin: 0 auto;
    padding: 0.9rem;
    border-radius: 1.7rem;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.88), rgba(241, 245, 249, 0.74)),
        linear-gradient(180deg, #f8fafc 0%, #e7edf5 100%);
    box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.28), 0 26px 58px rgba(15, 23, 42, 0.14);
}

.portrait-card {
    height: 100%;
    border-radius: 1.15rem;
    overflow: hidden;
    background-color: #e7edf5;
    background-image: var(--home-avatar-image, url('../images/Avatar/1.jpg'));
    background-size: cover;
    background-position: center top;
    background-repeat: no-repeat;
    box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.18);
}

.control-stack {
    display: grid;
    gap: 0.75rem;
}

.control-card,
.workflow-card,
.empty-history {
    position: relative;
    padding: clamp(0.95rem, 2.6vw, 1.25rem);
    border-radius: 1.25rem;
    background: rgba(255, 255, 255, 0.68);
    border: 1px solid rgba(255, 255, 255, 0.72);
    box-shadow: var(--shadow-soft);
}

.control-card span {
    color: var(--rose);
    font-weight: 900;
    font-size: 0.82rem;
}

.control-card strong {
    display: block;
    margin-top: 0.15rem;
}

.control-card p,
.workflow-card p,
.empty-history p {
    margin: 0.25rem 0 0;
    color: var(--muted);
    font-size: 0.92rem;
    line-height: 1.7;
}

.step-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.history-panel,
.spec-panel,
.page-heading {
    padding: clamp(1.2rem, 3vw, 2rem);
}

.history-panel h2,
.spec-panel h2,
.page-heading h1,
.workflow-card h2,
.empty-history h2 {
    margin: 0;
    font-size: clamp(1.35rem, 3vw, 2rem);
    line-height: 1.15;
}

.history-panel p,
.spec-panel p,
.page-heading p {
    margin: 0.8rem 0 0;
    color: var(--muted);
    line-height: 1.75;
}

.page-heading-card {
    margin-bottom: 1rem;
}

.studio-page,
.history-page,
.specs-page {
    display: grid;
    gap: clamp(0.85rem, 2.5vw, 1.25rem);
}

.step-indicator {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.5rem;
}

.step-indicator span {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.65rem 0.5rem;
    border-radius: 999px;
    color: var(--muted);
    background: rgba(255, 255, 255, 0.58);
    border: 1px solid rgba(255, 255, 255, 0.65);
    font-size: 0.92rem;
    font-weight: 800;
    text-align: center;
}

.step-indicator span.active {
    color: #fff;
    background: linear-gradient(135deg, var(--rose), var(--violet));
    box-shadow: 0 12px 30px rgba(206, 53, 255, 0.28);
}

.studio-grid {
    display: grid;
    grid-template-columns: minmax(0, 0.92fr) minmax(320px, 1.08fr);
    gap: clamp(0.9rem, 2.4vw, 1.4rem);
    align-items: start;
}

.studio-controls,
.studio-preview {
    min-width: 0;
    display: grid;
    gap: 0.9rem;
}

.studio-preview {
    align-content: start;
}

.studio-alert {
    border-radius: 1rem;
}

.crop-stage {
    width: min(320px, 76vw);
    margin: 0 auto;
    display: grid;
    place-items: center;
    overflow: hidden;
    border-radius: 1.35rem;
    border: 1px solid rgba(255, 255, 255, 0.72);
    box-shadow: inset 0 0 0 1px rgba(54, 19, 84, 0.08), 0 18px 45px rgba(92, 37, 124, 0.18);
}

.crop-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    will-change: transform;
}

.preview-rendering-badge {
    position: absolute;
    inset: auto 0 0 0;
    padding: 0.55rem 0.85rem;
    background: rgba(30, 19, 48, 0.72);
    color: #fff;
    font-weight: 800;
    text-align: center;
    backdrop-filter: blur(10px);
}

.current-photo-preview .crop-stage {
    position: relative;
}

.studio-step-actions {
    justify-content: flex-end;
}

.camera-video {
    width: 100%;
    max-height: 42vh;
    display: block;
    border-radius: 1.25rem;
    background: rgba(51, 16, 47, 0.08);
    object-fit: cover;
}

.camera-video-hidden {
    display: none;
}

.print-sheet-zoom-controls {
    display: grid;
    gap: 0.45rem;
    margin: 0.75rem 0 0.85rem;
}

.print-sheet-zoom-controls label {
    display: flex;
    justify-content: space-between;
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 800;
}

.print-sheet-frame {
    max-height: min(56vh, 520px);
    overflow: auto;
    display: grid;
    place-items: start center;
    padding: 0.9rem;
    border-radius: 1.25rem;
    background: rgba(255, 255, 255, 0.58);
    border: 1px solid rgba(255, 255, 255, 0.72);
    box-shadow: inset 0 0 0 1px rgba(54, 19, 84, 0.06);
}

.print-sheet-frame img {
    max-width: 100%;
    height: auto;
    display: block;
    transform-origin: top center;
    transition: transform 160ms ease;
}

.print-sheet-loading,
.print-sheet-empty {
    min-height: 180px;
    display: grid;
    place-items: center;
    color: var(--muted);
    font-weight: 800;
    text-align: center;
}

.background-options {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
}

.background-swatch {
    min-height: 76px;
    display: grid;
    place-items: center;
    gap: 0.35rem;
    padding: 0.75rem 0.5rem;
    border: 2px solid rgba(255, 255, 255, 0.82);
    border-radius: 1.15rem;
    color: var(--ink);
    background: rgba(255, 255, 255, 0.7);
    box-shadow: 0 12px 26px rgba(64, 23, 77, 0.12);
    cursor: pointer;
    transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease, outline-color 160ms ease;
}

.background-swatch:hover,
.background-swatch:focus-visible {
    transform: translateY(-2px);
    box-shadow: 0 18px 34px rgba(64, 23, 77, 0.18);
}

.background-swatch.selected {
    border-color: var(--rose);
    outline: 3px solid rgba(255, 79, 154, 0.22);
    box-shadow: 0 18px 38px rgba(206, 53, 255, 0.24);
}

.background-swatch-chip {
    width: 2.45rem;
    height: 2.45rem;
    border-radius: 999px;
    border: 2px solid rgba(255, 255, 255, 0.95);
    box-shadow: inset 0 0 0 1px rgba(24, 12, 36, 0.18), 0 8px 18px rgba(64, 23, 77, 0.16);
}

.background-swatch-label {
    font-size: 0.9rem;
    font-weight: 900;
}

.export-format-row {
    display: grid;
    gap: 0.45rem;
    margin: 0.85rem 0;
}

.export-format-row label {
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 800;
}

.form-select {
    width: 100%;
    min-height: 44px;
    border: 1px solid var(--line);
    border-radius: 0.95rem;
    padding: 0 0.9rem;
    color: var(--ink);
    background: rgba(255, 255, 255, 0.76);
    font: inherit;
    font-weight: 800;
}

.button-row .mud-button-root,
.workflow-card .mud-button-root,
.studio-step-actions .mud-button-root,
.history-panel .mud-button-root {
    min-height: 44px;
    border-radius: 999px;
}

.upload-hero-card {
    position: relative;
    min-height: 188px;
    display: grid;
    place-items: center;
    gap: 0.55rem;
    margin-top: 1rem;
    padding: 1.35rem;
    overflow: hidden;
    border-radius: 1.55rem;
    color: #fff;
    cursor: pointer;
    text-align: center;
    background: linear-gradient(135deg, var(--rose), var(--fuchsia) 52%, var(--violet));
    box-shadow: 0 22px 48px rgba(206, 53, 255, 0.34);
    isolation: isolate;
}

.upload-hero-card::before {
    content: '';
    position: absolute;
    inset: -30% -10% auto auto;
    width: 12rem;
    height: 12rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.2);
    animation: uploadPulse 2.4s ease-in-out infinite;
    z-index: -1;
}

.upload-hero-card::after {
    content: '';
    position: absolute;
    inset: auto auto -25% -18%;
    width: 11rem;
    height: 11rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
    z-index: -1;
}

.upload-hero-card input[type='file'] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.upload-plus {
    width: 4.35rem;
    height: 4.35rem;
    display: grid;
    place-items: center;
    border-radius: 1.55rem;
    color: var(--rose);
    background: rgba(255, 255, 255, 0.92);
    font-size: 3rem;
    font-weight: 300;
    line-height: 1;
    box-shadow: 0 16px 34px rgba(51, 16, 47, 0.22);
}

.upload-title {
    font-size: 1.35rem;
    font-weight: 900;
    letter-spacing: -0.03em;
}

.upload-subtitle {
    max-width: 18rem;
    color: rgba(255, 255, 255, 0.82);
    font-size: 0.92rem;
    line-height: 1.55;
}

.upload-badges {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.45rem;
}

.upload-badges span {
    min-height: 30px;
    display: inline-flex;
    align-items: center;
    padding: 0 0.7rem;
    border-radius: 999px;
    color: #fff;
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.26);
    font-size: 0.78rem;
    font-weight: 800;
}

.specs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
    gap: 1rem;
    padding: 0;
}

.spec-card {
    display: grid;
    gap: 0.5rem;
    padding: 1.25rem;
}

.spec-card-name {
    font-size: 1rem;
    font-weight: 800;
    margin: 0;
    color: var(--ink);
    line-height: 1.3;
}

.spec-card-category {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--berry);
    display: inline-block;
    padding: 0.15rem 0.65rem;
    background: rgba(148, 67, 138, 0.10);
    border-radius: 2rem;
    width: fit-content;
}

.spec-card-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.35rem 1rem;
    margin: 0.4rem 0 0;
}

.spec-card-details > div {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.spec-card-details dt {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--ink-4);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.spec-card-details dd {
    margin: 0;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--ink);
}

.spec-card-bg-colors {
    grid-column: 1 / -1;
}

/* ── Capture preview (photo taken, awaiting confirm/retake) ── */
.capture-preview {
    display: grid;
    gap: 0.75rem;
    text-align: center;
    padding: 1.25rem;
}

.captured-photo-img {
    width: 100%;
    max-height: 55vh;
    object-fit: contain;
    border-radius: 1rem;
    background: rgba(51, 16, 47, 0.06);
    box-shadow: 0 4px 20px rgba(118, 36, 133, 0.12);
}

.capture-preview .button-row {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
}

.capture-preview .button-row .mud-button-root {
    min-width: 9rem;
}

/* ── Reselect photo (back to step 1 from Edit/Export) ── */
.reselect-row {
    margin-top: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.reselect-confirm-text {
    font-size: 0.82rem;
    color: var(--ink-4, #7b5475);
    font-weight: 600;
}

.reselect-btn .mud-button-label {
    font-size: 0.82rem;
}

@media (max-width: 480px) {
    .specs-grid {
        grid-template-columns: 1fr;
        gap: 0.85rem;
    }

    .spec-card-details {
        grid-template-columns: 1fr 1fr;
    }
}

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

.history-card {
    display: grid;
    gap: 0.9rem;
    padding: 1rem;
}

.history-card img {
    width: 100%;
    aspect-ratio: 3 / 4;
    object-fit: cover;
    border-radius: 1rem;
    background: rgba(255, 255, 255, 0.55);
}

.history-card-body h3 {
    margin: 0;
    font-size: 1.1rem;
}

.history-card-body p {
    margin: 0.25rem 0 0;
    color: var(--muted);
}

.processing-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: grid;
    place-items: center;
    padding: 1.25rem;
    background: rgba(20, 12, 34, 0.58);
    backdrop-filter: blur(14px) saturate(130%);
    pointer-events: all;
}

.processing-panel {
    width: min(420px, 92vw);
    border-radius: 1.5rem;
    padding: 1.5rem;
    text-align: center;
    color: var(--ink);
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 24px 70px rgba(38, 16, 58, 0.32);
}

.processing-spinner {
    width: 3.25rem;
    height: 3.25rem;
    margin: 0 auto 1rem;
    border-radius: 999px;
    border: 0.35rem solid rgba(123, 77, 255, 0.18);
    border-top-color: var(--rose);
    animation: processingSpin 0.9s linear infinite;
}

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

@keyframes uploadPulse {
    0%, 100% {
        transform: scale(0.86) translate3d(0, 0, 0);
        opacity: 0.48;
    }
    50% {
        transform: scale(1.08) translate3d(-0.4rem, 0.35rem, 0);
        opacity: 0.78;
    }
}

.blazor-splash {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 1.15rem;
    overflow: hidden;
    color: var(--ink);
    background:
        radial-gradient(circle at 18% 18%, rgba(255, 79, 154, 0.42), transparent 18rem),
        radial-gradient(circle at 82% 14%, rgba(123, 77, 255, 0.36), transparent 20rem),
        linear-gradient(145deg, #fff0f7, #f5e7ff 55%, #ffe5ef);
}

.splash-orbit {
    position: absolute;
    width: min(86vw, 23rem);
    aspect-ratio: 1;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    animation: orbitSpin 3.4s linear infinite;
}

.splash-orbit span {
    position: absolute;
    width: 0.85rem;
    height: 0.85rem;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--rose), var(--violet));
    box-shadow: 0 0 24px rgba(206, 53, 255, 0.45);
}

.splash-orbit span:nth-child(1) { top: -0.35rem; left: 50%; }
.splash-orbit span:nth-child(2) { right: 8%; bottom: 18%; }
.splash-orbit span:nth-child(3) { left: 10%; bottom: 16%; }

.splash-photo-card {
    position: relative;
    width: 8.2rem;
    height: 11.2rem;
    overflow: hidden;
    border-radius: 2rem;
    background-color: #e7edf5;
    background-image: var(--splash-avatar-image, url('../images/Avatar/1.jpg'));
    background-size: cover;
    background-position: center top;
    background-repeat: no-repeat;
    box-shadow: 0 28px 70px rgba(15, 23, 42, 0.18);
    animation: splashFloat 1.9s ease-in-out infinite;
}

.splash-photo-card::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(110deg, transparent 0 35%, rgba(255, 255, 255, 0.34) 45%, transparent 58% 100%);
    transform: translateX(-120%);
    animation: shimmerSweep 1.8s ease-in-out infinite;
}

.splash-copy {
    display: grid;
    gap: 0.35rem;
    text-align: center;
    z-index: 1;
}

.splash-copy strong {
    font-size: 1.25rem;
    font-weight: 900;
}

.splash-copy span {
    color: var(--muted);
    font-size: 0.92rem;
}

.splash-shimmer {
    width: min(62vw, 16rem);
    height: 0.45rem;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.52);
}

.splash-shimmer::after {
    content: '';
    display: block;
    width: 42%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--rose), var(--violet));
    animation: shimmerSweep 1.25s ease-in-out infinite;
}

@keyframes splashFloat {
    0%, 100% { transform: translateY(0) rotate(-1deg); }
    50% { transform: translateY(-0.7rem) rotate(1.5deg); }
}

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

@keyframes shimmerSweep {
    from { transform: translateX(-120%); }
    to { transform: translateX(240%); }
}

#blazor-error-ui {
    color-scheme: light only;
    background: #fff4cb;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

.blazor-error-boundary {
    background: #b32121;
    color: white;
    padding: 1rem;
}

.blazor-error-boundary::after {
    content: "An error has occurred.";
}

.loading-progress {
    position: relative;
    display: block;
    width: 8rem;
    height: 8rem;
    margin: 20vh auto 1rem auto;
}

.loading-progress circle {
    fill: none;
    stroke: rgba(123, 77, 255, 0.18);
    stroke-width: 0.6rem;
    transform-origin: 50% 50%;
    transform: rotate(-90deg);
}

.loading-progress circle:last-child {
    stroke: var(--rose);
    stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
    transition: stroke-dasharray 0.05s ease-in-out;
}

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: 900;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

.loading-progress-text:after {
    content: var(--blazor-load-percentage-text, "Loading");
}

code {
    color: #c02d76;
}

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

@media (max-width: 900px) {
    .hero-grid,
    .studio-grid,
    .step-grid {
        grid-template-columns: 1fr;
    }

    .studio-controls {
        order: 2;
    }

    .studio-preview {
        order: 1;
    }
}

@media (max-width: 640px) {
    body {
        background-attachment: scroll;
    }

    .app-shell {
        padding: 0.6rem;
        padding-bottom: calc(5.6rem + var(--safe-bottom));
    }

    .top-nav,
    .hero-grid,
    .step-grid,
    .studio-grid {
        width: 100%;
    }

    .top-nav {
        position: sticky;
        top: 0.5rem;
        align-items: stretch;
        gap: 0.65rem;
        flex-direction: column;
        border-radius: 1.25rem;
        padding: 0.65rem;
    }

    .brand-link {
        justify-content: center;
    }

    .nav-links {
        width: 100%;
        justify-content: flex-start;
        gap: 0.35rem;
        overflow-x: auto;
        padding-bottom: 0.1rem;
        scrollbar-width: none;
    }

    .nav-links::-webkit-scrollbar {
        display: none;
    }

    .nav-links a {
        flex: 1 0 auto;
        min-width: 5.2rem;
        text-align: center;
        padding-inline: 0.75rem;
    }

    .app-bottom-nav {
        position: fixed;
        left: 0.75rem;
        right: 0.75rem;
        bottom: calc(0.65rem + var(--safe-bottom));
        z-index: 40;
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 0.45rem;
        padding: 0.45rem;
        border-radius: 1.4rem;
        background: rgba(255, 249, 253, 0.9);
        box-shadow: 0 18px 46px rgba(118, 36, 133, 0.24);
        backdrop-filter: blur(20px) saturate(150%);
    }

    .app-bottom-nav .nav-item {
        min-height: 52px;
        display: grid;
        place-items: center;
        gap: 0.12rem;
        padding: 0.35rem 0.25rem;
        border-radius: 1rem;
        color: var(--muted);
        text-decoration: none;
        font-size: 0.78rem;
        font-weight: 900;
    }

    .app-bottom-nav .nav-item:active,
    .app-bottom-nav .nav-item:focus-visible {
        color: #fff;
        background: linear-gradient(135deg, var(--rose), var(--violet));
    }

    .nav-glyph {
        width: 1.65rem;
        height: 1.65rem;
        display: grid;
        place-items: center;
        border-radius: 0.65rem;
        color: #fff;
        background: linear-gradient(135deg, var(--rose), var(--violet));
        font-size: 0.92rem;
        line-height: 1;
    }

    .page-container {
        width: 100%;
        padding-top: 0.85rem;
        padding-bottom: calc(1.25rem + var(--safe-bottom));
    }

    .hero-title {
        max-width: 100%;
        font-size: clamp(2.1rem, 13vw, 3.35rem);
        letter-spacing: -0.06em;
    }

    .hero-subtitle {
        line-height: 1.7;
    }

    .studio-panel {
        min-height: auto;
    }

    .cta-row a,
    .button-row .mud-button-root,
    .workflow-card .mud-button-root,
    .studio-step-actions .mud-button-root {
        width: 100%;
    }

    .step-indicator {
        display: flex;
        gap: 0.45rem;
        overflow-x: auto;
        padding-bottom: 0.15rem;
        scrollbar-width: none;
    }

    .step-indicator::-webkit-scrollbar {
        display: none;
    }

    .step-indicator span {
        flex: 0 0 auto;
        min-width: 6.25rem;
        padding-inline: 0.7rem;
    }

    .studio-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .studio-controls,
    .studio-preview {
        gap: 0.75rem;
    }

    .studio-step-actions {
        position: sticky;
        bottom: calc(0.55rem + var(--safe-bottom));
        z-index: 15;
        padding: 0.7rem;
        border: 1px solid rgba(255, 255, 255, 0.72);
        border-radius: 1.15rem;
        background: rgba(255, 249, 253, 0.88);
        box-shadow: 0 14px 36px rgba(118, 36, 133, 0.22);
        backdrop-filter: blur(18px) saturate(140%);
    }

    .preview-frame {
        width: min(235px, 70vw);
    }

    .camera-video {
        max-height: 34vh;
    }

    .control-card,
    .workflow-card,
    .empty-history,
    .history-panel,
    .spec-panel,
    .page-heading {
        border-radius: 1.15rem;
    }

    .export-format-row {
        margin-top: 0.65rem;
    }

    .specs-grid {
        gap: 0.85rem;
    }
}
