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

:root {
    --bg: #040815;
    --bg-2: #070e1f;
    --panel: #0c1422;
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.16);
    --text: #eef3fb;
    --text-dim: #9fb0c8;
    --text-muted: #5f7593;
    --accent: #5eead4;
    --accent-2: #38bdf8;
    --key-bg: rgba(255, 255, 255, 0.06);
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
    --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', monospace;
    --display: 'Clash Display', sans-serif;
    --body: 'Satoshi', -apple-system, BlinkMacSystemFont, sans-serif;
}

html, body { height: 100%; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--body);
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    overflow: hidden;
    position: relative;
    min-height: 100vh;
}

body::after {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    opacity: 0.035;
    mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-size: 180px;
}

/* ═══ orbs ═══ */
.backdrop { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.orb { position: absolute; border-radius: 50%; filter: blur(120px); mix-blend-mode: screen; }
.orb-1 { width: 640px; height: 640px; top: -20%; left: -15%; background: radial-gradient(circle, rgba(94, 234, 212, 0.5) 0%, transparent 68%); animation: drift 28s ease-in-out infinite; }
.orb-2 { width: 560px; height: 560px; bottom: -15%; right: -12%; background: radial-gradient(circle, rgba(56, 189, 248, 0.45) 0%, transparent 70%); animation: drift 34s ease-in-out infinite reverse; }
.orb-3 { width: 420px; height: 420px; top: 35%; left: 55%; background: radial-gradient(circle, rgba(251, 146, 60, 0.22) 0%, transparent 70%); animation: drift 40s ease-in-out infinite; }

@keyframes drift {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50%      { transform: translate(4vw, 3vh) scale(1.08); }
}

/* ═══ stage ═══ */
.stage {
    position: relative;
    z-index: 2;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.25rem;
    gap: 1.5rem;
}

/* top kbd hint · small and subtle */
.kbd-hint {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--mono);
    font-size: 0.78rem;
    color: var(--text-muted);
}
.kbd-hint .dim { color: var(--text-muted); }
.key {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 0.35rem;
    border-radius: 5px;
    background: var(--key-bg);
    border: 1px solid var(--border);
    border-bottom-width: 2px;
    font-family: var(--mono);
    font-size: 0.72rem;
    color: var(--text-dim);
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.3);
}
.key.k-small { min-width: 18px; height: 18px; font-size: 0.68rem; padding: 0 0.3rem; }

/* ═══ palette · the star ═══ */
.palette {
    width: 100%;
    max-width: 560px;
    background: rgba(12, 20, 34, 0.72);
    border: 1px solid var(--border-strong);
    border-radius: 14px;
    backdrop-filter: blur(30px) saturate(180%);
    -webkit-backdrop-filter: blur(30px) saturate(180%);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        0 1px 0 rgba(255, 255, 255, 0.04),
        0 30px 60px -12px rgba(0, 0, 0, 0.6),
        0 80px 140px -40px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: pop 0.45s var(--ease);
}

@keyframes pop {
    0% { opacity: 0; transform: translateY(12px) scale(0.98); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

.pal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
}
.pal-id { display: flex; align-items: center; gap: 0.55rem; }
.pal-id .dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 4px rgba(94, 234, 212, 0.18);
    animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 4px rgba(94, 234, 212, 0.18); }
    50%      { box-shadow: 0 0 0 7px rgba(94, 234, 212, 0.08); }
}
.pal-id .tag {
    font-family: var(--mono);
    font-size: 0.78rem;
    color: var(--text-dim);
    letter-spacing: 0.02em;
}
.pal-close {
    font-family: var(--mono);
    font-size: 0.68rem;
    color: var(--text-muted);
    padding: 0.22rem 0.55rem;
    border-radius: 5px;
    border: 1px solid var(--border);
    background: var(--key-bg);
    letter-spacing: 0.05em;
}

/* search bar */
.pal-search {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.9rem 1rem;
    border-bottom: 1px solid var(--border);
}
.pal-search .prompt {
    font-family: var(--mono);
    font-size: 1.25rem;
    color: var(--accent);
    font-weight: 500;
    line-height: 1;
}
.q-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text);
    font-family: var(--body);
    font-size: 1.05rem;
    font-weight: 400;
    caret-color: var(--accent);
}
.q-input::placeholder { color: var(--text-muted); }
.pal-search .hotkey {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 0.4rem;
    border-radius: 5px;
    background: var(--key-bg);
    border: 1px solid var(--border);
    font-family: var(--mono);
    font-size: 0.72rem;
    color: var(--text-muted);
}

/* list */
.pal-list {
    list-style: none;
    max-height: 58vh;
    overflow-y: auto;
    padding: 0.35rem;
    scrollbar-width: thin;
    scrollbar-color: var(--border-strong) transparent;
}
.pal-list::-webkit-scrollbar { width: 6px; }
.pal-list::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }

.row {
    position: relative;
    display: grid;
    grid-template-columns: 34px 1fr auto auto;
    align-items: center;
    gap: 0.9rem;
    padding: 0.7rem 0.9rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s var(--ease), transform 0.15s var(--ease);
}
.row::before {
    content: '';
    position: absolute;
    left: 0;
    top: 8px;
    bottom: 8px;
    width: 2.5px;
    border-radius: 2px;
    background: var(--accent);
    opacity: 0;
    transition: opacity 0.2s var(--ease);
}
.row.active {
    background: rgba(94, 234, 212, 0.06);
}
.row.active::before { opacity: 1; }
.row.fire {
    transform: scale(0.985);
    background: rgba(94, 234, 212, 0.14);
}

.row-ico {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    color: var(--text-dim);
    transition: color 0.18s var(--ease), background 0.18s var(--ease), border-color 0.18s var(--ease);
}
.row-ico svg { width: 17px; height: 17px; }
.row.active .row-ico {
    color: var(--accent);
    background: rgba(94, 234, 212, 0.08);
    border-color: rgba(94, 234, 212, 0.28);
}

.row-body {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.18rem;
}
.row-name {
    font-family: var(--body);
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.row-path {
    color: var(--text-muted);
    font-weight: 400;
    font-family: var(--mono);
    font-size: 0.85em;
    margin-left: 0.2rem;
}
.row-sub {
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.row-meta {
    font-family: var(--mono);
    font-size: 0.68rem;
    color: var(--text-muted);
    padding: 0.18rem 0.45rem;
    border-radius: 4px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.02);
    text-transform: lowercase;
    letter-spacing: 0.04em;
}
.row.active .row-meta {
    color: var(--accent);
    border-color: rgba(94, 234, 212, 0.25);
}

.row-enter {
    font-family: var(--mono);
    font-size: 0.85rem;
    color: var(--text-muted);
    opacity: 0;
    transition: opacity 0.2s var(--ease);
    padding-right: 0.2rem;
}
.row.active .row-enter { opacity: 1; color: var(--accent); }

/* empty */
.pal-empty {
    display: none;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 1rem;
    font-family: var(--mono);
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: italic;
}

/* foot */
.pal-foot {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.6rem 1rem;
    border-top: 1px solid var(--border);
    font-family: var(--mono);
    font-size: 0.72rem;
    color: var(--text-muted);
    flex-wrap: wrap;
}
.foot-item { display: inline-flex; align-items: center; gap: 0.4rem; }
.foot-spacer { flex: 1; }
.foot-clock {
    color: var(--text-muted);
    letter-spacing: 0.05em;
    font-variant-numeric: tabular-nums;
}

/* small home link under palette */
.home-link {
    font-family: var(--mono);
    font-size: 0.78rem;
    color: var(--text-muted);
    text-decoration: none;
    margin-top: 0.5rem;
    transition: color 0.2s var(--ease);
}
.home-link:hover { color: var(--text-dim); }

/* ═══ mobile ═══ */
@media (max-width: 600px) {
    .stage { padding: 1.25rem 0.85rem; gap: 1rem; }
    .kbd-hint { font-size: 0.72rem; }
    .palette { max-width: 100%; border-radius: 12px; }
    .pal-head { padding: 0.65rem 0.85rem; }
    .pal-search { padding: 0.8rem 0.85rem; }
    .q-input { font-size: 1rem; }
    .row {
        grid-template-columns: 32px 1fr auto;
        gap: 0.7rem;
        padding: 0.65rem 0.7rem;
    }
    .row-meta { display: none; }
    .row-name { font-size: 0.92rem; }
    .row-sub { font-size: 0.78rem; white-space: normal; }
    .pal-list { max-height: 62vh; }
    .pal-foot { font-size: 0.68rem; gap: 0.65rem; padding: 0.55rem 0.85rem; }
    .foot-clock { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .orb, .pal-id .dot, .palette { animation: none; }
}
