/* =========================================
   Base & Layout
   ========================================= */
html {
    margin: 0;
    padding: 0;
    min-height: 100%;
    overflow-y: auto;
    background: #000 top left repeat auto;
    color-scheme: light;
    font-family: 'Outfit', sans-serif;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    background: transparent !important;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

main,
#content,
.container,
[layout\:fragment="content"] {
    background: transparent !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* =========================================
   Dark Mode Form Fixes
   ========================================= */
html.dark {
    color-scheme: dark;
}

html.dark select,
html.dark input,
html.dark textarea {
    color-scheme: dark;
}

select option {
    background: #ffffff;
    color: #111827;
}

html.dark select option {
    background: #0b1220;
    color: #e5e7eb;
}

/* =========================================
   UI Components
   ========================================= */
#fileInput {
    display: none;
}

#toolbar {
    position: fixed;
    top: 84px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    width: min(960px, calc(100% - 24px));
    background: rgba(255, 255, 255, 0.92);
    color: #111;
    border-radius: 14px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(10px);
    padding: 12px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

#toolbar .left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 240px;
}

#toolbar .title {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

#toolbar .title .h {
    font-size: 16px;
    font-weight: 600;
}

#toolbar .title .s {
    font-size: 12px;
    opacity: 0.75;
    margin-top: 2px;
}

#toolbar .right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.btn {
    background: #2563eb;
    color: #fff;
    border: 0;
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 14px;
    cursor: pointer;
    white-space: nowrap;
}

.btn-light {
    background: #e5e7eb;
    color: #111;
}

.zoomWrap {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.06);
}

.zoomWrap span {
    font-size: 13px;
    color: rgba(0, 0, 0, 0.75);
}

#zoomSlider {
    width: 220px;
}

#hint {
    position: fixed;
    top: 160px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1999;
    width: min(960px, calc(100% - 24px));
    color: rgba(255, 255, 255, 0.8);
    font-size: 13px;
    text-align: center;
    pointer-events: none;
}

#dragOverlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(2px);
    z-index: 1998;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

#dragOverlay .box {
    width: min(900px, 100%);
    border: 2px dashed rgba(255, 255, 255, 0.55);
    border-radius: 18px;
    padding: 42px 20px;
    text-align: center;
    color: #fff;
    background: rgba(15, 23, 42, 0.55);
}

#dragOverlay .box .big {
    font-size: 24px;
    font-weight: 600;
    margin: 0;
}

#dragOverlay .box .small {
    margin-top: 10px;
    font-size: 13px;
    opacity: 0.8;
}

#tileBg {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background-color: #000;
    background-repeat: repeat;
    background-position: top left;
    background-size: auto;
}

/* =========================================
   Utilities & Scrollbars
   ========================================= */
.tt-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tt-pill[aria-pressed="true"] {
    background: #111827 !important;
    color: #fff !important;
}

.dark .tt-pill[aria-pressed="true"] {
    background: #fff !important;
    color: #111827 !important;
}

@media (min-width: 640px) {
    .tt-scroll::-webkit-scrollbar {
        width: 10px;
        height: 10px;
    }

    .tt-scroll::-webkit-scrollbar-thumb {
        border-radius: 999px;
        background: rgba(100, 116, 139, 0.35);
    }

    .dark .tt-scroll::-webkit-scrollbar-thumb {
        background: rgba(148, 163, 184, 0.25);
    }

    .tt-scroll::-webkit-scrollbar-track {
        background: transparent;
    }
}

@media (max-width: 640px) {
    #zoomSlider {
        width: 160px;
    }
    #toolbar {
        top: 76px;
    }
    #hint {
        top: 156px;
    }
}

/* =========================================
   Animations
   ========================================= */
@keyframes ttFloat {
    0% { transform: translate3d(0, 0, 0); opacity: 0.9; }
    50% { transform: translate3d(-10px, 12px, 0); opacity: 1; }
    100% { transform: translate3d(0, 0, 0); opacity: 0.9; }
}

@keyframes ttFloat2 {
    0% { transform: translate3d(0, 0, 0); opacity: 0.7; }
    50% { transform: translate3d(12px, -10px, 0); opacity: 0.95; }
    100% { transform: translate3d(0, 0, 0); opacity: 0.7; }
}

@keyframes ttGlowPulse {
    0%, 100% { opacity: 0.40; transform: scale(1); }
    50% { opacity: 0.70; transform: scale(1.03); }
}

@keyframes ttFadeUp {
    0% { opacity: 0; transform: translate3d(0, 10px, 0); }
    100% { opacity: 1; transform: translate3d(0, 0, 0); }
}

@keyframes ttFooterFloat1 {
    0% { transform: translate3d(0, 0, 0); opacity: 0.65; }
    50% { transform: translate3d(-10px, 10px, 0); opacity: 0.9; }
    100% { transform: translate3d(0, 0, 0); opacity: 0.65; }
}

@keyframes ttFooterFloat2 {
    0% { transform: translate3d(0, 0, 0); opacity: 0.55; }
    50% { transform: translate3d(12px, -10px, 0); opacity: 0.85; }
    100% { transform: translate3d(0, 0, 0); opacity: 0.55; }
}

@keyframes ttFooterSheen {
    0% { transform: translateX(-35%); opacity: 0; }
    20% { opacity: 0.55; }
    60% { opacity: 0.25; }
    100% { transform: translateX(35%); opacity: 0; }
}

.tt-float { animation: ttFloat 12s ease-in-out infinite; }
.tt-float2 { animation: ttFloat2 14s ease-in-out infinite; }
.tt-glow { animation: ttGlowPulse 6s ease-in-out infinite; }
.tt-enter { animation: ttFadeUp 0.55s ease-out both; }
.tt-footer-f1 { animation: ttFooterFloat1 14s ease-in-out infinite; }
.tt-footer-f2 { animation: ttFooterFloat2 16s ease-in-out infinite; }
.tt-footer-sheen { animation: ttFooterSheen 10s ease-in-out infinite; }

@media (prefers-reduced-motion: reduce) {
    .tt-float,
    .tt-float2,
    .tt-glow,
    .tt-enter,
    .tt-footer-f1,
    .tt-footer-f2,
    .tt-footer-sheen {
        animation: none !important;
    }
}