.eg-wrap {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 15px;
    box-sizing: border-box;
}

.eg-container {
    position: relative;
    transition: background 0.2s;
    border-radius: 16px;
    overflow: hidden;
}

/* Theme-matched backgrounds via data attribute */
.eg-container[data-bg="transparent"] { background: transparent; }
.eg-container[data-bg="white"] { background: #fff; }
.eg-container[data-bg="light"] { background: #f0f2f5; }
.eg-container[data-bg="dark"] { background: #1e1e2e; }

.eg-header {
    text-align: center;
    padding: 20px 10px 10px;
}

.eg-title {
    font-size: 2rem;
    font-weight: 700;
    margin: 0 0 4px;
    line-height: 1.2;
    color: inherit;
}

.eg-sub {
    font-size: 0.95rem;
    margin: 0;
    color: inherit;
    opacity: 0.7;
}

.eg-search-area {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    padding: 16px 10px 0;
}

.eg-search-box {
    position: relative;
    flex: 1;
    min-width: 200px;
}

.eg-search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.1rem;
    pointer-events: none;
    opacity: 0.5;
}

.eg-search {
    width: 100%;
    padding: 12px 44px 12px 44px;
    border-radius: 10px;
    font-size: 1rem;
    border: 2px solid rgba(128,128,128,0.25);
    background: rgba(255,255,255,0.85);
    color: inherit;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.eg-search:focus {
    border-color: #0066ff;
    box-shadow: 0 0 0 3px rgba(0,102,255,0.15);
    background: #fff;
}

.eg-clear-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    opacity: 0.5;
    color: inherit;
}

.eg-clear-btn:hover { opacity: 1; }

.eg-skin-area {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.eg-skin-lbl {
    font-size: 0.85rem;
    opacity: 0.7;
    white-space: nowrap;
}

.eg-skin-group {
    display: flex;
    gap: 4px;
}

.eg-skin {
    font-size: 1.3rem;
    border: 2px solid transparent;
    background: rgba(255,255,255,0.7);
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 8px;
    line-height: 1;
    transition: border-color 0.15s, background 0.15s;
}

.eg-skin.active {
    border-color: #0066ff;
    background: rgba(0,102,255,0.1);
    box-shadow: 0 0 0 2px rgba(0,102,255,0.2);
}

.eg-cats {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 14px 10px 0;
    justify-content: center;
}

.eg-cat {
    padding: 7px 16px;
    border-radius: 20px;
    border: 1.5px solid rgba(128,128,128,0.2);
    background: rgba(255,255,255,0.75);
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.15s;
    color: inherit;
    white-space: nowrap;
}

.eg-cat:hover {
    background: rgba(255,255,255,0.9);
    border-color: #0066ff;
}

.eg-cat.active {
    background: rgba(0,102,255,0.12);
    border-color: #0066ff;
    color: #0066ff;
    font-weight: 600;
}

.eg-view-tabs {
    display: flex;
    gap: 8px;
    padding: 16px 10px 0;
    border-bottom: 1px solid rgba(128,128,128,0.15);
}

.eg-vtab {
    padding: 8px 18px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 0.9rem;
    border-bottom: 2.5px solid transparent;
    margin-bottom: -1px;
    transition: all 0.15s;
    color: inherit;
    opacity: 0.6;
}

.eg-vtab.active {
    opacity: 1;
    border-bottom-color: #0066ff;
    color: #0066ff;
    font-weight: 600;
}

.eg-vtab:hover { opacity: 0.9; }

.eg-main {
    display: flex;
    gap: 16px;
    padding: 12px 10px;
}

.eg-grid-wrap {
    flex: 1;
    min-width: 0;
}

.eg-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
    gap: 4px;
}

.eg-emoji {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    padding: 6px;
    cursor: pointer;
    border-radius: 10px;
    border: 1.5px solid transparent;
    position: relative;
    transition: all 0.15s;
    background: rgba(255,255,255,0.6);
}

.eg-emoji:hover {
    background: rgba(255,255,255,0.95);
    border-color: rgba(0,102,255,0.3);
    transform: scale(1.08);
    z-index: 2;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

.eg-emoji.active {
    background: rgba(0,102,255,0.12);
    border-color: #0066ff;
    box-shadow: 0 0 0 2px rgba(0,102,255,0.15);
}

.eg-star {
    position: absolute;
    top: -4px;
    right: -4px;
    font-size: 0.55rem;
    opacity: 0;
    transition: opacity 0.15s;
    cursor: pointer;
    padding: 2px;
    border: none;
    background: none;
    line-height: 1;
    color: inherit;
}

.eg-emoji:hover .eg-star { opacity: 0.5; }
.eg-star:hover { opacity: 1 !important; }
.eg-star.fav { opacity: 1; color: #f5a623; }

.eg-nodata {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px 20px;
    font-size: 1.1rem;
    opacity: 0.6;
}

.eg-side {
    width: 240px;
    flex-shrink: 0;
    display: none;
}

.eg-side.show { display: block; }

.eg-side-inner {
    position: sticky;
    top: 10px;
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 14px;
    padding: 20px 16px;
    border: 1px solid rgba(128,128,128,0.15);
    box-shadow: 0 4px 24px rgba(0,0,0,0.04);
}

.eg-ph {
    text-align: center;
    padding: 20px 0;
    opacity: 0.45;
}

.eg-ph-icon { font-size: 2.5rem; display: block; margin-bottom: 8px; }
.eg-ph p { margin: 0; font-size: 0.9rem; }

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

.eg-preview-emoji {
    font-size: 3.5rem;
    display: block;
    margin-bottom: 6px;
}

.eg-preview-name {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 12px;
    word-break: break-word;
}

.eg-preview-codes {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.eg-code-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.78rem;
    background: rgba(0,0,0,0.04);
    border-radius: 8px;
    padding: 5px 10px;
}

.eg-code-lbl { opacity: 0.6; }
.eg-code-val {
    font-family: "SF Mono", Consolas, monospace;
    font-weight: 500;
    font-size: 0.72rem;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.eg-copy-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.85rem;
    padding: 0 4px;
    opacity: 0.5;
    transition: opacity 0.15s;
    color: inherit;
}

.eg-copy-btn:hover { opacity: 1; color: #0066ff; }

.eg-toast-box {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.82);
    color: #fff;
    padding: 12px 28px;
    border-radius: 12px;
    font-size: 0.95rem;
    z-index: 99999;
    opacity: 0;
    transition: opacity 0.25s;
    pointer-events: none;
    white-space: nowrap;
}

.eg-toast-box.show { opacity: 1; }

.eg-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.35);
    z-index: 99;
}

@media (max-width: 820px) {
    .eg-main { flex-direction: column; }
    .eg-side { width: 100%; }
    .eg-side-inner { position: static; }
    .eg-side.show { display: block; }
    .eg-grid { grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); }
    .eg-title { font-size: 1.5rem; }
    .eg-cat { font-size: 0.78rem; padding: 5px 12px; }
    .eg-skin { font-size: 1.1rem; }
}

@media (max-width: 480px) {
    .eg-grid { grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: 3px; }
    .eg-search-area { flex-direction: column; }
    .eg-search { font-size: 0.9rem; padding: 10px 40px 10px 38px; }
    .eg-side-inner { padding: 14px 12px; }
    .eg-preview-emoji { font-size: 2.8rem; }
}

/* ========== TOOLS ========== */

.eg-tool {
    width: 100%;
    max-width: 860px;
    margin: 0 auto 24px;
    padding: 0 10px;
    box-sizing: border-box;
}

.eg-tool-inner {
    background: rgba(255,255,255,0.85);
    border: 1px solid rgba(128,128,128,0.15);
    border-radius: 14px;
    padding: 24px 20px;
    box-shadow: 0 2px 16px rgba(0,0,0,0.04);
}

.eg-tool-title {
    font-size: 1.3rem;
    font-weight: 700;
    margin: 0 0 16px;
    padding-bottom: 10px;
    border-bottom: 2px solid #0066ff;
    color: inherit;
}

.eg-tool-upload {
    margin-bottom: 14px;
}

.eg-file-input {
    font-size: 0.9rem;
    padding: 6px 0;
    color: inherit;
}

.eg-tool-options {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    margin-bottom: 14px;
}

.eg-tool-options label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    color: inherit;
}

.eg-tool-options input[type="number"],
.eg-tool-options input[type="range"],
.eg-tool-options select {
    padding: 6px 10px;
    border-radius: 6px;
    border: 1.5px solid rgba(128,128,128,0.25);
    font-size: 0.85rem;
    background: rgba(255,255,255,0.8);
    color: inherit;
}

.eg-tool-options input[type="checkbox"] {
    width: 16px;
    height: 16px;
}

.eg-tool-canvas-area {
    margin-bottom: 14px;
    text-align: center;
}

.eg-tool-canvas-area canvas {
    max-width: 100%;
    border: 1px solid rgba(128,128,128,0.2);
    border-radius: 8px;
    cursor: crosshair;
}

.eg-tool-preview {
    text-align: center;
    margin-bottom: 14px;
    min-height: 40px;
}

.eg-tool-preview img {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

.eg-tool-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.eg-btn {
    padding: 10px 22px;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    background: #0066ff;
    color: #fff;
    transition: background 0.15s, transform 0.1s, opacity 0.15s;
}

.eg-btn:hover { background: #0052cc; }
.eg-btn:active { transform: scale(0.97); }
.eg-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.eg-tool-editor {
    margin-bottom: 10px;
}

.eg-fmt-input {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    border: 1.5px solid rgba(128,128,128,0.2);
    font-family: "SF Mono", Consolas, monospace;
    font-size: 0.85rem;
    line-height: 1.5;
    resize: vertical;
    box-sizing: border-box;
    background: rgba(255,255,255,0.7);
    color: inherit;
}

.eg-fmt-input:focus {
    border-color: #0066ff;
    outline: none;
    box-shadow: 0 0 0 2px rgba(0,102,255,0.1);
}

.eg-tool-output {
    margin-top: 10px;
}

.eg-fmt-output {
    background: rgba(0,0,0,0.03);
    border: 1px solid rgba(128,128,128,0.15);
    border-radius: 8px;
    padding: 14px;
    font-family: "SF Mono", Consolas, monospace;
    font-size: 0.82rem;
    line-height: 1.5;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 400px;
    overflow-y: auto;
    margin: 0;
    color: inherit;
}

.eg-tool-age-form {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    margin-bottom: 16px;
}

.eg-tool-age-form label {
    font-size: 0.95rem;
}

.eg-age-dob {
    padding: 8px 12px;
    border-radius: 6px;
    border: 1.5px solid rgba(128,128,128,0.25);
    font-size: 0.9rem;
    background: rgba(255,255,255,0.7);
    color: inherit;
}

.eg-tool-age-result {
    font-size: 1.15rem;
    line-height: 1.6;
    padding: 14px;
    background: rgba(0,102,255,0.06);
    border-radius: 8px;
    border-left: 3px solid #0066ff;
}

.eg-tool-age-result strong {
    font-size: 1.3rem;
    color: #0066ff;
}

.eg-tool-note {
    font-size: 0.88rem;
    opacity: 0.7;
    margin: 0 0 12px;
}

.eg-tool-progress {
    margin-bottom: 12px;
}

.eg-progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(128,128,128,0.15);
    border-radius: 3px;
    overflow: hidden;
}

.eg-progress-fill {
    height: 100%;
    width: 0;
    background: #0066ff;
    border-radius: 3px;
    transition: width 0.3s;
}

.eg-tool-thumbs {
    margin-bottom: 12px;
}

.eg-thumb-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.eg-thumb-list img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid rgba(128,128,128,0.15);
}

/* Crop overlay */
.eg-crop-overlay {
    position: absolute;
    border: 2px dashed #0066ff;
    background: rgba(0,102,255,0.08);
    pointer-events: none;
    z-index: 5;
}

.eg-tool-canvas-area {
    position: relative;
    display: inline-block;
}

/* Responsive */
@media (max-width: 600px) {
    .eg-tool-inner { padding: 16px 12px; }
    .eg-tool-options { flex-direction: column; align-items: flex-start; }
    .eg-tool-title { font-size: 1.1rem; }
    .eg-btn { width: 100%; justify-content: center; }
    .eg-fmt-input { font-size: 0.78rem; }
}

