/* ==========================================================================
   TierPix - Calm 2D Brutalist Styling with Subliminal RGB & Bold Brand Header
   ========================================================================== */

/* Global Reset & Viewport Constraints */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    width: 100vw;
    height: 100vh;
    overflow: hidden; /* NON-SCROLLABLE PAGE */
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    background-color: #f0e8d8;
    color: #000;
    user-select: none;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Header & Core UI Typography Standard: Space Grotesk @ weight 900 */
h1, h2, h3, h4, .brand-title, .brand-sub, .loader-text, .brutal-btn, 
.rating-title, .chart-title, .row-label, .modal-tier-badge, .toast,
.tier-letter, .sound-toggle-btn, .theme-toggle-btn, .collectibles-toggle-btn,
.stage-stamp-overlay, .floating-text-pop {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 900;
}

/* Metadata, IDs, URLs, Keyhints, Timestamps Standard: IBM Plex Mono */
.meta-tag, .meta-id, .meta-rarity, .modal-date, .modal-url, .key-hint, .rating-hint, 
.kw-placeholder, .stat-lbl, .stat-num, code, pre, .stage-meta-footer span {
    font-family: 'IBM Plex Mono', monospace;
}

/* Canvas overlay for particle pop (Hardware Accelerated GPU Layer) */
.fx-canvas {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 999999;
    will-change: transform;
    transform: translateZ(0);
}

/* 2-Column Split Viewport Layout */
.app-viewport {
    display: flex;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

/* Smooth & Gentle Floating Score / Tier Text Popups */
.floating-text-pop {
    position: fixed;
    pointer-events: none;
    z-index: 9999999;
    font-size: 18px;
    font-weight: 900;
    color: #facc15;
    text-shadow: 2px 2px 0 #000;
    letter-spacing: 0;
    animation: floatUpGentle 0.8s cubic-bezier(0.25, 1, 0.5, 1) forwards;
    will-change: transform, opacity;
}

@keyframes floatUpGentle {
    0% { transform: translate(-50%, -50%) scale(0.8); opacity: 0; }
    20% { transform: translate(-50%, -60%) scale(1.05); opacity: 0.9; }
    100% { transform: translate(-50%, -100%) scale(0.95); opacity: 0; }
}

/* Subtle & Soft Stage Rating Stamp Overlay */
.stage-stamp-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    font-size: 80px;
    font-weight: 900;
    line-height: 1;
    padding: 8px 24px;
    border: 5px solid #000;
    border-radius: 12px;
    box-shadow: 5px 5px 0 #000;
    z-index: 20;
    pointer-events: none;
    opacity: 0;
}

.stage-stamp-overlay.stamp-active {
    animation: stampGentle 0.45s ease forwards;
}

@keyframes stampGentle {
    0% { transform: translate(-50%, -50%) scale(1.4) rotate(-5deg); opacity: 0; }
    30% { transform: translate(-50%, -50%) scale(1) rotate(-3deg); opacity: 0.85; }
    70% { transform: translate(-50%, -50%) scale(1) rotate(-3deg); opacity: 0.85; }
    100% { transform: translate(-50%, -50%) scale(0.95) rotate(-3deg); opacity: 0; }
}

/* Stamp Tier Colors */
.stage-stamp-overlay.stamp-s { background: #e11d48; color: #fff; }
.stage-stamp-overlay.stamp-a { background: #f97316; color: #000; }
.stage-stamp-overlay.stamp-b { background: #eab308; color: #000; }
.stage-stamp-overlay.stamp-c { background: #22c55e; color: #000; }
.stage-stamp-overlay.stamp-d { background: #3b82f6; color: #fff; }
.stage-stamp-overlay.stamp-f { background: #4b5563; color: #fff; }

/* ==========================================================================
   LEFT PANEL (Interactive Resizable Image Stage Arena)
   ========================================================================== */
.left-panel {
    width: 52%;
    min-width: 340px;
    max-width: 80%;
    height: 100vh;
    background-color: #fff8eb;
    border-right: none;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow: hidden;
    contain: layout style;
}

/* Interactive Brutalist Panel Resizer Divider */
.panel-resizer {
    width: 8px;
    height: 100vh;
    background: #000;
    cursor: col-resize;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    user-select: none;
    transition: background-color 0.15s ease;
    flex-shrink: 0;
}

.panel-resizer:hover, .panel-resizer.is-dragging {
    background: #facc15;
}

.resizer-handle {
    width: 2px;
    height: 36px;
    background: #fff;
    border-radius: 1px;
}

/* Brand Banner (Subliminal 60-Second RGB Color Cycling) */
.brand-banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #facc15;
    border: 4px solid #000;
    padding: 8px 16px;
    border-radius: 10px;
    box-shadow: 4px 4px 0 #000;
    animation: subliminalRGBCycle 60s linear infinite;
    will-change: background-color;
}

@keyframes subliminalRGBCycle {
    0%   { background-color: #facc15; } /* Vivid Yellow */
    16.6% { background-color: #4ade80; } /* Soft Lime Green */
    33.3% { background-color: #38bdf8; } /* Vivid Sky Blue */
    50%   { background-color: #c084fc; } /* Soft Purple */
    66.6% { background-color: #fb7185; } /* Soft Coral Red */
    83.3% { background-color: #fb923c; } /* Warm Orange */
    100%  { background-color: #facc15; } /* Vivid Yellow */
}

/* Bigger & Bolder TIERPIX Brand Title */
.brand-title {
    font-size: 30px;
    font-weight: 900;
    letter-spacing: -0.8px;
    line-height: 1;
    color: #000;
    display: flex;
    align-items: center;
    gap: 10px;
    text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.15);
}

.brand-logo-svg {
    width: 38px;
    height: 38px;
    display: inline-block;
    filter: drop-shadow(2px 2px 0 #000);
}

/* Inverted 1:1 Icon-Only Square GitHub Brutalist Button (Kept Untouched) */
.github-btn-icon {
    width: 38px !important;
    height: 38px !important;
    padding: 0 !important;
    background: #fff !important;
    color: #000 !important;
    border: 2px solid #000 !important;
    box-shadow: 3px 3px 0 #000 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 8px !important;
    text-decoration: none !important;
    transition: transform 0.15s ease, box-shadow 0.15s ease !important;
    will-change: transform;
}

.github-btn-icon:hover {
    background: #fef3c7 !important;
    transform: translate(-2px, -2px) !important;
    box-shadow: 5px 5px 0 #000 !important;
}

/* Keywords Search Box */
.keywords-box {
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: #fff;
    border: 3px solid #000;
    border-radius: 8px;
    padding: 6px 10px;
    box-shadow: 3px 3px 0 #000;
}

.kw-input-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.kw-icon {
    font-size: 14px;
}

.brutal-kw-input {
    flex: 1;
    background: #fff;
    border: 2px solid #000;
    border-radius: 6px;
    padding: 6px 10px;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 12px;
    font-weight: 700;
    outline: none;
    transition: background-color 0.15s ease, box-shadow 0.15s ease;
}

.brutal-kw-input:focus {
    background: #fef3c7;
    box-shadow: 2px 2px 0 #000;
}

.active-kw-chips {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
    min-height: 24px;
}

.kw-placeholder {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    font-weight: 600;
    color: #888;
    font-style: italic;
}

.kw-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #0ea5e9;
    color: #fff;
    border: 2px solid #000;
    border-radius: 6px;
    padding: 2px 8px;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 11px;
    font-weight: 900;
    box-shadow: 2px 2px 0 #000;
    text-transform: uppercase;
}

.kw-del-btn {
    background: #e11d48;
    color: #fff;
    border: 1px solid #000;
    border-radius: 50%;
    width: 14px;
    height: 14px;
    font-size: 10px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin-left: 2px;
}

.kw-del-btn:hover {
    background: #000;
}

/* Expanded Static Image Stage Box */
.image-stage-box {
    position: relative;
    flex: 1;
    width: 100%;
    min-height: 0;
    background: #111;
    border: 4px solid #000;
    border-radius: 12px;
    box-shadow: 6px 6px 0 #000;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    contain: layout style;
}

.stage-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    transition: transform 0.28s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.25s ease;
    opacity: 1;
    will-change: transform, opacity;
    transform: translateZ(0);
}

.stage-image.hidden {
    opacity: 0;
    transform: scale(0.97) translateZ(0);
}

.stage-image.anim-pop {
    animation: popGentle 0.3s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

@keyframes popGentle {
    0% { transform: scale(1) translateZ(0); opacity: 1; }
    50% { transform: scale(1.02) translateZ(0); opacity: 0.8; }
    100% { transform: scale(0.94) translateZ(0); opacity: 0; }
}

/* Chaos / Abyss Stage Event Overlays */
.stage-event-banner {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: #e11d48;
    color: #fff;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 900;
    font-size: 13px;
    padding: 4px 12px;
    border: 3px solid #000;
    border-radius: 8px;
    box-shadow: 3px 3px 0 #000;
    z-index: 12;
    animation: bannerPulse 1.6s infinite alternate;
}

.stage-event-banner.abyss-mode {
    background: #8b5cf6;
}

.stage-event-banner.hidden {
    display: none;
}

@keyframes bannerPulse {
    0% { transform: translateX(-50%) scale(1); }
    100% { transform: translateX(-50%) scale(1.03); }
}

/* Secret Collectible Clickable Trigger */
.secret-collectible-badge {
    position: absolute;
    top: 14px;
    right: 14px;
    background: #facc15;
    color: #000;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 900;
    font-size: 11px;
    padding: 4px 8px;
    border: 2px solid #000;
    border-radius: 6px;
    box-shadow: 3px 3px 0 #000;
    cursor: pointer;
    z-index: 15;
    animation: secretGlow 1.2s infinite alternate;
}

.secret-collectible-badge.hidden {
    display: none;
}

@keyframes secretGlow {
    0% { transform: scale(1); }
    100% { transform: scale(1.04); }
}

/* Loader */
.loader-overlay {
    position: absolute;
    inset: 0;
    background: #f0e8d8;
    border: 4px solid #000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    z-index: 10;
    transition: opacity 0.25s ease;
    will-change: opacity;
}

.brutal-spinner {
    width: 44px;
    height: 44px;
    border: 5px solid #000;
    border-top-color: #e11d48;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    will-change: transform;
}

@keyframes spin {
    100% { transform: rotate(360deg); }
}

.loader-text {
    font-size: 16px;
    letter-spacing: 0.5px;
    text-align: center;
    padding: 0 10px;
}

/* Stage Overlay Footer & Rarity Badges */
.stage-meta-footer {
    position: absolute;
    bottom: 10px;
    left: 10px;
    display: flex;
    gap: 6px;
    z-index: 5;
}

.meta-tag, .meta-id, .meta-rarity, .meta-license {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 700;
    background: #fff;
    border: 2px solid #000;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
    box-shadow: 2px 2px 0 #000;
}

.meta-license {
    background: #10b981;
    color: #000;
    text-decoration: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.meta-license:hover {
    transform: translate(-1px, -1px);
    box-shadow: 3px 3px 0 #000;
    background: #34d399;
}

.meta-rarity.rarity-common { background: #4b5563; color: #fff; }
.meta-rarity.rarity-uncommon { background: #22c55e; color: #000; }
.meta-rarity.rarity-rare { background: #3b82f6; color: #fff; }
.meta-rarity.rarity-legendary { background: #facc15; color: #000; }
.meta-rarity.rarity-cursed { background: #e11d48; color: #fff; }

/* Left Actions: Compacted Icon Pair */
.left-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.compact-icon-pair {
    display: flex;
    gap: 6px;
}

.brutal-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: #fff;
    border: 3px solid #000;
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 15px;
    letter-spacing: 0.5px;
    color: #000;
    text-decoration: none;
    cursor: pointer;
    box-shadow: 4px 4px 0 #000;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    outline: none;
    will-change: transform;
}

.brutal-btn:hover {
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0 #000;
}

.brutal-btn:active {
    transform: translate(2px, 2px);
    box-shadow: 2px 2px 0 #000;
}

.btn-skip { background: #fb923c; flex: 1; }

.brutal-btn.icon-only {
    width: 38px;
    height: 38px;
    padding: 0;
    font-size: 16px;
    background: #facc15;
}

.brutal-btn.small {
    padding: 4px 10px;
    font-size: 13px;
    border-width: 2px;
    box-shadow: 3px 3px 0 #000;
}
.brutal-btn.small.yellow { background: #facc15; }
.brutal-btn.small.red { background: #e11d48; color: #fff; }

/* Left Stats Footer & Toggles Group */
/* Left Stats & Meta Footer (Locked 2-Row Alignment Grid) */
.left-stats-footer {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: #fff;
    border: 3px solid #000;
    padding: 8px 12px;
    border-radius: 10px;
    box-shadow: 3px 3px 0 #000;
    width: 100%;
}

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

.footer-row-top {
    justify-content: space-between;
}

.footer-row-bottom {
    justify-content: flex-start;
}

.meta-badges-group {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
    overflow-x: auto;
    white-space: nowrap;
    max-width: 80%;
}

.meta-badges-group::-webkit-scrollbar {
    display: none;
}

.stat-box {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
}

.stat-lbl {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 700;
}

.stat-num {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 16px;
    font-weight: 700;
    color: #e11d48;
}

.footer-toggles {
    display: flex;
    gap: 6px;
    align-items: center;
}

.collectibles-toggle-btn {
    background: #10b981;
    color: #000;
    border: 2px solid #000;
    border-radius: 6px;
    padding: 4px 8px;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 900;
    font-size: 12px;
    cursor: pointer;
    box-shadow: 2px 2px 0 #000;
    height: 32px;
    display: inline-flex;
    align-items: center;
}

/* 1:1 Icon-Only Square Toggle Buttons */
.sound-toggle-btn.icon-only-btn,
.theme-toggle-btn.icon-only-btn,
.disclaimer-toggle-btn.icon-only-btn {
    width: 32px !important;
    height: 32px !important;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 6px !important;
    border: 2px solid #000 !important;
    box-shadow: 2px 2px 0 #000 !important;
    cursor: pointer !important;
    transition: transform 0.15s ease, box-shadow 0.15s ease !important;
    text-decoration: none !important;
}

.sound-toggle-btn.icon-only-btn {
    background: #0ea5e9 !important;
    color: #fff !important;
}

.theme-toggle-btn.icon-only-btn {
    background: #8b5cf6 !important;
    color: #fff !important;
}

.disclaimer-toggle-btn.icon-only-btn {
    background: #e11d48 !important;
    color: #fff !important;
}

.sound-toggle-btn.icon-only-btn:hover,
.theme-toggle-btn.icon-only-btn:hover,
.disclaimer-toggle-btn.icon-only-btn:hover {
    transform: translate(-1px, -1px) !important;
    box-shadow: 3px 3px 0 #000 !important;
}

/* ==========================================================================
   RIGHT PANEL (Rating Box & Tier Chart)
   ========================================================================== */
.right-panel {
    flex: 1;
    height: 100vh;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow: hidden;
    contain: layout style;
}

/* Top Rating Section */
.rating-section {
    background: #fff;
    border: 4px solid #000;
    border-radius: 12px;
    padding: 10px 16px;
    box-shadow: 6px 6px 0 #000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.rating-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.rating-title {
    font-size: 20px;
    letter-spacing: -0.3px;
}

.rating-hint {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    font-weight: 600;
    background: #fef3c7;
    border: 2px solid #000;
    padding: 2px 8px;
    border-radius: 4px;
}

/* FLATTENED ALWAYS-VISIBLE SINGLE ROW OF 6 LARGE TIER BUTTONS */
.rating-buttons-row {
    display: flex;
    gap: 8px;
    width: 100%;
}

.tier-btn.item-color {
    position: relative;
    flex: 1;
    height: 56px;
    border: 3px solid #000;
    border-radius: 8px;
    box-shadow: 3px 3px 0 #000;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    outline: none;
    will-change: transform;
}

.tier-btn.item-color:hover {
    transform: translate(-2px, -2px);
    box-shadow: 5px 5px 0 #000;
}

.tier-btn.item-color:active, .tier-btn.btn-active-slam {
    transform: translate(2px, 2px) scale(0.96) !important;
    box-shadow: 1px 1px 0 #000 !important;
}

.tier-btn .tier-letter {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 24px;
    font-weight: 900;
    color: #000;
    line-height: 1;
}

.tier-btn .key-hint {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 9px;
    font-weight: 700;
    background: rgba(0, 0, 0, 0.15);
    color: #000;
    padding: 1px 5px;
    border-radius: 4px;
    margin-top: 2px;
}

/* COLOR SCALE DEGRADATION */
.tier-s { background: #e11d48; color: #fff; }
.tier-s .tier-letter { color: #fff; }
.tier-s .key-hint { background: rgba(255, 255, 255, 0.3); color: #fff; }

.tier-a { background: #f97316; }
.tier-b { background: #eab308; }
.tier-c { background: #22c55e; }
.tier-d { background: #3b82f6; color: #fff; }
.tier-d .tier-letter { color: #fff; }
.tier-d .key-hint { background: rgba(255, 255, 255, 0.3); color: #fff; }

.tier-f { background: #4b5563; color: #fff; }
.tier-f .tier-letter { color: #fff; }
.tier-f .key-hint { background: rgba(255, 255, 255, 0.3); color: #fff; }

/* Bottom Tier Chart Section */
.tier-chart-section {
    flex: 1;
    min-height: 0;
    background: #fff;
    border: 4px solid #000;
    border-radius: 12px;
    padding: 12px 16px;
    box-shadow: 6px 6px 0 #000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow: hidden;
}

.chart-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 3px solid #000;
    padding-bottom: 8px;
}

.chart-title {
    font-size: 20px;
    letter-spacing: -0.3px;
}

.chart-actions {
    display: flex;
    gap: 8px;
}

/* Tier Chart Grid & Rows */
.tier-chart-grid {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-right: 4px;
}

.tier-chart-grid::-webkit-scrollbar {
    width: 8px;
}
.tier-chart-grid::-webkit-scrollbar-track {
    background: #f0e8d8;
    border: 2px solid #000;
}
.tier-chart-grid::-webkit-scrollbar-thumb {
    background: #000;
    border-radius: 4px;
}

.chart-row {
    display: flex;
    min-height: 64px;
    background: #fff8eb;
    border: 3px solid #000;
    border-radius: 8px;
    box-shadow: 3px 3px 0 #000;
    overflow: hidden;
    contain: layout style;
}

.row-label {
    width: 60px;
    min-width: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 900;
    color: #000;
    border-right: 3px solid #000;
}

.row-label.tier-s { background: #e11d48; color: #fff; }
.row-label.tier-a { background: #f97316; }
.row-label.tier-b { background: #eab308; }
.row-label.tier-c { background: #22c55e; }
.row-label.tier-d { background: #3b82f6; color: #fff; }
.row-label.tier-f { background: #4b5563; color: #fff; }

/* --- TACTILE DRAG FEEDBACK ANIMATIONS --- */

/* 1. PICK PHASE (Drag Start on Stage Image) */
.stage-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    cursor: grab;
    transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.stage-image:active,
.stage-image.is-dragging {
    cursor: grabbing;
    opacity: 0.75;
    transform: scale(0.95) rotate(-2deg);
    filter: saturate(1.4) drop-shadow(6px 6px 0 #000);
}

.image-stage.stage-picked-up {
    border-style: dashed;
    border-color: #e11d48;
    box-shadow: 8px 8px 0 #000;
}

/* 2. DRAGGING PHASE (Hovering over Tier Row) */
.chart-row {
    transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1), background-color 0.15s ease, box-shadow 0.15s ease;
}

.chart-row.drag-over {
    transform: scale(1.025);
    background-color: #fef3c7 !important;
    border-color: #000 !important;
    box-shadow: 6px 6px 0 #000, inset 0 0 0 2px #facc15 !important;
    z-index: 10;
}

.chart-row.drag-over .row-label {
    transform: scale(1.1);
    box-shadow: 2px 0 0 #000;
}

.row-content.drag-over {
    background-color: #fef3c7 !important;
    outline: 3px dashed #000 !important;
    outline-offset: -4px;
}

/* 3. PLACED PHASE (Drop Slam & Entrance Bounce) */
.chart-row.tier-drop-slam {
    animation: tierDropSlam 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes tierDropSlam {
    0% { transform: scale(1.04); background-color: #fde047; }
    40% { transform: scale(0.97); }
    100% { transform: scale(1.0); background-color: #fff8eb; }
}

.brutal-thumb-card.new-placed-pop {
    animation: thumbEntrancePop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes thumbEntrancePop {
    0% { transform: scale(0) rotate(-12deg); opacity: 0; }
    60% { transform: scale(1.2) rotate(4deg); opacity: 1; }
    100% { transform: scale(1) rotate(0deg); }
}

.empty-placeholder {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 600;
    font-size: 12px;
    color: #999;
    letter-spacing: 0.5px;
    padding-left: 6px;
    pointer-events: none;
}

/* Brutalist Thumbnail Card Smooth Entry */
.brutal-thumb-card {
    position: relative;
    width: 54px;
    height: 54px;
    border-radius: 6px;
    border: 3px solid #000;
    box-shadow: 2px 2px 0 #000;
    overflow: hidden;
    cursor: grab;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease;
    animation: cardPopGentle 0.3s cubic-bezier(0.25, 1, 0.5, 1) forwards;
    will-change: transform;
}

@keyframes cardPopGentle {
    0% { transform: scale(0.6); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.brutal-thumb-card:hover {
    transform: scale(1.1) translateY(-2px);
    box-shadow: 4px 4px 0 #000;
    z-index: 10;
}

.row-content {
    flex: 1;
    padding: 6px 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    overflow-x: auto;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.brutal-thumb-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    pointer-events: none;
}

.thumb-del-btn {
    position: absolute;
    top: 1px;
    right: 1px;
    width: 16px;
    height: 16px;
    background: #e11d48;
    color: #fff;
    border: 1px solid #000;
    border-radius: 50%;
    font-size: 11px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    cursor: pointer;
    transition: opacity 0.15s ease;
}

.brutal-thumb-card:hover .thumb-del-btn {
    opacity: 1;
}

/* Collectibles Drawer Grid */
.collectibles-grid {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    min-height: 80px;
}

.collectible-card {
    background: #facc15;
    border: 2px solid #000;
    border-radius: 6px;
    padding: 6px 10px;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 900;
    font-size: 12px;
    box-shadow: 2px 2px 0 #000;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* Modal Styling */
.brutal-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999999;
    opacity: 1;
    transition: opacity 0.2s ease;
}

.brutal-modal.hidden {
    opacity: 0;
    pointer-events: none;
}

.brutal-modal-card {
    position: relative;
    background: #fff8eb;
    border: 5px solid #000;
    border-radius: 14px;
    padding: 20px;
    max-width: 580px;
    width: 90%;
    box-shadow: 8px 8px 0 #000;
}

.modal-close-x {
    position: absolute;
    top: 10px;
    right: 14px;
    background: #e11d48;
    color: #fff;
    border: 2px solid #000;
    font-size: 20px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 2px 2px 0 #000;
}

.modal-body-layout {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.modal-body-layout img {
    width: 100%;
    height: 100%;
    max-height: 340px;
    object-fit: contain;
    border: 3px solid #000;
    border-radius: 8px;
    background: #000;
}

.modal-meta-box {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.modal-badge-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-tier-badge {
    font-size: 18px;
    font-weight: 900;
    background: #facc15;
    border: 3px solid #000;
    padding: 2px 10px;
    border-radius: 6px;
    box-shadow: 2px 2px 0 #000;
}

.rerate-box {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 600;
    font-size: 13px;
}

.rerate-btn-group {
    display: flex;
    gap: 4px;
}

.r-btn {
    width: 26px;
    height: 26px;
    border: 2px solid #000;
    border-radius: 4px;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 900;
    font-size: 14px;
    cursor: pointer;
    box-shadow: 2px 2px 0 #000;
}

.r-btn.s { background: #e11d48; color: #fff; }
.r-btn.a { background: #f97316; }
.r-btn.b { background: #eab308; }
.r-btn.c { background: #22c55e; }
.r-btn.d { background: #3b82f6; color: #fff; }
.r-btn.f { background: #4b5563; color: #fff; }

.modal-date {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px;
    font-weight: 600;
}

.modal-license {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px;
    font-weight: 600;
}

.modal-license .license-link {
    background: #10b981;
    color: #000;
    border: 2px solid #000;
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 700;
    text-decoration: none;
    box-shadow: 2px 2px 0 #000;
    display: inline-block;
    transition: transform 0.15s ease;
}

.modal-license .license-link:hover {
    transform: translate(-1px, -1px);
    box-shadow: 3px 3px 0 #000;
    background: #34d399;
}

.modal-url {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    word-break: break-all;
}

.modal-footer-btns {
    display: flex;
    gap: 8px;
}

/* Toast Container */
.toast-container {
    position: fixed;
    bottom: 16px;
    right: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 9999999;
}

.toast {
    background: #fff;
    border: 3px solid #000;
    padding: 8px 14px;
    border-radius: 8px;
    box-shadow: 4px 4px 0 #000;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.5px;
    animation: toastIn 0.25s ease forwards;
    will-change: transform, opacity;
}

@keyframes toastIn {
    0% { transform: translateY(20px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

.toast.toast-out {
    animation: toastOut 0.2s forwards;
}

@keyframes toastOut {
    to { transform: translateY(10px); opacity: 0; }
}

/* ==========================================================================
   2D BRUTALIST DARK THEME OVERRIDES (.dark-theme)
   ========================================================================== */
body.dark-theme {
    background-color: #121214;
    color: #ffffff;
}

body.dark-theme .left-panel {
    background-color: #18181c;
    box-shadow: 6px 0 0 rgba(0, 0, 0, 0.4);
}

body.dark-theme .keywords-box {
    background-color: #222228;
    color: #ffffff;
}

body.dark-theme .brutal-kw-input {
    background-color: #16161a;
    color: #ffffff;
}

body.dark-theme .brutal-kw-input:focus {
    background-color: #2a2a34;
}

body.dark-theme .image-stage-box {
    background-color: #0a0a0c;
}

body.dark-theme .loader-overlay {
    background-color: #18181c;
    color: #ffffff;
}

body.dark-theme .meta-tag, 
body.dark-theme .meta-id,
body.dark-theme .meta-rarity {
    background-color: #222228;
    color: #ffffff;
}

body.dark-theme .left-stats-footer {
    background-color: #222228;
    color: #ffffff;
}

body.dark-theme .right-panel {
    background-color: #121214;
}

body.dark-theme .rating-section,
body.dark-theme .tier-chart-section {
    background-color: #1a1a20;
    color: #ffffff;
}

body.dark-theme .rating-hint {
    background-color: #2d2b1e;
    color: #facc15;
}

body.dark-theme .chart-row {
    background-color: #222228;
}

body.dark-theme .tier-chart-grid::-webkit-scrollbar-track {
    background: #18181c;
}
body.dark-theme .tier-chart-grid::-webkit-scrollbar-thumb {
    background: #facc15;
}

body.dark-theme .empty-placeholder {
    color: #777788;
}

body.dark-theme .brutal-btn {
    background-color: #222228;
    color: #ffffff;
}

body.dark-theme .btn-skip {
    background-color: #fb923c;
    color: #000000;
}

body.dark-theme .brutal-btn.icon-only {
    background-color: #facc15;
    color: #000000;
}

body.dark-theme .brutal-btn.small.yellow {
    background-color: #facc15;
    color: #000000;
}

body.dark-theme .brutal-btn.small.red {
    background-color: #e11d48;
    color: #ffffff;
}

body.dark-theme .brutal-modal-card {
    background-color: #1a1a20;
    color: #ffffff;
}

body.dark-theme .toast {
    background-color: #222228;
    color: #ffffff;
}
