:root {
    --bg:        #0f1115;
    --bg-soft:   #171a21;
    --bg-card:   #1d2029;
    --border:    #2a2f3a;
    --text:      #e6e8ee;
    --muted:     #8b93a7;
    --accent:    #ff9f43;
    --accent-2:  #ff6b6b;
    --accent-3:  #4ecdc4;
    --good:      #42d392;
    --shadow:    0 10px 30px rgba(0,0,0,.35);
    --radius:    16px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
                 "Hiragino Sans GB", "Microsoft YaHei", Arial, sans-serif;
    min-height: 100vh;
    background:
        radial-gradient(1200px 700px at 10% -20%, rgba(255,107,107,.18), transparent 60%),
        radial-gradient(900px 600px at 110% 10%, rgba(78,205,196,.16), transparent 60%),
        radial-gradient(800px 500px at 50% 120%, rgba(255,159,67,.14), transparent 60%),
        var(--bg);
}

/* ----------- top bar ----------- */
.topbar {
    display: flex; align-items: center; justify-content: space-between;
    gap: 24px; padding: 18px 28px;
    border-bottom: 1px solid var(--border);
    background: rgba(15,17,21,.6);
    backdrop-filter: blur(6px);
    position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 14px; }
.logo {
    font-size: 40px; line-height: 1;
    filter: drop-shadow(0 6px 16px rgba(255,159,67,.45));
}
.brand-text h1 {
    margin: 0; font-size: 22px; letter-spacing: .5px;
    background: linear-gradient(90deg, #ff9f43, #ff6b6b 50%, #4ecdc4);
    -webkit-background-clip: text; background-clip: text; color: transparent;
}
.brand-text small { color: var(--muted); font-size: 12px; }
.stats { display: flex; gap: 22px; }
.stats > div {
    display: flex; flex-direction: column; align-items: flex-end;
    line-height: 1;
}
.stats b { font-size: 18px; color: var(--text); }
.stats span { font-size: 11px; color: var(--muted); margin-top: 4px; letter-spacing: 1px; }

/* ----------- layout ----------- */
.layout {
    display: grid;
    grid-template-columns: 1.05fr 1.3fr;
    grid-template-rows: auto auto;
    gap: 20px;
    padding: 22px;
    max-width: 1400px;
    margin: 0 auto;
}
.result-panel { grid-column: 1; grid-row: 1; }
.picker       { grid-column: 2; grid-row: 1 / span 2; }
.suggest      { grid-column: 1; grid-row: 2; }

/* ----------- result card ----------- */
.result-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: var(--shadow);
}
.result-card {
    display: grid;
    grid-template-columns: 1fr auto 1fr auto 1.2fr;
    align-items: center;
    gap: 12px;
    padding: 18px;
    background: linear-gradient(135deg, #1a1e27, #22202b);
    border-radius: 14px;
    border: 1px dashed #333949;
}
.slot {
    aspect-ratio: 1 / 1;
    display: flex; align-items: center; justify-content: center;
    font-size: 54px;
    background: #10131a;
    border: 2px solid #2b3142;
    border-radius: 14px;
    cursor: pointer;
    transition: all .15s ease;
    user-select: none;
    position: relative;
}
.slot:hover { border-color: var(--accent); transform: translateY(-1px); }
.slot.active { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255,159,67,.25); }
.slot .ph { font-size: 13px; color: var(--muted); }
.plus, .equal {
    color: var(--muted); font-size: 28px; font-weight: 300;
}
.output {
    aspect-ratio: 1 / 1;
    display: flex; align-items: center; justify-content: center;
    background: #0e1118;
    border: 2px solid #2b3142;
    border-radius: 14px;
    overflow: hidden; position: relative;
}
.output .hint { color: var(--muted); font-size: 13px; text-align: center; padding: 12px; }
.output img {
    width: 86%; height: 86%; object-fit: contain;
    filter: drop-shadow(0 10px 24px rgba(0,0,0,.45));
    animation: pop .35s ease;
}
.output.empty-combo {
    background: repeating-linear-gradient(45deg, #0e1118 0 8px, #131824 8px 16px);
}
.output.empty-combo .hint { color: #9aa3b8; }
@keyframes pop {
    0%   { transform: scale(.6); opacity: 0; }
    70%  { transform: scale(1.08); opacity: 1; }
    100% { transform: scale(1); }
}

/* ----------- toolbar ----------- */
.toolbar {
    display: flex; flex-wrap: wrap; gap: 8px;
    margin-top: 14px;
}
.toolbar button {
    background: #242936; color: var(--text);
    border: 1px solid #313748; border-radius: 10px;
    padding: 8px 14px; cursor: pointer; font-size: 13px;
    transition: all .12s ease;
}
.toolbar button:hover { background: #2c3244; border-color: var(--accent); }
.toolbar button:disabled { opacity: .4; cursor: not-allowed; }
.toolbar #btnCopy { background: linear-gradient(135deg, #ff9f43, #ff6b6b); border-color: transparent; color: #1a0f00; font-weight: 600; min-width: 100px; }
.toolbar #btnCopy:disabled { background: #242936; color: var(--text); font-weight: normal; }
.toolbar #btnSave { background: linear-gradient(135deg, #4ecdc4, #42a5f5); border-color: transparent; color: #052229; font-weight: 600; min-width: 100px; }
.toolbar #btnSave:disabled { background: #242936; color: var(--text); font-weight: normal; }

/* toast */
.ek-toast {
    position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%) translateY(20px);
    background: rgba(20,22,30,.95); color: #fff;
    border: 1px solid #313748;
    padding: 10px 18px; border-radius: 10px;
    font-size: 13px; letter-spacing: .5px;
    box-shadow: 0 10px 30px rgba(0,0,0,.4);
    opacity: 0; pointer-events: none;
    transition: opacity .2s ease, transform .2s ease;
    z-index: 1000;
}
.ek-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.tip { color: var(--muted); font-size: 12px; margin: 12px 0 0; }

/* ----------- picker ----------- */
.picker {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    display: flex; flex-direction: column;
    min-height: 560px; max-height: calc(100vh - 140px);
    box-shadow: var(--shadow);
}
.picker-head {
    display: flex; align-items: center; gap: 10px; margin-bottom: 12px;
}
#searchInput {
    flex: 1; height: 40px; border-radius: 10px;
    background: #11141b; color: var(--text);
    border: 1px solid #2a2f3a; padding: 0 14px;
    font-size: 14px; outline: none;
}
#searchInput:focus { border-color: var(--accent); }
.picker-meta { color: var(--muted); font-size: 12px; white-space: nowrap; }
.emoji-grid {
    flex: 1; overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(54px, 1fr));
    gap: 6px;
    padding: 4px;
    scrollbar-width: thin;
    scrollbar-color: #333 transparent;
}
.emoji-grid::-webkit-scrollbar { width: 8px; }
.emoji-grid::-webkit-scrollbar-thumb { background: #333; border-radius: 6px; }
.emoji-btn {
    aspect-ratio: 1 / 1;
    display: flex; align-items: center; justify-content: center;
    font-size: 30px; cursor: pointer;
    background: transparent; border: 1px solid transparent;
    border-radius: 10px;
    transition: all .12s ease;
    user-select: none;
}
.emoji-btn:hover { background: #252a38; transform: scale(1.08); }
.emoji-btn.selected { background: rgba(255,159,67,.12); border-color: var(--accent); }
.emoji-btn.combinable { box-shadow: inset 0 0 0 2px rgba(78,205,196,.4); }
.emoji-btn.unavailable { opacity: .25; cursor: not-allowed; }
.emoji-btn.unavailable:hover { transform: none; background: transparent; }

/* ----------- suggest ----------- */
.suggest {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    min-height: 300px;
    box-shadow: var(--shadow);
}
.suggest-head h2 {
    margin: 0 0 4px; font-size: 16px; color: var(--text);
}
.suggest-head h2 .hl { color: var(--accent); }
.suggest-head small { color: var(--muted); font-size: 12px; }
.combo-grid {
    margin-top: 14px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 10px;
    max-height: 420px;
    overflow-y: auto;
    padding: 4px;
}
.combo-grid::-webkit-scrollbar { width: 8px; }
.combo-grid::-webkit-scrollbar-thumb { background: #333; border-radius: 6px; }
.combo-card {
    background: #10131a;
    border: 1px solid #262b38;
    border-radius: 12px;
    padding: 8px;
    display: flex; flex-direction: column; align-items: center;
    cursor: pointer;
    transition: all .12s ease;
    position: relative;
}
.combo-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.combo-card img { width: 60px; height: 60px; object-fit: contain; }
.combo-card .partner { margin-top: 6px; font-size: 20px; }
.combo-card .date { font-size: 10px; color: var(--muted); margin-top: 2px; }

.loading {
    grid-column: 1 / -1;
    text-align: center; padding: 30px; color: var(--muted);
}

/* ----------- footer ----------- */
.foot {
    display: flex; justify-content: space-between; align-items: center;
    padding: 18px 28px; color: var(--muted); font-size: 12px;
    border-top: 1px solid var(--border);
    margin-top: 20px;
}

/* ----------- responsive ----------- */
@media (max-width: 960px) {
    .layout {
        grid-template-columns: 1fr;
    }
    .result-panel { grid-column: 1; grid-row: 1; }
    .picker       { grid-column: 1; grid-row: 2; max-height: 500px; }
    .suggest      { grid-column: 1; grid-row: 3; }
    .stats { display: none; }
    .result-card {
        grid-template-columns: 1fr auto 1fr;
        grid-template-rows: auto auto auto;
        gap: 10px;
    }
    .plus { grid-column: 2; grid-row: 1; }
    .equal { grid-column: 2; grid-row: 2; }
    .output { grid-column: 1 / -1; grid-row: 3; aspect-ratio: 2 / 1; }
}
