/* ===== FOOTER v4 (2-row) ===== */
.footer-wrap {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 1200;
    padding: 0;
    pointer-events: none;
}

.footer-bar {
    pointer-events: all;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.1);
    border-radius: 0;
    border: none;
    max-width: none;
    margin: 0;
    box-sizing: border-box;
    overflow: visible;
    max-width: 100%;
}

.footer-row {
    display: flex;
    align-items: center;
    gap: 0;
    width: 100%;
    min-width: 0;
}

.footer-row-cubes {
    border-top: 1px solid var(--border);
    padding-top: 3px;
    overflow-x: auto;
    overflow-y: visible;
    height: 58px;
    min-height: 58px;
}


.hide-tablet { /* visible by default, hidden at tablet breakpoint */ }

@keyframes barIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes barOut {
    to { opacity: 0; transform: translateY(20px); }
}

/* Section groups */
.sec {
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 3px 6px;
    position: relative;
    flex-shrink: 0;
}

.sep {
    width: 1px;
    height: 24px;
    background: var(--border);
    margin: 0 2px;
    flex-shrink: 0;
}

.spacer { flex: 1; min-width: 2px; }

/* ===== CUBE STRIP ===== */
.cube-strip {
    display: flex;
    gap: 7px;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: visible;
    padding: 4px 6px 6px;
    flex: 1;
    min-width: 0;
}
.cube-strip::-webkit-scrollbar { height: 3px; }
.cube-strip::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.strip-cube {
    --strip-cube-size: 34px;
    min-width: var(--strip-cube-size);
    width: max-content;
    height: auto;
    padding: 0 2px;
    border-radius: 0;
    flex-shrink: 0;
    cursor: pointer;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 3px;
    border: none;
    background: transparent;
    transition: transform 0.15s;
}
.sc-face {
    width: var(--strip-cube-size);
    height: var(--strip-cube-size);
    border-radius: 5px;
    border: 1.5px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    box-sizing: border-box;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.strip-cube:hover {
    transform: translateY(-1px);
}
.strip-cube:hover .sc-face {
    border-color: var(--accent);
}
.strip-cube.active {
    transform: scale(1.1);
    z-index: 2;
}
.strip-cube.active .sc-face {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--glow);
}
.sc-num {
    font-size: 12px;
    color: #fff;
    text-shadow: 0 0 2px rgba(0,0,0,0.5);
    font-weight: 700;
    pointer-events: none;
}
.sc-status {
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    border: 1px solid #fff;
    pointer-events: none;
}
.sc-status.has-texture { background: #4caf50; }
.sc-status.partial-texture { background: #ff9800; }

/* Close button on strip cubes */
.strip-cube-close {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #ef4444;
    color: #fff;
    font-size: 8px;
    line-height: 1;
    border: 1.5px solid #fff;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 3;
    padding: 0;
    font-family: inherit;
}
.strip-cube:hover .strip-cube-close {
    display: flex;
}

/* Price badge below strip cubes */
.sc-price {
    position: static;
    transform: none;
    width: max-content;
    max-width: none;
    font-size: 10px;
    font-family: 'JetBrains Mono', monospace;
    color: var(--text2);
    white-space: nowrap;
    pointer-events: none;
    line-height: 1.1;
    text-align: center;
}

/* ===== PER-CUBE PRICE POPOVER ===== */
.cube-price-popover {
    position: fixed;
    background: rgba(255,255,255,0.98);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 12px 32px rgba(0,0,0,0.14);
    padding: 10px 12px;
    z-index: 1500;
    min-width: 150px;
}
.cube-price-popover .popover-arrow {
    position: absolute;
    bottom: -6px;
    left: 50%;
    width: 10px;
    height: 10px;
    transform: translateX(-50%) rotate(45deg);
    background: rgba(255,255,255,0.98);
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}
.cube-price-popover .popover-label {
    display: block;
    margin-bottom: 6px;
    color: var(--text3);
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.cube-price-popover .popover-input-row {
    display: flex;
    align-items: center;
    gap: 4px;
}
.cube-price-popover .popover-input-row span {
    color: var(--text2);
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    font-weight: 600;
}
.popover-price-input {
    width: 100px;
    height: 30px;
    box-sizing: border-box;
    padding: 0 8px;
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    outline: none;
}
.popover-price-input:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 2px var(--glow-soft);
}
.cube-price-popover .popover-min-price {
    margin-top: 4px;
    color: var(--text3);
    font-size: 9px;
    white-space: nowrap;
}

/* ===== FACE IMAGE BTNS ===== */
.face-group {
    display: flex;
    gap: 3px;
    background: var(--group-bg);
    border-radius: var(--r);
    padding: 2px;
}

.face-btn {
    width: 34px;
    height: 34px;
    background: var(--input-bg);
    border: 1.5px dashed rgba(0,0,0,0.15);
    color: var(--text2);
    font-family: inherit;
    font-size: 9px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
    white-space: nowrap;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    overflow: hidden;
}
.face-btn:hover { border-color: var(--accent); color: var(--accent); }
.face-btn.has-image {
    border-style: solid;
    border-color: var(--accent);
    padding: 0;
}
.face-btn.has-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
}
.face-btn .face-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}
.face-btn.has-image .face-icon { display: none; }
.face-file-input { display: none; }

/* ===== COLOR TRIGGER ===== */
.color-wrap { position: relative; flex-shrink: 0; }

.color-trigger {
    width: 34px;
    height: 34px;
    border-radius: var(--r);
    border: 2px solid rgba(0,0,0,0.1);
    cursor: pointer;
    transition: all 0.25s;
    position: relative;
    overflow: hidden;
}
.color-trigger-default {
    background: #4caf50;
}
.color-trigger::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.35), transparent 60%);
}
.color-trigger:hover {
    border-color: rgba(0,0,0,0.2);
    transform: scale(1.08);
}
.color-trigger.open {
    border-color: var(--accent);
    box-shadow: 0 0 12px var(--glow);
}

/* ===== COLOR POPUP ===== */
.color-popup {
    position: fixed;
    background: rgba(255,255,255,0.98);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 14px;
    box-shadow: 0 12px 48px rgba(0,0,0,0.12), 0 0 0 1px rgba(0,0,0,0.06);
    display: none;
    z-index: 1400;
    min-width: 260px;
}
.color-popup.show {
    display: block;
    animation: popIn 0.25s cubic-bezier(0.16,1,0.3,1);
}
.color-popup::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: var(--arrow-left, 50%);
    transform: translateX(-50%) rotate(45deg);
    width: 12px;
    height: 12px;
    background: rgba(255,255,255,0.98);
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

@keyframes popIn {
    from { opacity: 0; transform: translateY(8px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.cp-section-title {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text3);
    margin-bottom: 8px;
}
.cp-section-title:not(:first-child) {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

.cp-grid {
    display: grid;
    grid-template-columns: repeat(8, 28px);
    gap: 3px;
}

.cp-s {
    width: 28px;
    height: 28px;
    border-radius: 5px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.15s;
    position: relative;
}
.cp-s:hover { transform: scale(1.18); z-index: 2; box-shadow: 0 2px 8px rgba(0,0,0,0.12); }
.cp-s.active {
    border-color: #fff;
    box-shadow: 0 0 0 2px var(--accent), 0 4px 12px rgba(0,0,0,0.1);
    transform: scale(1.1);
}
.cp-s.active::after {
    content: '\2713';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 1px 4px rgba(0,0,0,0.4);
}

.cp-recent {
    display: flex;
    gap: 4px;
    align-items: center;
}
.cp-recent-swatch {
    width: 22px;
    height: 22px;
    border-radius: 4px;
    border: 1px solid rgba(0,0,0,0.1);
    cursor: pointer;
    transition: all 0.15s;
}
.cp-recent-swatch:hover { transform: scale(1.15); }

.cp-hex-row {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

.cp-hex-input {
    width: 100%;
    padding: 7px 8px;
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    outline: none;
    transition: all 0.2s;
}
.cp-hex-input:focus { border-color: var(--border-focus); }

/* ===== LINK INPUTS ===== */
.link-group { display: flex; gap: 3px; flex-shrink: 1; min-width: 0; }

.link-input {
    height: 34px;
    width: 110px;
    min-width: 0;
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-family: inherit;
    font-size: 11.5px;
    padding: 0 8px;
    outline: none;
    transition: all 0.3s cubic-bezier(0.16,1,0.3,1);
}
.link-input::placeholder { color: var(--text3); }
.link-input:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 2px var(--glow-soft);
    width: 150px;
}

/* ===== PAYMENT ===== */
.pay-sec {
    flex-wrap: wrap;
    row-gap: 4px;
    max-width: 314px;
}

.pay-group { display: flex; gap: 3px; flex-shrink: 1; min-width: 0; }

.currency-select-wrap {
    height: 34px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 0 7px;
    border: 1px solid var(--border);
    border-radius: var(--r);
    background: var(--input-bg);
    color: var(--text2);
    flex-shrink: 0;
}

.currency-select-label {
    color: var(--text3);
    font-size: 10px;
    white-space: nowrap;
}

.currency-select {
    min-width: 58px;
    border: 0;
    background: transparent;
    color: var(--text);
    font-family: inherit;
    font-size: 11.5px;
    font-weight: 600;
    outline: none;
    cursor: pointer;
}

.currency-display {
    min-width: 42px;
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--input-bg);
    color: var(--text);
    font-size: 12px;
    font-weight: 700;
    text-align: center;
}

.pay-btn {
    height: 34px;
    padding: 0 10px;
    background: var(--group-bg);
    border: 1.5px solid var(--border);
    border-radius: var(--r);
    color: var(--text2);
    font-family: inherit;
    font-size: 11.5px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
    transition: all 0.2s;
}
.pay-btn:hover { border-color: rgba(0,0,0,0.2); color: var(--text); }
.pay-btn.active {
    border-color: var(--accent);
    background: rgba(108,108,248,0.08);
    color: var(--text);
    box-shadow: 0 0 8px rgba(108,108,248,0.08);
}
.pay-btn svg { width: 15px; height: 15px; flex-shrink: 0; }
.pay-btn .btc-dot {
    width: 15px; height: 15px; background: var(--orange); border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 9px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.pay-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.pay-btn.disabled:hover {
    border-color: var(--border);
    color: var(--text2);
}

.king-challenge-hint {
    flex: 0 1 auto;
    max-width: 230px;
    color: #8a6d1f;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.2;
    white-space: normal;
}

.btc-network-panel {
    position: fixed;
    transform: translateX(-50%);
    z-index: 1450;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid var(--border);
    border-radius: var(--r);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.14);
    color: var(--text2);
    font-size: 11px;
    white-space: nowrap;
}

.btc-network-panel .network-label {
    color: var(--text3);
}

.btc-network-panel .network-value {
    color: var(--text);
    font-weight: 600;
}

.network-change-btn {
    height: 24px;
    padding: 0 8px;
    border: 1px solid var(--border);
    border-radius: 5px;
    background: var(--input-bg);
    color: var(--text2);
    font-family: inherit;
    font-size: 10px;
    cursor: pointer;
}

.network-change-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* ===== ACTION BUTTONS ===== */
.btn-cancel {
    height: 36px;
    padding: 0 14px;
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--r);
    color: var(--text2);
    font-family: inherit;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
}
.btn-cancel:hover { background: var(--group-hover); color: var(--text); border-color: rgba(0,0,0,0.15); }

.btn-buy {
    height: 36px;
    padding: 0 18px;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    border: none;
    border-radius: var(--r);
    color: #fff;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 7px;
    white-space: nowrap;
    transition: all 0.25s;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}
.btn-buy::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.25), transparent);
    opacity: 0;
    transition: opacity 0.2s;
}
.btn-buy:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 24px var(--glow);
}
.btn-buy:hover::before { opacity: 1; }
.btn-buy:active { transform: translateY(0); }
.btn-buy:disabled {
    opacity: 0.6;
    pointer-events: none;
}

.btn-buy .buy-total {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    background: rgba(255,255,255,0.3);
    padding: 2px 8px;
    border-radius: 4px;
}

.btn-buy .btn-spinner {
    display: none;
    align-items: center;
}
.btn-buy .btn-spinner i {
    animation: spin 1s linear infinite;
}
.btn-buy.loading .btn-text { display: none; }
.btn-buy.loading .buy-total { display: none; }
.btn-buy.loading .btn-spinner { display: flex; }

/* ===== TOOLTIPS ===== */
.tip {
    position: relative;
}
.tip::before, .tip::after {
    position: absolute;
    z-index: 1400;
    pointer-events: none;
    opacity: 0;
    transition: all 0.15s ease;
}
.tip::before {
    content: attr(data-tip);
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    padding: 5px 10px;
    background: rgba(255,255,255,0.97);
    backdrop-filter: blur(8px);
    color: var(--text);
    font-size: 11px;
    font-weight: 500;
    border-radius: 6px;
    white-space: nowrap;
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    border: 1px solid var(--border);
}
.tip::after {
    content: '';
    bottom: calc(100% + 4px);
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: rgba(255,255,255,0.97);
}
.tip:hover::before {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.tip:hover::after { opacity: 1; }

/* ===== KEYBOARD HINT ===== */
.kbd-hint {
    position: fixed;
    bottom: 80px;
    right: 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    z-index: 50;
}
.kbd-hint.show { opacity: 1; }
.kbd-row {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 10px;
    color: var(--text3);
}
.kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 18px;
    padding: 0 5px;
    background: var(--group-bg);
    border: 1px solid var(--border);
    border-radius: 3px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 9px;
    font-weight: 600;
    color: var(--text2);
}

/* ===== FOOTER RESPONSIVE ===== */
@media (max-width: 1100px) {
    .link-input { width: 90px; }
    .link-input:focus { width: 120px; }
}
@media (max-width: 900px) {
    .footer-bar { gap: 0; padding: 6px; }
    .footer-row { gap: 0; }
    .sec { padding: 3px 4px; }
    .link-sec { display: none; }
    .hide-tablet { display: none; }
    .face-btn { width: 30px; height: 30px; }
}
@media (max-width: 600px) {
    .footer-bar { padding: 4px 8px; }
    .face-group { gap: 2px; }
    .face-btn { width: 26px; height: 26px; }
}
