:root {
    --bg-dark: #0a0a0a;
    --bg-card: #1a1a1a;
    --bg-elevated: #252525;
    --accent: #ff4444;
    --accent-hover: #ff6666;
    --accent-light: rgba(255, 68, 68, 0.1);
    --text-primary: #ffffff;
    --text-secondary: #999999;
    --text-muted: #666666;
    --border: #333333;
    --border-light: #2a2a2a;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: 1.6;
}

.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
    width: 100%;
    flex: 1;
    display: flex;
    flex-direction: column;
}

header {
    text-align: center;
    margin-bottom: 40px;
    padding-top: 20px;
}

/* Logo - mobile first */
.logo {
    max-width: 150px;
    width: 40%;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(255, 107, 107, 0.2);
    margin-bottom: 10px;
}

@media (min-width: 768px) {
    .logo {
        max-width: 200px;
        border-radius: 15px;
    }
}

h1 {
    font-size: 3rem;
    margin-bottom: 10px;
    letter-spacing: -1px;
}

.tagline {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

main {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.section {
    display: none;
}

.section.active {
    display: block;
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.upload-zone {
    background: var(--bg-card);
    border: 3px dashed var(--border);
    border-radius: 20px;
    padding: 60px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.upload-zone:hover {
    border-color: var(--accent);
    background: rgba(255, 68, 68, 0.05);
}

.upload-zone.drag-over {
    border-color: var(--accent);
    background: rgba(255, 68, 68, 0.1);
}

.upload-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    stroke-width: 2;
    color: var(--text-secondary);
}

.upload-text {
    font-size: 1.3rem;
    margin-bottom: 5px;
}

.upload-subtext {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

#fileInput {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.preview-container {
    text-align: center;
}

.preview-container.hidden {
    display: none;
}

#preview {
    max-width: 100%;
    max-height: 400px;
    border-radius: var(--radius-lg);
    margin-bottom: 24px;
    box-shadow: var(--shadow-xl);
}

/* Preset Selector */
.preset-selector {
    margin: 24px 0;
    text-align: left;
}

.preset-label {
    display: block;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
    letter-spacing: 0.3px;
}

.preset-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.preset-card {
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    padding: 10px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.preset-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    opacity: 0;
    transition: opacity 0.2s;
}

.preset-card:hover {
    border-color: var(--accent);
    background: var(--accent-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.preset-card:hover::before {
    opacity: 1;
}

.preset-card.selected {
    border-color: var(--accent);
    background: var(--accent-light);
    box-shadow: 0 0 0 3px rgba(255, 68, 68, 0.2);
}

.preset-card.selected::before {
    opacity: 1;
}

.preset-icon {
    font-size: 1.5rem;
    margin-bottom: 6px;
    display: block;
}

.preset-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.preset-description {
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.3;
}

/* Button Group */
.button-group {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.btn-primary,
.btn-secondary {
    padding: 14px 24px;
    font-size: 1rem;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex: 1;
    position: relative;
    overflow: hidden;
}

.btn-icon {
    width: 18px;
    height: 18px;
    stroke-width: 2.5;
}

.btn-primary {
    background: var(--accent);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-primary:hover::before {
    width: 300px;
    height: 300px;
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(255, 68, 68, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 2px solid var(--border);
}

.btn-secondary:hover {
    border-color: var(--accent);
    background: var(--accent-light);
    transform: translateY(-2px);
}

.btn-secondary:active {
    transform: translateY(0);
}

.loading-animation {
    text-align: center;
    padding: 60px 20px;
}

.fire-emoji {
    font-size: 5rem;
    animation: bounce 1s infinite;
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0) scale(1);
    }
    50% {
        transform: translateY(-20px) scale(1.1);
    }
}

.loading-text {
    font-size: 1.3rem;
    color: var(--text-secondary);
    margin-top: 20px;
}

.loading-subtext {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 10px;
    opacity: 0.7;
}

.roast-container {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: 32px;
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border-light);
}

.roast-header {
    text-align: center;
    margin-bottom: 32px;
    position: relative;
}

/* Roasted image - maintain aspect ratio */
#roastedImage {
    max-width: 100%;
    max-height: 350px;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 15px;
}

.roast-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 16px;
    padding: 8px 16px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

.badge-icon {
    font-size: 1.1rem;
}

.badge-text {
    letter-spacing: 0.3px;
}

.roast-content {
    margin-bottom: 32px;
}

.roast-text-wrapper {
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--text-primary);
    text-align: left;
    padding: 24px;
    background: var(--bg-elevated);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    border-left: 4px solid var(--accent);
}

.roast-text-wrapper ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.roast-text-wrapper li {
    margin-bottom: 16px;
    padding-left: 24px;
    position: relative;
}

.roast-text-wrapper li:last-child {
    margin-bottom: 0;
}

.roast-text-wrapper li::before {
    content: '🔥';
    position: absolute;
    left: 0;
    font-size: 1.1rem;
}

.roast-text-wrapper p {
    margin-bottom: 12px;
}

.roast-text-wrapper p:last-child {
    margin-bottom: 0;
}
.roast-joke {
    margin-bottom: 20px;
    padding: 16px 20px;
    background: linear-gradient(135deg, rgba(255,107,107,0.1) 0%, rgba(255,107,107,0.05) 100%);
    border-radius: var(--radius-md);
    border-left: 3px solid var(--accent);
    font-size: 1.05rem;
    line-height: 1.7;
    position: relative;
}

.roast-joke:last-child {
    margin-bottom: 0;
}

.roast-joke::before {
    content: '🔥';
    position: absolute;
    left: -12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2rem;
    background: var(--bg-card);
    padding: 4px;
    border-radius: 50%;
}


.share-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.btn-share {
    padding: 12px 16px;
    font-size: 0.9rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--bg-elevated);
    color: var(--text-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.share-icon {
    width: 16px;
    height: 16px;
    stroke-width: 2;
}

.btn-share:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    background: var(--accent-light);
    box-shadow: var(--shadow-md);
}

.btn-share:active {
    transform: translateY(0);
}

#tryAgain {
    display: block;
    margin: 0 auto;
}

@media (max-width: 480px) {
    .share-buttons {
        grid-template-columns: 1fr;
    }
}

footer {
    text-align: center;
    padding: 30px 20px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

@media (max-width: 640px) {
    .preset-grid {
        grid-template-columns: 1fr;
    }

    .button-group {
        flex-direction: column;
    }

    .btn-primary,
    .btn-secondary {
        width: 100%;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 2.5rem;
    }

    .upload-zone {
        padding: 40px 20px;
    }

    .upload-icon {
        width: 60px;
        height: 60px;
    }

    .roast-text-wrapper {
        font-size: 1rem;
        padding: 20px;
    }

    .roast-container {
        padding: 24px;
    }

    .share-buttons {
        grid-template-columns: 1fr;
    }

    .preset-card {
        padding: 10px;
    }

    .preset-icon {
        font-size: 1.3rem;
    }

    .preset-name {
        font-size: 0.9rem;
    }

    .preset-description {
        font-size: 0.7rem;
    }
}

@media (max-width: 768px) {
    .preset-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .preset-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .preset-card {
        padding: 8px;
    }
    
    .preset-icon {
        font-size: 1.2rem;
    }
    
    .preset-name {
        font-size: 0.75rem;
    }
}

/* Share Card Primary Button */
.btn-share-primary {
    background: linear-gradient(135deg, #ff6b35, #ff4757) !important;
    color: white !important;
    border: none !important;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(255, 71, 87, 0.3);
    transform: scale(1.05);
}

.btn-share-primary:hover {
    background: linear-gradient(135deg, #ff4757, #ff6b35) !important;
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(255, 71, 87, 0.4);
}

.btn-share-primary svg {
    stroke: white !important;
}

/* Crop Modal Styles */
.crop-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.crop-modal.hidden {
    display: none;
}

.crop-container {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 20px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.crop-container h3 {
    color: var(--text-primary);
    margin: 0 0 15px 0;
    text-align: center;
    font-size: 1.2rem;
}

.crop-wrapper {
    width: 100%;
    max-height: 60vh;
    overflow: hidden;
    border-radius: 10px;
    background: #000;
}

.crop-wrapper img {
    max-width: 100%;
    display: block;
}

.crop-buttons {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    justify-content: center;
}

.crop-buttons button {
    flex: 1;
    max-width: 150px;
}

/* Cropper.js customization */
.cropper-view-box,
.cropper-face {
    border-radius: 50%;
}

.cropper-view-box {
    outline: 2px solid var(--primary);
    outline-color: var(--primary);
}

.cropper-line {
    background-color: var(--primary);
}

.cropper-point {
    background-color: var(--primary);
}
