:root {
    --favicon-purple: #6366f1;
    --favicon-light: #EEF2FF;
    --favicon-dark: #4f46e5;
}

.favicon-page {
    padding: 20px;
    max-width: var(--small-width);
    margin: 0 auto;
}

.favicon-container {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 20px;
}

@media (max-width: 1024px) {
    .favicon-container {
        grid-template-columns: 1fr;
    }
}

.favicon-config {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    position: sticky;
    top: 20px;
    height: fit-content;
}

.mode-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    background: #f8fafc;
    padding: 4px;
    border-radius: 8px;
}

.mode-tab {
    flex: 1;
    padding: 10px;
    border: none;
    background: transparent;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s;
}

.mode-tab:hover {
    background: #f1f5f9;
}

.mode-tab.active {
    background: white;
    color: var(--favicon-purple);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.mode-content {
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

.config-section {
    margin-bottom: 16px;
}

.config-section label {
    display: block;
    font-size: 13px;
    color: #64748b;
    margin-bottom: 6px;
    font-weight: 500;
}

.config-section input[type="text"],
.config-section select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
    background: #fafafa;
}

.config-section input[type="text"]:focus,
.config-section select:focus {
    outline: none;
    border-color: var(--favicon-purple);
    background: white;
}

.config-section input[type="range"] {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: #e2e8f0;
    border-radius: 3px;
    cursor: pointer;
}

.config-section input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: var(--favicon-purple);
    border-radius: 50%;
    cursor: pointer;
}

.config-section input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: var(--favicon-purple);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.range-value {
    display: block;
    text-align: right;
    font-size: 12px;
    color: #94a3b8;
    margin-top: 4px;
}

.color-picker-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.color-picker-wrapper input[type="color"] {
    width: 50px;
    height: 40px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    cursor: pointer;
    padding: 0;
}

.color-value {
    font-size: 14px;
    color: #334155;
    font-family: monospace;
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 8px;
    margin-bottom: 16px;
    max-height: 240px;
    overflow-y: auto;
    padding-right: 8px;
}

.emoji-grid::-webkit-scrollbar {
    width: 6px;
}

.emoji-grid::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

.emoji-grid::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.emoji-item {
    width: 100%;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    background: #f8fafc;
    border: 2px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.emoji-item:hover {
    background: #f1f5f9;
    border-color: #e2e8f0;
}

.emoji-item.active {
    background: var(--favicon-light);
    border-color: var(--favicon-purple);
}

.upload-area {
    border: 2px dashed #e2e8f0;
    border-radius: 10px;
    padding: 30px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 16px;
}

.upload-area:hover {
    border-color: var(--favicon-purple);
    background: #faf5ff;
}

.upload-area.dragover {
    border-color: var(--favicon-purple);
    background: var(--favicon-light);
}

.upload-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.upload-area p {
    margin: 0 0 8px 0;
    font-size: 14px;
    color: #64748b;
}

.upload-tip {
    font-size: 12px !important;
    color: #94a3b8 !important;
}

.upload-preview {
    width: 100%;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.upload-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 4px;
}

.action-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.btn-secondary {
    flex: 1;
    padding: 10px;
    background: #f1f5f9;
    color: #64748b;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: #e2e8f0;
}

.btn-primary {
    flex: 2;
    padding: 10px;
    background: linear-gradient(135deg, var(--favicon-purple) 0%, var(--favicon-dark) 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.favicon-preview {
    background: white;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.preview-title {
    font-size: 16px;
    font-weight: 600;
    color: #334155;
}

.preview-box {
    width: 100%;
    aspect-ratio: 3/2;
    background: #f8fafc;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    position: relative;
    overflow: hidden;
    border: 1px solid #e2e8f0;
}

#previewCanvas {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: none;
}

.preview-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #94a3b8;
}

.placeholder-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.preview-placeholder p {
    margin: 0;
    font-size: 14px;
}

.download-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
}

.btn-download {
    flex: 1;
    padding: 10px;
    background: var(--favicon-light);
    color: var(--favicon-purple);
    border: 1px solid var(--favicon-purple);
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-download:hover:not(:disabled) {
    background: var(--favicon-purple);
    color: white;
}

.btn-download:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.size-info {
    text-align: center;
    font-size: 12px;
    color: #94a3b8;
}