        /* Display face for headings, nav and rank numbers (SIL OFL, see fonts/Exo2-LICENSE.txt) */
        @font-face {
            font-family: 'Exo 2';
            src: url('../fonts/Exo2-BoldItalic.woff2') format('woff2');
            font-weight: 700;
            font-style: italic;
            font-display: swap;
        }
        @font-face {
            font-family: 'Exo 2';
            src: url('../fonts/Exo2-BlackItalic.woff2') format('woff2');
            font-weight: 900;
            font-style: italic;
            font-display: swap;
        }

        /* Site tokens. --slant is the one angle every cut, slab and slash uses.
           --cw and --ch are the canvas width and visible canvas height, set by
           assets/js/canvas.js. Use them instead of vw / vh units, and use
           html[data-canvas="..."] instead of width media queries, so the layout
           stays locked to the canvas whatever the window or zoom is. */
        :root {
            --cw: 1920px;
            --ch: 1080px;
            --ink: #050505;
            --coal: #11100e;
            --orange: #ff7300;
            --gold: #ffd700;
            --bone: #f3ede1;
            --ash: #9a9388;
            --slant: -14deg;
            --display: 'Exo 2', 'Arial Black', 'Helvetica Neue', Arial, sans-serif;
            /* The black rock texture (assets/ui/BG texture/black-rock.webp) is used behind
               the titles: each page's title slab and the slabs on the home screen. The page
               background itself is bg black.webp. --rock-shade is the black laid over the
               rock: the last number is how dark, from 0 (full strength) to 1 (plain black). */
            --rock-shade: rgba(5, 5, 5, 0.4);
            /* THE DIVIDER LINE between sections: one black line (--wire thick) with
               an orange edge (--wire-edge thick) on each side. The slanted cuts and
               the flat lines are the same line, so they join into each other.
               Change these two numbers and every divider on the site follows. */
            --wire: 12px;
            --wire-edge: 4px;
            --wire-h: calc(var(--wire) + var(--wire-edge) * 2);
        }

        @font-face {
            font-family: 'NarutoStorm';
            src: url('../fonts/Naruto Storm.ttf') format('truetype');
            font-weight: normal;
            font-style: normal;
        }
        @font-face {
            font-family: 'S4Fonts';
            src: url('../fonts/S4fonts.ttf') format('truetype');
            font-weight: normal;
            font-style: normal;
        }
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            background: url('../ui/BG texture/bg black.webp') center center / cover fixed;
            color: #ddd;
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
            overflow-x: hidden;
            min-height: var(--ch);
            display: flex;
            flex-direction: column;
        }

        /* Radial glow effect */
/* ══ HEADER ═══════════════════════════════════════════════════════════════
   The textured bar and stone tab buttons. Labels are bright with a dark edge
   so they read on the stone, and the page you are on gets the full-strength
   tab with a gold label.                                                    */
        .header {
            position: fixed !important;
            top: 0;
            left: 0;
            right: 0;
            height: 70px;
            min-height: 70px;
            max-height: 70px;
            background: url('../ui/BG texture/header top.webp') center/auto 70px repeat-x, #0d0d0d;
            border-bottom: 2px solid #ff7300;
            display: flex;
            align-items: center;
            justify-content: space-between;
            flex-wrap: nowrap;
            padding: 0 40px;
            z-index: 1000;
            overflow: hidden;
            box-shadow: 0 0 20px rgba(255, 115, 0, 0.1);
        }

        .header-logo {
            align-self: stretch;
            display: flex;
            align-items: center;
            gap: 12px;
            font-family: 'NarutoStorm', sans-serif;
            font-size: 22px;
            font-weight: normal;
            color: #ffd700;
            text-shadow: 0 0 10px rgba(255, 115, 0, 0.5);
            letter-spacing: 3px;
            white-space: nowrap;
            flex-shrink: 0;
            text-decoration: none;
        }

        .header-logo-img {
            height: 74%;
            max-height: 52px;
            width: auto;
            display: block;
            filter: drop-shadow(0 0 8px rgba(255, 180, 0, 0.9));
        }

        .header-logo:focus-visible,
        .nav-tab:focus-visible {
            outline: 2px solid #ffd700;
            outline-offset: 3px;
        }

        .header-nav {
            display: flex;
            align-items: center;
            gap: 20px;
            flex-shrink: 0;
            white-space: nowrap;
            margin-right: 20px;
        }

        .nav-tab {
            position: relative;
            z-index: 0;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            width: 160px;
            height: 45px;
            padding: 0;
            border: none;
            border-radius: 0;
            background: transparent;
            color: #f1ebdf;
            cursor: pointer;
            font-family: 'S4Fonts', sans-serif;
            font-size: 15px;
            font-weight: 600;
            letter-spacing: 1px;
            text-transform: uppercase;
            text-decoration: none;
            text-shadow: 0 1px 2px #000, 0 0 6px rgba(0, 0, 0, 0.85);
            white-space: nowrap;
            flex-shrink: 0;
            transition: color 0.2s ease, text-shadow 0.2s ease, transform 0.2s ease;
        }

        /* the stone tab */
        .nav-tab::before {
            content: '';
            position: absolute;
            inset: 0;
            background: url('../ui/BG texture/Tab buttons.webp') center center / 100% 100% no-repeat;
            opacity: 0.55;
            transition: opacity 0.2s ease;
            z-index: -1;
        }

        .nav-tab:hover {
            color: #ffb04d;
            transform: translateY(-1px);
        }

        .nav-tab:hover::before {
            opacity: 0.85;
        }

        .nav-tab.active,
        .nav-tab.active:hover {
            color: #ffd700;
            text-shadow: 0 1px 2px #000, 0 0 10px rgba(255, 115, 0, 0.9);
            transform: none;
        }

        .nav-tab.active::before {
            opacity: 1;
        }

        .header-auth {
            display: flex;
            align-items: center;
            gap: 10px;
            flex-shrink: 0;
        }

        /* MAIN CONTENT */
        .main-container {
            margin-top: 70px;
            padding-bottom: 0;
            flex: 1;
        }

        /* ── DATA PAGE ─────────────────────────────────────────────────────────
           Tables for cooldowns, biometrics and OTG, plus the item cards.
           One neutral bar colour for magnitude; orange only marks what
           changed or what you are pointing at. */
        .data-container,
        .all-tools-container {
            padding: 34px 40px 64px;
            max-width: 100%;
            margin: 0 auto;
        }

        /* Toolbar: patch chips on the left, search and count on the right */
        .version-select-bar {
            display: flex;
            align-items: center;
            gap: 8px;
            margin-bottom: 18px;
            flex-wrap: wrap;
        }

        .version-select-label {
            margin-right: 8px;
            font-family: var(--display);
            font-style: italic;
            font-weight: 700;
            font-size: 14px;
            color: var(--ash);
            letter-spacing: 2px;
            text-transform: uppercase;
        }

        .version-btn {
            min-width: 78px;
            height: 34px;
            padding: 0 18px;
            background: #1b1916;
            border: none;
            border-radius: 0;
            clip-path: polygon(9px 0, 100% 0, calc(100% - 9px) 100%, 0 100%);
            color: #aaa398;
            cursor: pointer;
            font-family: var(--display);
            font-style: italic;
            font-weight: 700;
            font-size: 15px;
            letter-spacing: 0.5px;
            transition: background 0.15s ease, color 0.15s ease;
        }

        .version-btn:hover {
            background: #2a2621;
            color: var(--bone);
        }

        .version-btn.active,
        .version-btn.active:hover {
            background: var(--orange);
            color: #0a0a0a;
        }

        .version-btn:focus-visible,
        .otg-filter-btn:focus-visible {
            outline: 2px solid var(--gold);
            outline-offset: 3px;
        }

        .data-search-bar {
            display: flex;
            align-items: center;
            gap: 16px;
            margin-bottom: 22px;
            flex-wrap: wrap;
        }

        .data-search-bar .search-input {
            width: 340px;
            max-width: 340px !important;
            height: 48px;
            padding: 0 18px;
            background: #12110f;
            border: 1px solid #2c2822;
            border-left: 4px solid var(--orange);
            border-radius: 0;
            color: var(--bone);
            font-size: 16px;
        }

        .data-search-bar .search-input::placeholder {
            color: #7d766b;
        }

        .data-search-bar .search-input:focus {
            outline: none;
            border-color: var(--orange);
            background: #171512;
            box-shadow: none;
        }

        .data-search-bar .char-count {
            margin-left: auto;
            font-size: 15px;
            font-style: normal;
            color: var(--ash);
        }

        /* What the marks in a table mean */
        .data-key {
            display: flex;
            flex-wrap: wrap;
            align-items: center;
            gap: 8px 26px;
            margin: -4px 0 20px;
            font-size: 15px;
            color: var(--ash);
        }

        .data-key__item {
            display: inline-flex;
            align-items: center;
            gap: 8px;
        }

        .data-key__item img {
            height: 24px;
            width: auto;
        }

        .data-key__swatch {
            display: inline-block;
            font-weight: 700;
        }

        .data-key__swatch--changed { color: var(--orange); }
        .data-key__swatch--common  { color: #6f695f; font-weight: 400; }
        .data-key__swatch--stands  { color: var(--bone); }

        /* Tables */
        .data-table-wrap,
        .table-wrap {
            border-top: 2px solid var(--orange);
        }

        .data-table {
            width: 100%;
            border-collapse: collapse;
            font-size: 17px;
            font-variant-numeric: tabular-nums;
        }

        .data-table th {
            position: sticky;
            top: 70px;
            z-index: 5;
            background: #0b0a09;
            color: var(--ash);
            font-family: var(--display);
            font-style: italic;
            font-weight: 700;
            font-size: 14px;
            letter-spacing: 1.5px;
            text-transform: uppercase;
            padding: 16px 20px;
            text-align: left;
            border-bottom: 1px solid rgba(255, 255, 255, 0.12);
            white-space: nowrap;
        }

        /* the name column stays narrow so the numbers sit close to the name */
        #cooldownTable th:first-child { width: 24%; }
        #bioTable th:first-child { width: 24%; }

        .data-table th[onclick]:hover {
            color: var(--bone);
        }

        .data-table th span {
            color: var(--orange);
        }

        .data-table td {
            height: 54px;
            padding: 8px 20px;
            border-bottom: 1px solid rgba(255, 255, 255, 0.06);
            color: #d6cfc3;
            white-space: nowrap;
        }

        .data-table tr:last-child td { border-bottom: none; }

        .data-table tbody tr:hover td {
            background: rgba(255, 115, 0, 0.09);
        }

        .data-table td:first-child {
            color: var(--bone);
            font-weight: 600;
            box-shadow: inset 4px 0 0 transparent;
        }

        .data-table tbody tr:hover td:first-child {
            box-shadow: inset 4px 0 0 var(--orange);
        }

        /* Cooldown cell: seconds, grade letter, then a bar on a shared 0 to max scale */
        .cd {
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .cd__num {
            min-width: 2ch;
            text-align: right;
            font-weight: 600;
            color: var(--bone);
        }

        .cd__grade {
            flex: none;
            height: 26px;
            width: 22px;
            object-fit: contain;
        }

        .cd__bar {
            flex: 0 1 230px;
            height: 6px;
            background: rgba(255, 255, 255, 0.08);
        }

        .cd__bar i {
            display: block;
            height: 100%;
            background: #bdb6aa;
        }

        .data-table tbody tr:hover .cd__bar i {
            background: var(--bone);
        }

        /* Biometrics: the usual value recedes, anything else stands out,
           and a value that changed since v1.01 is orange */
        .data-table td.val-common { color: #6f695f; }
        .data-table td.val-changed { color: var(--orange); font-weight: 700; }

        /* OTG: only the hits get a filled chip, so they are what you see first */
        .data-table td.otg-yes,
        .data-table td.otg-no,
        .data-table td.otg-special {
            text-align: center;
        }

        .otg-chip {
            display: inline-block;
            min-width: 74px;
            padding: 6px 14px;
            font-family: var(--display);
            font-style: italic;
            font-weight: 900;
            font-size: 15px;
            letter-spacing: 1px;
            clip-path: polygon(8px 0, 100% 0, calc(100% - 8px) 100%, 0 100%);
        }

        .otg-yes .otg-chip     { background: #3ddc84; color: #06140b; }
        .otg-special .otg-chip { background: #ffd24a; color: #1a1400; }
        .otg-no .otg-chip      { background: transparent; color: #5f594f; font-weight: 700; }

        .data-table td.otg-note {
            white-space: normal;
            font-size: 15px;
            line-height: 1.4;
            color: var(--ash);
        }

        .otg-filter-bar { display: flex; gap: 8px; margin: 0 0 20px; }

        .otg-filter-btn {
            height: 34px;
            padding: 0 20px;
            background: #1b1916;
            border: none;
            border-radius: 0;
            clip-path: polygon(9px 0, 100% 0, calc(100% - 9px) 100%, 0 100%);
            color: #aaa398;
            cursor: pointer;
            font-family: var(--display);
            font-style: italic;
            font-weight: 700;
            font-size: 15px;
            letter-spacing: 0.5px;
            transition: background 0.15s ease, color 0.15s ease;
        }

        .otg-filter-btn:hover { background: #2a2621; color: var(--bone); }

        .otg-filter-btn.active,
        .otg-filter-btn.active:hover { background: var(--orange); color: #0a0a0a; }

        /* Item cards */
        .item-cards {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
            gap: 14px;
        }

        .item-card {
            display: grid;
            grid-template-columns: 76px minmax(0, 1fr) auto;
            grid-template-areas:
                "icon name  grade"
                "icon cd    grade"
                "text text  text"
                "used used  used";
            column-gap: 16px;
            align-items: center;
            padding: 22px 24px 20px;
            background: #13110f;
            border-left: 4px solid #3a342c;
        }

        .item-card:hover {
            border-left-color: var(--orange);
            background: #181613;
        }

        .item-card__icon {
            grid-area: icon;
            width: 76px;
            height: 76px;
            object-fit: contain;
        }

        .item-card__name {
            grid-area: name;
            align-self: end;
            font-family: var(--display);
            font-style: italic;
            font-weight: 900;
            font-size: 21px;
            line-height: 1.15;
            color: var(--bone);
        }

        .item-card__cd {
            grid-area: cd;
            align-self: start;
            display: flex;
            align-items: center;
            gap: 12px;
            margin-top: 8px;
            font-size: 17px;
            font-weight: 600;
            font-variant-numeric: tabular-nums;
            color: var(--bone);
        }

        .item-card__cd .cd__bar {
            flex: 1 1 auto;
        }

        .item-card__grade {
            grid-area: grade;
            height: 54px;
            width: auto;
        }

        .item-card__effect {
            grid-area: text;
            margin-top: 18px;
            font-size: 16px;
            line-height: 1.45;
            color: #cbc4b8;
        }

        .item-card__used {
            grid-area: used;
            margin-top: 8px;
            font-size: 15px;
            color: var(--ash);
        }

        .data-credit {
            margin-top: 22px;
            font-size: 14px;
            color: #7d766b;
            font-style: normal;
        }

        /* Grade badges (kept for any text-only grades) */
        .grade {
            display: inline-block;
            padding: 1px 7px;
            font-family: var(--display);
            font-style: italic;
            font-size: 12px;
            letter-spacing: 1px;
            font-weight: 700;
        }

        .grade-S { background: rgba(255,215,0,0.15);   color: #ffd700; border: 1px solid rgba(255,215,0,0.4); }
        .grade-A { background: rgba(76,175,80,0.15);   color: #66bb6a; border: 1px solid rgba(76,175,80,0.4); }
        .grade-B { background: rgba(78,168,255,0.12);  color: #4ea8ff; border: 1px solid rgba(78,168,255,0.3); }
        .grade-C { background: rgba(255,115,0,0.12);   color: #ff7300; border: 1px solid rgba(255,115,0,0.3); }
        .grade-D { background: rgba(255,68,68,0.12);   color: #ff4444; border: 1px solid rgba(255,68,68,0.3); }
        .grade-E { background: rgba(150,0,0,0.2);      color: #cc3333; border: 1px solid rgba(150,0,0,0.4); }

        /* FOOTER
           The textured strip and paper tab buttons, on the right. */
        .site-footer {
            border-top: 1px solid rgba(214, 198, 232, 0.12);
            background: url('../ui/BG texture/Footer bg.webp') center/100% 100% no-repeat, rgba(0, 0, 0, 0.45);
            padding: 24px 40px;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 24px;
            margin-top: auto;
            flex-shrink: 0;
        }

        .footer-link {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            width: 126px;
            height: 42px;
            background: url('../ui/BG texture/footer tabs.webp') center/100% 100% no-repeat;
            text-decoration: none;
            color: #1a1a2e;
            font-size: 13px;
            font-weight: 800;
            letter-spacing: 0.06em;
            text-transform: uppercase;
            text-shadow: none;
            filter: brightness(0.88);
            transition: filter 0.2s, transform 0.2s;
        }

        .footer-link:hover {
            filter: brightness(1.1);
            transform: translateY(-2px);
        }

        .footer-link:focus-visible {
            outline: 2px solid #ffd700;
            outline-offset: 3px;
        }

        .footer-link img { display: none; }

        .tab-content {
            display: none;
        }

        .tab-content.active {
            display: block;
        }

        /* Tab slide transition */
        .tab-content.slide-left { animation: tabSlideFromRight 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94) both; }
        .tab-content.slide-right { animation: tabSlideFromLeft 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94) both; }
        @keyframes tabSlideFromRight { from { opacity: 0; transform: translateX(60px); } to { opacity: 1; transform: translateX(0); } }
        @keyframes tabSlideFromLeft { from { opacity: 0; transform: translateX(-60px); } to { opacity: 1; transform: translateX(0); } }
        @keyframes heroCounterRight { from { transform: translateX(-60px); } to { transform: translateX(0); } }
        @keyframes heroCounterLeft { from { transform: translateX(60px); } to { transform: translateX(0); } }
        .tab-content.slide-left .hero { animation: heroCounterRight 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94) both; }
        .tab-content.slide-right .hero { animation: heroCounterLeft 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94) both; }

        /* SUB-NAV (tabs under the page banner) */
        .sub-nav {
            display: flex;
            gap: 0;
            background: #0b0a09;
            border-bottom: 1px solid rgba(255, 255, 255, 0.09);
            padding: 0 26px;
        }

        .sub-tab {
            position: relative;
            padding: 17px 22px 16px;
            background: transparent;
            border: none;
            color: #8d867b;
            cursor: pointer;
            font-family: var(--display);
            font-style: italic;
            font-weight: 700;
            font-size: 15px;
            letter-spacing: 1.5px;
            text-transform: uppercase;
            transition: color 0.15s ease;
            white-space: nowrap;
        }

        .sub-tab::after {
            content: '';
            position: absolute;
            left: 14px;
            right: 14px;
            bottom: -1px;
            height: 4px;
            background: transparent;
            transform: skewX(var(--slant));
        }

        .sub-tab:hover {
            color: var(--bone);
        }

        .sub-tab.active {
            color: var(--bone);
        }

        .sub-tab.active::after {
            background: var(--orange);
        }

        .sub-tab:focus-visible {
            outline: 2px solid var(--gold);
            outline-offset: -6px;
        }

        .sub-tab-locked {
            opacity: 0.4;
            cursor: not-allowed !important;
        }
        .sub-tab-locked:hover {
            color: #8d867b;
        }

        .sub-content {
            display: none;
        }

        .sub-content.active {
            display: block;
        }

        /* ── Community / Auth bar ──────────────────────────────────────────── */
        .tier-community-bar {
            display: flex;
            align-items: center;
            justify-content: space-between;
            flex-wrap: wrap;
            gap: 12px;
            padding: 12px 40px;
            background: rgba(0,0,0,0.25);
            border-bottom: 1px solid rgba(214,198,232,0.08);
        }

        .tier-auth-area {
            display: flex;
            align-items: center;
            gap: 12px;
            font-size: 13px;
            color: #888;
        }

        .tier-auth-avatar {
            width: 28px;
            height: 28px;
            border-radius: 50%;
            border: 1px solid rgba(214,198,232,0.3);
        }

        .tier-auth-name {
            color: #ccc;
            font-size: 13px;
        }

        .tier-auth-btn {
            padding: 8px 18px;
            background: #5865F2;
            border: 1px solid #7289ff;
            border-radius: 6px;
            color: #fff;
            cursor: pointer;
            font-family: 'S4Fonts', sans-serif;
            font-size: 12px;
            letter-spacing: 1px;
            transition: all 0.2s;
            box-shadow: 0 0 12px rgba(88,101,242,0.5), 0 2px 6px rgba(0,0,0,0.4);
        }

        .tier-auth-btn:hover {
            background: #6875f5;
            border-color: #99aaff;
            box-shadow: 0 0 20px rgba(88,101,242,0.8), 0 2px 8px rgba(0,0,0,0.4);
            transform: translateY(-1px);
        }

        .tier-auth-btn.logout {
            border-color: rgba(255,255,255,0.15);
            color: #666;
        }

        .tier-auth-btn.logout:hover {
            border-color: rgba(255,68,68,0.4);
            color: #ff4444;
        }

        .tier-submit-btn {
            padding: 6px 16px;
            background: rgba(255,115,0,0.1);
            border: 1px solid rgba(255,115,0,0.4);
            border-radius: 4px;
            color: #ff7300;
            cursor: pointer;
            font-family: 'S4Fonts', sans-serif;
            font-size: 11px;
            letter-spacing: 1px;
            transition: all 0.2s;
        }

        .tier-submit-btn:hover {
            background: rgba(255,115,0,0.2);
            border-color: #ff7300;
        }

        .tier-submit-btn:disabled {
            opacity: 0.4;
            cursor: default;
        }

        .tier-submit-btn.saved {
            border-color: rgba(76,175,80,0.5);
            color: #4caf50;
            background: rgba(76,175,80,0.08);
        }

        .tier-view-toggle {
            display: flex;
            gap: 0;
            border: 1px solid rgba(214,198,232,0.15);
            border-radius: 4px;
            overflow: hidden;
        }

        .tier-view-btn {
            padding: 6px 18px;
            background: transparent;
            border: none;
            color: #666;
            cursor: pointer;
            font-family: 'S4Fonts', sans-serif;
            font-size: 11px;
            letter-spacing: 1px;
            text-transform: uppercase;
            transition: all 0.2s;
        }

        .tier-view-btn + .tier-view-btn {
            border-left: 1px solid rgba(214,198,232,0.15);
        }

        .tier-view-btn:hover { color: #ccc; }

        .tier-view-btn.active {
            background: rgba(214,198,232,0.1);
            color: #ffd700;
        }

        /* Community stats bar */
        .community-stats-bar {
            padding: 10px 40px;
            font-size: 12px;
            color: #666;
            font-style: italic;
        }

        /* Read-only community tier list — same layout, no drag */
        #communityView .tier-char-card {
            cursor: default;
        }

        #communityView .tier-char-card:hover {
            transform: none;
        }

        @keyframes fadeIn {
            from { opacity: 0; }
            to { opacity: 1; }
        }

        /* PAGE BANNER
           Stage art on the right, a black slab cut on the slant on the left,
           the page title sitting on the slab. */
        .hero {
            position: relative;
            width: 100%;
            height: calc(226px + var(--wire-h));
            background: linear-gradient(180deg, rgba(0, 0, 0, 0.55) 0%, rgba(0, 0, 0, 0.35) 100%),
                        url('../ui/hero-bg.webp') center center / cover no-repeat;
            overflow: hidden;
            display: flex;
            flex-direction: column;
            align-items: flex-start;
            justify-content: center;
        }

        /* The slab, and the "cut" that lies over it (<span class="hero-cut">,
           the first thing inside every banner). Both are the same slanted box. */
        .hero::before,
        .hero-cut {
            content: '';
            position: absolute;
            top: 0;
            bottom: 0;
            left: -160px;
            box-sizing: border-box;
            width: calc(40% + 162px);
            min-width: 782px;
            transform: skewX(var(--slant));
        }

        /* The slab: black rock, and along its slanted edge the divider line
           standing up (orange edge, black line, orange edge: three shadows, so
           the two orange edges are always the same thickness). It runs on down
           behind the flat line under the banner. */
        .hero::before {
            background: linear-gradient(var(--rock-shade), var(--rock-shade)),
                        url('../ui/BG texture/black-rock.webp') -120px -430px / 1920px auto no-repeat var(--ink);
            box-shadow: var(--wire-edge) 0 0 var(--orange),
                        calc(var(--wire-edge) + var(--wire)) 0 0 var(--ink),
                        calc(var(--wire-edge) * 2 + var(--wire)) 0 0 var(--orange);
            z-index: 2;
        }

        /* THE FLAT DIVIDER LINE
           A black bar with an orange edge above and below. Every page banner
           draws one along its bottom edge by itself. Anywhere else, put
           <div class="section-rule"></div> between two sections. */
        .section-rule,
        .hero::after {
            box-sizing: border-box;
            height: var(--wire-h);
            background: var(--ink);
            border-top: var(--wire-edge) solid var(--orange);
            border-bottom: var(--wire-edge) solid var(--orange);
        }

        .section-rule {
            position: relative;
            z-index: 2;
            flex: none;
        }

        .hero::after {
            content: '';
            position: absolute;
            left: 0;
            right: 0;
            bottom: 0;
            z-index: 3;
        }

        /* The cut: the black of the slanted line, laid over the flat line's
           upper orange edge so the black runs from one straight into the other.
           It stops halfway down the flat line. */
        .hero-cut {
            z-index: 4;
            width: calc(40% + 162px + var(--wire-edge));       /* starts where the slab's first orange edge ends */
            min-width: calc(782px + var(--wire-edge));
            box-shadow: var(--wire) 0 0 var(--ink);
            clip-path: inset(0 calc(var(--wire) * -1 - 2px) calc(var(--wire-edge) + var(--wire) / 2) 0);
            pointer-events: none;
        }

        /* ── Per-tab hero background overrides ─────────────────────────────────
           Drop an image into assets/ui/BGs/ then point the matching ID at it.
           Copy the pattern below for any tab you want to customise.
           The two numbers in rgba(0,0,0, X) control the overlay darkness —
           raise them (up to 1.0) to darken, lower to let more image show.
        ─────────────────────────────────────────────────────────────────────── */

        #heroChars { background: linear-gradient(180deg, rgba(0,0,0,0.35) 0%, rgba(0,0,0,0.2) 100%), url('../ui/BGs/hero-characters.webp') center 36% / cover no-repeat; }
        #heroData  { background: linear-gradient(180deg, rgba(0,0,0,0.55) 0%, rgba(0,0,0,0.35) 100%), url('../ui/BGs/hero-Data.webp') center center / cover no-repeat; }
        #heroAbout { background: linear-gradient(180deg, rgba(0,0,0,0.55) 0%, rgba(0,0,0,0.35) 100%), url('../ui/BGs/hero-about.webp') center center / cover no-repeat; }
        #heroTierlists { background: linear-gradient(180deg, rgba(0,0,0,0.55) 0%, rgba(0,0,0,0.35) 100%), url('../images/hero-tierlists.webp') center center / cover no-repeat; }

        .rain-container {
            position: absolute;
            width: 100%;
            height: 100%;
            overflow: hidden;
            contain: strict;
        }

        /* Banner embers. Only transform and opacity move, so the browser can
           animate them without redrawing the page. No blur filter: the soft edge
           is already in the gradient, and a filter per ember is what made them
           expensive. */
        .glow-orb {
            position: absolute;
            bottom: -30px;
            border-radius: 50%;
            background: radial-gradient(circle, rgba(255, 140, 0, 0.85) 0%, rgba(255, 115, 0, 0.4) 50%, transparent 70%);
            animation: floatUp linear infinite;
            pointer-events: none;
            will-change: transform, opacity;
        }
        .glow-orb--gold {
            background: radial-gradient(circle, rgba(255, 215, 0, 0.9) 0%, rgba(255, 115, 0, 0.4) 50%, transparent 70%);
        }
        .rain-container.is-idle .glow-orb {
            animation-play-state: paused;
        }

        @keyframes floatUp {
            0%   { transform: translateY(0) scale(1);    opacity: 0; }
            10%  { opacity: 1; }
            85%  { opacity: 0.7; }
            100% { transform: translateY(-230px) scale(0.4); opacity: 0; }
        }

        .hero-content {
            position: relative;
            z-index: 10;
            width: 100%;
            padding: 0 40px;
            display: flex;
            flex-direction: column;
            align-items: flex-start;
            text-align: left;
        }

        .hero h1 {
            font-family: var(--display);
            font-style: italic;
            font-size: 64px;
            font-weight: 900;
            color: var(--bone);
            margin-bottom: 10px;
            letter-spacing: 0;
            text-transform: uppercase;
        }

        /* Title art (assets/fonts/Words). Each file has different empty space
           around its letters, so --k and --l normalise them: every title ends up
           with the same letter height (--cap) and a flush left edge.
           --k = 100 / letter height in the file, --l = left gap in the file / 100. */
        .hero-title-img,
        .word-img {
            --cap: clamp(40px, calc(var(--cw) * 0.035), 64px);
            --k: 1.33;
            --l: 0;
            display: block;
            height: calc(var(--cap) * var(--k));
            width: auto;
            max-width: none;
            margin-left: calc(var(--cap) * var(--k) * var(--l) * -1);
        }
        .hero-title-img { margin-bottom: 14px; }
        img[src$="Words/Characters.webp"] { --k: 1.333; --l: 0.01; }
        img[src$="Words/About.webp"]      { --k: 1.235; --l: 1.54; }
        img[src$="Words/Data.webp"]       { --k: 1.316; --l: 1.92; }
        img[src$="Words/Tier lists.webp"] { --k: 1.111; --l: 0.95; }

        .hero p {
            display: block;
            font-family: var(--display);
            font-style: italic;
            font-weight: 700;
            font-size: 17px;
            color: var(--ash);
            letter-spacing: 3px;
            text-transform: uppercase;
        }

        /* CONTROLS BAR */
        .controls-bar {
            background: url('../ui/BG texture/Grainy black.webp') center / cover no-repeat, linear-gradient(180deg, #0d0d0d 0%, #060606 100%);
            border-bottom: 1px solid rgba(255, 115, 0, 0.25);
            padding: 20px 40px;
            display: flex;
            gap: 15px;
            flex-wrap: wrap;
            align-items: center;
            position: sticky;
            top: 70px;
            z-index: 900;
        }


        .search-input {
            background: #111;
            border: 1px solid #333;
            border-radius: 4px;
            padding: 10px 15px;
            color: #ddd;
            width: 250px;
            font-size: 14px;
            transition: all 0.3s ease;
        }

        .search-input:focus {
            outline: none;
            border-color: #ff7300;
            box-shadow: 0 0 12px rgba(255, 115, 0, 0.3);
            background: #0d0d0d;
        }

        /* ── Circular item filter slots ── */
        .item-filter-slots {
            display: flex;
            gap: 10px;
            align-items: center;
        }
        .item-filter-slot {
            position: relative;
            width: 70px;
            height: 70px;
            cursor: pointer;
            flex-shrink: 0;
        }
        .item-filter-slot .slot-bg,
        .item-filter-slot .slot-border {
            position: absolute;
            inset: 0;
            width: 100%;
            height: 100%;
            object-fit: contain;
            pointer-events: none;
        }
        .item-filter-slot .slot-bg    { z-index: 1; }
        .item-filter-slot .slot-border { z-index: 3; }
        .item-filter-slot .slot-icon {
            position: absolute;
            top: 50%;
            left: calc(50% - 1.5px);
            transform: translate(-50%, -50%);
            z-index: 2;
            object-fit: contain;
            width: 54px;
            height: 54px;
        }
        .item-filter-slot .slot-empty {
            position: absolute;
            inset: 0;
            padding-right: 3px;
            z-index: 2;
            display: flex;
            align-items: center;
            justify-content: center;
            color: #444;
            font-size: 18px;
            pointer-events: none;
        }
        .item-filter-slot.active .slot-border {
            filter: drop-shadow(0 0 6px rgba(255,180,0,0.9));
        }
        .item-filter-slot .slot-clear {
            position: absolute;
            top: -6px;
            right: -6px;
            width: 16px;
            height: 16px;
            background: #ff4444;
            border-radius: 50%;
            color: #fff;
            font-size: 9px;
            font-weight: bold;
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 10;
            cursor: pointer;
            opacity: 0;
            transition: opacity 0.15s;
        }
        .item-filter-slot:hover .slot-clear { opacity: 1; }

        /* Item filter picker panel */
        .item-picker-panel {
            display: none;
            position: absolute;
            top: calc(100% + 8px);
            left: 0;
            background: #111;
            border: 1px solid #ff7300;
            border-radius: 8px;
            padding: 10px;
            z-index: 500;
            width: 320px;
            max-height: 320px;
            overflow-y: auto;
            box-shadow: 0 8px 24px rgba(0,0,0,0.7);
        }
        .item-picker-panel.open { display: block; }
        .item-picker-search {
            display: none;
            width: 100%;
            background: #1a1a1a;
            border: 1px solid #333;
            border-radius: 5px;
            color: #ddd;
            padding: 6px 10px;
            font-size: 0.78rem;
            outline: none;
            margin-bottom: 8px;
        }
        .item-picker-search:focus { border-color: #ff7300; }
        .item-picker-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
            gap: 6px;
        }
        .item-picker-opt {
            position: relative;
            width: 52px;
            height: 51px;
            cursor: pointer;
            flex-shrink: 0;
            transition: transform 0.1s;
        }
        .item-picker-opt.selected .opt-icon {
            filter: drop-shadow(0 0 5px rgba(255,180,0,0.9));
        }
        .item-picker-opt img.opt-bg,
        .item-picker-opt img.opt-border {
            position: absolute;
            inset: 0;
            width: 100%;
            height: 100%;
            object-fit: contain;
            pointer-events: none;
        }
        .item-picker-opt img.opt-bg     { z-index: 1; display: none; }
        .item-picker-opt img.opt-border  { z-index: 3; display: none; }
        .item-picker-opt img.opt-icon {
            position: absolute;
            top: 50%;
            left: calc(50% - 1.5px);
            transform: translate(-50%, -50%);
            z-index: 2;
            object-fit: contain;
            width: 40px;
            height: 40px;
        }
        .item-picker-opt:hover { position: relative; z-index: 50; transform: scale(1.08); }
        .item-picker-hover-label {
            text-align: center;
            color: #ffd700;
            font-size: 0.7rem;
            min-height: 1.2em;
            margin-bottom: 6px;
            letter-spacing: 0.5px;
            pointer-events: none;
        }

        .btn {
            padding: 10px 20px;
            background: transparent;
            border: 1px solid #ff7300;
            border-radius: 4px;
            color: #ff7300;
            cursor: pointer;
            font-weight: 600;
            font-size: 13px;
            transition: all 0.3s ease;
            text-transform: uppercase;
            letter-spacing: 1px;
        }

        .btn:hover {
            background: rgba(255, 115, 0, 0.15);
            box-shadow: 0 0 12px rgba(255, 115, 0, 0.4);
        }

        .btn.secondary {
            border-color: #666;
            color: #aaa;
        }

        .btn.secondary:hover {
            border-color: #888;
            color: #ddd;
            background: rgba(100, 100, 100, 0.1);
        }

        .char-count {
            font-size: 13px;
            color: #888;
            margin-left: auto;
            font-style: italic;
        }

        /* ── Roster controls bar: sharp, high-contrast accents ── */
        .controls-bar .search-input {
            width: 350px;
            height: 70px;
            box-sizing: border-box;
            padding: 0 20px 0 65px;
            font-size: 15px;
            border-radius: 0;
            border: none;
            background: url('../ui/BG texture/Search Bar 2.webp') center / 100% 100% no-repeat;
            color: #fff;
            clip-path: none;
            transition: filter 0.2s;
        }

        .controls-bar .search-input:focus {
            outline: none;
            box-shadow: none;
            filter: brightness(1.25) drop-shadow(0 0 6px rgba(255, 180, 0, 0.5));
        }

        .controls-bar .search-input::placeholder {
            color: #999;
        }

        .controls-bar .btn.secondary {
            width: 70px;
            height: 70px;
            padding: 0;
            border: none;
            border-radius: 0;
            background: url('../ui/BG texture/Cancel Seal.webp') center / contain no-repeat;
            font-size: 0;
            color: transparent;
            flex-shrink: 0;
            cursor: pointer;
            transition: filter 0.2s, transform 0.2s;
        }

        .controls-bar .btn.secondary:hover {
            background: url('../ui/BG texture/Cancel Seal.webp') center / contain no-repeat;
            border-color: transparent;
            color: transparent;
            box-shadow: none;
            filter: brightness(1.3) drop-shadow(0 0 6px rgba(255, 115, 0, 0.6));
            transform: translateY(-2px);
        }

        .controls-bar .char-count {
            color: #ffb000;
            font-style: normal;
            font-weight: 700;
            letter-spacing: 1px;
        }

        .controls-bar .item-filter-slot.active .slot-border {
            filter: drop-shadow(0 0 2px #ffcc00) drop-shadow(0 0 1px #fff);
        }

        /* CHARACTER GRID */
        .char-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
            gap: 15px;
            padding: 40px;
            max-width: 2200px;
            margin: 0 auto;
        }

        /* Grouped-by-support layout */
        #groupedView {
            max-width: 2200px;
            margin: 0 auto;
        }
        .support-section {
            padding: 0 40px 32px;
            max-width: 2200px;
            width: 100%;
            margin: 0 auto;
            box-sizing: border-box;
        }
        .support-section-header {
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 14px 0 10px;
            border-bottom: 1px solid rgba(255,115,0,0.2);
            margin-bottom: 14px;
        }
        .support-section-header img {
            width: 28px;
            height: 28px;
            object-fit: contain;
            filter: drop-shadow(0 0 5px rgba(255,200,0,0.4));
        }
        .support-section-header span {
            color: #ccc;
            font-size: 0.8rem;
            text-transform: uppercase;
            letter-spacing: 2px;
            font-family: 'S4Fonts', sans-serif;
        }
        .support-section-header .section-count {
            display: flex;
            align-items: center;
            margin-left: 6px;
            gap: 1px;
        }
        .support-section-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
            gap: 15px;
        }

        /* Group toggle button active state */
.char-card {
            width: 100%;
            aspect-ratio: 236/266;
            background: url('../characters/Character frames/bg ico.webp') center center / 100% 100% no-repeat;
            border: none;
            border-radius: 2px;
            cursor: pointer;
            position: relative;
            transition: all 0.2s ease;
        }

        /* Gold frame sits on top of everything except the tier badge */
        .char-card::after {
            content: '';
            position: absolute;
            inset: 0;
            background: url('../characters/Character frames/img_frame.webp') center center / 100% 100% no-repeat;
            pointer-events: none;
            z-index: 5;
            transition: filter 0.2s ease;
        }

        .char-card:hover {
            transform: translateY(-4px);
        }

        .char-card:hover::after {
            filter: drop-shadow(0 0 6px rgba(255, 210, 0, 0.95)) drop-shadow(0 0 14px rgba(255, 140, 0, 0.6));
        }

        /* Placeholder shown in a character card until its portrait arrives.
           Deliberately still: portraits load as you scroll, and an endless
           shimmer on every waiting card would be redrawn every frame. */
        .char-card .char-skeleton {
            position: absolute;
            top: 1.9%;
            left: 13.1%;
            width: 84.8%;
            height: 78%;
            z-index: 2;
            clip-path: polygon(8% 0%, 100% 0%, 100% 100%, 0% 100%, 0% 8%);
            background: linear-gradient(160deg, #262626 0%, #171717 60%);
        }
        .char-card .char-skeleton.loaded { display: none; }

        /* Character portrait — fills the inner frame area (x=31,y=5 → x=231,y=247), sits above the name tab */
        .char-card > img {
            position: absolute;
            top: 1.9%;
            left: 13.1%;
            width: 84.8%;   /* (231-31)/236 */
            height: 78%;
            object-fit: cover;
            object-position: top;
            z-index: 3;
            clip-path: polygon(8% 0%, 100% 0%, 100% 100%, 0% 100%, 0% 8%);
            opacity: 1;
        }
        .char-card > img.img-loaded { opacity: 1; }

        .char-name {
            position: absolute;
            bottom: 7.1%;   /* matches 19px bottom border */
            left: 13.1%;    /* matches x=31 inner start */
            right: 2.1%;    /* matches x=231 inner end */
            height: 17%;
            background: rgba(0, 0, 0, 0.88);
            color: #ddd;
            font-size: 10px;
            text-align: center;
            display: flex;
            align-items: center;
            justify-content: center;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            padding: 0 4px;
            z-index: 4;
            border-radius: 1px;
            clip-path: polygon(0% 0%, 100% 0%, 100% 75%, 91% 100%, 0% 100%);
        }

        .tier-badge {
            position: absolute;
            top: 2px;
            right: 6px;
            width: 30px;
            height: 30px;
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 10;
        }

        .tier-badge img {
            width: 100%;
            height: 100%;
            object-fit: contain;
            filter: drop-shadow(0 1px 3px rgba(0,0,0,0.7));
        }


        /* Hide any image with empty or missing src — Safari doesn't fire error events for these */
        img[src=""], img:not([src]) {
            opacity: 0 !important;
            pointer-events: none;
        }

        /* Support type badge — sits directly below the tier badge (top-right) */
        .support-type-badge {
            position: absolute;
            top: 34px;
            right: 6px;
            width: 26px;
            height: 26px;
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 10;
        }
        .support-type-badge img {
            width: 100%;
            height: 100%;
            object-fit: contain;
            filter: drop-shadow(0 1px 3px rgba(0,0,0,0.8));
        }


        /* CHARACTER MODAL */
        .modal-overlay {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(0, 0, 0, 0.7);
            backdrop-filter: blur(4px);
            z-index: 2000;
            align-items: center;
            justify-content: center;
        }

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

        /* ══════════════════════════════════════════
           NINJA INFO CARD MODAL
        ══════════════════════════════════════════ */
        .modal-content {
            position: relative;
            background: #0d0d0f;
            border: none;
            border-radius: 6px;
            padding: 0;
            width: 660px;
            min-height: 780px;
            max-width: calc(var(--cw) * 0.98);
            max-height: calc(var(--ch) * 0.95);
            overflow: hidden;
            box-shadow: 0 0 80px rgba(0,0,0,0.95);
            animation: slideIn 0.3s ease;
            display: flex;
            flex-direction: column;
        }

        /* Map fills entire card bg */
        .modal-portrait-map {
            position: absolute;
            inset: 0;
            background-size: cover;
            background-position: center;
            filter: brightness(0.35) saturate(0.6);
            z-index: 0;
        }

        /* Card border overlay */
        .modal-card-border {
            position: absolute;
            inset: 0;
            background: url('../ui/BG texture/CardBorder.webp') center/100% 100% no-repeat;
            pointer-events: none;
            z-index: 30;
        }

        @keyframes slideIn {
            from { opacity: 0; transform: scale(0.92); }
            to   { opacity: 1; transform: scale(1); }
        }

        .modal-close {
            position: absolute;
            top: 10px; right: 10px;
            width: 36px; height: 36px;
            background: none;
            border: none;
            padding: 0;
            cursor: pointer;
            display: flex; align-items: center; justify-content: center;
            transition: transform 0.15s, filter 0.15s;
            z-index: 40;
        }
        .modal-close img {
            width: 100%; height: 100%;
            object-fit: contain;
            filter: drop-shadow(0 0 4px rgba(0,0,0,0.8));
        }
        .modal-close:hover { transform: scale(1.12); filter: brightness(1.25); }

        /* ── TOP ROW: portrait (top-left) + name block (right) ── */
        .modal-top-row {
            position: relative;
            z-index: 10;
            display: flex;
            flex-direction: row;
            gap: 20px;
            padding: 28px 28px 16px;
            border-bottom: 1px solid rgba(255,115,0,0.2);
        }

        /* Portrait frame — top left, smaller */
        .modal-portrait-frame-wrap {
            position: relative;
            width: 160px;
            height: 190px;
            flex-shrink: 0;
        }
        .modal-portrait-frame-wrap img.char-img {
            width: 100%; height: 100%;
            object-fit: cover;
            object-position: top center;
            display: block;
            border-radius: 2px;
        }
        .modal-portrait-frame-overlay {
            position: absolute;
            inset: 0;
            background: url('../ui/BG texture/portraitframe.webp') center/100% 100% no-repeat;
            pointer-events: none;
            z-index: 2;
        }

        /* Name + meta (right of portrait) */
        .modal-header {
            flex: 1;
            display: flex;
            flex-direction: column;
            justify-content: center;
            gap: 8px;
        }
        .modal-name {
            font-family: 'S4Fonts', sans-serif;
            font-size: 26px;
            color: #ffd700;
            text-shadow: 0 0 14px rgba(255,115,0,0.5);
            line-height: 1.1;
        }
        .modal-subtitle {
            font-size: 11px;
            color: #ff7300;
            text-transform: uppercase;
            letter-spacing: 2px;
        }
        .modal-tier-support-row {
            display: flex;
            align-items: center;
            gap: 10px;
            margin-top: 4px;
        }
        .modal-tier-support-row .modal-tier-badge img {
            width: 46px; height: 46px;
            object-fit: contain;
            filter: drop-shadow(0 0 8px rgba(255,180,0,0.5));
        }
        .modal-tier-support-row .divider { color: #444; font-size: 16px; }
        .modal-tier-support-row .modal-support-type { display: flex; align-items: center; gap: 6px; }
        .modal-tier-support-row .modal-support-type img { width: 24px; height: 24px; object-fit: contain; }
        .modal-tier-support-row .modal-support-type span {
            color: #aaa; font-size: 10px; letter-spacing: 1.5px;
            text-transform: uppercase; font-family: 'S4Fonts', sans-serif;
        }

        /* ── INFO FIELDS (like the card fields in the show) ── */
        .modal-fields {
            position: relative;
            z-index: 10;
            padding: 16px 28px;
            display: flex;
            flex-direction: column;
            gap: 8px;
            border-bottom: 1px solid rgba(255,115,0,0.15);
        }
        .modal-field-row {
            display: flex;
            align-items: baseline;
            gap: 10px;
        }
        .modal-field-label {
            font-family: 'S4Fonts', sans-serif;
            font-size: 11px;
            color: #ff7300;
            letter-spacing: 1.5px;
            text-transform: uppercase;
            min-width: 90px;
            flex-shrink: 0;
        }
        .modal-field-value {
            font-size: 13px;
            color: #ccc;
            line-height: 1.6;
        }

        /* ── BOTTOM ROW: abilities (left) + tools (right) ── */
        .modal-bottom-row {
            position: relative;
            z-index: 35;
            display: flex;
            flex-direction: row;
            gap: 0;
            flex: 1;
            padding: 16px 28px 24px;
        }

        /* Abilities column */
        .modal-abilities-col {
            display: flex;
            flex-direction: column;
            gap: 8px;
            min-width: 196px;
            flex-shrink: 0;
            position: relative;
            left: -12px;
        }
        .modal-section-title {
            font-family: 'S4Fonts', sans-serif;
            font-size: 10px;
            color: #e8c97a;
            text-transform: uppercase;
            letter-spacing: 2px;
            margin-bottom: 6px;
            width: 200px;
            height: 35px;
            background: url('../ui/BG texture/Subheadertabs.webp') center/100% 100% no-repeat;
            display: flex;
            align-items: center;
            justify-content: center;
            text-shadow: 0 1px 3px rgba(0,0,0,0.8);
            position: relative;
        }
        .modal-abilities {
            display: grid;
            grid-template-columns: repeat(2, 92px);
            gap: 8px;
        }
        .modal-ability-frame {
            width: 92px; height: 90px;
            position: relative;
            display: flex; align-items: center; justify-content: center;
        }
        /* Ability image — natural size, already circular with transparency */
        .modal-ability-frame img {
            width: 82px; height: 82px;
            object-fit: contain;
            position: absolute;
            top: calc(50% + 1px); left: calc(50% - 2px);
            transform: translate(-50%, -50%);
            z-index: 0;
        }
        /* Border ring overlaid on top at its natural dimensions */
        .modal-ability-frame::after {
            content: '';
            position: absolute;
            top: 50%; left: 50%;
            transform: translate(-50%, -50%);
            width: 92px; height: 90px;
            background: url('../duel_items/Item Frame/Item frame boarder.webp') center/100% 100% no-repeat;
            pointer-events: none;
            z-index: 1;
        }
        .modal-ability-frame.empty { opacity: 0.2; }

        /* Divider between columns */
        .modal-col-divider {
            width: 1px;
            background: rgba(255,115,0,0.15);
            margin: 0 20px;
            flex-shrink: 0;
        }

        /* Tools column */
        .modal-tools { flex: 1; }
        .modal-tools-header { margin-bottom: 10px; }
        .modal-tools-title {
            font-family: 'S4Fonts', sans-serif;
            font-size: 10px;
            font-weight: 700;
            color: #ff7300;
            text-transform: uppercase;
            letter-spacing: 2px;
        }


        .tool-select-edit {
            background: #111;
            border: 1px solid #444;
            border-radius: 4px;
            padding: 5px 8px;
            color: #ddd;
            font-size: 12px;
            flex: 1;
            cursor: pointer;
            transition: border-color 0.2s;
        }

        .tool-select-edit:focus {
            outline: none;
            border-color: #ff7300;
        }

        .tool-select-edit option {
            background: #111;
            color: #ddd;
        }

        .tool-slot {
            display: flex;
            gap: 12px;
            margin-bottom: 12px;
            align-items: center;
        }

        .tool-icon {
            width: 50px;
            height: 50px;
            background: #111;
            border: 1px solid #333;
            border-radius: 4px;
            display: flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
            overflow: hidden;
        }

        .tool-icon img {
            width: 100%;
            height: 100%;
            object-fit: contain;
            padding: 4px;
        }

        .tool-name {
            font-size: 13px;
            color: #ccc;
            flex: 1;
        }

        /* TIER LIST */
        .tier-list {
            padding: 40px;
            max-width: 2200px;
            margin: 0 auto;
        }

        .tier-row {
            display: flex;
            gap: 20px;
            margin-bottom: 25px;
            align-items: flex-start;
        }

        .tier-label {
            min-width: 70px;
            height: 100px;
            display: flex;
            align-items: center;
            justify-content: center;
            background: transparent;
            border: none;
        }

        .tier-label img {
            width: 62px;
            height: 62px;
            object-fit: contain;
            filter: drop-shadow(0 0 10px rgba(255, 200, 0, 0.4));
        }

        .tier-row-untiered .tier-label img {
            filter: drop-shadow(0 0 6px rgba(120, 120, 140, 0.4));
            opacity: 0.85;
        }

        .tier-row-untiered .tier-chars {
            opacity: 0.75;
        }

        .tier-chars {
            display: flex;
            gap: 10px;
            flex-wrap: wrap;
            flex: 1;
            align-items: flex-start;
            min-height: 100px;
            padding: 6px 80px 6px 6px;
            border-radius: 4px;
            transition: background 0.15s, border 0.15s;
            border: 2px solid transparent;
        }

        .tier-chars.drag-over {
            background: rgba(255, 115, 0, 0.12);
            border: 2px solid rgba(255, 115, 0, 0.6);
            box-shadow: inset 0 0 20px rgba(255, 115, 0, 0.08);
        }

        .drop-indicator {
            width: 5px;
            height: 113px;
            background: linear-gradient(180deg, #ffcc00, #ff7300, #ffcc00);
            border-radius: 3px;
            flex-shrink: 0;
            pointer-events: none;
            align-self: center;
            animation: indicator-pulse 0.7s ease-in-out infinite;
        }

        .tier-char-card {
            cursor: grab;
            width: 100px;
            height: 113px; /* preserves 236:266 ratio at 100px wide */
            background: url('../characters/Character frames/bg ico.webp') center center / 100% 100% no-repeat;
            border: none;
            border-radius: 2px;
            position: relative;
            transition: transform 0.15s, opacity 0.15s, filter 0.15s;
            user-select: none;
        }

        .tier-char-card::after {
            content: '';
            position: absolute;
            inset: 0;
            background: url('../characters/Character frames/img_frame.webp') center center / 100% 100% no-repeat;
            pointer-events: none;
            z-index: 5;
            transition: filter 0.15s ease;
        }

        .tier-char-card:hover {
            transform: translateY(-4px) scale(1.05);
            z-index: 10;
        }

        .tier-char-card:hover::after {
            filter: drop-shadow(0 0 8px rgba(255, 210, 0, 1)) drop-shadow(0 0 18px rgba(255, 140, 0, 0.7));
        }

        .tier-char-card:active {
            cursor: grabbing;
            transform: translateY(-4px) scale(1.08);
        }

        .tier-char-card.dragging {
            opacity: 0.25;
            transform: scale(0.95);
            filter: grayscale(0.5);
        }

        @keyframes indicator-pulse {
            0%, 100% { opacity: 1; box-shadow: 0 0 10px rgba(255,115,0,0.9), 0 0 20px rgba(255,115,0,0.4); }
            50%       { opacity: 0.6; box-shadow: 0 0 6px rgba(255,115,0,0.5), 0 0 12px rgba(255,115,0,0.2); }
        }

        .tier-char-card img {
            position: absolute;
            top: 1.9%;
            left: 13.1%;
            width: 84.8%;
            height: 74%;
            object-fit: cover;
            object-position: top;
            z-index: 3;
            clip-path: polygon(8% 0%, 100% 0%, 100% 100%, 0% 100%, 0% 8%);
        }

        .tier-char-name {
            position: absolute;
            bottom: 7.1%;
            left: 13.1%;
            right: 2.1%;
            height: 17%;
            background: rgba(0, 0, 0, 0.88);
            color: #ccc;
            font-size: 8px;
            text-align: center;
            display: flex;
            align-items: center;
            justify-content: center;
            flex-direction: column;
            overflow: hidden;
            white-space: nowrap;
            text-overflow: ellipsis;
            padding: 0 3px;
            z-index: 4;
            border-radius: 1px;
            clip-path: polygon(0% 0%, 100% 0%, 100% 75%, 91% 100%, 0% 100%);
        }

        /* ABOUT */
        #about {
            position: relative;
        }

        .about-standee {
            position: absolute;
            right: 0;
            bottom: 0;
            height: 95%;
            max-height: 900px;
            width: auto;
            object-fit: contain;
            object-position: bottom right;
            pointer-events: none;
            filter: drop-shadow(-8px 0 30px rgba(0,0,0,0.6));
            opacity: 0.92;
            z-index: 0;
        }

        .about-container {
            max-width: 1200px;
            margin: 0 auto;
            padding: 40px 40px;
            display: flex;
            flex-direction: column;
            gap: 40px;
        }

        .about-section {
            border-left: 3px solid #ff7300;
            padding-left: 24px;
        }

        .about-section-title {
            font-family: 'S4Fonts', sans-serif;
            font-size: 20px;
            color: #ffd700;
            text-shadow: 0 0 10px rgba(255, 115, 0, 0.6);
            letter-spacing: 2px;
            text-transform: uppercase;
            margin-bottom: 18px;
        }

        .about-section-body {
            color: #bbb;
            font-size: 14px;
            line-height: 1.8;
        }

        .about-section-body p {
            margin: 0 0 12px;
        }

        .about-section-body strong {
            color: #eee;
        }

        .about-section-body em {
            color: #ff9a40;
            font-style: normal;
        }

        .about-guide-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
            gap: 16px;
            margin-top: 6px;
        }

        .about-guide-card {
            background: rgba(255,255,255,0.03);
            border: 1px solid rgba(255,255,255,0.07);
            border-radius: 8px;
            padding: 20px 16px;
            display: flex;
            flex-direction: column;
            gap: 8px;
            transition: border-color 0.2s, background 0.2s;
        }

        .about-guide-card:hover {
            border-color: rgba(255, 115, 0, 0.4);
            background: rgba(255, 115, 0, 0.05);
        }

        .about-guide-icon {
            font-size: 22px;
        }

        .about-guide-label {
            font-family: 'S4Fonts', sans-serif;
            font-size: 13px;
            color: #ffd700;
            letter-spacing: 1px;
        }

        .about-guide-desc {
            font-size: 12px;
            color: #999;
            line-height: 1.6;
        }

        .about-credits-list {
            display: flex;
            flex-direction: column;
            gap: 12px;
        }

        .about-credit-row {
            display: flex;
            gap: 20px;
            align-items: center;
            border-bottom: 1px solid rgba(255,255,255,0.05);
            padding-bottom: 10px;
        }

        .about-credit-role {
            font-family: 'S4Fonts', sans-serif;
            font-size: 11px;
            color: #ff7300;
            letter-spacing: 1px;
            text-transform: uppercase;
            min-width: 130px;
            flex-shrink: 0;
        }

        .about-credit-name {
            font-size: 13px;
            color: #ccc;
        }

        .about-contact-row {
            display: flex;
            align-items: center;
            gap: 16px;
            margin-top: 10px;
        }

        .about-contact-label {
            font-family: 'S4Fonts', sans-serif;
            font-size: 11px;
            color: #ff7300;
            letter-spacing: 1px;
            text-transform: uppercase;
            min-width: 60px;
        }

        .about-contact-link {
            color: #d6c6e8;
            text-decoration: none;
            font-size: 13px;
            transition: color 0.2s;
        }

        .about-contact-link:hover {
            color: #fff;
            text-decoration: underline;
        }

        .about-contact-name {
            color: #d6c6e8;
            font-size: 13px;
        }

        .about-edit-bar {
            display: flex;
            align-items: center;
            gap: 16px;
            margin-bottom: 10px;
        }

        .about-edit-btn {
            padding: 7px 18px;
            background: transparent;
            border: 1px solid rgba(255, 115, 0, 0.4);
            border-radius: 4px;
            color: #ff7300;
            cursor: pointer;
            font-family: 'S4Fonts', sans-serif;
            font-size: 12px;
            letter-spacing: 1px;
            transition: all 0.2s;
        }

        .about-edit-btn:hover {
            background: rgba(255, 115, 0, 0.1);
            border-color: #ff7300;
        }

        .about-edit-btn.saving {
            border-color: #4caf50;
            color: #4caf50;
        }

        .about-edit-hint {
            font-size: 12px;
            color: #666;
            font-style: italic;
        }

        .about-add-row-btn {
            display: none;
            align-items: center;
            gap: 8px;
            margin-top: 12px;
            padding: 6px 16px;
            background: transparent;
            border: 1px dashed rgba(155, 127, 212, 0.45);
            border-radius: 4px;
            color: #888;
            cursor: pointer;
            font-family: 'S4Fonts', sans-serif;
            font-size: 11px;
            letter-spacing: 1px;
            transition: all 0.2s;
            width: fit-content;
        }

        .about-add-row-btn:hover {
            border-color: #9b7fd4;
            color: #9b7fd4;
            background: rgba(155, 127, 212, 0.08);
        }

        .about-del-row-btn {
            display: none;
            background: none;
            border: 1px solid transparent;
            color: #555;
            cursor: pointer;
            font-size: 15px;
            line-height: 1;
            margin-left: auto;
            padding: 2px 7px;
            border-radius: 3px;
            transition: color 0.2s, border-color 0.2s;
            flex-shrink: 0;
        }

        .about-del-row-btn:hover {
            color: #ff4444;
            border-color: rgba(255, 68, 68, 0.4);
        }

        /* Dynamic about blocks */
        .about-block-toolbar {
            display: flex;
            gap: 10px;
            padding: 0 40px 24px;
        }

        .about-block-wrap {
            position: relative;
            padding: 0 40px;
            margin-bottom: 6px;
        }

        .about-block-wrap .about-del-row-btn {
            position: absolute;
            top: 50%;
            right: 12px;
            transform: translateY(-50%);
            display: none;
        }

        .about-block-heading {
            font-size: 1.15em;
            font-weight: 700;
            color: #d6c6e8;
            margin: 18px 0 6px;
            letter-spacing: .04em;
        }

        .about-block-para {
            color: rgba(255,255,255,0.8);
            line-height: 1.75;
            margin: 0 0 4px;
        }

        [data-about-key][contenteditable="true"] {
            outline: 1px dashed rgba(255, 115, 0, 0.5);
            border-radius: 3px;
            padding: 2px 4px;
            min-width: 20px;
            cursor: text;
            transition: outline 0.15s, background 0.15s;
        }

        [data-about-key][contenteditable="true"]:hover {
            outline: 1px dashed rgba(255, 115, 0, 0.9);
            background: rgba(255, 115, 0, 0.05);
        }

        [data-about-key][contenteditable="true"]:focus {
            outline: 1px solid #ff7300;
            background: rgba(255, 115, 0, 0.08);
        }

        /* ALL TOOLS */
        .tools-grid-scroll {
            overflow-x: auto;
            padding: 16px 4px 16px;
        }

        .tools-grid {
            display: flex;
            flex-direction: row;
            flex-wrap: wrap;
            justify-content: center;
            gap: 20px;
            overflow: visible;
            min-width: max-content;
        }

        .tool-card {
            background: url('../ui/BG texture/Border for Items cards.webp') center / 100% 100% no-repeat;
            border: none;
            border-radius: 0;
            outline: 2px solid #ff7300;
            padding: 10px 8px 14px;
            text-align: center;
            cursor: pointer;
            transition: filter 0.2s, transform 0.2s;
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 5px;
            flex: 0 0 auto;
            width: 80px;
            height: 110px;
        }

        .tool-card:hover {
            filter: brightness(1.2) drop-shadow(0 0 8px rgba(255, 115, 0, 0.6));
            transform: translateY(-2px);
        }

        .tool-card-icon {
            width: 50px;
            height: 50px;
            background: #0a0a0a;
            border: 1px solid #333;
            border-radius: 4px;
            display: flex;
            align-items: center;
            justify-content: center;
            overflow: hidden;
        }

        .tool-card-icon img {
            width: 100%;
            height: 100%;
            object-fit: contain;
            padding: 3px;
        }

        .tool-card-name {
            font-size: 9px;
            color: #ddd;
            word-break: break-word;
            line-height: 1.2;
        }

        /* TOOL DETAIL PANEL */
        .tool-detail-panel {
            position: fixed;
            right: -400px;
            top: 70px;
            width: 400px;
            height: calc(var(--ch) - 70px);
            background: url('../ui/BG texture/Item_bg_expanded.webp') center/cover no-repeat, #0a0a0a;
            border-left: 2px solid #ff7300;
            padding: 30px;
            transition: right 0.3s ease;
            overflow-y: auto;
            z-index: 1500;
            box-shadow: -5px 0 30px rgba(255, 115, 0, 0.2);
        }

        .tool-detail-panel.active {
            right: 0;
        }

        .tool-detail-close {
            position: absolute;
            top: 15px;
            right: 15px;
            width: 32px;
            height: 32px;
            background: none;
            border: none;
            padding: 0;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: transform 0.15s, filter 0.15s;
        }

        .tool-detail-close:hover {
            transform: scale(1.12);
            filter: brightness(1.25);
        }

        .tool-detail-icon {
            width: 100px;
            height: 106px;
            background: transparent;
            border: none;
            position: relative;
            margin: 0 auto 20px;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .tool-detail-icon img {
            width: 75px;
            height: 75px;
            object-fit: contain;
            position: relative;
            z-index: 0;
        }

        .tool-detail-icon::after {
            content: '';
            position: absolute;
            top: 50%; left: 50%;
            transform: translate(-50%, -50%);
            width: 100px;
            height: 106px;
            background: url('../ui/BG texture/itemborder2.webp') center/100% 100% no-repeat;
            pointer-events: none;
            z-index: 1;
        }

        .tool-detail-name {
            font-family: 'S4Fonts', sans-serif;
            font-size: 20px;
            font-weight: 700;
            color: #ffd700;
            text-align: center;
            margin-bottom: 20px;
            text-shadow: 0 0 8px rgba(255, 115, 0, 0.3);
        }

        .tool-detail-section {
            margin-bottom: 20px;
        }

        .tool-detail-section-title {
            font-family: 'S4Fonts', sans-serif;
            font-size: 13px;
            font-weight: 700;
            color: #ff7300;
            text-transform: uppercase;
            letter-spacing: 1px;
            margin-bottom: 10px;
            border-bottom: 1px solid rgba(214, 198, 232, 0.2);
            padding-bottom: 8px;
        }

        .used-by-list {
            display: flex;
            flex-direction: column;
            gap: 8px;
        }

        .used-by-item {
            padding: 8px 12px;
            background: #111;
            border: 1px solid #333;
            border-radius: 4px;
            font-size: 12px;
            color: #ccc;
            cursor: pointer;
            transition: all 0.2s;
        }

        .used-by-item:hover {
            border-color: #ff7300;
            background: #0d0d0d;
            color: #ffd700;
        }

        /* ALL TOOLS MODAL */
        .all-tools-modal {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(0, 0, 0, 0.8);
            backdrop-filter: blur(4px);
            z-index: 2100;
            align-items: center;
            justify-content: center;
        }

        .all-tools-modal.active {
            display: flex;
        }

        .all-tools-modal-content {
            background: #0a0a0a;
            border: 2px solid #ff7300;
            border-radius: 8px;
            padding: 30px;
            width: 90%;
            max-width: 900px;
            max-height: calc(var(--ch) * 0.85);
            overflow-y: auto;
            box-shadow: 0 0 40px rgba(255, 115, 0, 0.3);
            animation: slideIn 0.3s ease;
        }

        .all-tools-modal-close {
            position: absolute;
            top: 20px;
            right: 20px;
            width: 36px;
            height: 36px;
            background: none;
            border: none;
            padding: 0;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: transform 0.15s, filter 0.15s;
        }

        .all-tools-modal-close:hover {
            transform: scale(1.12);
            filter: brightness(1.25);
        }

        .all-tools-modal-title {
            font-family: 'S4Fonts', sans-serif;
            font-size: 32px;
            font-weight: 700;
            color: #ffd700;
            margin-bottom: 20px;
            text-shadow: 0 0 10px rgba(255, 115, 0, 0.3);
            text-align: center;
            text-transform: uppercase;
            letter-spacing: 2px;
        }

        .all-tools-modal-search {
            margin-bottom: 25px;
        }

        .all-tools-modal-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
            gap: 12px;
        }

        /* SCROLLBAR STYLING */
        ::-webkit-scrollbar {
            width: 8px;
            height: 8px;
        }

        ::-webkit-scrollbar-track {
            background: #0a0a0a;
        }

        ::-webkit-scrollbar-thumb {
            background: #ff7300;
            border-radius: 4px;
        }

        ::-webkit-scrollbar-thumb:hover {
            background: #ffd700;
        }

        /* No small-window rules here on purpose: the page is scaled as one piece
           (assets/js/canvas.js), so it never needs to re-arrange for a narrow window. */

/* ── PAGE FADE TRANSITION ──────────────────────────────────────────────── */
/* Set html background so browser never flashes white between page loads */
html {
    background-color: #0a0a0a;
}
/* Page transitions — body starts hidden, JS adds .page-ready to fade in */
body {
    opacity: 0.08;
    transition: opacity 0.18s ease;
}
body.page-ready {
    opacity: 1;
}
/* Hold every animation until the page is shown, so nothing plays unseen or
   stutters while the page is still loading. */
body:not(.page-ready) *,
body:not(.page-ready) *::before,
body:not(.page-ready) *::after {
    animation-play-state: paused !important;
}
body.fade-out {
    opacity: 0.08;
    transition: opacity 0.15s ease;
}
