:root{
    color-scheme:light;
    --promo-ink:#111111;
    --promo-muted:#777777;
    --promo-cyan-soft:rgba(123,225,255,.5);
    --promo-error:#d93025;
    --border-soft:#dddddd;
    --surface:#ffffff;
}

*{ box-sizing:border-box; }

body{
    margin:0;
    min-height:100vh;
    overflow:hidden;
    font-family:Arial,sans-serif;
    background:var(--surface);
    color:var(--promo-ink);
}

canvas{ display:block; }
button{ font:inherit; }

.settings-panel{
    position:fixed;
    top:20px;
    right:20px;
    z-index:100;
    width:min(330px,calc(100vw - 40px));
    max-height:calc(100vh - 230px);
    overflow:auto;
    padding:20px;
    border:2px solid var(--promo-ink);
    border-radius:40px;
    color:var(--promo-ink);
    background:var(--surface);
}

.settings-panel h1{
    margin:0 0 14px;
    color:var(--promo-ink);
    font-size:34px;
    font-weight:400;
    line-height:1.2;
    letter-spacing:0;
}

.section{
    padding:14px 0;
    border-top:1px solid var(--border-soft);
}

.section:first-of-type{
    border-top:0;
    padding-top:0;
}

label,
.label{
    display:block;
    margin-bottom:8px;
    color:var(--promo-muted);
    font-size:14px;
}

select,
input[type="color"]{ width:100%; }

select{
    min-height:42px;
    padding:0 12px;
    border:2px solid var(--border-soft);
    border-radius:10px;
    color:var(--promo-ink);
    background:var(--surface);
    outline:none;
    transition:border-color .2s ease;
}

select:focus{ border-color:var(--promo-ink); }

input[type="color"]{
    height:42px;
    padding:2px;
    border:2px solid var(--border-soft);
    border-radius:10px;
    background:var(--surface);
    cursor:pointer;
}

.button-row{
    display:grid;
    grid-template-columns:repeat(6,minmax(0,1fr));
    gap:8px;
    margin-top:10px;
}

.color-button{
    min-height:38px;
    padding:0 14px;
    border:2px solid transparent;
    border-radius:20px;
    color:var(--promo-ink);
    background:var(--color,var(--surface));
    cursor:pointer;
    font-size:15px;
    transition:border-color .2s ease, transform .2s ease;
}

.color-button:hover,
.color-button.is-active{
    border-color:var(--promo-ink);
}

.color-button:hover{ transform:translateY(-1px); }

.rotation-controls{
    display:flex;
    align-items:center;
    gap:8px;
}

.rotation-button{
    flex:0 0 42px;
    width:42px;
    height:42px;
    padding:0;
    border:2px solid var(--border-soft);
    border-radius:50%;
    color:var(--promo-ink);
    background:var(--surface);
    cursor:pointer;
    font-size:16px;
    line-height:1;
    transition:border-color .2s ease, transform .2s ease, background .2s ease;
}

.rotation-button:hover{
    border-color:var(--promo-ink);
    transform:translateY(-1px);
}

.rotation-button.is-active{
    border-color:var(--promo-ink);
    background:var(--promo-cyan-soft);
}

.rotation-controls select{
    min-width:104px;
}

.stats{
    display:grid;
    grid-template-columns:auto 1fr;
    gap:6px 14px;
    margin:0;
    font-size:13px;
    line-height:1.35;
}

.stats dt{ color:var(--promo-muted); }

.stats dd{
    margin:0;
    color:var(--promo-ink);
    font-variant-numeric:tabular-nums;
    text-align:right;
}

.status{
    min-height:20px;
    color:var(--promo-ink);
    font-size:13px;
    line-height:1.35;
}

.status.error{ color:var(--promo-error); }

.model-dock{
    position:fixed;
    left:50%;
    bottom:24px;
    z-index:100;
    width:auto;
    max-width:calc(100vw - 24px);
    transform:translateX(-50%);
    display:flex;
    gap:12px;
    padding:12px;
    overflow-x:auto;
    overflow-y:hidden;
    border:2px solid var(--promo-ink);
    border-radius:60px;
    background:var(--surface);
    scrollbar-width:thin;
}

.model-button{
    position:relative;
    aspect-ratio:1;
    flex:0 0 clamp(66px,7vw,94px);
    width:clamp(66px,7vw,94px);
    overflow:hidden;
    padding:0;
    border:2px solid var(--border-soft);
    border-radius:50px;
    color:var(--promo-ink);
    background:var(--surface);
    cursor:pointer;
    transition:border-color .2s ease, transform .2s ease, background .2s ease;
}

.model-button:hover{
    transform:translateY(-2px);
    border-color:var(--promo-ink);
}

.model-button.is-active{
    border-color:var(--promo-ink);
    background:var(--promo-cyan-soft);
}

.model-button img{
    width:100%;
    height:100%;
    display:block;
    object-fit:contain;
    padding:6px;
    background:var(--surface);
}

.model-button img.is-missing{ display:none; }

.model-label{
    position:absolute;
    inset:0;
    display:grid;
    place-items:center;
    padding:8px;
    font-size:13px;
    color:var(--promo-ink);
    font-weight:500;
    text-align:center;
    text-transform:uppercase;
    letter-spacing:0;
    background:var(--surface);
}

.model-button img:not(.is-missing) + .model-label{ display:none; }

@media (max-width:720px){
    .settings-panel{
        right:12px;
        width:min(260px,calc(100vw - 24px));
        max-height:calc(100vh - 130px);
        padding:12px;
    }

    .settings-panel h1{ font-size:16px; }

    .rotation-button{
        flex-basis:38px;
        width:38px;
        height:38px;
    }

    .rotation-controls select{
        min-width:86px;
        padding:0 8px;
    }

    .model-dock{
        bottom:12px;
        max-width:calc(100vw - 24px);
        gap:8px;
        padding:8px;
    }

    .model-button{
        flex-basis:58px;
        width:58px;
    }

    .model-label{ font-size:11px; }
}

@media (max-width:520px), (max-height:560px){
    .settings-panel{ display:none; }
}
