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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #111;
    color: #eee;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

.container {
    max-width: 500px;
    margin: 0 auto;
    padding: 10px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-title {
    text-align: center;
    margin-bottom: 15px;
    font-size: 1.2rem;
    font-weight: normal;
    font-family: 'Press Start 2P', cursive;
    color: #4CAF50;
    text-shadow: 2px 2px 0px #222, 4px 4px 0px rgba(0,0,0,0.5);
    letter-spacing: 2px;
    line-height: 1.4;
}

.controls {
    background-color: #222;
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 15px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}

.emoji-selector {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 15px;
}

#emoji-input {
    width: 70px;
    height: 50px;
    font-size: 2rem;
    text-align: center;
    border: none;
    border-radius: 10px;
    background-color: #333;
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}

#emoji-input:hover, #emoji-input:focus {
    background-color: #444;
    box-shadow: 0 6px 24px rgba(76, 175, 80, 0.3);
    transform: translateY(-2px);
}

.picker-button {
    width: 50px;
    height: 50px;
    font-size: 1.2rem;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 16px rgba(76, 175, 80, 0.3);
}

.import-button {
    width: 50px;
    height: 50px;
    font-size: 1.2rem;
    background-color: #FF9800;
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 16px rgba(255, 152, 0, 0.3);
}

.import-button:hover {
    background-color: #F57C00;
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(255, 152, 0, 0.4);
}

.picker-button:hover {
    background-color: #45a049;
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(76, 175, 80, 0.4);
}

.stretch-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.control-label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #4CAF50;
    font-size: 0.9rem;
}

.slider {
    -webkit-appearance: none;
    width: 100%;
    height: 12px;
    border-radius: 6px;
    background: #333;
    outline: none;
    transition: all 0.3s ease;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.3);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #4CAF50;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
    touch-action: manipulation;
}

.slider::-moz-range-thumb {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #4CAF50;
    cursor: pointer;
    border: none;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
    touch-action: manipulation;
}

.slider::-webkit-slider-thumb:hover {
    background: #45a049;
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(76, 175, 80, 0.6);
}

.canvas-container {
    background-color: #222;
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 15px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 280px;
    width: 100%;
    max-width: 320px;
    margin-left: auto;
    margin-right: auto;
}

#emoji-canvas {
    max-width: 100%;
    max-height: 100%;
    border-radius: 10px;
    background-color: #333;
    box-shadow: inset 0 4px 8px rgba(0,0,0,0.3);
    width: 280px;
    height: 280px;
}

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

button {
    padding: 10px 16px;
    font-size: 0.9rem;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
    box-shadow: 0 4px 16px rgba(76, 175, 80, 0.3);
}

button:hover {
    background-color: #45a049;
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(76, 175, 80, 0.5);
}

button:active {
    transform: translateY(0);
}

.emoji-categories {
    background-color: #222;
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}

.category-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
    justify-content: center;
}

.category-tab {
    padding: 8px 12px;
    font-size: 0.8rem;
    background-color: #333;
    color: #ddd;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.category-tab.active {
    background-color: #4CAF50;
    color: white;
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
}

.category-tab:hover:not(.active) {
    background-color: #444;
    transform: translateY(-2px);
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
    gap: 8px;
    justify-items: center;
}

.emoji-grid-item {
    font-size: 1.5rem;
    background-color: #333;
    border: none;
    border-radius: 10px;
    padding: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.emoji-grid-item:hover {
    background-color: #444;
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

.version-text {
    text-align: center;
    color: #888;
    font-size: 0.8rem;
    margin-bottom: 8px;
}

.footer {
    text-align: center;
    color: #888;
    font-size: 0.8rem;
    margin-top: auto;
    padding: 15px 0;
    border-top: 1px solid #333;
}

.footer a {
    color: #4CAF50;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer a:hover {
    color: #45a049;
}

.tooltip {
    position: fixed;
    bottom: 120px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 24px;
    background: #4CAF50;
    color: white;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: bold;
    z-index: 10000;
    animation: fadeInOut 2s ease-in-out;
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
}

@keyframes fadeInOut {
    0% { opacity: 0; transform: translate(-50%, 20px); }
    15% { opacity: 1; transform: translate(-50%, 0); }
    85% { opacity: 1; transform: translate(-50%, 0); }
    100% { opacity: 0; transform: translate(-50%, -20px); }
}

/* Secret category styling */
.category-tab:last-child {
    background-color: #222;
    color: #666;
    border: 1px dashed #444;
}

.category-tab:last-child.active {
    background-color: #333;
    color: #aaa;
    border: 1px solid #555;
}

/* Emoji picker styling */
emoji-picker {
    --background: #222;
    --border-color: #444;
    --indicator-color: #4CAF50;
    --input-border-color: #444;
    --input-font-color: #eee;
    --input-placeholder-color: #888;
    --outline-color: #4CAF50;
    --category-font-color: #eee;
    --button-hover-background: #444;
    --button-active-background: #4CAF50;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}

/* Modal styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10001;
    backdrop-filter: blur(4px);
}

.modal {
    background-color: #222;
    border-radius: 16px;
    padding: 24px;
    max-width: 90%;
    width: 400px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    border: 1px solid #333;
}

.modal-header {
    margin-bottom: 16px;
}

.modal-header h3 {
    color: #4CAF50;
    font-size: 1.2rem;
    margin: 0;
    font-weight: bold;
}

.modal-body {
    margin-bottom: 24px;
}

.modal-body p {
    color: #eee;
    line-height: 1.5;
    margin: 0;
}

.modal-footer {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.modal-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
    min-width: 80px;
}

.modal-btn-primary {
    background-color: #4CAF50;
    color: white;
}

.modal-btn-primary:hover {
    background-color: #45a049;
    transform: translateY(-2px);
}

.modal-btn-secondary {
    background-color: #444;
    color: #eee;
}

.modal-btn-secondary:hover {
    background-color: #555;
    transform: translateY(-2px);
}

/* Responsive adjustments */
@media (max-width: 480px) {
    .container {
        padding: 8px;
    }
    
    .app-title {
        font-size: 1rem;
        margin-bottom: 10px;
        letter-spacing: 1px;
    }
    
    .controls {
        padding: 10px;
        margin-bottom: 10px;
    }
    
    .canvas-container {
        padding: 10px;
        margin-bottom: 10px;
        min-height: 250px;
        max-width: 280px;
    }
    
    #emoji-canvas {
        width: 250px;
        height: 250px;
    }
    
    #emoji-input {
        width: 60px;
        height: 45px;
        font-size: 1.8rem;
    }
    
    .picker-button {
        width: 45px;
        height: 45px;
        font-size: 1rem;
    }
    
    .import-button {
        width: 45px;
        height: 45px;
        font-size: 1rem;
    }
    
    .emoji-categories {
        padding: 10px;
        margin-bottom: 10px;
    }
    
    .category-tabs {
        gap: 6px;
        margin-bottom: 10px;
    }
    
    .category-tab {
        padding: 6px 10px;
        font-size: 0.75rem;
    }
    
    .emoji-grid {
        grid-template-columns: repeat(auto-fill, minmax(35px, 1fr));
        gap: 6px;
    }
    
    .emoji-grid-item {
        width: 35px;
        height: 35px;
        font-size: 1.3rem;
        padding: 4px;
    }
    
    .actions {
        gap: 8px;
        margin-bottom: 10px;
    }
    
    button {
        padding: 8px 12px;
        font-size: 0.8rem;
    }
    
    .control-label {
        font-size: 0.8rem;
        margin-bottom: 3px;
    }
    
    .stretch-controls {
        gap: 8px;
    }
    
    .footer {
        padding: 10px 0;
        font-size: 0.75rem;
    }
    
    .version-text {
        font-size: 0.75rem;
        margin-bottom: 5px;
    }
    
    .slider {
        height: 16px;
        touch-action: manipulation;
    }
    
    .slider::-webkit-slider-thumb {
        width: 32px;
        height: 32px;
        touch-action: manipulation;
    }
    
    .slider::-moz-range-thumb {
        width: 32px;
        height: 32px;
        touch-action: manipulation;
    }
}

/* PWA specific styles */
@media (display-mode: standalone) {
    body {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }
}