@import url('https://fonts.googleapis.com/css2?family=Roboto+Slab&display=swap');

:root {
    --bg: #0C1626;
    --bg-dark: #050722;
    --secondary: #151f30;
    --accent: #287882;
    --text: #C3E6EB;
}

html {
    background: #050722;
    height: 100vh;
}

#bg-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
}

body {
    background: transparent;
    color: var(--text);
    max-width: 1300px;
    max-height: 95%;
    margin: auto;
    font-family: 'Roboto Slab', serif;
    overflow: hidden;
}

header {
    display: flex;
    background: var(--secondary);
    color: inherit;
    justify-content: center;
    align-items: center;
    position: relative;
    font-size: 1.5vw;
    padding-left: 1.4%;
}

#app, #menu {
    background: inherit;
    height: 100%;
    /* height: 100vh; */
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(4, 1fr);
}

#menu {
    grid-template-areas:
        'canvas canvas canvas canvas'
        'canvas canvas canvas canvas'
        'canvas canvas canvas canvas'
        'toolPanel toolPanel toolPanel toolPanel';
    gap: 10px;
}

#app {
    grid-template-columns: 472px 1fr 1fr 1fr;
    grid-template-rows: repeat(3, 1fr) auto auto;
    grid-template-areas:
        'canvas beePanel beePanel beePanel'
        'canvas beePanel beePanel beePanel'
        'canvas beePanel beePanel beePanel'
        'toolPanel toolPanel toolPanel toolPanel'
        'presetPanel presetPanel presetPanel presetPanel';
    gap: 10px;
}

#presetPanel {
    grid-area: presetPanel;
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: -20px;
    padding: 4px 15px 10px;
}

#preset-tabs {
    display: flex;
    align-items: center;
    gap: 5px;
}

.preset-section-label {
    font-size: 0.7rem;
    opacity: 0.6;
    white-space: nowrap;
    margin-right: 2px;
    user-select: none;
}

.preset-tab {
    padding: 1px 10px;
    font-size: 0.72rem;
    border-radius: 4px;
    border: 1px solid transparent;
    cursor: pointer;
    height: 1.5rem;
}

.preset-tab.active {
    border-color: var(--accent);
    color: var(--accent);
}

#preset-list {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--accent) transparent;
}

#preset-list::-webkit-scrollbar {
    height: 3px;
}

#preset-list::-webkit-scrollbar-thumb {
    background-color: var(--accent);
    border-radius: 3px;
}

.preset-btn {
    flex-shrink: 0;
    padding: 1px 10px;
    font-size: 0.72rem;
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
    height: 1.5rem;
}

.custom-preset-entry {
    display: inline-flex;
    align-items: stretch;
    flex-shrink: 0;
}

.custom-preset-entry .preset-btn {
    border-radius: 4px 0 0 4px;
}

.custom-preset-del {
    padding: 1px 6px;
    font-size: 0.72rem;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
    height: auto;
    opacity: 0.5;
    border-left: none;
}

.custom-preset-del:hover {
    opacity: 1;
    color: #e55;
}

[data-status~='inactive'] {
    display: none !important;
}

.beePanel {
    grid-area: beePanel;
    display: flex;
    flex-direction: row;
    gap: 5px;
    overflow: hidden;
    max-height: 567px;
}

.bee-col {
    flex: 1;
    overflow-y: auto;
    min-width: 0;
    scrollbar-width: thin;
    scrollbar-color: var(--accent) transparent;
}

.bee-col::-webkit-scrollbar {
    width: 4px;
}

.bee-col::-webkit-scrollbar-track {
    background: transparent;
}

.bee-col::-webkit-scrollbar-thumb {
    background-color: var(--accent);
    border-radius: 4px;
}

.canvasContainer {
    grid-area: canvas;
}

.toolPanel {
    grid-area: toolPanel;
    display: flex;
    align-items: center;
    justify-content: center;
    column-gap: 5px;
    height: 100%;
}

canvas {
    position: relative;
    border-radius: 16px;
}

.toolPanel button {
    height: 1.5rem;
}

.toolPanel:has(#appButton-1) {
    justify-content: center;
}

#app .toolPanel {
    max-height: 50%;
}

button {
    font-family: 'Roboto Slab', serif;
    background: var(--secondary);
    color: var(--text);
    border-radius: 6px;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    transition: background-color 0.15s, box-shadow 0.15s, transform 0.1s;
}

button:not(.minMax):hover {
    background-color: #1e2d45;
    box-shadow: 0 0 8px rgba(40, 120, 130, 0.35);
    transform: translateY(-1px);
}

button:not(.minMax):active {
    transform: translateY(0);
    box-shadow: none;
}

#appButton-1, #appButton-2, #appButton-3 {
    width: 10rem;
    height: 5rem;
    font-size: 1rem;
}

#hivemind_icon {
    width: 3vw;
    height: auto;
}

#savedText {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    min-width: 60px;
    display: inline-block !important;
}

.left {
    margin-left: 15px;
    margin-right: auto;
}

.right {
    margin-right: 15px;
    margin-left: auto;
}

.beeTitle {
    margin: 10px 0 4px;
}

.beeHead {
    position: relative;
}

.minMax {
    position: absolute;
    background: transparent !important;
    border: 0 !important;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
}

#giftedSelect {
    display: flex;
    flex-direction: row-reverse;
    align-items: center;
    gap: 4px;
}

.bee-section {
    display: flex !important;
    flex-wrap: wrap;
    gap: 2px;
    max-height: 800px;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.2s ease;
    opacity: 1;
}

.bee-section[data-status~='inactive'] {
    max-height: 0 !important;
    opacity: 0;
}

#bees-general *, #bees-common *, #bees-rare *, #bees-epic *, #bees-legend *, #bees-mythic *, #bees-event *, #bees-mutation *, #bees-beequip *, #bees-beesmas *, #bees-unreleased *, #bees-partial *, #bees-drives * {
    width: 32%;
}


#bees-common button, #bees-rare button, #bees-epic button,
#bees-legend button, #bees-mythic button, #bees-event button,
#bees-beequip button, #bees-beesmas button, #bees-unreleased button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    height: auto;
    padding: 5px 2px;
    font-size: 0.65rem;
    line-height: 1.2;
    text-align: center;
}

#bees-drives button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    height: auto;
    padding: 5px 2px;
    line-height: 1.2;
    text-align: center;
}

#bees-drives button span {
    width: 100%;
}

#bees-common button img, #bees-rare button img, #bees-epic button img,
#bees-legend button img, #bees-mythic button img, #bees-event button img,
#bees-beequip button img, #bees-beesmas button img, #bees-unreleased button img,
#bees-drives button img {
    width: 38px;
    height: 38px;
    object-fit: contain;
    pointer-events: none;
    border-radius: 6px;
}

footer {
    display: flex;
    align-items: center;
    position: relative;
    padding: 4px 0 10px;
    background: var(--secondary);
    font-size: 0.75rem;
    padding-left: 1%;
    border-radius: 0 0 16px 16px;
}

#multSeltCon {
    position: absolute;
    right: 12px;
    bottom: 8px;
    display: flex;
    flex-direction: column-reverse;
    align-items: flex-end;
    gap: 3px;
    font-size: 0.75rem;
}

#multSeltCon label {
    display: flex;
    flex-direction: row-reverse;
    align-items: center;
    gap: 4px;
    cursor: pointer;
}

footer a {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

#atn_icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
    border-radius: 6px;
}

#modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    align-items: center;
    justify-content: center;
    z-index: 5000;
}

#modal-overlay.active {
    display: flex;
}

#modal-box {
    background: var(--secondary);
    color: var(--text);
    border-radius: 10px;
    padding: 28px 32px;
    min-width: 300px;
    max-width: min(480px, 90vw);
    display: flex;
    flex-direction: column;
    gap: 14px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
    border: 1px solid var(--accent);
}

#modal-message {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.5;
}

#modal-input {
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--accent);
    border-radius: 6px;
    padding: 6px 10px;
    font-family: 'Roboto Slab', serif;
    font-size: 0.9rem;
    width: 100%;
    box-sizing: border-box;
    outline: none;
}

#modal-buttons {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

#modal-buttons button {
    padding: 6px 18px;
}

@keyframes save-fadeout {
    to {
        opacity: 0;
    }
}

#keybindsBtn {
    margin-left: auto;
    margin-bottom: auto;
    margin-top: 10px;
    margin-right: 10px;
    padding: 5px 12px;
    font-size: 0.8rem;
    white-space: nowrap;
}

#keybinds-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    align-items: center;
    justify-content: center;
    z-index: 5000;
}

#keybinds-overlay.active {
    display: flex;
}

#keybinds-box {
    background: var(--secondary);
    color: var(--text);
    border-radius: 10px;
    padding: 24px 28px;
    min-width: 340px;
    max-width: min(560px, 92vw);
    max-height: 82vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
    border: 1px solid var(--accent);
}

#keybinds-box h2 {
    margin: 0;
    font-size: 1.1rem;
}

.kb-section h3 {
    margin: 0 0 6px 0;
    font-size: 0.85rem;
    opacity: 0.7;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.kb-section table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

.kb-section td {
    padding: 3px 6px;
    vertical-align: top;
}

.kb-section td:first-child {
    white-space: nowrap;
    padding-right: 14px;
}

kbd {
    display: inline-block;
    background: var(--bg);
    border: 1px solid var(--accent);
    border-radius: 4px;
    padding: 1px 5px;
    font-size: 0.78rem;
    font-family: monospace;
}

#keybinds-ok {
    align-self: flex-end;
    padding: 6px 18px;
    margin-top: 4px;
}

#bee-tooltip {
    position: fixed;
    z-index: 9000;
    background: var(--secondary);
    border: 1px solid var(--accent);
    border-radius: 8px;
    padding: 8px 12px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.12s;
    white-space: nowrap;
    box-shadow: 0 4px 16px rgba(0,0,0,0.55);
    font-size: 0.72rem;
    line-height: 1.4;
}
#bee-tooltip.visible { opacity: 1; }
#bee-tooltip .tt-name { font-weight: bold; font-size: 0.82rem; margin-bottom: 2px; }
#bee-tooltip .tt-meta {
    display: flex;
    gap: 6px;
    font-size: 0.68rem;
    opacity: 0.85;
    margin-bottom: 5px;
}
#bee-tooltip .tt-row {
    display: flex;
    gap: 5px;
    margin-bottom: 2px;
    align-items: baseline;
}
#bee-tooltip .tt-lbl {
    font-size: 0.6rem;
    opacity: 0.5;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    min-width: 64px;
    padding-top: 1px;
}
#bee-tooltip .tt-statvals { font-family: monospace; font-size: 0.68rem; }

/* ── Token Sources Slide-out Panel ────────────────────────────────────────── */
#token-sources-panel {
    position: fixed;
    top: 50%;
    left: 0;
    transform: translateY(-50%) translateX(calc(-100% + 28px));
    transition: transform 0.3s ease;
    z-index: 500;
    display: flex;
    flex-direction: row;
    align-items: stretch;
}

#token-sources-panel.open {
    transform: translateY(-50%) translateX(0);
}

#token-sources-content {
    background: rgba(12, 22, 38, 0.55);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid rgba(40, 120, 130, 0.45);
    border-bottom: 1px solid rgba(40, 120, 130, 0.45);
    border-radius: 0;
    padding: 10px 12px;
    width: 210px;
    height: 55vh;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--accent) transparent;
}

#token-sources-content::-webkit-scrollbar { width: 4px; }
#token-sources-content::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 4px; }

#token-sources-tab {
    width: 28px;
    padding: 10px 0;
    background: rgba(12, 22, 38, 0.55);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(40, 120, 130, 0.45);
    border-left: none;
    border-radius: 0 8px 8px 0;
    cursor: pointer;
    color: var(--text);
    font-family: 'Roboto Slab', serif;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

#token-sources-tab:hover {
    transform: none !important;
    background: rgba(30, 45, 69, 0.7);
    box-shadow: none;
}

.ts-tab-label {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    transform: rotate(180deg);
    font-size: 0.62rem;
    user-select: none;
    letter-spacing: 0.05em;
}

.ts-header {
    font-size: 0.72rem;
    font-weight: bold;
    color: var(--accent);
    text-align: center;
    border-bottom: 1px solid var(--accent);
    padding-bottom: 5px;
    margin-bottom: 7px;
}

.ts-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 2px 0;
    font-size: 0.7rem;
}

.ts-count {
    font-weight: bold;
    min-width: 30px;
    text-align: right;
    flex-shrink: 0;
    font-family: monospace;
    font-size: 0.72rem;
}

.ts-full    { color: var(--accent); }
.ts-partial { color: #e5a030; }

.ts-name {
    color: var(--text);
    line-height: 1.3;
}

.ts-empty {
    color: #888;
    font-size: 0.68rem;
    font-style: italic;
}

/* ── Beequip Token Picker ──────────────────────────────────────────────────── */
#bqp-picker-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.65);
    z-index: 1200;
    align-items: center;
    justify-content: center;
}
#bqp-picker-overlay.active { display: flex; }

#bqp-picker-box {
    background: var(--secondary);
    border: 1px solid var(--accent);
    border-radius: 10px;
    padding: 18px 22px;
    max-width: 560px;
    width: 90%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

#bqp-picker-title {
    font-size: 0.92rem;
    color: var(--text);
    text-align: center;
}

#bqp-picker-options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.bqp-picker-card {
    background: var(--bg);
    border: 2px solid var(--accent);
    border-radius: 8px;
    padding: 8px 10px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    min-width: 90px;
    transition: border-color 0.15s, background 0.15s;
}
.bqp-picker-card:hover {
    border-color: var(--text);
    background: #1e2e44;
}

.bqp-card-imgwrap {
    position: relative;
    width: 56px;
    height: 56px;
}
.bqp-card-bqp {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.bqp-card-token {
    position: absolute;
    width: 20px;
    height: 20px;
    object-fit: contain;
    border-radius: 3px;
}
.bqp-card-token:nth-child(2) { bottom: 0; right: 0; }
.bqp-card-token:nth-child(3) { bottom: 0; right: 22px; }
.bqp-card-token-guar { opacity: 0.45; }
.bqp-card-token-sel  { opacity: 1; }

.bqp-card-label {
    font-size: 0.62rem;
    color: var(--text);
    text-align: center;
    max-width: 90px;
    line-height: 1.2;
}

.bqp-group-wrap {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 6px;
}
.bqp-group-label {
    font-size: 0.7rem;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.bqp-group-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.bqp-picker-card.bqp-card-active {
    border-color: #e5a030;
    background: #1e2e44;
}

#bqp-picker-confirm {
    margin-top: 8px;
    padding: 6px 22px;
    background: var(--accent);
    border: none;
    border-radius: 4px;
    color: var(--text);
    cursor: pointer;
    font-size: 0.82rem;
    font-family: inherit;
    align-self: center;
}
#bqp-picker-confirm:hover { background: #1e5f6a; }

#bqp-picker-cancel {
    padding: 5px 18px;
    background: transparent;
    border: 1px solid #e5a030;
    color: #e5a030;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
}
#bqp-picker-cancel:hover { background: rgba(229,160,48,0.15); }
