:root {
    --bg: #121212;
    --panel: #1a1a1a;
    --panel-2: #222;
    --text: #e6e6e6;
    --muted: #9aa0a6;
    --accent: #3b82f6;
    --danger: #ef4444;
    --border: #2a2a2a;
    --font-head: 14px;
    --font-1: 12px;
}
* {
    box-sizing: border-box;
}
html,
body,
#app {
    height: 100%;
    margin: 0;
    background: var(--panel);
    color: var(--text);
    font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto,
        Helvetica, Arial;
}
.app {
    display: grid;
    grid-template-columns: 15% 1fr 15%;
    height: 100vh;
    min-height: 0;
}

/* Sidebar */
.sidebar {
    background: var(--panel);
    border-right: 1px solid var(--border);
    overflow: auto;
    scrollbar-gutter: stable;
}
.header {
    display: grid;
    gap: 6px;
    padding: 6px;
    border-bottom: 1px solid var(--border);
    background: var(--panel-2);
    position: sticky;
    top: 0;
    z-index: 5;
}
.search,
.version-select {
    width: 100%;
    padding: 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-size: var(--font-head);
}
.tile-items {
    display: grid;
    margin: 6px 12px;
    gap: 6px;
}
.tile-items * {
    user-select: none;
}
.tree {
    margin: 6px 6px 0px 6px;
}
.tree * {
    user-select: none;
}
.group {
    margin: 6px 0;
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}
.group-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--panel-2);
    padding: 6px 12px;
    cursor: pointer;
    font-size: var(--font-head);
}
.badge {
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-size: var(--font-1);
    color: var(--muted);
}
.items {
    display: grid;
    margin: 6px;
    gap: 6px;
}
.item {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 1px;
    padding: 6px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg);
    cursor: pointer;
}
.item.active {
    outline: 2px solid var(--accent);
}
.item img {
    width: 25%;
    aspect-ratio: 1 / 1;
    image-rendering: pixelated;
}
.item span {
    width: 75%;
    font-size: 12px;
    text-align: center;
    line-height: 1.2;
    word-break: break-word;
    color: var(--muted);
}

.center {
    display: grid;
    grid-template-rows: 8% 1fr;
    height: 100vh;
    min-height: 0;
}
/* Toolbar */
.toolbar {
    position: relative;
    justify-self: start;
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 6px;
    background: var(--panel);
    z-index: 20;
}
.button {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 90%;
    aspect-ratio: 1 / 1;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    cursor: pointer;
    padding: 0;
}
.button:hover {
    background: #3a3a3a;
}
.button .material-symbols-rounded {
    font-size: 28px;
    line-height: 1;
}
.toolbar-panel-wrap {
    position: relative;
    display: flex;
    align-items: center;
    height: 100%;
}
.toolbar-panel {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    display: inline-block;
    width: auto;
    white-space: nowrap;
    color: var(--text);
    max-width: 560px;
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    z-index: 40;
}
select.toolbar-panel:focus {
    outline: none;
}
.toolbar-panel ul {
    margin: 0;
    padding: 0;
    list-style: none;
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
}
.kbd {
    display: inline-block;
    min-width: 18px;
    padding: 2px 6px;
    margin: 0 2px;
    border: 1px solid var(--border);
    border-bottom-width: 2px;
    border-radius: 6px;
    background: var(--bg);
    font: 12px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    text-align: center;
}
.desc {
    color: var(--muted);
    font-size: 12px;
}

/* Canvas */
.canvas-wrap {
    width: 100%;
    height: 100%;
    grid-row: 2;
    position: relative;
    background: #fff;
    overflow: auto;
    scrollbar-gutter: stable;
    min-height: 0;
    min-width: 0;
}
.canvas-wrap.grab {
    cursor: grab;
    cursor: -webkit-grab;
}
.canvas-wrap.grabbing {
    cursor: grabbing;
    cursor: -webkit-grabbing;
}
.canvas-wrap.grabbing * {
    user-select: none;
}

/* Inspector */
.inspector {
    background: var(--panel);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}
.pane-header {
    display: grid;
    gap: 6px;
    padding: 6px;
    border-bottom: 1px solid var(--border);
    background: var(--panel-2);
    position: sticky;
    top: 0;
    z-index: 5;
}
.pane-top,
.pane-bottom {
    /* overflow: auto; */
    display: flex;
    border-bottom: none;
    flex-direction: column;
}
.pane-divider {
    height: 6px;
    background: #2a2a2a;
    cursor: row-resize;
}
.pane-divider:hover {
    background: #3a3a3a;
}

.kv {
    display: grid;
    padding: 12px 12px;
    gap: 6px;
    overflow: auto;
    scrollbar-gutter: stable;
}
.kv div {
    color: var(--muted);
}
hr.sep {
    border: 0;
    border-top: 1px solid var(--border);
    margin: 1px 0;
}
.stat {
    font-size: 12px;
    color: var(--muted);
}

/* Scrollbars */
.sidebar::-webkit-scrollbar,
.kv::-webkit-scrollbar,
.canvas-wrap::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}
.sidebar::-webkit-scrollbar-track,
.kv::-webkit-scrollbar-track,
.canvas-wrap::-webkit-scrollbar-track {
    background: var(--bg);
}
.sidebar::-webkit-scrollbar-thumb,
.kv::-webkit-scrollbar-thumb,
.canvas-wrap::-webkit-scrollbar-thumb {
    background: #2a2a2a;
    border-radius: 8px;
}
.sidebar::-webkit-scrollbar-thumb:hover,
.kv::-webkit-scrollbar-thumb:hover,
.canvas-wrap::-webkit-scrollbar-thumb:hover {
    background: #3a3a3a;
}
.sidebar::-webkit-scrollbar-corner,
.kv::-webkit-scrollbar-corner,
.canvas-wrap::-webkit-scrollbar-corner {
    background: var(--bg);
}
