        * { margin: 0; padding: 0; box-sizing: border-box; }

        /* ============ PARCHMENT (LIGHT) THEME ============ */
        :root {
            --bg-primary: #f5ecdb;
            --bg-secondary: #efe3cd;
            --bg-tertiary: #e3d4b6;
            --bg-page: #d9c7a3;
            --text-primary: #2c2014;
            --text-secondary: #6b5840;
            --text-tertiary: #9a8568;
            --border-color: #c4ad84;
            --border-light: #d8c8a6;
            --accent: #7a1f1f;
            --accent-hover: #5e1616;
            --accent-soft: #f0ddc8;
            --accent-light: #f3e4d0;
            --gold: #a8842c;
            --gold-soft: #c9a85a;
            --danger: #8b2316;
            --danger-light: #ecd4c8;
            --success: #4a6b2e;
            --success-light: #dde4cc;
            --ink-shadow: rgba(44, 32, 20, 0.18);
            --ink-shadow-strong: rgba(44, 32, 20, 0.32);
            --paper-noise: 0.55;
            --display-font: 'Cinzel', serif;
            --serif-font: 'Cormorant Garamond', serif;
            --body-font: 'Spectral', Georgia, serif;
            --mono-font: 'JetBrains Mono', monospace;
            --vignette: rgba(70, 50, 25, 0.0);
        }

        /* ============ CANDLELIT DUNGEON (DARK) THEME ============ */
        body.dark-mode {
            --bg-primary: #221d2b;
            --bg-secondary: #1b1722;
            --bg-tertiary: #2c2536;
            --bg-page: #14111b;
            --text-primary: #ede4d3;
            --text-secondary: #b3a48c;
            --text-tertiary: #7c6f5e;
            --border-color: #44394f;
            --border-light: #352d40;
            --accent: #c7472f;
            --accent-hover: #dd5a40;
            --accent-soft: #3a2630;
            --accent-light: #322230;
            --gold: #d9b25c;
            --gold-soft: #b5904a;
            --danger: #c7472f;
            --danger-light: #3a2228;
            --success: #7fa555;
            --success-light: #28301f;
            --ink-shadow: rgba(0, 0, 0, 0.45);
            --ink-shadow-strong: rgba(0, 0, 0, 0.7);
            --paper-noise: 0.0;
        }

        body {
            font-family: var(--body-font);
            color: var(--text-primary);
            background: var(--bg-page);
            transition: background-color 0.4s ease, color 0.4s ease;
            -webkit-font-smoothing: antialiased;
            position: relative;
        }

        /* Atmospheric paper grain + vignette overlay */
        body::before {
            content: "";
            position: fixed;
            inset: 0;
            pointer-events: none;
            z-index: 1;
            opacity: var(--paper-noise);
            background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
            mix-blend-mode: multiply;
        }
        body::after {
            content: "";
            position: fixed;
            inset: 0;
            pointer-events: none;
            z-index: 2;
            background: radial-gradient(ellipse at center, transparent 55%, var(--ink-shadow) 130%);
        }
        body.dark-mode::after {
            background: radial-gradient(ellipse at 50% 20%, rgba(217,178,92,0.06) 0%, transparent 45%),
                        radial-gradient(ellipse at center, transparent 45%, rgba(0,0,0,0.55) 125%);
        }

        ::selection { background: var(--accent); color: #fff; }

        /* Scrollbars */
        ::-webkit-scrollbar { width: 11px; height: 11px; }
        ::-webkit-scrollbar-track { background: var(--bg-tertiary); }
        ::-webkit-scrollbar-thumb {
            background: var(--border-color);
            border-radius: 6px;
            border: 2px solid var(--bg-tertiary);
        }
        ::-webkit-scrollbar-thumb:hover { background: var(--gold-soft); }

        /* ============ FORM ELEMENTS ============ */
        input, textarea, select {
            font-family: var(--body-font);
            color: var(--text-primary);
            background: var(--bg-primary);
            border: 1px solid var(--border-color);
            border-radius: 3px;
            padding: 9px 12px;
            font-size: 15px;
            transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
        }

        input::placeholder, textarea::placeholder {
            color: var(--text-tertiary);
            font-style: italic;
            opacity: 0.8;
        }

        input:focus, textarea:focus, select:focus {
            outline: none;
            border-color: var(--accent);
            box-shadow: 0 0 0 3px var(--accent-light), inset 0 1px 2px var(--ink-shadow);
        }

        input[type="number"]::-webkit-inner-spin-button { opacity: 0.35; }

        textarea {
            resize: vertical;
            line-height: 1.6;
        }

        select {
            cursor: pointer;
            appearance: none;
            -webkit-appearance: none;
            background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23a8842c' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
            background-repeat: no-repeat;
            background-position: right 12px center;
            padding-right: 32px;
        }

        /* ============ BUTTONS ============ */
        button {
            font-family: var(--display-font);
            font-weight: 600;
            cursor: pointer;
            border-radius: 3px;
            border: 1px solid var(--border-color);
            background: var(--bg-primary);
            color: var(--text-primary);
            padding: 9px 18px;
            font-size: 12px;
            letter-spacing: 0.06em;
            text-transform: uppercase;
            transition: all 0.18s ease;
            position: relative;
        }

        button:hover {
            background: var(--bg-secondary);
            border-color: var(--gold);
            color: var(--accent);
            transform: translateY(-1px);
        }
        button:active { transform: translateY(0); }

        button.primary {
            background: linear-gradient(170deg, var(--accent), var(--accent-hover));
            color: #f3e4d0;
            border: 1px solid var(--accent-hover);
            box-shadow: 0 2px 6px var(--ink-shadow), inset 0 1px 0 rgba(255,255,255,0.12);
        }
        button.primary:hover {
            color: #fff;
            border-color: var(--gold);
            box-shadow: 0 4px 12px var(--ink-shadow-strong), inset 0 1px 0 rgba(255,255,255,0.18);
        }

        button.danger {
            background: var(--danger-light);
            color: var(--danger);
            border-color: var(--danger);
        }
        button.danger:hover {
            background: var(--danger);
            color: #f3e4d0;
            border-color: var(--danger);
        }

        /* ============ LOGIN SCREEN ============ */
        .login-screen {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            min-height: 100vh;
            padding: 2rem;
            position: relative;
            z-index: 3;
        }

        .login-card {
            background: var(--bg-primary);
            border: 1px solid var(--border-color);
            border-radius: 4px;
            padding: 3rem 2.75rem;
            width: 100%;
            max-width: 440px;
            box-shadow: 0 18px 50px var(--ink-shadow-strong);
            position: relative;
        }
        /* Decorative double-rule frame */
        .login-card::before {
            content: "";
            position: absolute;
            inset: 10px;
            border: 1px solid var(--border-light);
            border-radius: 2px;
            pointer-events: none;
        }

        .login-card h1 {
            font-family: var(--display-font);
            font-size: 30px;
            font-weight: 700;
            margin-bottom: 0.35rem;
            text-align: center;
            color: var(--accent);
            letter-spacing: 0.04em;
        }
        .login-card .crest {
            text-align: center;
            font-size: 26px;
            color: var(--gold);
            margin-bottom: 0.25rem;
            line-height: 1;
        }
        .login-card .subtitle {
            text-align: center;
            font-family: var(--serif-font);
            font-style: italic;
            font-size: 16px;
            color: var(--text-secondary);
            margin-bottom: 2rem;
        }
        .login-card .divider-rule {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 12px;
            margin-bottom: 2rem;
            color: var(--gold);
        }
        .login-card .divider-rule::before,
        .login-card .divider-rule::after {
            content: "";
            height: 1px;
            flex: 1;
            background: linear-gradient(90deg, transparent, var(--border-color));
        }
        .login-card .divider-rule::after {
            background: linear-gradient(90deg, var(--border-color), transparent);
        }

        .login-card .field {
            display: flex;
            flex-direction: column;
            margin-bottom: 1.25rem;
        }

        .login-card label {
            font-family: var(--display-font);
            font-size: 11px;
            font-weight: 600;
            margin-bottom: 7px;
            color: var(--text-secondary);
            text-transform: uppercase;
            letter-spacing: 0.12em;
        }

        .login-card input { width: 100%; }
        .login-card button { width: 100%; margin-top: 0.5rem; padding: 12px 16px; font-size: 13px; }

        .toggle-form { text-align: center; margin-top: 1.5rem; }
        .toggle-form button {
            background: none;
            border: none;
            color: var(--accent);
            padding: 0;
            font-size: 12px;
            font-family: var(--serif-font);
            font-style: italic;
            text-transform: none;
            letter-spacing: 0;
            text-decoration: underline;
            text-decoration-color: var(--gold-soft);
            text-underline-offset: 3px;
            width: auto;
        }
        .toggle-form button:hover { transform: none; background: none; color: var(--accent-hover); }

        /* ============ STATUS BANNERS ============ */
        .status {
            margin-bottom: 1.25rem;
            padding: 11px 14px;
            border-radius: 3px;
            font-size: 14px;
            font-family: var(--serif-font);
            display: none;
            border-left: 3px solid;
        }
        .status.show { display: block; }
        .status.info {
            background: var(--accent-light);
            color: var(--accent);
            border-color: var(--accent);
        }
        .status.error {
            background: var(--danger-light);
            color: var(--danger);
            border-color: var(--danger);
        }
        .status.success {
            background: var(--success-light);
            color: var(--success);
            border-color: var(--success);
        }

        /* ============ APP LAYOUT ============ */
        .app-screen { display: none; }

        .app-container {
            display: flex;
            min-height: 100vh;
            position: relative;
            z-index: 3;
        }

        .sidebar {
            width: 290px;
            min-width: 290px;
            background: var(--bg-secondary);
            border-right: 1px solid var(--border-color);
            padding: 2rem 1.5rem;
            display: flex;
            flex-direction: column;
            overflow-y: auto;
            box-shadow: inset -8px 0 16px -10px var(--ink-shadow);
            transition: min-width 0.35s ease, width 0.35s ease, max-height 0.35s ease, padding 0.35s ease, border 0.35s ease, opacity 0.25s ease;
        }
        .sidebar.hidden {
            width: 0;
            min-width: 0;
            padding: 0;
            border: none;
            overflow: hidden;
            opacity: 0;
        }

        .sidebar-brand {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 2px;
            margin-bottom: 2rem;
            padding-bottom: 1.5rem;
            border-bottom: 1px solid var(--border-color);
        }
        .sidebar-brand .crest { font-size: 30px; color: var(--gold); line-height: 1; }
        .sidebar-brand .name {
            font-family: var(--display-font);
            font-size: 16px;
            font-weight: 700;
            letter-spacing: 0.1em;
            color: var(--accent);
        }
        .sidebar-brand .tag {
            font-family: var(--serif-font);
            font-style: italic;
            font-size: 12px;
            color: var(--text-tertiary);
        }

        .main-content {
            flex: 1;
            overflow-y: auto;
        }

        .container {
            max-width: 1040px;
            margin: 0 auto;
            padding: 2.5rem 2rem 4rem;
            transition: max-width 0.35s ease;
        }
        .main-content.expanded .container { max-width: 1240px; }

        /* ============ HEADER ============ */
        .header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 2rem;
            gap: 1rem;
            flex-wrap: wrap;
        }
        .header h1 {
            font-family: var(--display-font);
            font-size: 26px;
            font-weight: 700;
            letter-spacing: 0.06em;
            color: var(--text-primary);
        }
        .header-controls { display: flex; gap: 0.75rem; align-items: center; }

        .icon-btn, .hamburger, .theme-toggle {
            background: var(--bg-secondary);
            border: 1px solid var(--border-color);
            width: 44px;
            height: 44px;
            border-radius: 3px;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: 5px;
            cursor: pointer;
            transition: all 0.18s;
        }
        .hamburger:hover, .theme-toggle:hover {
            background: var(--bg-primary);
            border-color: var(--gold);
            transform: translateY(-1px);
        }
        .hamburger span {
            width: 19px;
            height: 2px;
            background: var(--accent);
            border-radius: 1px;
        }
        .theme-toggle { font-size: 19px; }

        .user-info {
            font-family: var(--serif-font);
            font-size: 15px;
            color: var(--text-secondary);
            display: flex;
            gap: 10px;
            align-items: center;
            padding-left: 4px;
        }
        .user-info #username {
            font-weight: 600;
            color: var(--accent);
        }
        .user-info #username::before {
            content: "❧ ";
            color: var(--gold);
        }

        /* ============ SIDEBAR DICE ROLLER ============ */
        .dice-section { margin-bottom: 2rem; }
        .dice-section h3, .section-subtitle-side {
            font-family: var(--display-font);
            font-size: 12px;
            font-weight: 600;
            margin-bottom: 1rem;
            color: var(--text-secondary);
            text-transform: uppercase;
            letter-spacing: 0.14em;
            text-align: center;
            position: relative;
        }
        .dice-section h3::after {
            content: "⬥";
            display: block;
            color: var(--gold);
            font-size: 9px;
            margin-top: 6px;
        }

        .dice-grid {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 8px;
            margin-bottom: 8px;
        }

        .dice-btn {
            padding: 12px 6px;
            font-size: 13px;
            font-family: var(--display-font);
            font-weight: 700;
            background: var(--bg-primary);
            border: 1px solid var(--border-color);
            border-radius: 3px;
            cursor: pointer;
            color: var(--text-primary);
            letter-spacing: 0.04em;
            transition: all 0.16s ease;
            box-shadow: 0 1px 3px var(--ink-shadow);
        }
        .dice-btn:hover {
            background: linear-gradient(165deg, var(--accent), var(--accent-hover));
            color: #f3e4d0;
            border-color: var(--accent-hover);
            transform: translateY(-2px);
            box-shadow: 0 4px 10px var(--ink-shadow-strong);
        }
        .dice-btn:active { transform: translateY(0) scale(0.97); }

        .roll-result {
            background: var(--bg-primary);
            border: 1px solid var(--gold-soft);
            border-radius: 4px;
            padding: 1.25rem 1rem;
            margin-top: 1rem;
            text-align: center;
            position: relative;
            box-shadow: inset 0 0 24px var(--accent-light), 0 2px 8px var(--ink-shadow);
        }
        .roll-result-label {
            font-family: var(--display-font);
            font-size: 10px;
            color: var(--text-tertiary);
            text-transform: uppercase;
            letter-spacing: 0.16em;
            margin-bottom: 0.4rem;
        }
        .roll-result-value {
            font-family: var(--display-font);
            font-size: 46px;
            font-weight: 700;
            color: var(--accent);
            line-height: 1;
            text-shadow: 0 2px 4px var(--ink-shadow);
        }
        @keyframes rollPop {
            0% { transform: scale(0.4) rotate(-25deg); opacity: 0; }
            55% { transform: scale(1.18) rotate(8deg); opacity: 1; }
            100% { transform: scale(1) rotate(0); opacity: 1; }
        }
        .roll-result-value.rolling { animation: rollPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1); }

        .sidebar-bottom {
            margin-top: auto;
            padding-top: 1.75rem;
            border-top: 1px solid var(--border-color);
            display: flex;
            flex-direction: column;
            gap: 8px;
        }
        .sidebar-bottom button { width: 100%; }

        /* ============ CONTROLS ============ */
        .controls {
            display: flex;
            gap: 10px;
            margin-bottom: 1.5rem;
            flex-wrap: wrap;
            align-items: center;
        }
        .controls button { display: flex; align-items: center; gap: 6px; }
        .controls button.primary { padding: 10px 22px; }

        /* ============ CHARACTER SELECTOR ============ */
        .char-selector {
            display: flex;
            gap: 10px;
            align-items: center;
            padding: 12px 14px;
            background: var(--bg-secondary);
            border: 1px solid var(--border-color);
            border-radius: 4px;
            flex-wrap: wrap;
            margin-bottom: 2rem;
        }
        .char-selector label {
            font-family: var(--display-font);
            font-size: 11px;
            font-weight: 600;
            color: var(--text-secondary);
            margin: 0;
            text-transform: uppercase;
            letter-spacing: 0.12em;
        }
        .char-list { display: flex; gap: 7px; flex-wrap: wrap; }
        .char-button {
            padding: 7px 14px;
            background: var(--bg-primary);
            border: 1px solid var(--border-color);
            border-radius: 3px;
            cursor: pointer;
            font-family: var(--serif-font);
            font-size: 14px;
            font-weight: 600;
            color: var(--text-primary);
            transition: all 0.16s;
            max-width: 160px;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            text-transform: none;
            letter-spacing: 0;
        }
        .char-button.active {
            background: linear-gradient(165deg, var(--accent), var(--accent-hover));
            color: #f3e4d0;
            border-color: var(--accent-hover);
            box-shadow: 0 2px 6px var(--ink-shadow);
        }
        .char-button:hover { border-color: var(--gold); transform: translateY(-1px); }
        .char-button.active:hover { color: #fff; }

        /* ============ SHEET CARD ============ */
        .sheet {
            background: var(--bg-primary);
            border: 1px solid var(--border-color);
            border-radius: 5px;
            padding: 3rem 3rem 3.5rem;
            box-shadow: 0 10px 40px var(--ink-shadow), 0 1px 0 rgba(255,255,255,0.3) inset;
            position: relative;
        }
        /* corner flourishes */
        .sheet::before, .sheet::after {
            content: "";
            position: absolute;
            width: 28px;
            height: 28px;
            border: 2px solid var(--gold-soft);
            opacity: 0.5;
        }
        .sheet::before {
            top: 14px; left: 14px;
            border-right: none; border-bottom: none;
        }
        .sheet::after {
            bottom: 14px; right: 14px;
            border-left: none; border-top: none;
        }

        .sheet input, .sheet textarea, .sheet select { width: 100%; }

        /* ============ INFO BOXES ============ */
        .info-box {
            background: var(--bg-secondary);
            border: 1px solid var(--border-color);
            border-left: 3px solid var(--gold);
            border-radius: 4px;
            padding: 1.25rem 1.35rem;
            margin-bottom: 2rem;
            font-size: 14px;
            line-height: 1.65;
        }
        .info-box-title {
            font-family: var(--display-font);
            font-weight: 600;
            color: var(--accent);
            margin-bottom: 0.85rem;
            font-size: 13px;
            text-transform: uppercase;
            letter-spacing: 0.1em;
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
            align-items: baseline;
        }

        .features-disclaimer {
            font-family: var(--serif-font);
            font-size: 12px;
            font-weight: 500;
            font-style: italic;
            color: var(--gold);
            background: var(--accent-light);
            border: 1px solid var(--gold-soft);
            border-radius: 3px;
            padding: 3px 9px;
            text-transform: none;
            letter-spacing: 0;
        }

        .info-box-content {
            color: var(--text-secondary);
            font-family: var(--serif-font);
            font-size: 15px;
            white-space: pre-line;
        }

        /* Feature cards */
        .feature-level-group { margin-bottom: 1.1rem; }
        .feature-level-badge {
            display: inline-block;
            background: linear-gradient(165deg, var(--accent), var(--accent-hover));
            color: #f3e4d0;
            font-family: var(--display-font);
            font-size: 10px;
            font-weight: 700;
            padding: 3px 11px;
            border-radius: 2px;
            margin-bottom: 7px;
            letter-spacing: 0.1em;
            box-shadow: 0 1px 3px var(--ink-shadow);
        }
        .feature-card {
            background: var(--bg-primary);
            border: 1px solid var(--border-color);
            border-radius: 3px;
            margin-bottom: 6px;
            overflow: hidden;
            transition: border-color 0.18s;
        }
        .feature-card:hover { border-color: var(--gold-soft); }
        .feature-card-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 10px 13px;
            cursor: pointer;
            user-select: none;
            font-family: var(--serif-font);
            font-weight: 700;
            font-size: 15px;
            color: var(--text-primary);
            gap: 8px;
        }
        .feature-card-header:hover { background: var(--bg-secondary); color: var(--accent); }
        .feature-card-chevron {
            font-size: 10px;
            color: var(--gold);
            transition: transform 0.25s ease;
            flex-shrink: 0;
        }
        .feature-card.open .feature-card-chevron { transform: rotate(180deg); }
        .feature-card-body {
            display: none;
            padding: 2px 13px 12px;
            font-family: var(--serif-font);
            font-size: 14.5px;
            color: var(--text-secondary);
            line-height: 1.7;
            border-top: 1px solid var(--border-light);
        }
        .feature-card.open .feature-card-body { display: block; padding-top: 10px; }

        /* Auto-calc note */
        .auto-calc-note {
            font-family: var(--serif-font);
            font-size: 14px;
            color: var(--text-secondary);
            background: var(--bg-secondary);
            border: 1px solid var(--border-color);
            border-left: 3px solid var(--gold);
            border-radius: 4px;
            padding: 10px 14px;
            margin-bottom: 1.25rem;
            line-height: 1.6;
        }
        .calc-hint {
            font-family: var(--mono-font);
            font-size: 11px;
            color: var(--text-tertiary);
            margin-top: 3px;
        }
        .reset-btn {
            background: none;
            border: 1px solid var(--border-color);
            color: var(--text-tertiary);
            padding: 0px 5px;
            font-size: 11px;
            border-radius: 3px;
            cursor: pointer;
            vertical-align: middle;
            margin-left: 4px;
            text-transform: none;
            letter-spacing: 0;
        }
        .reset-btn:hover {
            color: var(--accent);
            border-color: var(--gold);
            background: var(--accent-light);
            transform: none;
        }

        /* ============ GRID ROWS & FIELDS ============ */
        .row {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
            gap: 1.3rem;
            margin-bottom: 2rem;
        }
        .field {
            display: flex;
            flex-direction: column;
            gap: 7px;
        }
        .field label {
            font-family: var(--display-font);
            font-size: 11px;
            font-weight: 600;
            color: var(--text-secondary);
            text-transform: uppercase;
            letter-spacing: 0.11em;
        }
        .field input, .field textarea, .field select { font-size: 15px; }

        /* ============ SECTION TITLES ============ */
        .section-title {
            font-family: var(--display-font);
            font-size: 17px;
            font-weight: 700;
            color: var(--accent);
            margin-top: 2.75rem;
            margin-bottom: 1.4rem;
            padding-bottom: 0;
            letter-spacing: 0.08em;
            text-transform: uppercase;
            display: flex;
            align-items: center;
            gap: 14px;
        }
        .section-title::before {
            content: "⚜";
            color: var(--gold);
            font-size: 16px;
        }
        .section-title::after {
            content: "";
            flex: 1;
            height: 2px;
            background: linear-gradient(90deg, var(--gold-soft), transparent);
        }

        .section-subtitle {
            font-family: var(--display-font);
            font-size: 12px;
            font-weight: 600;
            color: var(--text-secondary);
            text-transform: uppercase;
            letter-spacing: 0.12em;
            margin-bottom: 0.85rem;
        }

        /* ============ ABILITY SCORES ============ */
        .abilities {
            display: grid;
            grid-template-columns: repeat(6, 1fr);
            gap: 14px;
            margin-bottom: 2rem;
        }
        .ability {
            display: flex;
            flex-direction: column;
            align-items: center;
            padding: 16px 10px 12px;
            background: var(--bg-secondary);
            border: 1px solid var(--border-color);
            border-radius: 5px;
            gap: 8px;
            position: relative;
            transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s;
        }
        .ability:hover {
            transform: translateY(-3px);
            border-color: var(--gold-soft);
            box-shadow: 0 6px 16px var(--ink-shadow);
        }
        .ability label {
            font-family: var(--display-font);
            font-size: 11px;
            font-weight: 700;
            color: var(--accent);
            margin: 0;
            text-transform: uppercase;
            letter-spacing: 0.14em;
        }
        .ability input {
            width: 100%;
            text-align: center;
            font-family: var(--display-font);
            font-size: 26px;
            font-weight: 700;
            padding: 8px 4px;
            color: var(--text-primary);
            background: var(--bg-primary);
        }
        .ability-mod {
            font-family: var(--display-font);
            font-size: 14px;
            color: #f3e4d0;
            font-weight: 700;
            background: linear-gradient(165deg, var(--accent), var(--accent-hover));
            min-width: 46px;
            text-align: center;
            padding: 3px 0;
            border-radius: 12px;
            box-shadow: 0 1px 3px var(--ink-shadow);
        }

        /* ============ EXP BAR ============ */
        .exp-bar {
            display: flex;
            align-items: center;
            gap: 14px;
            padding: 14px 16px;
            background: var(--bg-secondary);
            border: 1px solid var(--border-color);
            border-radius: 4px;
            margin-bottom: 1rem;
        }
        .exp-text {
            font-family: var(--display-font);
            font-size: 12px;
            font-weight: 600;
            color: var(--accent);
            text-transform: uppercase;
            letter-spacing: 0.1em;
            min-width: 84px;
        }
        #expDisplay {
            flex: 1;
            font-family: var(--serif-font) !important;
            font-style: italic;
            font-weight: 600;
            color: var(--text-secondary) !important;
            font-size: 15px !important;
        }

        /* ============ SKILLS ============ */
        .skills {
            display: grid;
            grid-template-columns: repeat(2, 1fr);
            gap: 10px;
            margin-bottom: 2rem;
        }
        .skill {
            display: flex;
            align-items: center;
            gap: 11px;
            padding: 10px 13px;
            background: var(--bg-secondary);
            border-radius: 3px;
            border: 1px solid var(--border-light);
            transition: border-color 0.15s, background 0.15s;
        }
        .skill:hover { border-color: var(--gold-soft); background: var(--accent-light); }
        .skill input[type="checkbox"] {
            width: 17px;
            height: 17px;
            cursor: pointer;
            border: none;
            accent-color: var(--accent);
            flex-shrink: 0;
        }
        .skill label {
            font-family: var(--serif-font);
            font-size: 15px;
            cursor: pointer;
            margin: 0;
            flex: 1;
            color: var(--text-primary);
            letter-spacing: 0;
            text-transform: none;
        }
        .skill input[type="number"] {
            flex: 0 0 48px;
            padding: 6px 6px;
            text-align: center;
            font-size: 13px;
            font-family: var(--display-font);
            font-weight: 600;
        }

        /* ============ CURRENCY ============ */
        .currency-row {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
            gap: 1rem;
            margin-bottom: 2rem;
        }
        .currency-row .field label::before {
            margin-right: 5px;
            font-size: 13px;
        }
        .currency-row .field:nth-child(1) label::before { content: "◈"; color: #8fa6b8; }
        .currency-row .field:nth-child(2) label::before { content: "●"; color: var(--gold); }
        .currency-row .field:nth-child(3) label::before { content: "◆"; color: #b08d4c; }
        .currency-row .field:nth-child(4) label::before { content: "●"; color: #9a9a9a; }
        .currency-row .field:nth-child(5) label::before { content: "●"; color: #a9683f; }

        /* ============ TRAITS / INVENTORY ============ */
        .traits {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
            gap: 1.3rem;
            margin-bottom: 2rem;
        }
        .inventory-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
            gap: 1rem;
            margin-bottom: 2rem;
        }
        .inventory-item {
            background: var(--bg-secondary);
            border: 1px solid var(--border-color);
            border-radius: 4px;
            padding: 1rem;
        }
        .inventory-item label {
            font-family: var(--display-font);
            font-size: 11px;
            font-weight: 600;
            color: var(--text-secondary);
            text-transform: uppercase;
            letter-spacing: 0.1em;
            display: block;
            margin-bottom: 8px;
        }
        .inventory-item input, .inventory-item textarea { width: 100%; }

        /* ============ INDICATORS & MODALS ============ */
        .unsaved-indicator {
            position: fixed;
            top: 20px;
            right: 20px;
            padding: 11px 16px;
            background: var(--bg-primary);
            color: var(--gold);
            border: 1px solid var(--gold-soft);
            border-left: 3px solid var(--gold);
            border-radius: 4px;
            font-family: var(--display-font);
            font-size: 11px;
            font-weight: 600;
            letter-spacing: 0.06em;
            text-transform: uppercase;
            display: none;
            box-shadow: 0 4px 14px var(--ink-shadow-strong);
            z-index: 100;
        }
        .unsaved-indicator.show { display: block; animation: rollPop 0.4s ease; }

        .modal-overlay {
            display: none;
            position: fixed;
            inset: 0;
            background: rgba(20, 14, 8, 0.72);
            z-index: 200;
            align-items: center;
            justify-content: center;
            backdrop-filter: blur(2px);
        }
        .modal-overlay.show { display: flex; }

        .auto-level-banner {
            display: none;
            position: fixed;
            top: 12px;
            left: 50%;
            transform: translateX(-50%);
            background: var(--bg-primary);
            border: 1px solid var(--gold-soft);
            color: var(--text-primary);
            padding: 10px 20px;
            border-radius: 6px;
            font-family: var(--display-font);
            font-size: 13px;
            font-weight: 600;
            letter-spacing: 0.02em;
            box-shadow: 0 4px 18px var(--ink-shadow-strong);
            z-index: 300;
        }
        .modal {
            background: var(--bg-primary);
            border: 1px solid var(--gold-soft);
            border-radius: 5px;
            padding: 2.25rem;
            max-width: 420px;
            width: 100%;
            box-shadow: 0 24px 60px rgba(0,0,0,0.5);
            position: relative;
        }
        .modal::before {
            content: "";
            position: absolute;
            inset: 8px;
            border: 1px solid var(--border-light);
            border-radius: 3px;
            pointer-events: none;
        }
        .modal h2 {
            font-family: var(--display-font);
            font-size: 21px;
            font-weight: 700;
            margin-bottom: 0.85rem;
            color: var(--accent);
            letter-spacing: 0.04em;
        }
        .modal p {
            font-family: var(--serif-font);
            font-size: 16px;
            color: var(--text-secondary);
            margin-bottom: 1.5rem;
            line-height: 1.6;
        }
        .modal .field { margin-bottom: 0.5rem; }
        .modal .field label {
            font-family: var(--display-font);
            font-size: 11px;
            font-weight: 600;
            text-transform: uppercase;
            letter-spacing: 0.1em;
            color: var(--text-secondary);
        }
        .modal-buttons { display: flex; gap: 10px; }
        .modal-buttons button { flex: 1; }

        /* ============ TABLES ============ */
        .table-wrapper { margin-bottom: 1.5rem; overflow-x: auto; }
        .sheet-table {
            width: 100%;
            border-collapse: collapse;
            font-size: 14px;
            min-width: 400px;
        }
        .sheet-table thead tr { background: var(--bg-tertiary); }
        .sheet-table th {
            text-align: left;
            padding: 9px 11px;
            font-family: var(--display-font);
            font-size: 11px;
            font-weight: 600;
            text-transform: uppercase;
            letter-spacing: 0.1em;
            color: var(--accent);
            border-bottom: 2px solid var(--gold-soft);
            white-space: nowrap;
        }
        .sheet-table td {
            padding: 4px 6px;
            border-bottom: 1px solid var(--border-light);
            vertical-align: middle;
        }
        .sheet-table td input[type="text"],
        .sheet-table td input[type="number"] {
            width: 100%;
            border: 1px solid transparent;
            background: transparent;
            padding: 6px 7px;
            font-size: 14px;
            border-radius: 3px;
        }
        .sheet-table td input[type="text"]:hover,
        .sheet-table td input[type="number"]:hover {
            border-color: var(--border-color);
            background: var(--bg-primary);
        }
        .sheet-table td input[type="text"]:focus,
        .sheet-table td input[type="number"]:focus {
            border-color: var(--accent);
            background: var(--bg-primary);
            box-shadow: 0 0 0 2px var(--accent-light);
        }
        .sheet-table tbody tr { transition: background 0.13s; }
        .sheet-table tbody tr:hover { background: var(--accent-light); }

        .prep-check {
            width: 17px !important;
            height: 17px;
            cursor: pointer;
            accent-color: var(--accent);
        }

        .row-del-btn {
            background: none;
            border: none;
            color: var(--text-tertiary);
            font-size: 13px;
            padding: 4px 7px;
            cursor: pointer;
            border-radius: 3px;
            line-height: 1;
        }
        .row-del-btn:hover {
            background: var(--danger-light);
            color: var(--danger);
            transform: none;
        }

        .add-row-btn {
            margin-top: 8px;
            font-size: 11px;
            padding: 7px 14px;
            color: var(--accent);
            border-color: var(--gold-soft);
            background: var(--accent-light);
        }
        .add-row-btn:hover {
            background: linear-gradient(165deg, var(--accent), var(--accent-hover));
            color: #f3e4d0;
            border-color: var(--accent-hover);
        }

        /* ============ SPELL SLOTS ============ */
        .spell-slots-grid {
            display: grid;
            grid-template-columns: repeat(9, 1fr);
            gap: 9px;
            margin-bottom: 1rem;
        }
        .spell-slot-item {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 5px;
            background: var(--bg-secondary);
            border: 1px solid var(--border-light);
            border-radius: 4px;
            padding: 8px 5px;
        }
        .spell-slot-item label {
            font-family: var(--display-font);
            font-size: 11px;
            font-weight: 700;
            color: var(--accent);
            text-transform: uppercase;
            letter-spacing: 0.05em;
        }
        .spell-slot-item input {
            width: 100%;
            text-align: center;
            font-size: 12px;
            padding: 5px 4px;
            font-family: var(--mono-font);
        }

        /* ============ STAGGERED LOAD-IN ============ */
        @keyframes fadeUp {
            from { opacity: 0; transform: translateY(14px); }
            to { opacity: 1; transform: translateY(0); }
        }
        .sheet > .row,
        .sheet > .section-title,
        .sheet > .info-box,
        .sheet > .exp-bar,
        .sheet > .abilities,
        .sheet > .auto-calc-note,
        .sheet > .table-wrapper,
        .sheet > .section-subtitle,
        .sheet > .spell-slots-grid,
        .sheet > .skills,
        .sheet > .currency-row,
        .sheet > .traits,
        .sheet > .field {
            animation: fadeUp 0.5s ease both;
        }

        /* ============ RESPONSIVE ============ */
        @media (max-width: 768px) {
            .app-container { flex-direction: column; }
            .sidebar {
                width: 100%;
                min-width: 100%;
                max-height: 420px;
                border-right: none;
                border-bottom: 1px solid var(--border-color);
                box-shadow: none;
            }
            .sidebar.hidden {
                width: 100%;
                min-width: 100%;
                max-height: 0;
                padding: 0;
                border: none;
                overflow: hidden;
                opacity: 0;
            }
            .main-content.expanded .container { max-width: 100%; }

            .sheet { padding: 1.5rem 1.25rem; }
            .container { padding: 1.5rem 0.85rem 3rem; }

            .abilities { grid-template-columns: repeat(3, 1fr); gap: 9px; }
            .ability { padding: 12px 6px 9px; }
            .ability input { font-size: 21px; }

            .skills { grid-template-columns: 1fr; }
            .row { grid-template-columns: 1fr 1fr; }
            #sheet .row:has(#ac) { grid-template-columns: 1fr 1fr; }
            #sheet .row:has(#armorType) { grid-template-columns: 1fr; }

            .login-card { padding: 2rem 1.5rem; }
            .char-selector { flex-direction: column; align-items: flex-start; }

            .spell-slots-grid { grid-template-columns: repeat(3, 1fr); }

            .table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
            .sheet-table { min-width: 420px; }
            .sheet-table th, .sheet-table td { padding: 6px 5px; font-size: 13px; }

            .controls { flex-direction: column; gap: 8px; }
            .controls button { width: 100%; }

            .header { flex-direction: row; flex-wrap: wrap; gap: 0.5rem; }
            .header h1 { font-size: 19px; }

            .feature-card-header { font-size: 14px; padding: 8px 11px; }
            .auto-calc-note { font-size: 13px; }
            .traits { grid-template-columns: 1fr; }
            .currency-row { grid-template-columns: repeat(3, 1fr); }
            .inventory-grid { grid-template-columns: 1fr; }
            .section-title { font-size: 15px; }
            .dice-grid { grid-template-columns: repeat(3, 1fr); }
        }

        @media (max-width: 480px) {
            .abilities { grid-template-columns: repeat(2, 1fr); }
            .spell-slots-grid { grid-template-columns: repeat(3, 1fr); }
            .row { grid-template-columns: 1fr; }
            .currency-row { grid-template-columns: repeat(2, 1fr); }
            .char-button { max-width: 130px; }
        }

        /* ============ TABS ============ */
        .tab-bar {
            display: flex;
            gap: 0;
            margin-bottom: 0;
            border-bottom: 2px solid var(--border-color);
            position: relative;
        }
        .tab-btn {
            font-family: var(--display-font);
            font-size: 11px;
            font-weight: 600;
            letter-spacing: 0.12em;
            text-transform: uppercase;
            color: var(--text-secondary);
            background: var(--bg-secondary);
            border: 1px solid var(--border-color);
            border-bottom: none;
            border-radius: 4px 4px 0 0;
            padding: 10px 20px;
            cursor: pointer;
            margin-right: 4px;
            margin-bottom: -2px;
            position: relative;
            transition: color 0.15s, background 0.15s;
        }
        .tab-btn:hover {
            color: var(--text-primary);
            background: var(--bg-primary);
        }
        .tab-btn.active {
            color: var(--accent);
            background: var(--bg-primary);
            border-color: var(--border-color);
            border-bottom: 2px solid var(--bg-primary);
            z-index: 1;
        }
        .tab-panel {
            display: none;
            padding-top: 2.5rem;
        }
        .tab-panel.active {
            display: block;
        }
        .tab-characters-controls {
            display: flex;
            flex-wrap: wrap;
            gap: 10px;
            margin-bottom: 1.5rem;
            align-items: center;
        }
        .tab-characters-controls button { display: flex; align-items: center; gap: 6px; }
        .tab-characters-controls button.primary { padding: 10px 22px; }

        @media (max-width: 640px) {
            .tab-btn { font-size: 10px; padding: 8px 12px; letter-spacing: 0.08em; }
            .tab-characters-controls { flex-direction: column; gap: 8px; }
            .tab-characters-controls button { width: 100%; }
        }
        @media (max-width: 480px) {
            .tab-btn { padding: 8px 9px; }
        }

        /* ============ V2 POLISH: MOTION & FX ============ */
        @media (prefers-reduced-motion: reduce) {
            *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
        }

        /* Tab panel entrance */
        @keyframes panelIn {
            from { opacity: 0; transform: translateY(10px); }
            to { opacity: 1; transform: translateY(0); }
        }
        .tab-panel.active { animation: panelIn 0.28s cubic-bezier(0.22, 1, 0.36, 1) both; animation-delay: 0s !important; }

        /* Ability modifier pulse when scores change */
        @keyframes modPulse {
            0% { transform: scale(1); box-shadow: 0 1px 3px var(--ink-shadow); }
            45% { transform: scale(1.22); box-shadow: 0 0 14px var(--gold-soft); }
            100% { transform: scale(1); box-shadow: 0 1px 3px var(--ink-shadow); }
        }
        .ability-mod.pulse { animation: modPulse 0.45s cubic-bezier(0.34, 1.56, 0.64, 1); }
        .ability-mod { transition: background 0.3s; }

        /* Candle flicker for dark mode crest */
        @keyframes candleFlicker {
            0%, 100% { text-shadow: 0 0 8px rgba(217,178,92,0.55), 0 0 22px rgba(199,71,47,0.25); opacity: 1; }
            42% { text-shadow: 0 0 12px rgba(217,178,92,0.8), 0 0 30px rgba(199,71,47,0.4); opacity: 0.94; }
            58% { text-shadow: 0 0 6px rgba(217,178,92,0.45), 0 0 16px rgba(199,71,47,0.2); opacity: 1; }
            73% { text-shadow: 0 0 14px rgba(217,178,92,0.85), 0 0 34px rgba(199,71,47,0.45); opacity: 0.96; }
        }
        body.dark-mode .sidebar-brand .crest,
        body.dark-mode .login-card .crest { animation: candleFlicker 3.4s ease-in-out infinite; }

        /* Dice: advantage / disadvantage / modifier controls */
        .roll-options { display: flex; gap: 6px; margin-bottom: 8px; }
        .adv-btn {
            flex: 1; padding: 7px 4px; font-size: 10px; letter-spacing: 0.08em;
            background: var(--bg-primary); border: 1px solid var(--border-color);
        }
        .adv-btn.active-adv { background: var(--success-light); color: var(--success); border-color: var(--success); }
        .adv-btn.active-dis { background: var(--danger-light); color: var(--danger); border-color: var(--danger); }
        .roll-mod-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
        .roll-mod-row label {
            font-family: var(--display-font); font-size: 10px; font-weight: 600;
            color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.1em; white-space: nowrap;
        }
        .roll-mod-row input { width: 100%; text-align: center; padding: 6px; font-size: 13px; font-family: var(--mono-font); }

        /* Dice: tumbling + crit/fumble */
        @keyframes diceTumble {
            0% { transform: rotate(0deg) scale(0.85); opacity: 0.6; }
            100% { transform: rotate(360deg) scale(0.95); opacity: 0.9; }
        }
        .roll-result-value.tumbling { animation: diceTumble 0.12s linear infinite; color: var(--text-secondary); }
        @keyframes critBurst {
            0% { transform: scale(0.4); text-shadow: 0 0 0 transparent; }
            50% { transform: scale(1.35); text-shadow: 0 0 26px var(--gold), 0 0 50px var(--gold-soft); }
            100% { transform: scale(1); text-shadow: 0 0 12px var(--gold-soft); }
        }
        .roll-result-value.crit { color: var(--gold); animation: critBurst 0.7s cubic-bezier(0.34, 1.56, 0.64, 1); }
        .roll-result.crit-frame { border-color: var(--gold); box-shadow: inset 0 0 30px rgba(168,132,44,0.2), 0 0 18px rgba(168,132,44,0.35); }
        @keyframes fumbleShake {
            0%, 100% { transform: translateX(0); }
            15% { transform: translateX(-7px) rotate(-3deg); } 30% { transform: translateX(6px) rotate(2deg); }
            45% { transform: translateX(-5px) rotate(-2deg); } 60% { transform: translateX(4px) rotate(1deg); }
            75% { transform: translateX(-2px); } 90% { transform: translateX(1px); }
        }
        .roll-result-value.fumble { color: var(--danger); animation: fumbleShake 0.55s ease; }
        .roll-breakdown {
            font-family: var(--mono-font); font-size: 11px; color: var(--text-tertiary);
            margin-top: 6px; min-height: 14px;
        }
        .roll-breakdown .kept { color: var(--accent); font-weight: 600; }
        .roll-breakdown .dropped { text-decoration: line-through; opacity: 0.55; }

        /* Roll history */
        .roll-history { margin-top: 10px; max-height: 150px; overflow-y: auto; display: none; }
        .roll-history.has-rolls { display: block; }
        .roll-history-title {
            font-family: var(--display-font); font-size: 9px; font-weight: 600; color: var(--text-tertiary);
            text-transform: uppercase; letter-spacing: 0.16em; margin-bottom: 5px; text-align: center;
        }
        .roll-history-entry {
            display: flex; justify-content: space-between; align-items: center; gap: 8px;
            font-family: var(--mono-font); font-size: 11px; color: var(--text-secondary);
            padding: 4px 8px; border-bottom: 1px dashed var(--border-light);
            animation: fadeUp 0.25s ease both;
        }
        .roll-history-entry .total { font-weight: 700; color: var(--text-primary); }
        .roll-history-entry .total.crit { color: var(--gold); }
        .roll-history-entry .total.fumble { color: var(--danger); }

        /* HP bar */
        .hp-bar-wrap { margin-bottom: 2rem; }
        .hp-bar-labels {
            display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px;
            font-family: var(--display-font); font-size: 11px; font-weight: 600;
            color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.1em;
        }
        .hp-bar-labels .hp-numbers { font-family: var(--mono-font); font-size: 12px; letter-spacing: 0; text-transform: none; }
        .hp-bar-track {
            position: relative; height: 18px; background: var(--bg-tertiary);
            border: 1px solid var(--border-color); border-radius: 9px; overflow: hidden;
            box-shadow: inset 0 2px 4px var(--ink-shadow);
        }
        .hp-bar-fill {
            position: absolute; inset: 0 auto 0 0; width: 100%;
            background: linear-gradient(180deg, var(--success), #3a5524);
            border-radius: 9px; transition: width 0.45s cubic-bezier(0.22, 1, 0.36, 1), background 0.45s;
        }
        .hp-bar-fill.hp-warn { background: linear-gradient(180deg, var(--gold), #8a6c24); }
        .hp-bar-fill.hp-danger { background: linear-gradient(180deg, var(--danger), #5e1610); }
        .hp-bar-temp {
            position: absolute; inset: 0 auto 0 0; height: 100%;
            background: repeating-linear-gradient(45deg, rgba(143,166,184,0.65), rgba(143,166,184,0.65) 5px, rgba(143,166,184,0.35) 5px, rgba(143,166,184,0.35) 10px);
            border-radius: 9px; transition: left 0.45s cubic-bezier(0.22, 1, 0.36, 1), width 0.45s;
        }
        .hp-quick-btns { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
        .hp-quick-btns button { padding: 5px 12px; font-size: 11px; flex: 1; min-width: 52px; }
        .hp-quick-btns button.heal { color: var(--success); border-color: var(--success); background: var(--success-light); }
        .hp-quick-btns button.heal:hover { background: var(--success); color: #f3e4d0; }
        .hp-quick-btns button.dmg { color: var(--danger); border-color: var(--danger); background: var(--danger-light); }
        .hp-quick-btns button.dmg:hover { background: var(--danger); color: #f3e4d0; }
        @keyframes hpHit { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
        .hp-bar-track.hit { animation: hpHit 0.3s ease; }

        /* Spell slot pips */
        .slot-pips { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; min-height: 12px; margin-top: 5px; }
        .slot-pip {
            width: 12px; height: 12px; border-radius: 50%;
            border: 1.5px solid var(--gold); background: var(--gold-soft);
            cursor: pointer; transition: transform 0.15s, background 0.2s, opacity 0.2s;
            box-shadow: 0 0 5px rgba(168,132,44,0.4);
        }
        .slot-pip:hover { transform: scale(1.3); }
        .slot-pip.used { background: transparent; box-shadow: none; opacity: 0.45; }
        /* ============ EQUIPMENT TOGGLE (still used, now inside Weapons section) ============ */
        .eq-toggle-row { margin-bottom: 8px; font-size: 13px; }
        .eq-toggle-row label { display: flex; align-items: center; gap: 6px; cursor: pointer; }

        /* ============ EQUIPMENT/SPELL PICKER MODAL CONTENTS ============ */
        .eqpick-custom {
            border: 1px dashed var(--gold-soft);
            border-radius: 10px;
            padding: 10px 12px;
            margin-bottom: 10px;
            background: var(--accent-light);
            cursor: pointer;
        }
        .eqpick-custom-title { font-weight: 700; color: var(--accent); font-size: 13.5px; }
        .eqpick-custom-hint { font-size: 11.5px; color: var(--text-tertiary); margin-top: 2px; }
        .eqpick-custom-form { display: none; margin-top: 10px; gap: 8px; flex-direction: column; }
        .eqpick-custom-form.open { display: flex; }
        .eqpick-custom-form input { width: 100%; }
        .eqpick-custom-form .wiz-btn { align-self: flex-end; }

        .eqpick-group-label {
            font-family: var(--display-font, inherit);
            font-size: 10.5px;
            font-weight: 700;
            letter-spacing: 0.04em;
            text-transform: uppercase;
            color: var(--text-tertiary);
            margin: 12px 0 6px;
        }
        .eqpick-list { display: flex; flex-direction: column; gap: 6px; max-height: 44vh; overflow-y: auto; padding: 2px; }
        .eqpick-item {
            display: flex; align-items: center; justify-content: space-between; gap: 10px;
            padding: 9px 12px;
            border: 1px solid var(--border-color); border-radius: 8px;
            background: var(--bg-primary);
            cursor: pointer;
            transition: border-color .1s, background .1s;
        }
        .eqpick-item:hover { border-color: var(--gold); background: var(--accent-light); }
        .eqpick-item.sel { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent) inset; }
        .eqpick-item-main { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
        .eqpick-item-name { font-weight: 600; font-size: 13.5px; }
        .eqpick-item-meta { font-size: 11.5px; color: var(--text-tertiary); }
        .eqpick-item-desc { font-size: 11.5px; color: var(--text-secondary); margin-top: 3px; line-height: 1.4; }
        .eqpick-item-cost {
            flex: none; font-size: 12px; font-weight: 700;
            color: var(--accent); background: var(--accent-soft);
            border: 1px solid var(--gold-soft); border-radius: 10px;
            padding: 2px 9px; white-space: nowrap;
        }
        .eqpick-no-results { padding: 14px 4px; font-size: 13px; color: var(--text-tertiary); text-align: center; }
        .eqpick-added-flash { animation: eqpickFlash 0.5s ease; }
        @keyframes eqpickFlash { 0% { background: var(--accent-soft); } 100% { background: transparent; } }
