* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #1a1a1a;
    color: #fff;
    min-height: 100vh;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Sticker container */
.sticker {
    max-width: 900px;
    width: 100%;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
    position: relative;
}

/* Red top header */
.sticker-top {
    background: #DE1A22;
    padding: 24px 32px 20px;
    text-align: center;
}

.sticker-top-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sticker-hello {
    font-size: 3rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: 4px;
    text-transform: uppercase;
    line-height: 1;
}

.sticker-mynameis {
    font-size: 1.5rem;
    font-weight: 400;
    color: #fff;
    font-style: italic;
    line-height: 1.2;
}

/* White body / drawing area */
.sticker-body {
    background: #fff;
    position: relative;
    aspect-ratio: 5 / 3;
    overflow: hidden;
}

.sticker-body #drawCanvas {
    display: block;
    width: 100%;
    height: 100%;
    cursor: crosshair;
    touch-action: none;
    background: transparent;
    border: none;
    border-radius: 0;
}

.sticker-body #previewTarget {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    cursor: grab;
    overflow: hidden;
}

.sticker-body #previewTarget:active {
    cursor: grabbing;
}

.sticker-body #previewTarget canvas {
    width: 100% !important;
    height: 100% !important;
    border: none;
    border-radius: 0;
}

.sticker-body.view-3d #drawCanvas {
    display: none;
}

.sticker-body.view-3d #previewTarget {
    display: block;
}

/* Red bottom bar */
.sticker-bottom {
    background: #DE1A22;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    gap: 8px;
    position: relative;
    z-index: 10;
}

.bottom-left,
.bottom-right {
    display: flex;
    gap: 4px;
    align-items: center;
}

.bottom-center {
    display: flex;
    align-items: center;
}

/* Bar buttons (icons on red) */
.bar-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.85);
    width: 36px;
    height: 36px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    min-width: unset;
    transition: background 0.15s, color 0.15s;
}

.bar-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.bar-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.bar-btn svg {
    flex-shrink: 0;
}

/* View toggle */
.view-toggle {
    display: flex;
    border-radius: 6px;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.toggle-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    padding: 4px 16px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    min-width: unset;
    transition: background 0.15s, color 0.15s;
    border-radius: 0;
}

.toggle-btn.active {
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
}

.toggle-btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.1);
}

/* Preferences panel (expandable from bottom bar) */
.preferences-panel {
    background: #b5161d;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease;
}

.preferences-panel.open {
    max-height: 600px;
    overflow-y: auto;
}

.prefs-content {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    padding: 16px;
    justify-content: center;
}

.control-section {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 170px;
    flex: 1;
    max-width: 260px;
}

.control-section h3 {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.8);
    margin: 0 0 4px 0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.slider-group {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.slider-group label {
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.7);
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.7);
}

input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #fff;
    cursor: pointer;
}

select {
    padding: 5px 7px;
    background: rgba(0, 0, 0, 0.2);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    font-size: 0.78rem;
    cursor: pointer;
    width: 100%;
}

select:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.5);
}

input[type="range"] {
    -webkit-appearance: none;
    height: 6px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: #fff;
    border-radius: 50%;
    cursor: pointer;
}

input[type="range"]:disabled {
    opacity: 0.5;
}

input[type="range"]:disabled::-webkit-slider-thumb {
    background: #999;
    cursor: not-allowed;
}

/* Text input inside preferences */
.text-input {
    padding: 6px 8px;
    background: rgba(0, 0, 0, 0.2);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    font-size: 0.85rem;
    width: 100%;
}

.text-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.text-input:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.5);
}

/* Mesh export button inside preferences */
.mesh-export-btn {
    padding: 8px 16px;
    font-size: 0.85rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    min-width: unset;
    transition: background 0.2s;
    font-weight: 600;
}

.mesh-export-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.3);
}

.mesh-export-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Status bar */
.status {
    text-align: center;
    padding: 10px;
    color: #888;
    min-height: 40px;
    max-width: 900px;
    width: 100%;
}

/* General button reset */
button {
    font-family: inherit;
}