.lfp-app,
.lfp-app * {
    box-sizing: border-box;
}

.lfp-app {
    --lfp-brand: #dd3333;
    --lfp-brand-soft: color-mix(in srgb, var(--lfp-brand) 12%, white);
    --lfp-brand-softer: color-mix(in srgb, var(--lfp-brand) 6%, white);
    --lfp-text: #202124;
    --lfp-muted: #687078;
    --lfp-line: #e2e5e9;
    --lfp-panel: #ffffff;
    --lfp-bg: #f5f6f8;
    --lfp-radius: 18px;
    color: var(--lfp-text);
    font-family: inherit;
    line-height: 1.5;
    margin: 28px auto;
    max-width: 1500px;
}

.lfp-app button,
.lfp-app input,
.lfp-app select {
    font: inherit;
}

.lfp-app button {
    cursor: pointer;
}

.lfp-app [hidden] {
    display: none !important;
}

.lfp-shell {
    background: var(--lfp-bg);
    border: 1px solid var(--lfp-line);
    border-radius: 24px;
    box-shadow: 0 18px 50px rgba(25, 30, 38, 0.08);
    overflow: hidden;
}

.lfp-header {
    align-items: center;
    background: linear-gradient(135deg, #fff 0%, var(--lfp-brand-softer) 100%);
    border-bottom: 1px solid var(--lfp-line);
    display: flex;
    gap: 24px;
    justify-content: space-between;
    padding: 26px 30px;
}

.lfp-eyebrow {
    color: var(--lfp-brand);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.12em;
    margin: 0 0 5px;
    text-transform: uppercase;
}

.lfp-title {
    color: var(--lfp-text);
    font-size: clamp(26px, 3vw, 40px);
    line-height: 1.1;
    margin: 0;
}

.lfp-subtitle {
    color: var(--lfp-muted);
    margin: 8px 0 0;
    max-width: 760px;
}

.lfp-score-card {
    align-items: center;
    background: #fff;
    border: 1px solid var(--lfp-line);
    border-radius: 16px;
    display: grid;
    flex: 0 0 auto;
    min-width: 145px;
    padding: 12px 18px;
    text-align: center;
}

.lfp-score-card > span:first-child {
    color: var(--lfp-muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.lfp-score-card strong {
    color: var(--lfp-brand);
    font-size: 30px;
    line-height: 1.1;
}

.lfp-stars,
.lfp-result-stars {
    color: #d59b00;
    letter-spacing: 2px;
}

.lfp-modebar {
    align-items: center;
    background: #fff;
    border-bottom: 1px solid var(--lfp-line);
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 20px;
}

.lfp-mode,
.lfp-modebar select,
.lfp-challenge-copy {
    border-radius: 999px;
}

.lfp-mode {
    background: #fff;
    border: 1px solid var(--lfp-line);
    color: var(--lfp-text);
    font-weight: 700;
    padding: 8px 15px;
}

.lfp-mode.is-active {
    background: var(--lfp-brand);
    border-color: var(--lfp-brand);
    color: #fff;
}

.lfp-modebar select {
    background: #fff;
    border: 1px solid var(--lfp-line);
    min-height: 40px;
    padding: 7px 36px 7px 13px;
}

.lfp-challenge-copy {
    background: var(--lfp-brand-soft);
    color: #542020;
    flex: 1 1 320px;
    font-size: 13px;
    margin: 0;
    padding: 8px 14px;
}

.lfp-workspace {
    display: grid;
    grid-template-columns: minmax(180px, 225px) minmax(420px, 1fr) minmax(250px, 310px);
    min-height: 720px;
}

.lfp-panel {
    background: var(--lfp-panel);
    padding: 20px;
}

.lfp-panel-left {
    border-right: 1px solid var(--lfp-line);
}

.lfp-panel-right {
    border-left: 1px solid var(--lfp-line);
}

.lfp-panel section + section {
    border-top: 1px solid var(--lfp-line);
    margin-top: 22px;
    padding-top: 20px;
}

.lfp-panel h3,
.lfp-tabpanel h3 {
    color: var(--lfp-text);
    font-size: 14px;
    margin: 0 0 12px;
}

.lfp-panel select {
    background: #fff;
    border: 1px solid var(--lfp-line);
    border-radius: 10px;
    min-height: 42px;
    padding: 8px 32px 8px 11px;
    width: 100%;
}

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

.lfp-garment-button {
    align-items: center;
    background: #fff;
    border: 1px solid var(--lfp-line);
    border-radius: 12px;
    color: var(--lfp-text);
    display: flex;
    flex-direction: column;
    font-size: 11px;
    font-weight: 700;
    gap: 4px;
    min-height: 74px;
    padding: 8px 5px;
}

.lfp-garment-button svg {
    height: 36px;
    width: 42px;
}

.lfp-garment-button.is-active {
    background: var(--lfp-brand-soft);
    border-color: var(--lfp-brand);
    color: var(--lfp-brand);
}

.lfp-segmented {
    background: #eff1f3;
    border-radius: 12px;
    display: grid;
    gap: 4px;
    grid-template-columns: 1fr 1fr;
    padding: 4px;
}

.lfp-segmented button {
    background: transparent;
    border: 0;
    border-radius: 9px;
    color: var(--lfp-muted);
    font-size: 13px;
    font-weight: 700;
    padding: 8px;
}

.lfp-segmented button.is-active {
    background: #fff;
    box-shadow: 0 2px 8px rgba(30, 34, 42, 0.08);
    color: var(--lfp-brand);
}

.lfp-stage-panel {
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 18px;
}

.lfp-stage-topbar {
    align-items: center;
    display: flex;
    font-size: 13px;
    gap: 15px;
    justify-content: space-between;
    margin-bottom: 10px;
}

.lfp-selected-label strong {
    color: var(--lfp-brand);
}

.lfp-help {
    color: var(--lfp-muted);
}

.lfp-stage {
    align-items: center;
    background-color: #fff;
    background-image:
        linear-gradient(45deg, #f3f4f6 25%, transparent 25%),
        linear-gradient(-45deg, #f3f4f6 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #f3f4f6 75%),
        linear-gradient(-45deg, transparent 75%, #f3f4f6 75%);
    background-position: 0 0, 0 10px, 10px -10px, -10px 0;
    background-size: 20px 20px;
    border: 1px solid var(--lfp-line);
    border-radius: var(--lfp-radius);
    display: flex;
    flex: 1 1 auto;
    justify-content: center;
    min-height: 570px;
    overflow: hidden;
    padding: 10px;
    position: relative;
}

.lfp-canvas {
    display: block;
    height: min(64vh, 650px);
    max-height: 650px;
    max-width: 100%;
    overflow: visible;
    width: auto;
}

.lfp-part {
    cursor: pointer;
    outline: none;
    transition: filter 0.15s ease, opacity 0.15s ease;
}

.lfp-part:hover,
.lfp-part:focus-visible {
    filter: brightness(0.96);
}

.lfp-part.is-selected {
    filter: drop-shadow(0 0 5px color-mix(in srgb, var(--lfp-brand) 60%, transparent));
}

.lfp-outline {
    fill: none;
    stroke: #373a3f;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 3;
}

.lfp-detail-line {
    fill: none;
    stroke: rgba(55, 58, 63, 0.65);
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
}

.lfp-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    justify-content: center;
    margin-top: 12px;
}

.lfp-toolbar button,
.lfp-wide-button {
    align-items: center;
    background: #fff;
    border: 1px solid var(--lfp-line);
    border-radius: 10px;
    color: var(--lfp-text);
    display: inline-flex;
    font-size: 12px;
    font-weight: 700;
    gap: 5px;
    justify-content: center;
    min-height: 39px;
    padding: 7px 10px;
}

.lfp-toolbar button:hover,
.lfp-wide-button:hover {
    border-color: var(--lfp-brand);
}

.lfp-toolbar .lfp-primary,
.lfp-wide-button {
    background: var(--lfp-brand);
    border-color: var(--lfp-brand);
    color: #fff;
}

.lfp-toolbar button:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

.lfp-tabs {
    border-bottom: 1px solid var(--lfp-line);
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    margin: -4px -4px 18px;
}

.lfp-tabs button {
    background: transparent;
    border: 0;
    border-bottom: 3px solid transparent;
    color: var(--lfp-muted);
    font-size: 12px;
    font-weight: 800;
    padding: 11px 4px;
}

.lfp-tabs button.is-active {
    border-bottom-color: var(--lfp-brand);
    color: var(--lfp-brand);
}

.lfp-tabpanel {
    display: none;
}

.lfp-tabpanel.is-active {
    display: block;
}

.lfp-color-row,
.lfp-pattern-colors label,
.lfp-range-row {
    align-items: center;
    display: flex;
    font-size: 12px;
    justify-content: space-between;
    margin: 10px 0;
}

.lfp-color-row input,
.lfp-pattern-colors input {
    background: none;
    border: 0;
    height: 42px;
    padding: 0;
    width: 52px;
}

.lfp-swatches {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(5, 1fr);
    margin: 14px 0;
}

.lfp-swatch {
    aspect-ratio: 1;
    border: 2px solid #fff;
    border-radius: 50%;
    box-shadow: 0 0 0 1px var(--lfp-line);
    padding: 0;
}

.lfp-swatch.is-active {
    box-shadow: 0 0 0 2px var(--lfp-brand);
}

.lfp-wide-button {
    width: 100%;
}

.lfp-category-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}

.lfp-category-chip {
    background: #fff;
    border: 1px solid var(--lfp-line);
    border-radius: 999px;
    color: var(--lfp-muted);
    font-size: 11px;
    font-weight: 700;
    padding: 5px 9px;
}

.lfp-category-chip.is-active {
    background: var(--lfp-brand-soft);
    border-color: var(--lfp-brand);
    color: var(--lfp-brand);
}

.lfp-pattern-grid {
    display: grid;
    gap: 9px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    max-height: 265px;
    overflow: auto;
    padding: 2px;
}

.lfp-pattern-button {
    background: #fff;
    border: 2px solid transparent;
    border-radius: 10px;
    min-width: 0;
    overflow: hidden;
    padding: 0;
    position: relative;
}

.lfp-pattern-button.is-active {
    border-color: var(--lfp-brand);
}

.lfp-pattern-preview {
    aspect-ratio: 1;
    background-color: #f2f2f2;
    background-position: center;
    background-repeat: repeat;
    background-size: 44px 44px;
    display: block;
}

.lfp-pattern-name {
    background: rgba(255, 255, 255, 0.94);
    bottom: 0;
    display: block;
    font-size: 9px;
    font-weight: 700;
    left: 0;
    overflow: hidden;
    padding: 3px;
    position: absolute;
    right: 0;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lfp-pattern-colors {
    border-top: 1px solid var(--lfp-line);
    display: grid;
    gap: 12px;
    grid-template-columns: 1fr 1fr;
    margin-top: 15px;
    padding-top: 8px;
}

.lfp-pattern-colors label {
    display: grid;
    gap: 5px;
    justify-items: center;
}

.lfp-range-row {
    align-items: stretch;
    flex-direction: column;
    gap: 6px;
}

.lfp-range-row input {
    accent-color: var(--lfp-brand);
    width: 100%;
}

.lfp-parts-list {
    display: grid;
    gap: 7px;
}

.lfp-part-button {
    align-items: center;
    background: #fff;
    border: 1px solid var(--lfp-line);
    border-radius: 10px;
    color: var(--lfp-text);
    display: flex;
    gap: 9px;
    padding: 9px;
    text-align: left;
    width: 100%;
}

.lfp-part-button.is-active {
    background: var(--lfp-brand-soft);
    border-color: var(--lfp-brand);
}

.lfp-part-chip {
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 6px;
    flex: 0 0 26px;
    height: 26px;
}

.lfp-part-meta {
    min-width: 0;
}

.lfp-part-meta strong,
.lfp-part-meta span {
    display: block;
}

.lfp-part-meta strong {
    font-size: 12px;
}

.lfp-part-meta span {
    color: var(--lfp-muted);
    font-size: 10px;
}

.lfp-learning {
    align-items: center;
    background: #fff;
    border-top: 1px solid var(--lfp-line);
    display: flex;
    gap: 20px;
    justify-content: space-between;
    padding: 22px 30px;
}

.lfp-learning h3 {
    font-size: 20px;
    margin: 0 0 5px;
}

.lfp-learning p:last-child {
    color: var(--lfp-muted);
    margin: 0;
}

.lfp-learn-link {
    background: var(--lfp-brand-soft);
    border-radius: 10px;
    color: var(--lfp-brand);
    flex: 0 0 auto;
    font-weight: 800;
    padding: 10px 14px;
    text-decoration: none;
}

.lfp-toast {
    background: #202124;
    border-radius: 10px;
    bottom: 22px;
    color: #fff;
    left: 50%;
    max-width: calc(100% - 30px);
    padding: 10px 16px;
    position: fixed;
    transform: translateX(-50%);
    z-index: 99999;
}

.lfp-modal {
    inset: 0;
    position: fixed;
    z-index: 100000;
}

.lfp-modal-backdrop {
    background: rgba(20, 22, 26, 0.7);
    inset: 0;
    position: absolute;
}

.lfp-modal-card {
    background: #fff;
    border-radius: 20px;
    left: 50%;
    max-height: calc(100vh - 40px);
    max-width: calc(100% - 30px);
    overflow: auto;
    padding: 28px;
    position: absolute;
    text-align: center;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 440px;
}

.lfp-modal-close {
    background: transparent;
    border: 0;
    color: var(--lfp-muted);
    font-size: 30px;
    line-height: 1;
    position: absolute;
    right: 12px;
    top: 8px;
}

.lfp-modal-card h3 {
    font-size: 25px;
    margin: 0;
}

.lfp-result-score {
    color: var(--lfp-brand);
    font-size: 68px;
    font-weight: 900;
    line-height: 1;
    margin: 18px 0 4px;
}

.lfp-result-stars {
    font-size: 28px;
}

.lfp-result-breakdown {
    background: var(--lfp-bg);
    border-radius: 12px;
    margin: 18px 0;
    padding: 12px;
    text-align: left;
}

.lfp-breakdown-row {
    display: flex;
    font-size: 13px;
    justify-content: space-between;
    padding: 5px;
}

@media (max-width: 1150px) {
    .lfp-workspace {
        grid-template-columns: 190px minmax(390px, 1fr) 260px;
    }

    .lfp-toolbar button span {
        display: none;
    }
}

@media (max-width: 900px) {
    .lfp-workspace {
        grid-template-columns: 1fr;
    }

    .lfp-panel-left,
    .lfp-panel-right {
        border: 0;
    }

    .lfp-panel-left {
        border-bottom: 1px solid var(--lfp-line);
        display: grid;
        gap: 14px;
        grid-template-columns: 2fr 1fr 1fr;
        padding: 14px;
    }

    .lfp-panel-left section,
    .lfp-panel-left section + section {
        border: 0;
        margin: 0;
        padding: 0;
    }

    .lfp-panel-right {
        border-top: 1px solid var(--lfp-line);
    }

    .lfp-garment-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .lfp-stage {
        min-height: 500px;
    }

    .lfp-canvas {
        height: min(58vh, 570px);
    }
}

@media (max-width: 640px) {
    .lfp-app {
        margin: 16px 0;
    }

    .lfp-shell {
        border-radius: 16px;
    }

    .lfp-header {
        align-items: flex-start;
        padding: 20px;
    }

    .lfp-score-card {
        min-width: 95px;
        padding: 10px;
    }

    .lfp-score-card strong {
        font-size: 24px;
    }

    .lfp-subtitle,
    .lfp-help {
        display: none;
    }

    .lfp-modebar {
        align-items: stretch;
    }

    .lfp-modebar select,
    .lfp-challenge-copy {
        flex: 1 1 100%;
    }

    .lfp-panel-left {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    .lfp-panel-left section {
        display: inline-block;
        margin-right: 16px;
        min-width: 170px;
        vertical-align: top;
        white-space: normal;
    }

    .lfp-garment-grid {
        display: flex;
    }

    .lfp-garment-button {
        flex: 0 0 68px;
    }

    .lfp-stage-panel {
        padding: 10px;
    }

    .lfp-stage {
        min-height: 410px;
        padding: 2px;
    }

    .lfp-canvas {
        height: min(52vh, 470px);
        width: 100%;
    }

    .lfp-toolbar {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
    }

    .lfp-toolbar button {
        min-width: 0;
    }

    .lfp-toolbar button span {
        display: none;
    }

    .lfp-panel-right {
        padding: 14px;
    }

    .lfp-pattern-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .lfp-learning {
        align-items: flex-start;
        flex-direction: column;
        padding: 20px;
    }

    .lfp-learn-link {
        width: 100%;
    }
}
