:root {
    color-scheme: light;
    font-family: Arial, Helvetica, sans-serif;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
    overflow: hidden;
    background: #f8f7f3;
}

button {
    font: inherit;
}

#v3d-container {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 320px;
    overflow: hidden;
    background: #f8f7f3;
    isolation: isolate;
}

#v3d-container canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
    touch-action: none;
}

#loading-status {
    position: absolute;
    inset: 0;
    z-index: 4;
    display: grid;
    place-content: center;
    gap: 10px;
    color: #26402f;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-align: center;
    background: #f8f7f3;
    transition: opacity 220ms ease, visibility 220ms ease;
}

#loading-status.is-hidden {
    visibility: hidden;
    opacity: 0;
}

.spinner {
    width: 32px;
    height: 32px;
    margin: auto;
    border: 3px solid rgba(38, 64, 47, 0.2);
    border-top-color: #26402f;
    border-radius: 50%;
    animation: spin 800ms linear infinite;
}

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

.interaction-hints {
    position: absolute;
    top: 12px;
    left: 50%;
    z-index: 3;
    display: flex;
    gap: 14px;
    align-items: center;
    padding: 7px 11px;
    color: #26402f;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid rgba(38, 64, 47, 0.25);
    border-radius: 16px;
    box-shadow: 0 2px 10px rgba(27, 38, 30, 0.14);
    transform: translateX(-50%);
    pointer-events: none;
    backdrop-filter: blur(5px);
}

.interaction-hints > span {
    display: inline-flex;
    gap: 5px;
    align-items: center;
}

.gesture-icon {
    font-size: 15px;
    line-height: 1;
}

.profile-options {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 4;
    display: flex;
    padding: 3px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(38, 64, 47, 0.25);
    border-radius: 18px;
    box-shadow: 0 2px 10px rgba(27, 38, 30, 0.14);
    backdrop-filter: blur(5px);
}

.profile-options button {
    padding: 6px 10px;
    color: #59655d;
    font-size: 11px;
    font-weight: 700;
    background: transparent;
    border: 0;
    border-radius: 14px;
    cursor: pointer;
}

.profile-options button[aria-checked="true"] {
    color: #fff;
    background: #26402f;
}

.profile-options button:focus-visible {
    outline: 3px solid #962364;
    outline-offset: 1px;
}

.fullscreen-toggle {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 4;
    display: grid;
    width: 36px;
    height: 36px;
    padding: 0;
    color: #26402f;
    font-size: 23px;
    line-height: 1;
    place-items: center;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(38, 64, 47, 0.25);
    border-radius: 50%;
    box-shadow: 0 2px 10px rgba(27, 38, 30, 0.14);
    cursor: pointer;
    backdrop-filter: blur(5px);
}

.fullscreen-toggle[hidden] {
    display: none;
}

.fullscreen-toggle:hover {
    background: #fff;
    transform: translateY(-1px);
}

.fullscreen-toggle:focus-visible {
    outline: 3px solid #962364;
    outline-offset: 2px;
}

.fullscreen-exit,
.fullscreen-toggle[aria-pressed="true"] .fullscreen-enter {
    display: none;
}

.fullscreen-toggle[aria-pressed="true"] .fullscreen-exit {
    display: inline;
    font-size: 28px;
}

#v3d-container:fullscreen,
#v3d-container:-webkit-full-screen {
    width: 100vw;
    height: 100vh;
    min-height: 100vh;
}

.color-panel {
    position: absolute;
    right: 10px;
    bottom: 10px;
    left: 10px;
    z-index: 3;
    padding: 9px 10px 10px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(38, 64, 47, 0.18);
    border-radius: 12px;
    box-shadow: 0 4px 18px rgba(27, 38, 30, 0.15);
    backdrop-filter: blur(7px);
}

.color-heading {
    display: flex;
    align-items: baseline;
    justify-content: center;
    margin: 0 2px 7px;
    color: #26402f;
    font-size: 12px;
    font-weight: 700;
}

#selected-color {
    overflow: hidden;
    width: 100%;
    color: #59655d;
    font-weight: 600;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.color-options {
    display: grid;
    grid-auto-columns: 28px;
    grid-auto-flow: column;
    grid-template-rows: repeat(2, 28px);
    gap: 7px;
    justify-content: start;
    padding: 3px 2px 5px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-color: rgba(38, 64, 47, 0.35) transparent;
    scrollbar-width: thin;
}

.color-swatch {
    position: relative;
    width: 28px;
    height: 28px;
    padding: 0;
    background: var(--swatch);
    background-image: var(--swatch-image, none);
    background-position: center;
    background-size: cover;
    border: 1px solid rgba(20, 26, 22, 0.35);
    border-radius: 4px;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
    cursor: pointer;
}

.color-swatch.is-crinkle {
    background-blend-mode: soft-light;
}

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

.color-swatch[aria-checked="true"] {
    outline: 3px solid #26402f;
    outline-offset: 2px;
}

.color-swatch:focus-visible {
    outline: 3px solid #962364;
    outline-offset: 2px;
}

noscript {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: grid;
    padding: 24px;
    place-items: center;
    color: #26402f;
    text-align: center;
    background: #f8f7f3;
}

@media (max-height: 400px) {
    .color-panel {
        bottom: 6px;
    }

    .color-heading {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .spinner {
        animation-duration: 1600ms;
    }

    #loading-status,
    .color-swatch {
        transition: none;
    }
}
