:root {
            --gold: #cfb53b;
            --gold-glow: #ffd700;
            --parchment: #eaddcf;
            --border-color: #5c4033;
            --primary-gold: #ffd700;
            --secondary-gold: #c5a000;
            --magic-blue: #00d2ff;
            --bg-dark: #050510;
            --glass-bg: rgba(12, 12, 20, 0.85);
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            overflow: hidden;
            background: #000;
            font-family: 'MedievalSharp', cursive;
            color: var(--parchment);
        }

        /* --- 3D Canvas --- */
        #canvas-container {
            position: fixed;
            inset: 0;
            z-index: 1;
        }

        /* --- UI Layer --- */
        #ui-layer {
            position: fixed;
            inset: 0;
            z-index: 10;
            pointer-events: none;
            display: flex;
            flex-direction: column;
            opacity: 0;
            transition: opacity 1s ease;
        }

        /* --- Sound Control --- */
        #sound-control {
            position: absolute;
            top: 20px;
            right: 20px;
            pointer-events: auto;
            border: 2px solid var(--gold);
            background: rgba(0, 0, 0, 0.7);
            color: var(--gold);
            padding: 10px;
            cursor: pointer;
            font-family: 'Cinzel', serif;
            font-weight: bold;
            transition: 0.3s;
            z-index: 30;
            user-select: none;
        }

        #sound-control:hover {
            box-shadow: 0 0 10px var(--gold-glow);
            text-shadow: 0 0 5px var(--gold-glow);
        }

        /* --- Header --- */
        header {
            padding: 2rem;
            pointer-events: auto;
            background: linear-gradient(to bottom, rgba(0, 0, 0, 0.9), transparent);
        }

        h1 {
            font-family: 'Cinzel', serif;
            font-size: 3.5rem;
            color: var(--magic-blue);
            text-shadow: 2px 2px 0px #000, 0 0 15px rgba(255, 215, 0, 0.5);
            letter-spacing: 2px;
        }

        .class-title {
            font-size: 1.2rem;
            color: #aaa;
            letter-spacing: 1px;
            margin-top: 5px;
        }

        /* --- RPG Menu (Left Side) --- */
        nav {
            position: absolute;
            left: 50px;
            top: 50%;
            transform: translateY(-50%);
            pointer-events: auto;
            width: 300px;
        }

        .menu-border {
            border: 3px double var(--gold);
            background: rgba(18, 18, 24, 0.9);
            padding: 5px;
            box-shadow: 0 0 20px rgba(0, 0, 0, 0.8);
            clip-path: polygon(0% 0%, 100% 0%, 100% 100%, 0% 100%, 0% 20px, 20px 0%);
        }

        .menu-inner {
            border: 1px solid #444;
            padding: 20px;
        }

        .nav-item {
            display: block;
            padding: 15px 10px;
            margin: 10px 0;
            color: #888;
            text-decoration: none;
            font-size: 1.3rem;
            transition: all 0.2s ease;
            cursor: pointer;
            border-bottom: 1px solid rgba(255, 255, 255, 0.1);
            position: relative;
            user-select: none;
        }

        .nav-item:hover {
            color: var(--gold-glow);
            padding-left: 20px;
            background: linear-gradient(90deg, rgba(207, 181, 59, 0.1), transparent);
        }

        .nav-item::before {
            content: '◆';
            position: absolute;
            left: -15px;
            opacity: 0;
            color: var(--gold);
            transition: 0.2s;
        }

        .nav-item:hover::before {
            opacity: 1;
            left: 0;
        }

        .nav-item.is-active {
            color: var(--gold-glow);
            padding-left: 20px;
            background: linear-gradient(90deg, rgba(207, 181, 59, 0.18), transparent);
        }

        .nav-item.is-active::before {
            opacity: 1;
            left: 0;
        }

        /* --- Content Panel (Right Side) --- */
        #quest-panel {
            position: absolute;
            right: 50px;
            top: 45%;
            transform: translateY(-50%) translateX(20px) scale(0.98);
            width: 35%;
            max-width: 90vw;

            background: rgba(20, 15, 10, 0.95);
            border: 2px solid var(--border-color);
            box-shadow: 0 0 30px #000;
            background-image: repeating-linear-gradient(0deg, transparent, transparent 19px, rgba(0, 0, 0, 0.1) 20px);

            max-height: min(70vh, 640px);
            overflow: hidden;

            opacity: 0;
            pointer-events: none;
            transition: opacity 240ms ease, transform 240ms ease;
        }

        #quest-panel.is-open {
            opacity: 1;
            transform: translateY(-50%) translateX(0) scale(1);
            pointer-events: auto;
        }

        #quest-panel .panel-topbar {
            position: sticky;
            top: 0;
            z-index: 2;
            padding: 1.25rem 1.5rem 1rem;
            background: rgba(20, 15, 10, 0.97);
            border-bottom: 2px solid var(--border-color);
            backdrop-filter: blur(2px);
        }

        #quest-title {
            font-family: 'Cinzel', serif;
            color: var(--gold);
            margin: 0;
            padding-right: 50px;
        }

        .close-btn {
            position: absolute;
            right: 16px;
            top: 16px;
            background: #332222;
            border: 1px solid #663333;
            color: #cc8888;
            padding: 6px 12px;
            cursor: pointer;
            pointer-events: auto;
        }

        .close-btn:hover {
            background: #552222;
            color: #fff;
        }

        #quest-body {
            padding: 1.25rem 1.5rem 1.5rem;
            overflow-y: auto;
            max-height: calc(min(70vh, 640px) - 70px);
        }

        #quest-body ul {
            padding-left: 1.2rem;
        }

        #quest-body li {
            margin: 0.4rem 0;
        }

        #quest-body strong {
            color: #f0e0b0;
        }

        /* --- Start Screen Overlay --- */
        #start-screen {
            position: fixed;
            z-index: 100;
            width: 100%;
            height: 100%;
            background: #000000;
            background: linear-gradient(90deg, rgba(0, 0, 0, 0.5) 0%, rgba(0, 0, 0, 0.5) 100%);
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            transition: opacity 1s ease;
        }

        .start-btn {
            padding: 15px 40px;
            font-size: 1.5rem;
            font-family: 'Cinzel', serif;
            background: transparent;
            color: var(--magic-blue);
            border: 2px solid var(--magic-blue);
            cursor: pointer;
            transition: all 0.3s;
            text-transform: uppercase;
            box-shadow: 0 0 15px var(--magic-blue);
        }

        .start-btn:hover {
            background: var(--magic-blue);
            color: black;
            box-shadow: 0 0 30px var(--magic-blue);
        }

        /* Mobile */
        @media (max-width: 768px) {
            h1 {
                font-size: 2rem;
            }

            nav {
                left: 0;
                bottom: 0;
                top: auto;
                width: 100%;
                transform: none;
            }

            .menu-border {
                clip-path: none;
                border-left: none;
                border-right: none;
            }

            .menu-inner {
                display: flex;
                overflow-x: auto;
                padding: 10px;
            }

            .nav-item {
                flex: 0 0 auto;
                margin: 0 10px;
                font-size: 1rem;
                border: none;
            }

            /* Make panel fit the visible screen area */
            #quest-panel {
                left: 5%;
                right: 5%;
                top: 19%;
                width: auto;
                transform: none;

                max-height: calc(100dvh - 23% - 92px - env(safe-area-inset-bottom));
                display: flex;
                flex-direction: column;
            }

            #quest-panel.is-open {
                transform: none;
            }

            /* Make inner body scroll correctly based on available height */
            #quest-body {
                flex: 1 1 auto;
                min-height: 0;
                overflow-y: auto;
            }
        }

        /* ===== Scrollbar CSS ===== */
        /* Firefox */
        * {
            scrollbar-width: auto;
            scrollbar-color: #59126d #ffffff;
        }

        /* Chrome, Edge, and Safari */
        *::-webkit-scrollbar {
            width: 16px;
        }

        *::-webkit-scrollbar-track {
            background: #ffffff;
        }

        *::-webkit-scrollbar-thumb {
            background-color: #59126d;
            border-radius: 10px;
            border: 3px none #ffffff;
        }

        .skill-section {
            margin-bottom: 1.6rem;
        }

        .skill-section h3 {
            font-family: 'Cinzel', serif;
            color: var(--gold);
            font-size: 1.1rem;
            margin-bottom: 0.5rem;
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .skill-list {
            list-style: none;
            padding-left: 0;
        }

        .skill-list li {
            padding: 6px 0;
            display: flex;
            align-items: center;
            gap: 10px;
            color: #e0d8c8;
        }

        .skill-list i {
            color: var(--gold-glow);
            min-width: 18px;
        }

        .log-block {
            margin-bottom: 1.6rem;
        }

        .log-block h3 {
            font-family: 'Cinzel', serif;
            color: var(--gold);
            font-size: 1.12rem;
            margin-bottom: 0.7rem;
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .log-entry {
            border-left: 2px solid rgba(207, 181, 59, 0.35);
            padding-left: 12px;
            margin: 0.9rem 0;
            position: relative;
        }

        .log-entry::before {
            content: "";
            position: absolute;
            left: -6px;
            top: 6px;
            width: 10px;
            height: 10px;
            background: rgba(255, 215, 0, 0.75);
            border: 2px solid rgba(0, 0, 0, 0.35);
            border-radius: 50%;
            box-shadow: 0 0 10px rgba(255, 215, 0, 0.25);
        }

        .log-title {
            display: flex;
            justify-content: space-between;
            gap: 10px;
            align-items: baseline;
        }

        .log-time {
            color: rgba(255, 255, 255, 0.65);
            font-size: 0.92rem;
            white-space: nowrap;
        }

        .log-sub {
            color: rgba(255, 255, 255, 0.6);
            margin-top: 4px;
            margin-bottom: 8px;
            font-size: 0.95rem;
        }

        .pill-grid {
            display: flex;
            flex-wrap: wrap;
            gap: 10px;
        }

        .pill {
            display: inline-flex;
            align-items: center;
            gap: 8px;
            padding: 8px 10px;
            border: 1px solid rgba(207, 181, 59, 0.28);
            background: rgba(0, 0, 0, 0.18);
            border-radius: 999px;
            color: #e9dfc9;
            font-size: 0.95rem;
        }

        .resume-top {
            margin-bottom: 1rem;
        }

        .resume-name {
            font-family: 'Cinzel', serif;
            color: var(--gold);
            margin: 0;
            font-size: 1.4rem;
        }

        .resume-sub {
            color: rgba(255, 255, 255, 0.7);
            margin-top: 4px;
        }

        .resume-tags {
            display: flex;
            flex-wrap: wrap;
            gap: 10px;
            margin-top: 10px;
        }

        .badge {
            display: inline-flex;
            align-items: center;
            gap: 8px;
            padding: 7px 10px;
            border: 1px solid rgba(207, 181, 59, 0.25);
            background: rgba(0, 0, 0, 0.18);
            border-radius: 999px;
            font-size: 0.92rem;
            color: #efe3c7;
        }

        .resume-block {
            margin: 1.4rem 0;
            padding-top: 0.2rem;
        }

        .resume-block h3 {
            font-family: 'Cinzel', serif;
            color: var(--gold);
            font-size: 1.1rem;
            margin-bottom: 0.7rem;
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .resume-grid {
            display: grid;
            grid-template-columns: repeat(2, minmax(0, 1fr));
            gap: 10px;
        }

        .resume-card {
            border: 1px solid rgba(255, 255, 255, 0.12);
            background: rgba(0, 0, 0, 0.18);
            border-radius: 12px;
            padding: 10px 12px;
        }

        .resume-card-title {
            color: rgba(255, 215, 0, 0.85);
            display: flex;
            align-items: center;
            gap: 8px;
            font-family: 'Cinzel', serif;
            font-size: 0.98rem;
            margin-bottom: 6px;
        }

        .resume-card-body {
            color: #e7dcc4;
            font-size: 0.95rem;
            line-height: 1.35;
        }

        .resume-line {
            border-left: 2px solid rgba(207, 181, 59, 0.35);
            padding-left: 12px;
            margin: 0.9rem 0;
            position: relative;
        }

        .resume-line::before {
            content: "";
            position: absolute;
            left: -6px;
            top: 6px;
            width: 10px;
            height: 10px;
            background: rgba(255, 215, 0, 0.75);
            border: 2px solid rgba(0, 0, 0, 0.35);
            border-radius: 50%;
            box-shadow: 0 0 10px rgba(255, 215, 0, 0.25);
        }

        .resume-line-top {
            display: flex;
            justify-content: space-between;
            gap: 10px;
            align-items: baseline;
        }

        .muted {
            color: rgba(255, 255, 255, 0.65);
            font-size: 0.92rem;
            white-space: nowrap;
        }

        @media (max-width: 768px) {
            .resume-grid {
                grid-template-columns: 1fr;
            }

            .muted {
                white-space: normal;
            }
        }

        .contact-wrap {
            display: flex;
            flex-direction: column;
            gap: 1.4rem;
        }

        .contact-block h3 {
            font-family: 'Cinzel', serif;
            color: var(--gold);
            font-size: 1.1rem;
            margin-bottom: 0.6rem;
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .contact-grid {
            display: grid;
            grid-template-columns: repeat(2, minmax(0, 1fr));
            gap: 10px;
            margin-top: 0.9rem;
        }

        .contact-card {
            border: 1px solid rgba(255, 255, 255, 0.12);
            background: rgba(0, 0, 0, 0.18);
            border-radius: 12px;
            padding: 10px 12px;
        }

        .contact-label {
            color: rgba(255, 215, 0, 0.85);
            display: flex;
            align-items: center;
            gap: 8px;
            font-family: 'Cinzel', serif;
            font-size: 0.95rem;
            margin-bottom: 6px;
        }

        .contact-value {
            color: #e7dcc4;
            font-size: 0.98rem;
            word-break: break-word;
        }

        .map-frame {
            border: 1px solid rgba(207, 181, 59, 0.28);
            border-radius: 14px;
            overflow: hidden;
            background: rgba(0, 0, 0, 0.18);
            box-shadow: 0 0 20px rgba(0, 0, 0, 0.35);
        }

        /* Make map responsive (fixed height but safe on mobile) */
        .map-frame iframe {
            display: block;
            width: 100%;
            height: 320px;
            /* desktop default */
            border: 0;
            filter: saturate(0.95) contrast(1.05);
        }

        /* Map height for bigger screens */
        @media (min-width: 900px) {
            .map-frame iframe {
                height: 420px;
            }
        }

        /* Mobile adjustments */
        @media (max-width: 768px) {
            .contact-grid {
                grid-template-columns: 1fr;
            }

            .map-frame iframe {
                height: 260px;
            }
        }

        .contact-note {
            margin-top: 10px;
            color: rgba(255, 255, 255, 0.7);
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .project-wrap {
            display: flex;
            flex-direction: column;
            gap: 1.2rem;
        }

        .project-intro {
            color: rgba(255, 255, 255, 0.75);
            margin-bottom: 0.6rem;
        }

        .project-card {
            border: 1px solid rgba(255, 255, 255, 0.12);
            background: rgba(0, 0, 0, 0.18);
            border-radius: 14px;
            padding: 14px 16px;
            box-shadow: inset 0 0 0 1px rgba(207, 181, 59, 0.06);
        }

        .project-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 10px;
            margin-bottom: 6px;
        }

        .project-header h3 {
            font-family: 'Cinzel', serif;
            color: var(--gold);
            font-size: 1.05rem;
            display: flex;
            align-items: center;
            gap: 10px;
            margin: 0;
        }

        .project-tag {
            font-size: 0.78rem;
            padding: 4px 10px;
            border-radius: 999px;
            border: 1px solid rgba(207, 181, 59, 0.35);
            color: #efe3c7;
            background: rgba(0, 0, 0, 0.25);
            white-space: nowrap;
        }

        .project-card p {
            margin: 8px 0;
            color: #e7dcc4;
        }

        .project-card ul {
            padding-left: 1.2rem;
            margin-top: 6px;
        }

        .project-card li {
            margin: 0.35rem 0;
            color: rgba(255, 255, 255, 0.75);
        }

        .project-grid {
            display: grid;
            grid-template-columns: repeat(2, minmax(0, 1fr));
            gap: 12px;
        }

        .project-tile {
            display: block;
            text-decoration: none;
            color: inherit;
            border: 1px solid rgba(255, 255, 255, 0.12);
            background: rgba(0, 0, 0, 0.16);
            border-radius: 14px;
            overflow: hidden;
            transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
            box-shadow: inset 0 0 0 1px rgba(207, 181, 59, 0.06);
        }

        .project-tile:hover {
            transform: translateY(-2px);
            border-color: rgba(207, 181, 59, 0.30);
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
        }

        .project-thumb {
            position: relative;
            aspect-ratio: 16 / 9;
            background: rgba(0, 0, 0, 0.28);
        }

        .project-thumb img {
            width: 100%;
            height: 100%;
            object-fit: cover;
            display: block;
            filter: saturate(0.95) contrast(1.05);
            transform: scale(1.02);
        }

        .project-badges {
            position: absolute;
            left: 10px;
            bottom: 10px;
            display: flex;
            flex-wrap: wrap;
            gap: 6px;
        }

        .badge-mini {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            padding: 5px 9px;
            border-radius: 999px;
            border: 1px solid rgba(207, 181, 59, 0.28);
            background: rgba(0, 0, 0, 0.55);
            color: #efe3c7;
            font-size: 0.78rem;
            backdrop-filter: blur(2px);
        }

        .project-info {
            padding: 12px 14px 14px;
        }

        .project-info h3 {
            font-family: 'Cinzel', serif;
            color: var(--gold);
            font-size: 1.02rem;
            margin: 0 0 6px;
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .project-info p {
            margin: 0;
            color: rgba(255, 255, 255, 0.75);
            font-size: 0.95rem;
            line-height: 1.35;
        }

        /* Mobile: single column */
        @media (max-width: 768px) {
            .project-grid {
                grid-template-columns: 1fr;
            }
        }

        /* === GUILD LICENSE === */
        .guild-license {
            background:
                radial-gradient(circle at top left, rgba(255, 255, 255, 0.12), transparent 40%),
                linear-gradient(180deg, #f2e3c6, #e6d2a8);
            border: 3px solid #8a6a3d;
            border-radius: 14px;
            padding: 14px;
            color: #3b2a16;
            box-shadow:
                inset 0 0 40px rgba(0, 0, 0, 0.15),
                0 12px 35px rgba(0, 0, 0, 0.6);
            font-family: 'Cinzel', serif;
        }

        /* Banner */
        .license-banner {
            display: flex;
            justify-content: space-between;
            align-items: center;
            background: #2e3b42;
            color: #e6f2ff;
            padding: 6px 12px;
            border-radius: 8px;
            font-size: 0.85rem;
            margin-bottom: 10px;
        }

        /* Body */
        .license-body {
            display: flex;
            gap: 14px;
        }

        /* Info Section */
        .license-info {
            flex: 1;
            font-size: 0.9rem;
        }

        .info-line {
            display: flex;
            justify-content: space-between;
            border-bottom: 1px solid rgba(0, 0, 0, 0.25);
            padding: 4px 0;
        }

        .info-line span {
            opacity: 0.7;
        }

        .license-notes {
            margin-top: 10px;
            font-size: 0.85rem;
            line-height: 1.4;
        }

        /* Portrait */
        .license-portrait {
            position: relative;
            width: 120px;
        }

        .license-portrait img {
            width: 100%;
            height: 150px;
            object-fit: cover;
            border: 3px solid #8a6a3d;
            border-radius: 8px;
        }

        /* Rank Seal */
        .rank-seal {
            position: absolute;
            bottom: -12px;
            right: -12px;
            width: 56px;
            height: 56px;
            border-radius: 50%;
            background: #d9c07c;
            border: 3px solid #8a6a3d;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 2rem;
            font-weight: bold;
            color: #3b2a16;
            box-shadow: 0 0 15px rgba(0, 0, 0, 0.4);
        }

        /* Footer */
        .license-footer {
            margin-top: 10px;
            display: flex;
            justify-content: space-between;
            font-size: 0.75rem;
            opacity: 0.8;
        }

        /* Mobile */
        @media (max-width:768px) {
            .license-body {
                flex-direction: column;
                align-items: center;
            }
        }

        /* === Spellbook (HTML driven) === */
        .sb {
            position: relative;
        }

        .sb-tabs {
            display: flex;
            gap: 8px;
            overflow-x: auto;
            padding: 6px 6px 10px;
        }

        .sb-tabs::-webkit-scrollbar {
            height: 6px;
        }

        .sb-tabs::-webkit-scrollbar-thumb {
            background: rgba(207, 181, 59, 0.35);
            border-radius: 6px;
        }

        .sb-tab {
            flex: 0 0 auto;
            padding: 8px 10px;
            border: 1px solid rgba(92, 64, 51, 0.55);
            background: rgba(20, 15, 10, 0.55);
            color: #eaddcf;
            border-radius: 10px;
            font-family: 'Cinzel', serif;
            cursor: pointer;
            user-select: none;
        }

        .sb-tab.is-active {
            border-color: rgba(207, 181, 59, 0.95);
            color: #ffdca0;
            box-shadow: 0 0 14px rgba(255, 215, 0, 0.12);
        }

        .sb-page {
            display: none;
        }

        .sb-page.is-active {
            display: block;
        }

        .sb-grid {
            display: grid;
            grid-template-columns: 1fr;
            gap: 10px;
            padding: 0 8px 8px;
        }

        .sb-spell {
            width: 100%;
            display: grid;
            grid-template-columns: 54px 1fr;
            grid-template-rows: auto auto;
            column-gap: 12px;
            padding: 10px 12px;
            border: 1px solid rgba(92, 64, 51, 0.55);
            background: rgba(20, 15, 10, 0.55);
            border-radius: 12px;
            cursor: pointer;
            user-select: none;
            text-align: left;
            transition: transform 120ms ease, border-color 120ms ease;
        }

        .sb-spell:hover {
            transform: translateY(-1px);
            border-color: rgba(207, 181, 59, 0.9);
        }

        .sb-icon {
            grid-row: 1 / span 2;
            width: 54px;
            height: 54px;
            border-radius: 12px;
            border: 1px solid rgba(207, 181, 59, 0.5);
            background: radial-gradient(circle at 30% 30%, rgba(255, 215, 0, 0.25), rgba(0, 0, 0, 0.35));
            display: grid;
            place-items: center;
            color: #ffdca0;
            font-size: 20px;
        }

        .sb-name {
            font-family: 'Cinzel', serif;
            color: #ffdca0;
            font-size: 1.05rem;
            line-height: 1.15;
        }

        .sb-sub {
            color: #eaddcf;
            opacity: 0.82;
            font-size: 0.88rem;
            margin-top: 2px;
        }

        /* Tooltip panel: bottom drawer on mobile, floating on desktop */
        .sb-tip {
            position: fixed;
            left: 0;
            right: 0;
            bottom: 0;
            z-index: 9999;
            transform: translateY(110%);
            transition: transform 220ms ease;
            background: rgba(20, 15, 10, 0.98);
            border-top: 2px solid rgba(207, 181, 59, 0.9);
            box-shadow: 0 -18px 50px rgba(0, 0, 0, 0.55);
            pointer-events: none;
        }

        .sb-tip.is-open {
            transform: translateY(0);
            pointer-events: auto;
        }

        .sb-tipbar {
            display: flex;
            justify-content: space-between;
            align-items: center;
            gap: 10px;
            padding: 10px 12px;
            border-bottom: 1px solid rgba(92, 64, 51, 0.6);
        }

        .sb-tiptitle {
            font-family: 'Cinzel', serif;
            color: #ffdca0;
            font-size: 1.1rem;
        }

        .sb-tipmeta {
            color: #eaddcf;
            opacity: 0.85;
            font-size: 0.9rem;
        }

        .sb-tipclose {
            background: #332222;
            border: 1px solid #663333;
            color: #cc8888;
            padding: 6px 10px;
            border-radius: 8px;
            cursor: pointer;
        }

        .sb-tipdesc {
            padding: 12px 12px 18px;
            max-height: 42vh;
            overflow: auto;
            color: #eaddcf;
            line-height: 1.5;
        }

        @media (min-width: 900px) {
            .sb-grid {
                grid-template-columns: 1fr 1fr;
            }

            .sb-tip {
                left: auto;
                right: 0;
                bottom: 0;
                width: 420px;
                margin: 0 24px 24px 0;
                border: 2px solid rgba(207, 181, 59, 0.85);
                border-radius: 14px;
            }
        }

        /* === Spellbook Detail Panel (Bottom, Static) === */
        .sb-detail {
            margin-top: 14px;
            border-top: 2px solid rgba(207, 181, 59, 0.85);
            background: rgba(20, 15, 10, 0.88);
            box-shadow: inset 0 10px 30px rgba(0, 0, 0, 0.4);
            padding: 12px;
            border-radius: 10px;
        }

        .sb-detail-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-bottom: 6px;
        }

        .sb-detail-title {
            font-family: 'Cinzel', serif;
            font-size: 1.15rem;
            color: #ffdca0;
        }

        .sb-detail-meta {
            font-size: 0.9rem;
            color: #eaddcf;
            opacity: 0.85;
        }

        .sb-detail-desc {
            font-size: 0.95rem;
            line-height: 1.5;
            color: #eaddcf;
            opacity: 0.95;
            max-height: 26vh;
            overflow-y: auto;
        }

        /* Desktop polish */
        @media (min-width: 900px) {
            .sb-detail {
                padding: 14px 16px;
            }
        }

        .start-sub {
            opacity: 0.75;
            letter-spacing: 0.05em;
            margin-bottom: 1.5rem;
        }

        /* === Header Title Row === */
        .site-header {
            padding: 2rem;
            pointer-events: auto;
            background: linear-gradient(to bottom, rgba(0, 0, 0, 0.9), transparent);
        }

        .title-row {
            display: flex;
            align-items: center;
            gap: 14px;
        }

        /* Icon scales with text */
        .site-icon {
            width: 64px;
            height: 64px;
            object-fit: contain;
            filter:
                drop-shadow(0 0 6px rgba(255, 215, 0, 0.35)) drop-shadow(0 0 12px rgba(255, 215, 0, 0.15));
        }

        /* Title stays dominant */
        .site-title {
            font-family: 'Cinzel', serif;
            font-size: 2.5rem;
            color: var(--magic-blue);
            line-height: 1;
            letter-spacing: 2px;
            text-shadow:
                2px 2px 0 #000,
                0 0 15px rgba(255, 215, 0, 0.5);
            margin: 0;
        }

        /* Subtitle */
        .class-title {
            margin-top: 6px;
            margin-left: 78px;
            /* aligns under text, not icon */
            font-size: 1.15rem;
            color: #aaa;
            letter-spacing: 1px;
        }

        /* Mobile tuning */
        @media (max-width: 768px) {
            .site-title {
                font-size: 2.1rem;
            }

            .site-icon {
                width: 46px;
                height: 46px;
            }

            .class-title {
                margin-left: 60px;
            }
        }
        
        .quality-badge{
  position: fixed;
  right: 12px;
  bottom: 12px;
  z-index: 9999;
  font: 12px/1.2 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  letter-spacing: .04em;
  padding: 8px 10px;
  border: 1px solid rgba(207,181,59,.45);
  color: #cfb53b;
  background: rgba(8,10,18,.55);
  backdrop-filter: blur(6px);
  border-radius: 10px;
  pointer-events: none;
  user-select: none;
  text-transform: uppercase;
}
.quality-badge.low { border-color: rgba(255,170,51,.55); color:#ffaa33; }
.quality-badge.ultra { border-color: rgba(255,68,68,.55); color:#ff4444; }
.quality-badge.high { border-color: rgba(120,166,255,.55); color:#78a6ff; }

  .quality-control{
    display:flex; align-items:center; gap:.4rem;
    padding:.35rem .5rem;
    border:1px solid rgba(255,255,255,.18);
    border-radius:.6rem;
    background:rgba(0,0,0,.25);
    backdrop-filter: blur(6px);
    width: fit-content;
    color:#fff;
  }
  .quality-control select{
    background:rgba(0,0,0,.35);
    color:#fff;
    border:1px solid rgba(255,255,255,.18);
    border-radius:.5rem;
    padding:.25rem .4rem;
    outline:none;
  }