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

body {
    font-family: 'Arial', sans-serif;
    position: relative;
    background: #050814;
    background-image:
        radial-gradient(40% 60% at 20% 30%, rgba(64, 179, 255, 0.22), rgba(64, 179, 255, 0) 60%),
        radial-gradient(50% 50% at 80% 20%, rgba(91, 33, 182, 0.20), rgba(91, 33, 182, 0) 60%),
        radial-gradient(60% 60% at 50% 80%, rgba(0, 128, 255, 0.16), rgba(0, 128, 255, 0) 60%),
        linear-gradient(135deg, #030712 0%, #0b1430 45%, #020617 100%);
    background-size: 320% 320%, 320% 320%, 320% 320%, 240% 240%;
    background-position: 0% 60%, 100% 10%, 10% 100%, 0% 0%;
    animation: bg-pan 12s linear infinite alternate-reverse;
    min-height: 100vh;
    color: #333;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

.rotating-logo {
	position: fixed;
	top: 10px;
	right: 10px;
	margin-right: 10px;
	width: 38px;
	height: 38px;
	z-index: 10;
	filter: drop-shadow(0 2px 6px rgba(0,0,0,0.4));
	animation: spin 8s linear infinite;
}

.top-left-logo {
	position: fixed;
	top: 10px;
	left: 10px;
	margin-left: 10px;
	width: 48px;
	height: 48px;
	z-index: 10;
	filter: drop-shadow(0 2px 6px rgba(0,0,0,0.4));
}

@keyframes spin {
	0% { transform: rotate(0deg); }
	100% { transform: rotate(360deg); }
}

/* Subtle shimmering light overlay */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    background:
        radial-gradient(35% 35% at 30% 40%, rgba(176, 208, 255, 0.16), rgba(176, 208, 255, 0) 70%),
        radial-gradient(25% 25% at 70% 60%, rgba(140, 185, 255, 0.12), rgba(140, 185, 255, 0) 70%);
    filter: blur(12px);
    opacity: 0.6;
    transform-origin: 50% 50%;
    animation: bg-swirl 16s linear infinite, bg-pulse 6s ease-in-out infinite alternate;
    will-change: transform, opacity, filter;
}

/* Sweeping light layer for extra dynamism */
body::after {
    content: '';
    position: fixed;
    top: -20%;
    left: -20%;
    width: 140%;
    height: 140%;
    pointer-events: none;
    background:
        radial-gradient(30% 40% at 50% 50%, rgba(255,255,255,0.10), rgba(255,255,255,0) 70%),
        linear-gradient(115deg, rgba(255,255,255,0.08), rgba(255,255,255,0));
    mix-blend-mode: screen;
    filter: blur(18px) saturate(120%);
    opacity: 0.35;
    transform: translateX(-120%) rotate(0deg);
    animation: light-sweep 8s linear infinite;
    will-change: transform, opacity;
}

/* Shooting stars */
.shooting-stars {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	pointer-events: none;
	z-index: 0;
}

.shooting-star {
	position: absolute;
	width: 2px;
	height: 2px;
	background: radial-gradient(circle, rgba(255,255,255,0.95) 30%, rgba(255,255,255,0) 70%);
	box-shadow: 0 0 6px rgba(176, 208, 255, 0.8), 0 0 12px rgba(140, 185, 255, 0.6);
	border-radius: 50%;
	transform: translateZ(0);
    animation: star-trail var(--dur, 4s) linear var(--delay, 0s) 1 forwards;
    will-change: transform, opacity;
}

@keyframes star-trail {
	0% { opacity: 0; transform: translate3d(0, 0, 0) scale(1); }
	5% { opacity: 1; }
	100% { opacity: 0; transform: translate3d(var(--tx, 600px), var(--ty, -80px), 0) scale(0.9); }
}

@keyframes bg-pan {
    0%   { background-position: 0% 60%, 100% 10%, 10% 100%, 0% 0%; }
    25%  { background-position: 30% 30%, 70% 40%, 20% 70%, 25% 25%; }
    50%  { background-position: 60% 0%, 40% 70%, 50% 50%, 50% 50%; }
    75%  { background-position: 80% 80%, 10% 30%, 80% 20%, 75% 75%; }
    100% { background-position: 100% 40%, 0% 100%, 100% 0%, 100% 100%; }
}

@keyframes bg-swirl {
    0%   { transform: rotate(0deg) scale(1); opacity: 0.5; }
    50%  { transform: rotate(180deg) scale(1.08); opacity: 0.65; }
    100% { transform: rotate(360deg) scale(1); opacity: 0.5; }
}

@keyframes bg-pulse {
    0%   { opacity: 0.45; filter: blur(10px); }
    100% { opacity: 0.75; filter: blur(14px); }
}

@keyframes light-sweep {
    0%   { transform: translateX(-120%) rotate(0deg); opacity: 0.25; }
    50%  { opacity: 0.45; }
    100% { transform: translateX(120%) rotate(0deg); opacity: 0.25; }
}

/* Ensure key UI text is readable on dark backgrounds */
#current-layer-name,
#progress-text {
    color: #ffffff;
}

/* Compact desktop layout to avoid page scroll */

@media (min-width: 1025px) {
	html, body { height: 100%; overflow-y: auto; }
	.container { padding: 10px; }
	header { margin-bottom: 16px; }
	header h1 { font-size: 2rem; }
	header p { font-size: 1rem; }
	.character-display { padding: 14px; margin-bottom: 10px; }
	.character-container { width: 240px; height: 320px; margin: 0 auto 10px; }
	.picture-progress { width: 240px; margin: 6px auto 10px; }
	.progress { padding: 12px; }
	.controls { gap: 10px; }
	.nav-btn, .select-btn { padding: 10px 14px; min-width: 110px; font-size: 0.9rem; min-height: 38px; }
	.layer-nav { gap: 6px; margin: 12px 0 14px; }
	.layer-nav-btn { padding: 6px 8px; font-size: 0.8rem; }
	.layer-nav-select { max-width: 320px; padding: 8px 10px; font-size: 0.95rem; }
	.layer-info { padding: 12px; margin-bottom: 10px; }
	.layer-info h2 { font-size: 1rem; margin-bottom: 8px; }
	.layer-options { max-height: 160px; gap: 8px; }
	.layer-option { padding: 6px; min-height: 80px; }
	.layer-option img { width: 54px; height: 54px; margin-bottom: 4px; }
	.layer-option span { font-size: 0.8rem; }
	.download-section { margin-bottom: 6px; }
	.download-btn { padding: 9px 14px; font-size: 0.9rem; min-height: 38px; }
}

/* Remove angelic decorations */
.angelic-decor, .cloud, .feather { display: none !important; }

header {
    text-align: center;
    margin-bottom: 30px;
    color: white;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

/* removed title icon */

header p {
    font-size: 1.2rem;
    opacity: 0.9;
}

.character-display {
    background: rgba(255, 255, 255, 0.08);
    -webkit-backdrop-filter: blur(12px) saturate(120%);
    backdrop-filter: blur(12px) saturate(120%);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    text-align: center;
}

.character-container {
    position: relative;
    width: 300px;
    height: 400px;
    margin: 0 auto 30px;
    border: 3px solid #ddd;
    border-radius: 15px;
    background: #f8f9fa;
    overflow: hidden;
}

#character-layers { position: relative; width: 100%; height: 100%; }
.character-layer { position: absolute; top:0; left:0; width:100%; height:100%; object-fit: contain; z-index:1; transition: all 0.3s ease-in-out; opacity:0; transform: scale(0.8); animation: layerAppear 0.5s ease-out forwards; }

/* Placeholder logo before any selection */
.placeholder-logo {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: 70%;
    max-height: 70%;
    opacity: 0.4;
    z-index: 0;
    pointer-events: none;
}

/* Remove halo around container */
.character-container::after { content: none; }

/* Buttons back to previous neutral look */
.nav-btn { background: linear-gradient(135deg, #6c757d, #5a6268); color: white; box-shadow: 0 4px 15px rgba(108, 117, 125, 0.3); }
.nav-btn:hover { background: linear-gradient(135deg, #5a6268, #495057); transform: translateY(-3px) scale(1.05); box-shadow: 0 8px 25px rgba(108, 117, 125, 0.4); }
.select-btn {
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
    box-shadow: 0 4px 15px rgba(0, 123, 255, 0.3);
}

/* Dice spin on randomize click */
.select-btn .dice { display: inline-block; will-change: transform; }
.select-btn .dice.spinning {
	animation: spin 0.6s ease-out 1;
}
.select-btn:hover {
    background: linear-gradient(135deg, #0069d9, #004a99);
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 25px rgba(0, 123, 255, 0.4);
}

.layer-info { background: white; }
.layer-info h2 { color: #495057; font-family: inherit; }

.layer-option { background: rgba(248, 249, 250, 0.75); border: 2px solid transparent; }
.layer-option:hover { background: linear-gradient(135deg, #e9ecef, #f8f9fa); }
.layer-option.selected { background: linear-gradient(135deg, #d4e6ff, #c3d7ff); border-color: #007bff; box-shadow: 0 8px 25px rgba(0, 123, 255, 0.35); }
.layer-option.selected::after { background: #007bff; }

.download-btn { background: linear-gradient(135deg, #007bff, #0056b3); color: white; box-shadow: 0 4px 15px rgba(0, 123, 255, 0.3); }
.download-btn:hover { background: linear-gradient(135deg, #0056b3, #004085); }

.progress { background: white; }
#progress-text { color: #495057; }

/* Feather hover trails on options */
.layer-option:hover::before { left: 100%; filter: blur(1px); }

.character-layer.loading {
    opacity: 0.5;
    transform: scale(0.9);
}

.character-layer.loaded {
    opacity: 1;
    transform: scale(1);
}

.controls {
    display: flex;
    justify-content: center;
    gap: clamp(10px, 1.5vw, 18px);
    flex-wrap: wrap;
}

.controls { margin: 16px auto; }

.controls .select-btn { margin: 8px 0; }

.layer-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin: 16px 0 20px;
}

/* Mobile wheel picker */
.layer-nav-select {
    display: none;
}

@media (max-width: 768px) {
    .layer-nav {
        justify-content: center;
    }
    .layer-nav-select {
        display: block;
        width: 100%;
        max-width: 360px;
        padding: 10px 12px;
        border-radius: 16px;
        border: 1px solid #dee2e6;
        background: #f8f9fa;
        color: #495057;
        font-size: 1rem;
        -webkit-appearance: none;
        appearance: none;
        text-align: center;
    }
}

.layer-nav-btn {
    padding: 8px 12px;
    border: 1px solid #dee2e6;
    border-radius: 16px;
    background: #f8f9fa;
    color: #495057;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.layer-nav-btn:hover {
    background: #e9ecef;
    transform: translateY(-1px);
}

.layer-nav-btn.active {
    background: linear-gradient(135deg, #d4e6ff, #c3d7ff);
    border-color: #007bff;
    color: #004a99;
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.25);
}

.layer-nav-btn.completed {
    background: linear-gradient(135deg, #fff7c2, #ffe27a, #d4af37);
    border-color: #c9a227;
    color: #2a2000;
    box-shadow: 0 0 12px rgba(255, 215, 0, 0.55), 0 0 20px rgba(255, 204, 51, 0.3) inset;
}

/* Mobile select completed state */
.layer-nav-select.completed {
    background: #fff7c2;
    background: linear-gradient(135deg, #fff7c2, #ffe27a, #d4af37);
    border-color: #c9a227;
    color: #2a2000;
    box-shadow: 0 0 12px rgba(255, 215, 0, 0.55) inset;
}

.nav-btn, .select-btn {
    padding: clamp(10px, 1.1vw + 6px, 16px) clamp(16px, 1.8vw + 8px, 28px);
    border: none;
    border-radius: 25px;
    font-size: clamp(0.9rem, 1.2vw + 0.1rem, 1.1rem);
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: clamp(110px, 16vw, 160px);
    position: relative;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
}

.nav-btn:active {
    transform: translateY(-1px) scale(1.02);
    box-shadow: 0 4px 15px rgba(108, 117, 125, 0.3);
}

.nav-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.select-btn:active {
    transform: translateY(-1px) scale(1.02);
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
}

/* Button click animation */
@keyframes buttonClick {
    0% { transform: scale(1); }
    50% { transform: scale(0.95); }
    100% { transform: scale(1); }
}

.nav-btn.clicked, .select-btn.clicked {
    animation: buttonClick 0.2s ease-in-out;
}

.layer-info {
    background: rgba(255, 255, 255, 0.08);
    -webkit-backdrop-filter: blur(10px) saturate(120%);
    backdrop-filter: blur(10px) saturate(120%);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    animation: slideInUp 0.5s ease-out;
}

@keyframes slideInUp {
    0% {
        opacity: 0;
        transform: translateY(30px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.layer-info h2 {
    text-align: center;
    margin-bottom: 20px;
    color: #495057;
    font-size: 1.5rem;
}


.layer-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
    padding: 20px;
    max-height: 300px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #ccc transparent;
}

.layer-options.single-option {
    display: flex;
    justify-content: center;
    align-items: center;
}

.layer-options::-webkit-scrollbar {
    display: none;
}

.layer-option {
    text-align: center;
    cursor: pointer;
    padding: 10px;
    border-radius: 10px;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
    background: rgba(248, 249, 250, 0.9);
    animation: optionAppear 0.6s ease-out;
}

@keyframes optionAppear {
    0% {
        opacity: 0;
        transform: scale(0.8) translateY(20px);
    }
    100% {
        opacity: 0.7;
        transform: scale(1) translateY(0);
    }
}

.layer-option::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: left 0.5s;
}

.layer-option:hover::before {
    left: 100%;
}

.layer-option:hover {
    background: linear-gradient(135deg, #e9ecef, #f8f9fa);
    transform: scale(1.08) translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border-color: #dee2e6;
}

.layer-option.selected {
    background: linear-gradient(135deg, #d4e6ff, #c3d7ff);
    border-color: #007bff;
    transform: scale(1.05);
    box-shadow: 0 8px 25px rgba(0, 123, 255, 0.35);
    opacity: 1;
    z-index: 2;
}

.layer-option.selected::after {
    content: '';
    position: absolute;
    top: 5px;
    right: 5px;
    background: transparent;
    background-image: url('logo.PNG');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    border: none;
    border-radius: 0;
    width: 20px;
    height: 20px;
    box-shadow: 0 0 8px rgba(255, 215, 0, 0.45);
    transform-origin: center center;
    animation: checkmarkAppear 0.3s ease-out, spin 2s linear infinite;
}

/* Mobile: make checkmark dot slightly smaller */
@media (max-width: 768px) {
	.layer-option.selected::after {
		width: 16px;
		height: 16px;
		font-size: 10px;
	}
}

@media (max-width: 480px) {
	.layer-option.selected::after {
		width: 14px;
		height: 14px;
		font-size: 9px;
	}
}

@keyframes checkmarkAppear {
    0% { 
        transform: scale(0) rotate(180deg);
        opacity: 0;
    }
    100% { 
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

/* Selection pulse animation */
@keyframes selectionPulse {
    0% { box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(40, 167, 69, 0); }
    100% { box-shadow: 0 0 0 0 rgba(40, 167, 69, 0); }
}

.layer-option.selecting {
    animation: selectionPulse 0.6s ease-out;
}

.layer-option img {
    width: 80px;
    height: 80px;
    object-fit: contain;
    border-radius: 8px;
    margin-bottom: 8px;
}

.layer-option span {
    display: block;
    font-size: 0.9rem;
    color: #495057;
    word-break: break-word;
}

.download-section {
    text-align: center;
    margin-bottom: 30px;
}

.download-btn {
    background: linear-gradient(135deg, #fff0a6, #ffd75a, #d4af37);
    color: #2a2000;
    padding: 15px 30px;
    border: none;
    border-radius: 25px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 6px 18px rgba(212, 175, 55, 0.55), 0 0 28px rgba(255, 215, 0, 0.35) inset, 0 0 10px rgba(255, 200, 0, 0.35);
    position: relative;
    overflow: hidden;
}

.download-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.download-btn:hover::before {
    left: 100%;
}

.download-btn:hover {
    background: linear-gradient(135deg, #fff7c2, #ffe27a, #c9a227);
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 12px 32px rgba(212, 175, 55, 0.6), 0 0 34px rgba(255, 215, 0, 0.45) inset, 0 0 12px rgba(255, 200, 0, 0.4);
}

.download-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* Download Progress Styles */
.download-progress {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #28a745, #20c997, #17a2b8);
    border-radius: 4px;
    width: 0%;
    transition: width 0.3s ease;
    position: relative;
    overflow: hidden;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: progressShine 1.5s infinite;
}

.progress-text {
    color: white;
    font-size: 0.9rem;
    font-weight: 500;
    text-align: center;
}

/* Animations */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Shake animation trigger for character container */
.character-container.shaking {
    animation: strong-shake 0.6s ease-in-out;
}

@keyframes strong-shake {
    0% { transform: translateX(0) rotate(0deg); }
    10% { transform: translateX(-12px) rotate(-1.5deg); }
    20% { transform: translateX(12px) rotate(1.5deg); }
    30% { transform: translateX(-10px) rotate(-1.2deg); }
    40% { transform: translateX(10px) rotate(1.2deg); }
    50% { transform: translateX(-8px) rotate(-1deg); }
    60% { transform: translateX(8px) rotate(1deg); }
    70% { transform: translateX(-6px) rotate(-0.8deg); }
    80% { transform: translateX(6px) rotate(0.8deg); }
    90% { transform: translateX(-3px) rotate(-0.4deg); }
    100% { transform: translateX(0) rotate(0deg); }
}

@keyframes successPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

@keyframes progressShine {
    0% { left: -100%; }
    100% { left: 100%; }
}

.download-btn:active {
    transform: translateY(-1px) scale(1.02);
    box-shadow: 0 4px 15px rgba(0, 123, 255, 0.3);
}

.download-btn.clicked {
    animation: buttonClick 0.2s ease-in-out;
}

.progress {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.picture-progress {
    width: 300px; /* match .character-container default width */
    margin: 12px auto 20px; /* center under picture */
    background: transparent;
    padding: 0;
    box-shadow: none;
    border-radius: 0;
}

@media (max-width: 1024px) {
    .picture-progress { width: 280px; }
}

@media (max-width: 768px) {
    .picture-progress { width: 260px; }
}

@media (max-width: 480px) {
    .picture-progress { width: 230px; }
}

@media (max-width: 360px) {
    .picture-progress { width: 200px; }
}

/* header-progress removed in linear restore */

/* Mobile: place circular progress at the far right of the title */
@media (max-width: 768px) {
    header { position: relative; }
}

.progress-bar {
    width: 100%;
    height: 10px;
    background: #e9ecef;
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #28a745, #20c997);
    width: 0%;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background-image: linear-gradient(
        -45deg,
        rgba(255, 255, 255, 0.2) 25%,
        transparent 25%,
        transparent 50%,
        rgba(255, 255, 255, 0.2) 50%,
        rgba(255, 255, 255, 0.2) 75%,
        transparent 75%,
        transparent
    );
    background-size: 20px 20px;
    animation: progressStripes 1s linear infinite;
}

@keyframes progressStripes {
    0% { background-position: 0 0; }
    100% { background-position: 20px 0; }
}

#progress-text {
    display: block;
    text-align: center;
    font-weight: bold;
    color: #495057;
}

/* Circular progress removed in linear restore */

/* Loading animation for character layers */
@keyframes pulse {
    0% { opacity: 0.5; }
    50% { opacity: 0.8; }
    100% { opacity: 0.5; }
}

.character-layer.loading {
    animation: pulse 1s ease-in-out infinite;
}

/* Smooth transitions for layer changes */
.layer-info.updating {
    animation: slideInUp 0.3s ease-out;
}

/* Character container hover effect */
.character-container:hover {
    transform: scale(1.02);
    box-shadow: 0 15px 40px rgba(0,0,0,0.2);
}

/* Success animation for completed selections */
@keyframes successBounce {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.layer-option.success {
    animation: successBounce 0.6s ease-in-out;
}

/* Mobile-specific improvements */
@media (max-width: 768px) {
    .layer-options {
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
    }
    
    .layer-options::-webkit-scrollbar {
        width: 4px;
    }
    
    .layer-options::-webkit-scrollbar-track {
        background: #f1f1f1;
        border-radius: 2px;
    }
    
    .layer-options::-webkit-scrollbar-thumb {
        background: #c1c1c1;
        border-radius: 2px;
    }
    
    .layer-options::-webkit-scrollbar-thumb:hover {
        background: #a8a8a8;
    }
}

/* Mobile-First Responsive Design */
@media (max-width: 1024px) {
    .container {
        padding: 15px;
    }
    
    .character-container {
        width: 280px;
        height: 360px;
    }
    
    .layer-options {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 12px;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    header h1 {
        font-size: 2.2rem;
        margin-bottom: 8px;
    }
    
    header p {
        font-size: 1rem;
    }
    
    .character-display {
        padding: 20px;
        margin-bottom: 20px;
    }
    
    .character-container {
        width: 260px;
        height: 340px;
        margin: 0 auto 20px;
    }
    
    .layer-info {
        padding: 20px;
        margin-bottom: 20px;
    }
    
    .layer-info h2 {
        font-size: 1.3rem;
        margin-bottom: 15px;
    }
    
    
    .layer-option {
        width: 100px;
    }
    
    .layer-option {
        padding: 8px;
        min-height: 90px;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
    }
    
    .layer-option img {
        width: 60px;
        height: 60px;
        margin-bottom: 4px;
    }
    
    .layer-option span {
        font-size: 0.8rem;
        text-align: center;
        line-height: 1.15;
        padding: 0 4px;
        hyphens: auto;
        overflow-wrap: anywhere;
    }
    
    .controls {
        gap: 12px;
        flex-direction: column;
        align-items: center;
    }
    
    .nav-btn, .select-btn {
        padding: 12px 24px; /* keep comfortable touch target */
        min-width: 140px;
        font-size: 1rem;
        width: 100%;
        max-width: 240px;
        min-height: 48px;
    }
    
    .download-btn {
        padding: 12px 24px;
        font-size: 1rem;
        width: 100%;
        max-width: 250px;
        min-height: 48px;
    }
    
    .progress {
        padding: 15px;
    }

	/* Infinite wheel for layer options - user controlled */
	.layer-options.wheel {
		display: inline-flex;
		align-items: center;
		gap: 10px;
		overflow-x: auto;
		overflow-y: hidden;
		width: 100%;
		white-space: nowrap;
		scrollbar-width: none;
	}
	.layer-options.wheel .layer-option {
		flex: 0 0 auto;
		min-width: 90px;
	}
	.layer-options.wheel::-webkit-scrollbar { display: none; }
	/* Layer nav mobile wheel */
/* (reverted) mobile wheel styles removed; using select dropdown */
}


@media (max-width: 480px) {
    .container {
        padding: 8px;
    }
    
    header h1 {
        font-size: 1.9rem;
        margin-bottom: 6px;
    }
    
    header p {
        font-size: 0.9rem;
    }
    
    .character-display {
        padding: 15px;
        margin-bottom: 15px;
    }
    
    .character-container {
        width: 230px;
        height: 300px;
        margin: 0 auto 15px;
    }
    
    .layer-info {
        padding: 15px;
        margin-bottom: 15px;
    }
    
    .layer-info h2 {
        font-size: 1.2rem;
        margin-bottom: 12px;
    }
    
    
    .layer-option {
        width: 85px;
    }
    
    .layer-option {
        padding: 6px;
    }
    
    .layer-option img {
        width: 50px;
        height: 50px;
    }
    
    .layer-option span {
        font-size: 0.7rem;
        line-height: 1.15;
        padding: 0 3px;
        hyphens: auto;
        overflow-wrap: anywhere;
    }
    
    .controls {
        gap: 10px;
    }
    
    .nav-btn, .select-btn {
        padding: 10px 20px;
        min-width: 120px;
        font-size: 0.9rem;
        max-width: 180px;
    }
    
    .download-btn {
        padding: 10px 20px;
        font-size: 0.9rem;
        max-width: 200px;
    }
    
    .progress {
        padding: 12px;
    }
    
    #progress-text {
        font-size: 0.9rem;
    }
}

@media (max-width: 360px) {
    .container {
        padding: 5px;
    }
    
    header h1 {
        font-size: 1.6rem;
    }
    
    .character-container {
        width: 200px;
        height: 260px;
    }
    
    .layer-options {
        grid-template-columns: repeat(auto-fill, minmax(75px, 1fr));
        gap: 6px;
    }
    
    .layer-option img {
        width: 45px;
        height: 45px;
    }
    
    .layer-option span {
        font-size: 0.65rem;
        line-height: 1.1;
    }
    
    .nav-btn, .select-btn {
        padding: 8px 16px;
        min-width: 100px;
        font-size: 0.85rem;
        max-width: 160px;
    }
    
    .download-btn {
        padding: 8px 16px;
        font-size: 0.85rem;
        max-width: 180px;
    }
}

/* Extra-compact mobile to avoid page scrolling */
@media (max-width: 480px) {
	html, body { height: auto; min-height: 100%; overflow-y: auto; -webkit-overflow-scrolling: touch; }
	header h1 { font-size: 1.6rem; }
	header p { display: none; }
	.character-display { padding: 12px; margin-bottom: 10px; }
	.character-container { width: 210px; height: 270px; margin: 0 auto 12px; }
	.picture-progress { width: 210px; margin: 8px auto 12px; }
	.progress { padding: 12px; }
	.controls { gap: 8px; }
	.nav-btn, .select-btn { padding: 8px 16px; min-width: 100px; font-size: 0.85rem; max-width: 160px; min-height: 40px; }
	.layer-nav-select { max-width: 260px; padding: 8px 10px; font-size: 0.95rem; }
	.layer-info { padding: 12px; margin-bottom: 10px; }
	.layer-info h2 { font-size: 1.05rem; margin-bottom: 10px; }
	.layer-options { max-height: 180px; gap: 10px; }
	.layer-option { padding: 6px; min-height: 80px; }
	.layer-option img { width: 48px; height: 48px; margin-bottom: 4px; }
	.layer-option span { font-size: 0.8rem; }
	.download-section { margin-bottom: 10px; }
	.download-btn { padding: 8px 16px; font-size: 0.9rem; min-height: 40px; max-width: 180px; }
}

@media (max-width: 360px) {
	header h1 { font-size: 1.4rem; }
	.character-container { width: 180px; height: 230px; }
	.picture-progress { width: 180px; }
	.layer-options { max-height: 150px; gap: 6px; }
	.layer-option img { width: 42px; height: 42px; }
	.layer-nav-select { max-width: 220px; font-size: 0.85rem; padding: 6px 8px; }
}
