:root {
    --background: #000000;
    --bg-lighter: #0a0a0a;
    --card-bg: #111111;
    --card-elevated: #1a1a1a;
    --card-elevated-2: #242424;
    --card-elevated-3: #2e2e2e;
    --gray900: #3d3d3d;
    --gray700: #6b6b6b;
    --gray400: #a0a0a0;
    --gray200: #d0d0d0;
    --primary: #ffffff;
    --text: #ffffff;
    --text-secondary: #a0a0a0;
    --text-muted: #6b6b6b;
    --border: rgba(255, 255, 255, 0.15);
    --border-strong: rgba(255, 255, 255, 0.50);
    --danger: #ff3b3b;
    --font-display: 'Space Grotesk', sans-serif;
    --font-body: 'Space Grotesk', sans-serif;
    --font-mono: 'DM Mono', ui-monospace, monospace;
    --sp1: 0.5rem;
    --sp2: 0.75rem;
    --sp3: 1rem;
    --sp4: 1.5rem;
    --sp5: 2rem;
    --r-sm: 6px;
    --r-md: 10px;
    --r-lg: 16px;
    --r-xl: 24px;
    --r-pill: 999px;
    --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.6);
    --shadow-glow: 0 0 30px rgba(255, 255, 255, 0.15);
    --grad-surface: linear-gradient(135deg, #1a1a1a 0%, #000000 100%);
    --grad-primary-btn: linear-gradient(135deg, #ffffff 0%, #d0d0d0 100%);
    --grad-bg: linear-gradient(135deg, #000000 0%, #0a0a0a 100%);
}

.loading-screen {
    position: fixed; inset: 0;
    background: var(--background);
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    z-index: 9999;
    transition: opacity 0.6s ease-out, visibility 0.6s;
}
.loading-screen.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.loading-logo-wrap { position: relative; width: 100px; height: 100px; margin-bottom: 2rem; }
.loading-logo { width: 100%; height: 100%; border-radius: 50%; border: 1px solid var(--border-strong); display: flex; align-items: center; justify-content: center; background: var(--card-bg); overflow: hidden; }
.loading-logo img { width: 75%; height: 75%; object-fit: cover; border-radius: 50%; }
.loading-spinner { position: absolute; top: -8px; left: -8px; width: calc(100% + 16px); height: calc(100% + 16px); border-radius: 50%; border: 1px solid transparent; border-top-color: var(--primary); border-right-color: var(--border); animation: spin 1.2s linear infinite; }
.loading-spinner::before { content: ''; position: absolute; inset: 4px; border-radius: 50%; border: 1px solid transparent; border-bottom-color: var(--border-strong); animation: spin 1.8s linear infinite reverse; }
.loading-title { font-size: clamp(1.5rem, 4vw, 2.2rem); font-weight: 700; letter-spacing: -0.02em; opacity: 0; animation: fadeUp 0.7s ease-out 0.3s forwards; }
.loading-sub { font-size: 0.9rem; color: var(--text-muted); margin-top: 0.5rem; font-weight: 300; opacity: 0; animation: fadeUp 0.7s ease-out 0.5s forwards; }
.loading-track { position: absolute; bottom: 0; left: 0; width: 100%; height: 2px; background: var(--border); }
.loading-fill { height: 100%; background: var(--primary); animation: loadBar 1.4s ease-out forwards; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes loadBar { from { width: 0; } to { width: 100%; } }

*{box-sizing:border-box;}
html{scroll-behavior:smooth;}
body{
    margin:0;
    background: var(--grad-bg);
    color: var(--text);
    font-family: var(--font-body);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}
img{image-rendering:pixelated;}

.wrap{ max-width:920px; margin:0 auto; padding:56px 20px 80px; }

.panel{
    position: relative;
    background: var(--grad-surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 40px clamp(20px, 5vw, 56px);
    margin-bottom: 28px;
}

.topbar{
    display: flex; justify-content: space-between; align-items: center;
    max-width: 920px; margin: 0 auto; padding: 0 20px 12px;
    font-family: var(--font-mono); font-size: 12px;
    letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-muted);
    border-bottom: 1px solid var(--border); margin-bottom: 0;
}
.topbar a{ color: var(--text-secondary); text-decoration: none; }
.topbar a:hover{ color: var(--primary); }

.eyebrow{
    font-family: var(--font-mono); font-size: 12px;
    letter-spacing: 0.18em; text-transform: uppercase;
    color: var(--text-secondary); margin: 0 0 18px;
}

h1.title{
    font-family: var(--font-display); font-weight: 700;
    font-size: clamp(34px, 6vw, 54px); line-height: 1.15;
    margin: 0 0 18px; color: var(--text);
    letter-spacing: -0.03em;
}

.subtitle{
    max-width: 56ch; color: var(--text-secondary);
    font-size: 17px; margin: 0 0 36px;
}
.subtitle b{ color: var(--text); font-weight: 600; }

.hotbar-label{
    font-family: var(--font-mono); font-size: 11px;
    color: var(--text-muted); text-transform: uppercase;
    letter-spacing: 0.1em; margin: 0 0 10px;
}

.hotbar{
    display: flex; gap: 6px; padding: 12px;
    background: var(--card-elevated);
    border-radius: var(--r-md);
    width: max-content; max-width: 100%; overflow-x: auto;
}

.slot{
    position: relative;
    width: 60px; height: 60px; min-width: 60px;
    background: var(--card-bg);
    border-radius: var(--r-sm);
    border: 1px solid var(--border);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: background 0.1s, transform 0.1s;
}
.slot:hover{ background: var(--card-elevated-2); transform: translateY(-2px); }
.slot:active{ transform: translateY(0); }
.slot img{ width: 40px; height: 40px; }

.slot .tip{
    position: absolute; bottom: calc(100% + 10px); left: 50%;
    transform: translateX(-50%) translateY(4px);
    background: var(--card-bg); border: 1px solid var(--border);
    color: var(--text); font-family: var(--font-mono); font-size: 11px;
    white-space: nowrap; padding: 6px 9px;
    opacity: 0; pointer-events: none;
    transition: opacity 0.12s, transform 0.12s;
    border-radius: var(--r-sm); z-index: 5;
}
.slot .tip::after{
    content: ""; position: absolute; top: 100%; left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent; border-top-color: var(--card-bg);
}
.slot .tip .copied{ color: var(--primary); }
.slot:hover .tip{ opacity: 1; transform: translateX(-50%) translateY(0); }
@media(max-width:640px){ .slot .tip{ display:none; } }

.hotbar-hint{ font-size: 13px; color: var(--text-muted); margin: 12px 0 0; }
.hotbar-hint kbd{
    font-family: var(--font-mono); background: var(--card-elevated);
    border: 1px solid var(--border); border-radius: var(--r-sm);
    padding: 1px 6px; color: var(--text); font-size: 12px;
}

.chips{ display: flex; flex-wrap: wrap; gap: 10px; margin: 34px 0 0; }
.chip{
    font-family: var(--font-mono); font-size: 12px; color: var(--text);
    background: var(--card-elevated); border: 1px solid var(--border);
    border-radius: var(--r-pill); padding: 8px 14px;
    display: flex; align-items: center; gap: 8px;
}
.chip .n{ color: var(--primary); font-weight: 600; }

.section-head{
    display: flex; align-items: baseline; gap: 12px; margin: 0 0 22px;
}
.section-head .num{
    font-family: var(--font-mono); color: var(--text-muted); font-size: 13px;
}
.section-head h2{
    font-family: var(--font-display); font-size: 26px;
    margin: 0; color: var(--text); letter-spacing: -0.02em;
}

.feature-grid{
    display: grid; grid-template-columns: 1.1fr 0.9fr;
    gap: 40px; align-items: center;
}
@media(max-width:720px){ .feature-grid{ grid-template-columns: 1fr; } }

.feature-list{ list-style: none; margin: 0; padding: 0; }
.feature-list li{
    display: flex; gap: 12px; padding: 12px 0;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary); font-size: 15px;
}
.feature-list li:last-child{ border-bottom: none; }
.feature-list li::before{
    content: "▸"; color: var(--text-muted); flex-shrink: 0;
}
.feature-list b{ color: var(--text); font-weight: 600; }
.feature-list code{
    font-family: var(--font-mono); background: var(--card-elevated);
    border-radius: var(--r-sm); padding: 1px 6px; font-size: 13px; color: var(--gray200);
}

.swatchgrid{
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 10px;
    background: var(--card-elevated); border-radius: var(--r-md);
}
.swatch{
    aspect-ratio: 1; background: var(--card-bg); border-radius: var(--r-sm);
    display: flex; align-items: center; justify-content: center;
    border: 1px solid var(--border);
}
.swatch img{ width: 70%; height: 70%; }

table.usage{ width: 100%; border-collapse: collapse; font-size: 14px; }
table.usage th{
    text-align: left; font-family: var(--font-mono); font-size: 11px;
    letter-spacing: 0.08em; text-transform: uppercase;
    color: var(--text-muted); padding: 0 0 12px; border-bottom: 1px solid var(--border);
}
table.usage td{
    padding: 14px 0; border-bottom: 1px solid var(--border);
    color: var(--text); vertical-align: middle;
}
table.usage tr:last-child td{ border-bottom: none; }
.kbd-row{ display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.key{
    font-family: var(--font-mono); font-size: 12px;
    background: var(--card-elevated); border: 1px solid var(--border);
    border-radius: var(--r-sm); padding: 3px 8px; color: var(--text); white-space: nowrap;
}
.plus{ color: var(--text-muted); font-size: 12px; }
td.result{ color: var(--text-muted); }

.index-controls{ display: flex; flex-direction: column; gap: 14px; margin-bottom: 16px; }
.search-input{
    width: 100%; background: var(--card-elevated); border: 1px solid var(--border);
    border-radius: var(--r-md); color: var(--text);
    font-family: var(--font-mono); font-size: 14px; padding: 12px 14px; outline: none;
}
.search-input:focus{ border-color: var(--border-strong); }
.search-input::placeholder{ color: var(--text-muted); }

.pillrow{ display: flex; flex-wrap: wrap; gap: 8px; }
.pill{
    font-family: var(--font-mono); font-size: 12px; color: var(--text-muted);
    background: var(--card-elevated); border: 1px solid var(--border);
    border-radius: var(--r-pill); padding: 6px 12px; cursor: pointer; user-select: none;
}
.pill:hover{ color: var(--text); border-color: var(--border-strong); }
.pill.active{ color: #000; background: var(--primary); border-color: var(--primary); }

.index-meta{
    display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px;
    padding: 10px 2px; font-family: var(--font-mono); font-size: 12px;
    color: var(--text-muted); border-bottom: 1px solid var(--border); margin-bottom: 8px;
}

.ghost-btn{
    cursor: pointer; font-family: var(--font-mono); font-size: 12px;
    color: var(--text-secondary); background: transparent;
    border: 1px solid var(--border); border-radius: var(--r-pill); padding: 6px 12px;
}
.ghost-btn:hover{ color: var(--text); border-color: var(--border-strong); }

.index-list{
    list-style: none; margin: 0; padding: 0;
    max-height: 420px; overflow-y: auto; border: 1px solid var(--border);
    border-radius: var(--r-md);
}
.index-list li{
    display: flex; align-items: center; gap: 10px; padding: 8px 14px;
    font-family: var(--font-mono); font-size: 13px; color: var(--text);
    border-bottom: 1px solid var(--border); cursor: pointer;
}
.index-list li .thumb{
    flex-shrink: 0; width: 30px; height: 30px;
    background: var(--card-elevated); border-radius: var(--r-sm);
    display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.index-list li .thumb img{ width: 22px; height: 22px; object-fit: contain; }
.index-list li:last-child{ border-bottom: none; }
.index-list li:hover{ background: var(--card-elevated); }
.index-list li .cat{
    flex-shrink: 0; font-size: 10px; text-transform: uppercase;
    letter-spacing: 0.06em; color: var(--text-secondary);
    background: var(--card-elevated-2); border-radius: var(--r-pill);
    padding: 2px 7px;
}
.index-list li .p{
    flex: 1; overflow: hidden; text-overflow: ellipsis;
    white-space: nowrap; color: var(--text-muted);
}
.index-list li:hover .p{ color: var(--text); }
.index-list li.empty{ justify-content: center; color: var(--text-muted); cursor: default; }
.index-list li.empty:hover{ background: none; }

.copy-flash{
    height: 16px; font-family: var(--font-mono); font-size: 12px;
    color: var(--gray200); margin: 10px 2px 0; opacity: 0; transition: opacity 0.15s;
}
.copy-flash.show{ opacity: 1; }

.index-list::-webkit-scrollbar{ width: 8px; }
.index-list::-webkit-scrollbar-track{ background: transparent; }
.index-list::-webkit-scrollbar-thumb{ background: var(--card-elevated-2); border-radius: var(--r-pill); }

.codeblock{
    background: var(--card-elevated); border: 1px solid var(--border);
    border-radius: var(--r-md); padding: 18px 20px;
    font-family: var(--font-mono); font-size: 14px; color: var(--text); overflow-x: auto;
}
.codeblock .k{ color: var(--gray200); }
.codeblock .s{ color: var(--text-secondary); }
.code-pair{ display: grid; grid-template-columns: 1fr; gap: 14px; }
.code-label{
    font-family: var(--font-mono); font-size: 11px; text-transform: uppercase;
    letter-spacing: 0.08em; color: var(--text-muted); margin: 0 0 8px;
}

footer{
    max-width: 920px; margin: 36px auto 0; padding: 0 20px;
    display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px;
    font-size: 13px; color: var(--text-muted); font-family: var(--font-mono);
}
footer a{ color: var(--text-secondary); text-decoration: none; }
footer a:hover{ color: var(--text); }

@media(prefers-reduced-motion: reduce){ *{ transition: none !important; scroll-behavior: auto !important; } }
