:root {
    --primary-color: #ff6b6b;
    --secondary-color: #4ecdc4;
    --accent-color: #ffe66d;
    --bg-color: #f7f9fc;
    --text-color: #2d3436;
    --card-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

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

body,
html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'Tajawal', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
}

#app {
    position: relative;
    width: 100%;
    height: 100%;
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    padding: 20px;
    padding-top: env(safe-area-inset-top, 20px);
    background: linear-gradient(135deg, #fdfbfb 0%, #ebedee 100%);
}

.screen.active {
    display: flex;
}

/* Typography */
h1,
h2,
h3 {
    text-align: center;
    color: var(--primary-color);
    margin-bottom: 20px;
}

/* Buttons */
.primary-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 50px;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4);
    transition: transform 0.2s, box-shadow 0.2s;
    margin: 10px auto;
    display: block;
}

.primary-btn:active {
    transform: scale(0.95);
    box-shadow: 0 2px 8px rgba(255, 107, 107, 0.4);
}

.back-btn {
    background: none;
    border: none;
    font-size: 1.1rem;
    color: var(--text-color);
    padding: 10px;
    cursor: pointer;
}

.circle-btn {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 5px solid white;
    background: var(--primary-color);
    font-size: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 20px auto;
    box-shadow: var(--card_shadow);
    cursor: pointer;
}

.circle-btn.recording {
    animation: pulse 1s infinite;
    background: #e74c3c;
}

/* Layouts */
.content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.menu-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    width: 100%;
    max-width: 400px;
    margin: auto;
}

.menu-item {
    background: white;
    padding: 30px;
    border-radius: 20px;
    border: 3px solid transparent;
    box-shadow: var(--card-shadow);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.3s;
}

.menu-item:active {
    border-color: var(--secondary-color);
    transform: translateY(-5px);
}

.menu-item .icon {
    font-size: 3rem;
}

.menu-item .label {
    font-size: 1.4rem;
    font-weight: bold;
    color: var(--primary-color);
}

/* Voice Recorder Effects */
.effects-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin: 20px 0;
}

.effects-grid button {
    padding: 15px;
    border-radius: 12px;
    border: 2px solid var(--secondary-color);
    background: white;
    font-size: 1rem;
    cursor: pointer;
}

/* Templates */
.template-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
}

.template-btn {
    background: white;
    padding: 20px;
    border-radius: 15px;
    border: 2px solid var(--accent-color);
    font-size: 1.1rem;
    text-align: right;
    cursor: pointer;
}

.input-field {
    width: 100%;
    padding: 15px;
    margin: 10px 0;
    border-radius: 10px;
    border: 2px solid #ddd;
    font-size: 1rem;
}

/* Canvas */
.canvas-container {
    background: white;
    border-radius: 15px;
    box-shadow: var(--card-shadow);
    margin-bottom: 15px;
    width: 100%;
    aspect-ratio: 1/1;
    position: relative;
    overflow: hidden;
}

#canvas {
    width: 100%;
    height: 100%;
    touch-action: none;
}

.canvas-tools {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* Sticker Editor */
.editor-container {
    width: 100%;
    max-width: 400px;
    margin-bottom: 20px;
}

#sticker-canvas-area {
    width: 100%;
    max-height: 60vh;
    /* Don't let it be too tall */
    position: relative;
    border-radius: 15px;
    overflow: hidden;
    background: #f0f0f0;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 10px 0;
}

#user-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    /* Ensure image fits */
    display: block;
}

#stickers-layer {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    /* Center it over the contained image */
    width: 100%;
    height: 100%;
    z-index: 10;
    /* Ensure it's on top */
    pointer-events: auto;
}

.sticker-bar {
    display: flex;
    overflow-x: auto;
    gap: 15px;
    width: 100%;
    padding: 15px;
    background: white;
    border-radius: 20px;
    box-shadow: var(--card-shadow);
    margin-bottom: 20px;
}

.sticker-item {
    font-size: 2.5rem;
    background: none;
    border: 3px solid transparent;
    border-radius: 15px;
    cursor: pointer;
    padding: 5px;
    transition: all 0.2s;
}

.sticker-item.selected {
    border-color: var(--secondary-color);
    background: rgba(78, 205, 196, 0.1);
    transform: scale(1.1);
}

.placed-sticker {
    position: absolute;
    font-size: 50px;
    /* Base size */
    transform: translate(-50%, -50%);
    cursor: move;
    user-select: none;
    touch-action: none;
    border: 2px solid transparent;
    padding: 5px;
    border-radius: 10px;
}

.placed-sticker.selected {
    border-color: var(--secondary-color);
    background: rgba(255, 255, 255, 0.3);
}

.control-panel {
    display: flex;
    align-items: center;
    gap: 20px;
    background: white;
    padding: 10px 20px;
    border-radius: 15px;
    box-shadow: var(--card-shadow);
    margin: 10px 0;
    width: 100%;
}

.size-control {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
}

.size-control input {
    flex: 1;
}

.delete-btn {
    background: #ff4757;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 10px;
    font-size: 1rem;
    cursor: pointer;
}

/* Prank Mode */
#prank-mode {
    background: black;
    color: white;
    justify-content: center;
}

.funny-alert {
    font-size: 3rem;
    font-weight: bold;
    color: var(--accent-color);
    text-shadow: 0 0 10px rgba(255, 230, 109, 0.8);
}

.shake-container {
    animation: shake 0.5s infinite;
}

.prank-msg {
    font-size: 1.5rem;
    margin: 30px 0;
    color: var(--secondary-color);
}

/* Credits */
.credit-box {
    background: white;
    padding: 30px;
    border-radius: 20px;
    box-shadow: var(--card-shadow);
    margin-bottom: 30px;
}

.credit-box p {
    font-size: 1.4rem;
    margin: 10px 0;
}

/* Animations */
@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.7);
    }

    70% {
        transform: scale(1.05);
        box-shadow: 0 0 0 15px rgba(231, 76, 60, 0);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(231, 76, 60, 0);
    }
}

@keyframes shake {
    0% {
        transform: translate(1px, 1px) rotate(0deg);
    }

    10% {
        transform: translate(-1px, -2px) rotate(-1deg);
    }

    20% {
        transform: translate(-3px, 0px) rotate(1deg);
    }

    30% {
        transform: translate(3px, 2px) rotate(0deg);
    }

    40% {
        transform: translate(1px, -1px) rotate(1deg);
    }

    50% {
        transform: translate(-1px, 2px) rotate(-1deg);
    }

    60% {
        transform: translate(-3px, 1px) rotate(0deg);
    }

    70% {
        transform: translate(3px, 1px) rotate(-1deg);
    }

    80% {
        transform: translate(-1px, -1px) rotate(1deg);
    }

    90% {
        transform: translate(1px, 2px) rotate(0deg);
    }

    100% {
        transform: translate(1px, -2px) rotate(-1deg);
    }
}

.anim-bounce {
    animation: bounce 2s infinite;
}

@keyframes bounce {

    0%,
    20%,
    50%,
    80%,
    100% {
        transform: translateY(0);
    }

    40% {
        transform: translateY(-20px);
    }

    60% {
        transform: translateY(-10px);
    }
}

.hidden {
    display: none !important;
}

.main-logo {
    width: 150px;
    height: 150px;
    margin-bottom: 20px;
    border-radius: 30px;
}

.design-gallery {
    display: flex;
    overflow-x: auto;
    gap: 10px;
    width: 100%;
    padding: 10px 0;
}

.saved-item {
    min-width: 100px;
    height: 100px;
    border-radius: 10px;
    background-size: cover;
    border: 2px solid white;
    box-shadow: var(--card_shadow);
}