:root {
    --page-bg: #e7ebef;
    --page-bg-2: #f5f6f8;
    --panel: #ffffff;
    --panel-soft: #f7f9fc;
    --panel-warm: #fffaf1;
    --text: #17202a;
    --muted: #637083;
    --line: #d9e1ec;
    --line-strong: #c3cedd;
    --accent: #f0a020;
    --accent-2: #ffb640;
    --accent-dark: #c57b00;
    --blue: #1f6feb;
    --shadow-sm: 0 5px 14px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 8px 24px rgba(0,0,0,.08), 0 2px 6px rgba(0,0,0,.04);
    --shadow-lg: 0 18px 42px rgba(0,0,0,.12), 0 4px 12px rgba(0,0,0,.06);
    --radius: 16px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background:
        radial-gradient(circle at 8% 0%, rgba(240, 160, 32, 0.10), transparent 28%),
        radial-gradient(circle at 96% 7%, rgba(31, 111, 235, 0.08), transparent 30%),
        linear-gradient(135deg, #ece8e0, #f5f6f8 48%, #e7ebef);
    color: var(--text);
    min-height: 100vh;
}

header {
    padding: 18px 20px;
    text-align: center;
    background: rgba(255, 255, 255, 0.86);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 3px 18px rgba(21, 35, 56, 0.06);
    backdrop-filter: blur(10px);
}

header h1 {
    margin: 0 0 6px;
    font-size: 32px;
    letter-spacing: -0.04em;
    color: #111827;
}

header p {
    margin: 0;
    color: var(--muted);
    font-size: 15px;
}

.app-wrap {
    max-width: 1320px;
    margin: 0 auto;
    padding: 22px 20px 30px;
}

.intro-card,
.brand-logo-panel,
.wheel-strip-panel,
.canvas-panel,
.side-panel {
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid rgba(181, 195, 214, 0.95);
    border-radius: var(--radius);
    padding: 15px;
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}


.intro-card:hover,
.brand-logo-panel:hover,
.wheel-strip-panel:hover,
.canvas-panel:hover,
.side-panel:hover {
    box-shadow: var(--shadow-lg);
}

.brand-intro {
    display: grid;
    grid-template-columns: minmax(280px, 430px) 1fr;
    gap: 18px;
    align-items: stretch;
    margin-bottom: 18px;
}

.brand-logo-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 108px;
    background:
        linear-gradient(145deg, rgba(255,255,255,0.96), rgba(247,249,252,0.92)),
        radial-gradient(circle at 50% 40%, rgba(240,160,32,0.18), transparent 58%);
    overflow: hidden;
    position: relative;
}

.brand-logo-panel::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(135deg, rgba(255,255,255,0.75), transparent 42%);
    pointer-events: none;
}

.brand-logo {
    display: block;
    width: 100%;
    max-width: 539px;
    height: auto;
    margin: 0 auto;
    position: relative;
    z-index: 1;
    filter: drop-shadow(0 10px 18px rgba(21, 35, 56, 0.16));
}

.intro-card {
    background: linear-gradient(135deg, rgba(255,255,255,.88), rgba(247,249,252,.82) 58%, rgba(255,250,241,.86));
}

.instruction-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.intro-card h2 {
    margin: 0 0 10px;
    font-size: 18px;
    color: var(--accent-dark);
    letter-spacing: -0.01em;
}

.intro-card p {
    margin: 0;
    color: #344154;
    font-size: 12px;
    line-height: 1.6;
}

.wheel-strip-panel {
    margin-bottom: 18px;
    padding: 13px 15px 12px;
    background: linear-gradient(180deg, #ffffff, #f4f7fb);
}

.wheel-strip-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.wheel-strip-head h2 {
    margin: 0;
    font-size: 20px;
    white-space: nowrap;
    letter-spacing: -0.03em;
}

.wheel-strip-note {
    color: var(--muted);
    font-size: 13px;
    text-align: right;
}

.main-grid {
    display: grid;
    grid-template-columns: 1fr 310px;
    gap: 18px;
}

.main-grid > *,
.canvas-panel,
.side-panel,
.accessory-panel,
.wheel-strip-panel {
    min-width: 0;
}

.canvas-shell {
    width: 100%;
    overflow: auto;
    text-align: center;
    position: relative;
    border-radius: 12px;
}

canvas {
    background: #d6d6d6;
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    max-width: 100%;
    height: auto;
    cursor: grab;
    display: block;
    margin: 0 auto;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.45), 0 12px 30px rgba(21, 35, 56, 0.12);
}

canvas:active { cursor: grabbing; }

.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    margin-bottom: 14px;
    align-items: center;
}

button,
.upload-label {
    background: linear-gradient(180deg, var(--accent-2), var(--accent));
    color: #151515;
    border: 1px solid rgba(185, 111, 0, 0.35);
    border-radius: 10px;
    padding: 10px 14px;
    font-weight: bold;
    cursor: pointer;
    font-size: 14px;
    box-shadow: 0 7px 16px rgba(240, 160, 32, 0.26), inset 0 1px 0 rgba(255,255,255,0.45);
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

button:hover,
.upload-label:hover {
    background: linear-gradient(180deg, #ffc35f, #FF9900);
    transform: translateY(-1px);
    box-shadow: 0 10px 22px rgba(240, 160, 32, 0.32), inset 0 1px 0 rgba(255,255,255,0.55);
}

button:active,
.upload-label:active {
    transform: translateY(0);
}

.upload-limit {
    font-size: 12px;
    font-weight: normal;
    opacity: 0.78;
}

.loading-overlay {
    display: none;
    position: absolute;
    inset: 0;
    z-index: 20;
    align-items: center;
    justify-content: center;
    background: rgba(248, 250, 252, 0.72);
    border: 1px solid var(--line-strong);
    border-radius: 12px;
    backdrop-filter: blur(4px);
}

.loading-overlay.active {
    display: flex;
}

.loading-box {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    background: #ffffff;
    border: 1px solid var(--line-strong);
    border-radius: 14px;
    color: var(--text);
    font-size: 15px;
    box-shadow: var(--shadow-lg);
}

.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #d7deea;
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

button.secondary {
    background: linear-gradient(180deg, #7d8797, #596579);
    color: #fff;
    border-color: rgba(69, 80, 97, 0.45);
    box-shadow: 0 7px 16px rgba(61, 73, 92, 0.18), inset 0 1px 0 rgba(255,255,255,0.18);
}

button.secondary:hover {
    background: linear-gradient(180deg, #8b95a4, #667184);
    box-shadow: 0 10px 22px rgba(61, 73, 92, 0.24), inset 0 1px 0 rgba(255,255,255,0.22);
}

input[type="file"] { display: none; }

.top-option {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: #ffffff;
    color: #2b3544;
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    padding: 9px 11px;
    font-size: 13px;
    user-select: none;
    box-shadow: var(--shadow-sm);
}

.top-option input {
    margin: 0;
    transform: scale(1.12);
    accent-color: var(--blue);
}

.hint {
    margin: 10px 0 0;
    font-size: 13px;
    color: var(--muted);
    line-height: 1.48;
}

.demo-note {
    margin: 0 0 10px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.42;
}

.wheel-row {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 3px 2px 12px;
    scrollbar-width: thin;
    scrollbar-color: #aab5c5 #e6ebf2;
}

.wheel-row::-webkit-scrollbar {
    height: 12px;
}

.wheel-row::-webkit-scrollbar-track {
    background: #e6ebf2;
    border-radius: 10px;
}

.wheel-row::-webkit-scrollbar-thumb {
    background: linear-gradient(90deg, #aab5c5, #8795a8);
    border-radius: 10px;
    border: 2px solid #e6ebf2;
}

.wheel-row::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(90deg, #909eb0, #718096);
}

.wheel-thumb {
    flex: 0 0 92px;
    width: 92px;
    height: 92px;
    background: linear-gradient(180deg, #ffffff, #f3f6fa);
    border: 1px solid var(--line-strong);
    border-radius: 14px;
    padding: 7px;
    cursor: pointer;
    text-align: center;
    display: grid;
    place-items: center;
    box-shadow: var(--shadow-sm);
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.wheel-thumb:hover {
    border-color: var(--accent);
    background: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(21, 35, 56, 0.13);
}

.wheel-thumb.active {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(240,160,32,0.25), 0 12px 24px rgba(21, 35, 56, 0.13);
    background: linear-gradient(180deg, #ffffff, #fff6e5);
}

.wheel-thumb img {
    width: 78px;
    height: 78px;
    object-fit: contain;
    display: block;
    margin: 0 auto;
    filter: drop-shadow(0 7px 8px rgba(21, 35, 56, 0.14));
}

.side-panel {
    background: linear-gradient(180deg, rgba(255,255,255,.88), rgba(244,247,251,.84));
}

.side-panel h2 {
    margin: 0 0 14px;
    font-size: 21px;
    letter-spacing: -0.04em;
}

.small-controls {
    margin-top: 14px;
    display: grid;
    gap: 8px;
}

.small-controls button { width: 100%; }

.selected-info {
    margin-top: 12px;
    padding: 11px;
    background: #f7f9fc;
    border: 1px solid var(--line);
    border-radius: 10px;
    color: #4d596a;
    font-size: 13px;
    line-height: 1.45;
}

.range-row,
.check-row {
    margin-top: 12px;
    font-size: 13px;
    color: #4d596a;
}

.range-row input[type="range"] {
    width: 100%;
    accent-color: var(--blue);
}

.range-row input[type="range"]:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.check-row label {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f7f9fc;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px;
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.check-row label:hover {
    background: #ffffff;
    border-color: var(--line-strong);
    box-shadow: var(--shadow-sm);
}

.check-row input {
    accent-color: var(--blue);
}

.empty-msg {
    padding: 12px;
    background: #f7f9fc;
    border: 1px dashed var(--line-strong);
    border-radius: 10px;
    color: var(--muted);
}

@media (max-width: 1000px) {
    .main-grid { grid-template-columns: 1fr; }

    
.intro-card:hover,
.brand-logo-panel:hover,
.wheel-strip-panel:hover,
.canvas-panel:hover,
.side-panel:hover {
    box-shadow: var(--shadow-lg);
}

.brand-intro {
        grid-template-columns: 1fr;
    }

    .brand-logo-panel {
        min-height: auto;
        padding: 16px;
    }

    .brand-logo {
        max-width: 539px;
    }

    .wheel-strip-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .wheel-strip-note {
        text-align: left;
    }
}

@media (max-width: 560px) {
    header h1 { font-size: 24px; }

    .main-grid,
    .canvas-panel,
    .accessory-panel {
        min-width: 0;
        overflow: visible;
    }

    .app-wrap {
        padding: 10px;
    }

    
.intro-card:hover,
.brand-logo-panel:hover,
.wheel-strip-panel:hover,
.canvas-panel:hover,
.side-panel:hover {
    box-shadow: var(--shadow-lg);
}

.brand-intro {
        gap: 10px;
        margin-bottom: 10px;
    }

    .brand-logo-panel {
        padding: 8px;
        border-radius: 12px;
    }

    .brand-logo {
        max-width: 330px;
        margin: 0 auto;
    }

    .instruction-card {
        padding: 10px 12px;
    }

    .intro-card h2 {
        font-size: 17px;
        margin-bottom: 5px;
    }

    .intro-card p {
        font-size: 11px;
        line-height: 1.35;
    }

    .wheel-strip-panel,
    .canvas-panel,
    .side-panel {
        padding: 10px;
        border-radius: 12px;
    }

    .wheel-thumb {
        flex-basis: 66px;
        width: 66px;
        height: 66px;
        border-radius: 11px;
    }

    .wheel-thumb img {
        width: 54px;
        height: 54px;
    }

    button,
    .upload-label {
        padding: 8px 10px;
        font-size: 12px;
        border-radius: 9px;
    }

    .demo-note,
    .hint {
        font-size: 11px;
    }
}

/* Accessories library under the canvas */
.accessory-panel {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
}

.accessory-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.accessory-head h2 {
    margin: 0;
    font-size: 18px;
    letter-spacing: -0.03em;
    color: var(--text);
}

.accessory-note {
    color: var(--muted);
    font-size: 12px;
    text-align: right;
}

.accessory-row {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 10px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: scroll;
    overflow-y: hidden;
    padding: 3px 2px 16px;
    margin-bottom: 2px;
    scrollbar-width: thin;
    scrollbar-color: #aab5c5 #e6ebf2;
    scrollbar-gutter: stable;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    touch-action: pan-x;
}

.accessory-row::-webkit-scrollbar {
    display: block;
    height: 14px;
}

.accessory-row::-webkit-scrollbar-track {
    background: #e6ebf2;
    border-radius: 10px;
}

.accessory-row::-webkit-scrollbar-thumb {
    background: linear-gradient(90deg, #aab5c5, #8795a8);
    border-radius: 10px;
    border: 2px solid #e6ebf2;
}

.accessory-row::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(90deg, #909eb0, #718096);
}

.accessory-thumb {
    flex: 0 0 92px;
    min-width: 92px;
    width: 92px;
    height: 92px;
    background:
        linear-gradient(180deg, rgba(255,255,255,.88), rgba(243,246,250,.88)),
        linear-gradient(45deg, #eef2f7 25%, transparent 25%),
        linear-gradient(-45deg, #eef2f7 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #eef2f7 75%),
        linear-gradient(-45deg, transparent 75%, #eef2f7 75%);
    background-size: auto, 18px 18px, 18px 18px, 18px 18px, 18px 18px;
    background-position: 0 0, 0 0, 0 9px, 9px -9px, -9px 0;
    border: 1px solid var(--line-strong);
    border-radius: 14px;
    padding: 7px;
    cursor: pointer;
    text-align: center;
    display: grid;
    place-items: center;
    box-shadow: var(--shadow-sm);
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.accessory-thumb:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(21, 35, 56, 0.13);
}

.accessory-thumb.active {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(240,160,32,0.25), 0 12px 24px rgba(21, 35, 56, 0.13);
}

.accessory-thumb img {
    width: 78px;
    height: 78px;
    object-fit: contain;
    display: block;
    margin: 0 auto;
    filter: drop-shadow(0 7px 8px rgba(21, 35, 56, 0.14));
}

@media (max-width: 1000px) {
    .accessory-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .accessory-note {
        text-align: left;
    }
}

@media (max-width: 560px) {
    .accessory-head h2 {
        font-size: 16px;
    }

    .accessory-note {
        font-size: 11px;
    }

    .accessory-row {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        width: 100%;
        max-width: 100%;
        min-width: 0;
        overflow-x: scroll !important;
        overflow-y: hidden !important;
        gap: 8px;
        padding: 3px 2px 18px;
        margin-bottom: 2px;
        scrollbar-width: thin;
        scrollbar-gutter: stable;
        -webkit-overflow-scrolling: touch;
    }

    .accessory-row::-webkit-scrollbar {
        display: block;
        height: 14px;
    }

    .accessory-thumb {
        flex: 0 0 66px;
        min-width: 66px;
        width: 66px;
        height: 66px;
        border-radius: 11px;
    }

    .accessory-thumb img {
        width: 54px;
        height: 54px;
    }
}
