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

:root {
    --cream: #FDF8F3;
    --warm-white: #FEFCFA;
    --paper-beige: #F5E6D3;
    --fold-line: #E8D4B8;
    --origami-red: #C94C4C;
    --origami-orange: #D4A574;
    --origami-gold: #B8860B;
    --text-dark: #2C2416;
    --shadow-soft: rgba(0, 0, 0, 0.08);
    --shadow-medium: rgba(0, 0, 0, 0.12);
}

body {
    font-family: 'Exo 2', sans-serif;
    background: var(--cream);
    min-height: 100vh;
    background-image: 
        repeating-linear-gradient(
            45deg,
            transparent,
            transparent 20px,
            rgba(232, 212, 184, 0.1) 20px,
            rgba(232, 212, 184, 0.1) 21px
        ),
        repeating-linear-gradient(
            -45deg,
            transparent,
            transparent 20px,
            rgba(232, 212, 184, 0.1) 20px,
            rgba(232, 212, 184, 0.1) 21px
        );
}

.app-container {
    max-width: 640px;
    margin: 0 auto;
    padding: 16px;
    min-height: 100vh;
    position: relative;
    display: flex;
    flex-direction: column;
}

/* Sound toggle */
.sound-toggle {
    position: fixed;
    top: 16px;
    right: 16px;
    width: 44px;
    height: 44px;
    border-radius: 4px;
    background: var(--warm-white);
    border: 2px solid var(--fold-line);
    font-size: 20px;
    cursor: pointer;
    z-index: 100;
    transition: all 0.2s;
    box-shadow: 2px 2px 0 var(--shadow-soft);
}

.sound-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 4px 4px 0 var(--shadow-soft);
}

/* Header */
.header {
    text-align: center;
    padding: 28px 20px;
    background: var(--warm-white);
    border-radius: 4px;
    border: 2px solid var(--fold-line);
    margin-bottom: 20px;
    position: relative;
    box-shadow: 
        4px 4px 0 var(--shadow-soft),
        inset 0 0 0 1px rgba(255,255,255,0.8);
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        linear-gradient(135deg, transparent 49%, var(--fold-line) 49%, var(--fold-line) 51%, transparent 51%),
        linear-gradient(-135deg, transparent 49%, var(--fold-line) 49%, var(--fold-line) 51%, transparent 51%);
    background-size: 30px 30px;
    background-position: 0 0, 15px 0;
    opacity: 0.15;
}

.header::after {
    content: '';
    position: absolute;
    top: -20px;
    right: -20px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, transparent 50%, var(--fold-line) 50%);
    transform: rotate(0deg);
}

.header-content {
    position: relative;
    z-index: 1;
}

.title {
    font-family: 'Rajdhani', sans-serif;
    font-size: 2.8rem;
    font-weight: 700;
    color: var(--origami-red);
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 6px;
}

.subtitle {
    font-size: 1rem;
    color: var(--text-dark);
    font-weight: 500;
    letter-spacing: 0.5px;
}

/* Main content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Input panel */
.input-panel {
    background: var(--warm-white);
    border-radius: 4px;
    padding: 24px;
    border: 2px solid var(--fold-line);
    margin-bottom: 20px;
    box-shadow: 4px 4px 0 var(--shadow-soft);
    position: relative;
}

.input-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 30px;
    height: 30px;
    background: linear-gradient(-45deg, var(--warm-white) 50%, var(--fold-line) 50%);
    border-bottom-right-radius: 4px;
}

.input-section {
    margin-bottom: 20px;
}

.food-input {
    width: 100%;
    min-height: 100px;
    padding: 16px;
    border: 2px solid var(--fold-line);
    border-radius: 4px;
    font-family: 'Exo 2', sans-serif;
    font-size: 1rem;
    resize: vertical;
    background: var(--cream);
    color: var(--text-dark);
    transition: border-color 0.2s;
}

.food-input:focus {
    outline: none;
    border-color: var(--origami-red);
}

.food-input::placeholder {
    color: #999;
}

.char-count {
    text-align: right;
    font-size: 0.85rem;
    color: #888;
    margin-top: 6px;
    font-family: 'Rajdhani', sans-serif;
}

/* Suggestions */
.suggestions-section {
    margin-bottom: 20px;
}

.suggestions-label {
    font-size: 0.9rem;
    color: var(--text-dark);
    margin-bottom: 10px;
    font-weight: 600;
}

.suggestions-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.suggestion-tag {
    padding: 8px 14px;
    background: var(--paper-beige);
    border: 2px solid var(--fold-line);
    border-radius: 4px;
    font-family: 'Exo 2', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-dark);
    position: relative;
}

.suggestion-tag::before {
    content: '';
    position: absolute;
    top: -2px;
    right: -2px;
    width: 12px;
    height: 12px;
    background: linear-gradient(-45deg, transparent 50%, var(--fold-line) 50%);
}

.suggestion-tag:hover {
    background: var(--origami-orange);
    color: white;
    transform: translateY(-2px);
    box-shadow: 2px 2px 0 var(--shadow-medium);
}

/* Style options */
.style-options {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 20px;
}

.style-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.style-label {
    font-size: 0.9rem;
    color: var(--text-dark);
    font-weight: 600;
    font-family: 'Rajdhani', sans-serif;
    letter-spacing: 0.5px;
}

.style-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.style-tab {
    padding: 10px 16px;
    background: var(--cream);
    border: 2px solid var(--fold-line);
    border-radius: 4px;
    font-family: 'Exo 2', sans-serif;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-dark);
    flex: 1;
    min-width: 80px;
    text-align: center;
}

.style-tab:hover {
    background: var(--paper-beige);
}

.style-tab.active {
    background: var(--origami-red);
    color: white;
    border-color: var(--origami-red);
    box-shadow: 2px 2px 0 rgba(201, 76, 76, 0.3);
}

/* Generate button */
.generate-btn {
    width: 100%;
    padding: 18px;
    background: linear-gradient(135deg, var(--origami-red) 0%, #A83232 100%);
    border: none;
    border-radius: 4px;
    font-family: 'Rajdhani', sans-serif;
    font-size: 1.4rem;
    font-weight: 700;
    color: white;
    cursor: pointer;
    box-shadow: 4px 4px 0 rgba(201, 76, 76, 0.4);
    transition: all 0.2s;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.generate-btn:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 6px 6px 0 rgba(201, 76, 76, 0.4);
}

.generate-btn:active:not(:disabled) {
    transform: translateY(1px);
    box-shadow: 2px 2px 0 rgba(201, 76, 76, 0.4);
}

.generate-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Loading */
.loading-container {
    text-align: center;
    padding: 50px 20px;
}

.paper-fold-animation {
    width: 80px;
    height: 80px;
    margin: 0 auto 24px;
    position: relative;
}

.fold-paper {
    position: absolute;
    width: 60px;
    height: 60px;
    background: var(--paper-beige);
    border: 2px solid var(--fold-line);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(0deg);
    animation: fold 2s ease-in-out infinite;
}

.fold-paper.fold-2 {
    animation-delay: 0.3s;
    opacity: 0.7;
}

.fold-paper.fold-3 {
    animation-delay: 0.6s;
    opacity: 0.4;
}

@keyframes fold {
    0%, 100% { transform: translate(-50%, -50%) rotate(0deg) scale(1); }
    25% { transform: translate(-50%, -50%) rotate(90deg) scale(0.8); }
    50% { transform: translate(-50%, -50%) rotate(180deg) scale(1); }
    75% { transform: translate(-50%, -50%) rotate(270deg) scale(0.8); }
}

.loading-message {
    font-family: 'Rajdhani', sans-serif;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--origami-red);
    margin-bottom: 8px;
}

.loading-pun {
    font-size: 1rem;
    color: var(--text-dark);
    font-style: italic;
}

/* Result */
.result-container {
    text-align: center;
}

.display-pedestal {
    background: var(--warm-white);
    border-radius: 4px;
    padding: 16px;
    border: 2px solid var(--fold-line);
    box-shadow: 
        6px 6px 0 var(--shadow-soft),
        inset 0 0 0 1px rgba(255,255,255,0.9);
    margin-bottom: 20px;
}

.paper-tag {
    display: inline-block;
    background: var(--paper-beige);
    padding: 8px 16px;
    border-radius: 4px;
    margin-bottom: 12px;
    font-family: 'Rajdhani', sans-serif;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-dark);
    border: 1px solid var(--fold-line);
    position: relative;
}

.paper-tag::before {
    content: '';
    position: absolute;
    top: -1px;
    left: -1px;
    width: 10px;
    height: 10px;
    background: linear-gradient(-45deg, var(--paper-beige) 50%, var(--fold-line) 50%);
}

.image-frame {
    background: white;
    border-radius: 4px;
    overflow: hidden;
    border: 2px solid var(--fold-line);
}

.origami-image {
    width: 100%;
    height: auto;
    display: block;
}

.result-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.action-btn {
    padding: 14px 16px;
    border: 2px solid var(--fold-line);
    border-radius: 4px;
    font-family: 'Exo 2', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--warm-white);
    color: var(--text-dark);
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 3px 3px 0 var(--shadow-soft);
}

.action-btn.download {
    background: var(--paper-beige);
}

.action-btn.share {
    background: #1DA1F2;
    color: white;
    border-color: #1DA1F2;
}

.action-btn.retry {
    background: var(--origami-orange);
    color: white;
    border-color: var(--origami-orange);
}

.action-btn.new {
    background: var(--origami-red);
    color: white;
    border-color: var(--origami-red);
}

/* Example gallery */
.example-section {
    margin-top: 24px;
}

.section-title {
    text-align: center;
    font-family: 'Rajdhani', sans-serif;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--origami-red);
    margin-bottom: 14px;
    letter-spacing: 1px;
}

.example-gallery {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    padding: 6px 0 16px;
    scroll-snap-type: x mandatory;
}

.example-card {
    flex: 0 0 130px;
    scroll-snap-align: start;
    background: var(--warm-white);
    border-radius: 4px;
    padding: 8px;
    border: 2px solid var(--fold-line);
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 3px 3px 0 var(--shadow-soft);
}

.example-card:hover {
    transform: translateY(-4px);
    box-shadow: 5px 5px 0 var(--shadow-medium);
    border-color: var(--origami-red);
}

.example-image {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 2px;
    border: 1px solid var(--fold-line);
}

.example-name {
    display: block;
    text-align: center;
    font-family: 'Rajdhani', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-top: 8px;
}

/* Collection */
.collection-toggle {
    width: 100%;
    padding: 14px;
    margin-top: 20px;
    background: var(--warm-white);
    border: 2px solid var(--origami-red);
    border-radius: 4px;
    font-family: 'Rajdhani', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    color: var(--origami-red);
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 0.5px;
}

.collection-toggle:hover {
    background: var(--origami-red);
    color: white;
}

.collection-drawer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--warm-white);
    border-radius: 16px 16px 0 0;
    padding: 24px;
    box-shadow: 0 -10px 40px rgba(0,0,0,0.2);
    max-height: 60vh;
    overflow-y: auto;
    z-index: 1000;
    border: 2px solid var(--fold-line);
    border-bottom: none;
}

.collection-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.collection-header h3 {
    font-family: 'Rajdhani', sans-serif;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--origami-red);
}

.collection-header button {
    width: 36px;
    height: 36px;
    border-radius: 4px;
    border: 2px solid var(--fold-line);
    background: var(--cream);
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s;
}

.collection-header button:hover {
    background: var(--origami-red);
    color: white;
    border-color: var(--origami-red);
}

.collection-hint {
    font-size: 0.85rem;
    color: #888;
    margin-bottom: 16px;
    text-align: center;
    font-style: italic;
}

.collection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 12px;
}

.collection-item {
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    border-radius: 4px;
    padding: 6px;
    background: var(--cream);
    border: 2px solid transparent;
}

.collection-item:hover {
    transform: scale(1.05);
    border-color: var(--origami-red);
}

.collection-item img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 2px;
    border: 2px solid var(--fold-line);
}

.collection-item span {
    display: block;
    font-family: 'Rajdhani', sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-top: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Lightbox */
.lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.lightbox-content {
    background: var(--warm-white);
    border-radius: 4px;
    max-width: 90vw;
    max-height: 90vh;
    overflow: hidden;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: scaleIn 0.3s ease;
    border: 2px solid var(--fold-line);
}

@keyframes scaleIn {
    from { 
        opacity: 0;
        transform: scale(0.9);
    }
    to { 
        opacity: 1;
        transform: scale(1);
    }
}

.lightbox-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 40px;
    height: 40px;
    border-radius: 4px;
    border: 2px solid var(--fold-line);
    background: var(--warm-white);
    font-size: 1.3rem;
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s;
}

.lightbox-close:hover {
    background: var(--origami-red);
    color: white;
    border-color: var(--origami-red);
}

.lightbox-image-container {
    max-height: 70vh;
    overflow: hidden;
}

.lightbox-image {
    width: 100%;
    max-height: 70vh;
    object-fit: contain;
    display: block;
}

.lightbox-info {
    padding: 20px;
    text-align: center;
    background: var(--cream);
    border-top: 2px solid var(--fold-line);
}

.lightbox-title {
    font-family: 'Rajdhani', sans-serif;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--origami-red);
    margin-bottom: 6px;
}

.lightbox-date {
    font-size: 0.9rem;
    color: #888;
    margin-bottom: 16px;
}

.lightbox-download {
    padding: 14px 28px;
    background: var(--origami-red);
    border: none;
    border-radius: 4px;
    font-family: 'Rajdhani', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: white;
    cursor: pointer;
    box-shadow: 3px 3px 0 rgba(201, 76, 76, 0.4);
    transition: all 0.2s;
}

.lightbox-download:hover {
    transform: translateY(-2px);
    box-shadow: 5px 5px 0 rgba(201, 76, 76, 0.4);
}

/* Footer */
.footer {
    text-align: center;
    padding: 24px 16px;
    margin-top: auto;
    border-top: 2px solid var(--fold-line);
    background: var(--warm-white);
}

.footer p {
    font-family: 'Rajdhani', sans-serif;
    color: var(--text-dark);
    font-weight: 600;
    margin-bottom: 10px;
}

.footer-link {
    display: inline-block;
    background: var(--origami-red);
    color: white;
    padding: 8px 20px;
    border-radius: 4px;
    text-decoration: none;
    font-family: 'Rajdhani', sans-serif;
    font-weight: 700;
    margin-bottom: 8px;
    transition: all 0.2s;
}

.footer-link:hover {
    transform: translateY(-2px);
    box-shadow: 3px 3px 0 rgba(201, 76, 76, 0.3);
}

.footer-credit {
    display: block;
    font-size: 0.85rem;
    color: #888;
    margin-bottom: 4px;
}

.footer-inspired {
    display: block;
    font-size: 0.8rem;
    color: #aaa;
    font-style: italic;
}

/* Confetti */
.confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 9999;
    overflow: hidden;
}

.confetti-crane {
    position: absolute;
    top: -20px;
    clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
    animation: fall 3s ease-out forwards;
}

@keyframes fall {
    to {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

/* Responsive */
@media (max-width: 480px) {
    .title {
        font-size: 2.2rem;
    }
    
    .generate-btn {
        font-size: 1.2rem;
        padding: 16px;
    }
    
    .result-actions {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    
    .action-btn {
        padding: 12px 10px;
        font-size: 0.85rem;
    }

    .style-tab {
        padding: 8px 12px;
        font-size: 0.8rem;
    }

    .lightbox-content {
        max-width: 95vw;
    }

    .lightbox-title {
        font-size: 1.2rem;
    }

    .example-card {
        flex: 0 0 110px;
    }
}