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

        body {
            font-family: 'Cinzel', serif;
            min-height: 100vh;
            background: #0a0908;
            color: #d4d0c8;
            overflow-x: hidden;
        }

        /* Deep stone cavern background */
        .bg-layer {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background:
                radial-gradient(ellipse 150% 50% at 50% 120%, rgba(255, 80, 20, 0.12) 0%, transparent 50%),
                radial-gradient(ellipse at 10% 20%, rgba(255, 100, 40, 0.05) 0%, transparent 30%),
                radial-gradient(ellipse at 90% 20%, rgba(255, 100, 40, 0.05) 0%, transparent 30%),
                linear-gradient(180deg, #12100e 0%, #1a1815 20%, #1f1c18 40%, #181510 70%, #0d0b08 100%);
            z-index: -2;
        }

        /* Stone texture overlay */
        .stone-texture {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-image:
                repeating-linear-gradient(0deg, transparent, transparent 80px, rgba(0,0,0,0.15) 80px, rgba(0,0,0,0.05) 82px),
                repeating-linear-gradient(90deg, transparent, transparent 120px, rgba(0,0,0,0.1) 120px, rgba(0,0,0,0.03) 123px),
                url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
            opacity: 0.12;
            z-index: -1;
            pointer-events: none;
        }

        .container {
            max-width: 1400px;
            margin: 0 auto;
            padding: 30px 20px;
        }

        /* Back link */
        .back-link {
            display: inline-flex;
            align-items: center;
            gap: 8px;
            color: #8b7355;
            text-decoration: none;
            font-family: 'Cinzel', serif;
            font-size: 0.9em;
            padding: 8px 16px;
            border: 1px solid rgba(139, 115, 85, 0.3);
            border-radius: 4px;
            background: rgba(0, 0, 0, 0.3);
            transition: all 0.3s ease;
            margin-bottom: 15px;
        }

        .back-link:hover {
            color: #d4a574;
            border-color: rgba(212, 165, 116, 0.5);
            background: rgba(0, 0, 0, 0.5);
            text-shadow: 0 0 10px rgba(255, 150, 80, 0.3);
        }

        .back-link .arrow {
            font-size: 0.8em;
        }

        /* Stone header banner */
        .header-banner {
            text-align: center;
            margin-bottom: 30px;
            position: relative;
        }

        .stone-plate {
            display: inline-block;
            background: linear-gradient(180deg, #4a4540 0%, #3a3530 20%, #2a2520 60%, #1a1510 100%);
            padding: 20px 60px;
            border-radius: 8px;
            border: 3px solid #5a4a3a;
            box-shadow:
                0 8px 30px rgba(0,0,0,0.8),
                inset 0 2px 4px rgba(255,255,255,0.1),
                inset 0 -4px 8px rgba(0,0,0,0.4);
            position: relative;
        }

        .stone-plate::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.2' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
            opacity: 0.08;
            border-radius: 8px;
            pointer-events: none;
        }

        h1 {
            font-family: 'Cinzel Decorative', serif;
            font-size: 2.2em;
            color: transparent;
            background: linear-gradient(180deg,
                #fff8e8 0%,
                #ffe4a0 15%,
                #ffcc44 30%,
                #ff9922 50%,
                #ff6600 70%,
                #dd3300 90%,
                #aa1100 100%);
            -webkit-background-clip: text;
            background-clip: text;
            text-shadow:
                0 0 10px rgba(255, 200, 100, 1),
                0 0 20px rgba(255, 150, 50, 0.9),
                0 0 40px rgba(255, 100, 30, 0.8),
                0 0 60px rgba(255, 80, 20, 0.6),
                0 0 80px rgba(255, 50, 10, 0.5),
                0 0 120px rgba(255, 30, 0, 0.4),
                2px 2px 4px rgba(0,0,0,0.8);
            letter-spacing: 3px;
            animation: headerGlow 2s ease-in-out infinite alternate;
        }

        @keyframes headerGlow {
            0% {
                text-shadow:
                    0 0 10px rgba(255, 200, 100, 1),
                    0 0 20px rgba(255, 150, 50, 0.9),
                    0 0 40px rgba(255, 100, 30, 0.8),
                    0 0 60px rgba(255, 80, 20, 0.6),
                    0 0 80px rgba(255, 50, 10, 0.5),
                    0 0 120px rgba(255, 30, 0, 0.4),
                    2px 2px 4px rgba(0,0,0,0.8);
                filter: brightness(1);
            }
            100% {
                text-shadow:
                    0 0 15px rgba(255, 220, 120, 1),
                    0 0 30px rgba(255, 180, 80, 1),
                    0 0 50px rgba(255, 130, 50, 0.9),
                    0 0 80px rgba(255, 100, 40, 0.7),
                    0 0 100px rgba(255, 70, 20, 0.6),
                    0 0 150px rgba(255, 40, 10, 0.5),
                    2px 2px 4px rgba(0,0,0,0.8);
                filter: brightness(1.1);
            }
        }

        .subtitle {
            font-family: 'Metamorphous', serif;
            font-size: 1em;
            color: transparent;
            background: linear-gradient(180deg,
                #ffeecc 0%,
                #ffcc66 30%,
                #ff9933 60%,
                #ff6600 100%);
            -webkit-background-clip: text;
            background-clip: text;
            margin-top: 8px;
            letter-spacing: 4px;
            text-shadow:
                0 0 8px rgba(255, 180, 80, 0.9),
                0 0 15px rgba(255, 130, 50, 0.7),
                0 0 30px rgba(255, 100, 30, 0.5),
                0 0 50px rgba(255, 60, 10, 0.4);
            animation: subtitleGlow 2.5s ease-in-out infinite alternate;
        }

        @keyframes subtitleGlow {
            0% {
                text-shadow:
                    0 0 8px rgba(255, 180, 80, 0.9),
                    0 0 15px rgba(255, 130, 50, 0.7),
                    0 0 30px rgba(255, 100, 30, 0.5),
                    0 0 50px rgba(255, 60, 10, 0.4);
            }
            100% {
                text-shadow:
                    0 0 12px rgba(255, 200, 100, 1),
                    0 0 25px rgba(255, 160, 70, 0.9),
                    0 0 40px rgba(255, 120, 50, 0.7),
                    0 0 60px rgba(255, 80, 20, 0.5);
            }
        }

        /* Gem Loot Roller Section */
        .loot-roller-section {
            background: linear-gradient(180deg, #3a3530 0%, #2a2520 50%, #1a1510 100%);
            border: 3px solid #5a4a3a;
            border-radius: 12px;
            padding: 25px;
            margin-bottom: 30px;
            box-shadow: 0 8px 30px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.1);
            position: relative;
        }

        .loot-roller-section::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
            opacity: 0.06;
            border-radius: 12px;
            pointer-events: none;
        }

        .loot-roller-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-bottom: 20px;
            flex-wrap: wrap;
            gap: 15px;
        }

        .loot-roller-title {
            font-family: 'Cinzel Decorative', serif;
            font-size: 1.4em;
            color: #d4a574;
        }

        .tier-buttons {
            display: flex;
            gap: 10px;
            flex-wrap: wrap;
        }

        .tier-btn {
            background: linear-gradient(180deg, #4a4540 0%, #3a3530 50%, #2a2520 100%);
            border: 2px solid #5a4a3a;
            border-radius: 8px;
            padding: 12px 20px;
            font-family: 'Cinzel', serif;
            font-size: 0.9em;
            color: #c9a86c;
            cursor: pointer;
            transition: all 0.3s ease;
            position: relative;
            overflow: hidden;
        }

        .tier-btn::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
            opacity: 0.1;
            pointer-events: none;
        }

        .tier-btn:hover {
            border-color: #8b7355;
            transform: translateY(-2px);
            box-shadow: 0 4px 15px rgba(0,0,0,0.5);
        }

        .tier-btn.tier-1 { border-left: 4px solid #808080; }
        .tier-btn.tier-2 { border-left: 4px solid #4a9050; }
        .tier-btn.tier-3 { border-left: 4px solid #5080c0; }
        .tier-btn.tier-4 { border-left: 4px solid #a050c0; }

        .tier-label {
            font-weight: 600;
            display: block;
        }

        .tier-desc {
            font-size: 0.75em;
            color: #888;
            margin-top: 3px;
        }

        /* Loot results display */
        .loot-results {
            min-height: 100px;
            background: rgba(0,0,0,0.3);
            border-radius: 8px;
            padding: 15px;
            display: flex;
            flex-wrap: wrap;
            gap: 12px;
            align-items: center;
            justify-content: center;
        }

        .loot-gem {
            background: linear-gradient(180deg, #3a3530 0%, #2a2520 100%);
            border: 2px solid #5a4a3a;
            border-radius: 8px;
            padding: 12px 15px;
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 8px;
            transition: all 0.3s ease;
            animation: dropIn 0.5s ease-out;
            min-width: 100px;
            cursor: pointer;
            position: relative;
        }

        .loot-gem:hover {
            border-color: #8b4a4a;
            background: linear-gradient(180deg, #4a3530 0%, #3a2520 100%);
        }

        .loot-gem:hover::after {
            content: '✕';
            position: absolute;
            top: 5px;
            right: 8px;
            font-size: 0.7em;
            color: #ff6666;
            opacity: 0.8;
        }

        @keyframes dropIn {
            0% { transform: translateY(-30px) scale(0.8); opacity: 0; }
            60% { transform: translateY(5px) scale(1.05); }
            100% { transform: translateY(0) scale(1); opacity: 1; }
        }

        .loot-gem-icon {
            width: 40px;
            height: 40px;
        }

        .loot-gem-icon svg {
            width: 100%;
            height: 100%;
        }

        .loot-gem-name {
            font-size: 0.85em;
            color: #e8dcc0;
            text-align: center;
        }

        .loot-gem-cut {
            font-size: 0.7em;
            color: #8b7355;
            text-align: center;
        }

        .loot-placeholder {
            color: #666;
            font-style: italic;
        }

        .loot-count {
            background: rgba(212, 165, 116, 0.2);
            border: 1px solid #5a4a3a;
            border-radius: 20px;
            padding: 8px 20px;
            color: #d4a574;
            font-size: 0.9em;
        }

        .add-gem-btn {
            background: linear-gradient(180deg, #3a3530 0%, #2a2520 100%);
            border: 2px dashed #6b5a48;
            border-radius: 8px;
            padding: 12px 15px;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: 5px;
            cursor: pointer;
            transition: all 0.3s ease;
            min-width: 100px;
            color: #d4a574;
            font-family: 'Cinzel', serif;
            font-size: 0.75em;
            position: relative;
        }

        .add-gem-btn::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
            opacity: 0.06;
            border-radius: 8px;
            pointer-events: none;
        }

        .add-gem-btn:hover {
            background: linear-gradient(180deg, #4a4540 0%, #3a3530 100%);
            border-color: #8b7355;
            border-style: solid;
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(0,0,0,0.4);
        }

        .add-gem-btn .plus-icon {
            font-size: 1.8em;
            line-height: 1;
            color: #c9a86c;
            text-shadow: 0 2px 4px rgba(0,0,0,0.5);
        }

        .add-gem-btn:hover .plus-icon {
            color: #ffd700;
        }

        /* Selection Panel */
        .selection-panel {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 25px;
            margin-bottom: 30px;
        }

        @media (max-width: 900px) {
            .selection-panel {
                grid-template-columns: 1fr;
            }
        }

        .selection-group {
            background: linear-gradient(180deg, #3a3530 0%, #2a2520 50%, #1a1510 100%);
            border: 3px solid #5a4a3a;
            border-radius: 12px;
            padding: 20px;
            position: relative;
            box-shadow: 0 6px 25px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.08);
        }

        .selection-group::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
            opacity: 0.06;
            border-radius: 12px;
            pointer-events: none;
        }

        .selection-group h2 {
            font-family: 'Cinzel Decorative', serif;
            color: #d4a574;
            font-size: 1.2em;
            margin-bottom: 15px;
            padding-bottom: 10px;
            border-bottom: 2px solid #4a3a2a;
            position: relative;
        }

        .option-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(95px, 1fr));
            gap: 8px;
            position: relative;
        }

        .option-btn {
            background: linear-gradient(180deg, #3a3530 0%, #2a2520 100%);
            border: 2px solid #4a3a2a;
            border-radius: 8px;
            padding: 10px 6px;
            cursor: pointer;
            transition: all 0.3s ease;
            text-align: center;
            color: #c9a86c;
            font-family: 'Cinzel', serif;
            font-size: 0.7em;
            position: relative;
        }

        .option-btn::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
            opacity: 0.08;
            border-radius: 8px;
            pointer-events: none;
        }

        .option-btn:hover:not(:disabled) {
            border-color: #8b7355;
            transform: translateY(-2px);
        }

        .option-btn.selected {
            background: linear-gradient(180deg, #4a4035 0%, #3a3025 100%);
            border-color: #d4a574;
            color: #fff;
            box-shadow: 0 0 15px rgba(212, 165, 116, 0.3);
        }

        .option-btn:disabled {
            opacity: 0.25;
            cursor: not-allowed;
        }

        .option-btn .gem-preview {
            width: 32px;
            height: 32px;
            border-radius: 50%;
            margin: 0 auto 5px;
            border: 2px solid rgba(255,255,255,0.15);
        }

        .option-btn .cut-preview {
            width: 32px;
            height: 32px;
            margin: 0 auto 5px;
        }

        .option-btn .cut-preview svg {
            width: 100%;
            height: 100%;
        }

        .gem-price {
            font-size: 0.85em;
            color: #ffd700;
            margin-top: 2px;
        }

        /* THE FORGE - Multi-click button */
        .forge-section {
            text-align: center;
            margin-bottom: 30px;
        }

        .forge-anvil {
            display: inline-block;
            position: relative;
        }

        .forge-btn {
            background: linear-gradient(180deg, #4a4540 0%, #3a3530 30%, #2a2520 70%, #1a1510 100%);
            border: 4px solid #6b5a48;
            border-radius: 12px;
            padding: 20px 60px;
            font-family: 'Cinzel Decorative', serif;
            font-size: 1.3em;
            color: #c9a86c;
            cursor: pointer;
            position: relative;
            overflow: hidden;
            transition: all 0.2s ease;
            box-shadow:
                0 8px 30px rgba(0,0,0,0.6),
                inset 0 2px 4px rgba(255,255,255,0.1),
                inset 0 -4px 8px rgba(0,0,0,0.3);
            min-width: 300px;
        }

        .forge-btn::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
            opacity: 0.1;
            pointer-events: none;
        }

        .forge-btn:hover:not(:disabled) {
            transform: translateY(-2px);
            border-color: #8b7355;
        }

        .forge-btn:active:not(:disabled) {
            transform: translateY(2px) scale(0.98);
            box-shadow: 0 2px 10px rgba(0,0,0,0.6);
        }

        .forge-btn:disabled {
            opacity: 0.4;
            cursor: not-allowed;
        }

        /* Fire fill effect */
        .forge-fire {
            position: absolute;
            bottom: 0;
            left: 0;
            height: 100%;
            width: 0%;
            background: linear-gradient(90deg,
                rgba(255, 80, 0, 0.7) 0%,
                rgba(255, 120, 0, 0.8) 30%,
                rgba(255, 180, 0, 0.9) 60%,
                rgba(255, 220, 100, 1) 100%);
            transition: width 0.15s ease-out;
            z-index: 0;
            pointer-events: none;
        }

        .forge-fire::after {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: linear-gradient(180deg,
                rgba(255,255,200,0.3) 0%,
                transparent 30%,
                transparent 70%,
                rgba(255,100,0,0.5) 100%);
        }

        .forge-btn-text {
            position: relative;
            z-index: 1;
            text-shadow: 0 2px 4px rgba(0,0,0,0.8);
        }

        .forge-btn.heating .forge-btn-text {
            color: #1a0f0a;
            text-shadow: 0 0 10px rgba(255,200,100,0.8);
        }

        .forge-progress {
            margin-top: 10px;
            font-size: 0.9em;
            color: #8b7355;
        }

        .forge-progress .strikes {
            color: #ff8844;
            font-weight: 600;
        }

        /* Spark container - uses absolute positioning relative to document */
        .spark-container {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            pointer-events: none;
            z-index: 1000;
            overflow: visible;
        }

        .spark {
            position: absolute;
            width: 8px;
            height: 8px;
            background: radial-gradient(circle, #fff 0%, #ffcc00 30%, #ff6600 60%, #ff2200 100%);
            border-radius: 50%;
            box-shadow: 0 0 12px #ff8800, 0 0 25px #ff4400, 0 0 40px #ff2200;
            animation: sparkFly var(--spark-duration, 0.8s) ease-out forwards;
            pointer-events: none;
        }

        .spark.large {
            width: 12px;
            height: 12px;
            box-shadow: 0 0 15px #ffaa00, 0 0 30px #ff6600, 0 0 50px #ff2200;
        }

        .spark.small {
            width: 4px;
            height: 4px;
        }

        @keyframes sparkFly {
            0% {
                transform: translate(0, 0) scale(1);
                opacity: 1;
            }
            50% {
                opacity: 1;
            }
            100% {
                transform: translate(var(--spark-x), var(--spark-y)) scale(0);
                opacity: 0;
            }
        }

        /* Ember trails */
        .ember {
            position: absolute;
            width: 3px;
            height: 3px;
            background: #ff4400;
            border-radius: 50%;
            box-shadow: 0 0 6px #ff2200;
            animation: emberFloat var(--ember-duration, 2s) ease-out forwards;
            pointer-events: none;
        }

        @keyframes emberFloat {
            0% {
                transform: translate(0, 0) scale(1);
                opacity: 0.8;
            }
            100% {
                transform: translate(var(--ember-x), var(--ember-y)) scale(0.3);
                opacity: 0;
            }
        }

        /* Dice Roll Overlay */
        .dice-roll-overlay {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0,0,0,0.9);
            z-index: 2000;
            justify-content: center;
            align-items: center;
            flex-direction: column;
        }

        .dice-roll-overlay.active {
            display: flex;
            animation: overlayIn 0.3s ease-out;
        }

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

        .dice-container {
            font-size: 6em;
            color: #ffd700;
            text-shadow: 0 0 40px rgba(255,150,50,0.8), 0 0 80px rgba(255,100,0,0.5);
            margin-bottom: 20px;
        }

        /* Fixed-size roll panel */
        .roll-panel {
            display: flex;
            align-items: stretch;
            background: linear-gradient(180deg, #2a2520 0%, #1a1510 100%);
            border: 3px solid #5a4a3a;
            border-radius: 16px;
            overflow: hidden;
            width: 650px;
            min-height: 280px;
        }

        .roll-info {
            flex: 1;
            padding: 25px;
            display: flex;
            flex-direction: column;
            font-family: 'Cinzel', serif;
        }

        .roll-header {
            color: #8b7355;
            font-size: 0.85em;
            margin-bottom: 15px;
            text-align: center;
        }

        .roll-gem-name {
            font-size: 1.4em;
            color: #d4a574;
            text-align: center;
            margin-bottom: 5px;
        }

        .roll-cut-name {
            font-size: 0.9em;
            color: #8b7355;
            text-align: center;
            margin-bottom: 20px;
        }

        .roll-rows {
            flex: 1;
            display: flex;
            flex-direction: column;
            justify-content: center;
            gap: 15px;
        }

        .roll-row {
            display: flex;
            align-items: center;
            gap: 15px;
            padding: 12px 15px;
            background: rgba(0,0,0,0.3);
            border-radius: 8px;
            transition: all 0.3s ease;
        }

        .roll-row.active {
            background: rgba(255, 200, 100, 0.15);
            border: 1px solid #6b5a48;
        }

        .roll-row.success {
            background: rgba(100, 255, 100, 0.1);
            border: 1px solid #4a6a4a;
        }

        .roll-row.fail {
            background: rgba(255, 100, 100, 0.1);
            border: 1px solid #6a4a4a;
        }

        .roll-arrow {
            font-size: 1.2em;
            color: #ffd700;
            opacity: 0;
            transition: opacity 0.3s ease;
            width: 25px;
            text-align: center;
        }

        .roll-row.active .roll-arrow {
            opacity: 1;
            animation: arrowPulse 0.8s ease-in-out infinite;
        }

        @keyframes arrowPulse {
            0%, 100% { transform: translateX(0); }
            50% { transform: translateX(5px); }
        }

        .roll-label {
            flex: 1;
            font-size: 0.95em;
            color: #c9a86c;
        }

        .roll-threshold {
            font-size: 0.8em;
            color: #666;
        }

        .roll-value {
            font-size: 1.3em;
            font-weight: 600;
            color: #888;
            min-width: 50px;
            text-align: center;
        }

        .roll-value.rolled {
            color: #ffd700;
        }

        .roll-value.success {
            color: #80ff80;
        }

        .roll-value.fail {
            color: #ff6666;
        }

        .roll-status {
            font-size: 1.2em;
            width: 30px;
            text-align: center;
        }

        /* Gem preview panel */
        .roll-gem-preview {
            width: 180px;
            background: rgba(0,0,0,0.4);
            display: flex;
            align-items: center;
            justify-content: center;
            border-left: 2px solid #3a3025;
            padding: 20px;
            position: relative;
            overflow: hidden;
        }

        .roll-gem-preview svg {
            width: 120px;
            height: 120px;
            filter: drop-shadow(0 0 20px var(--gem-glow, rgba(255,255,255,0.3)));
        }

        .roll-gem-preview::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
            opacity: 0.05;
            pointer-events: none;
        }

        /* Slide animation for gem transitions */
        .roll-panel.slide-out {
            animation: slideOut 0.3s ease-in forwards;
        }

        .roll-panel.slide-in {
            animation: slideIn 0.3s ease-out forwards;
        }

        @keyframes slideOut {
            from { transform: translateX(0); opacity: 1; }
            to { transform: translateX(-50px); opacity: 0; }
        }

        @keyframes slideIn {
            from { transform: translateX(50px); opacity: 0; }
            to { transform: translateX(0); opacity: 1; }
        }

        /* Card Display */
        .card-display {
            display: flex;
            justify-content: center;
            flex-wrap: wrap;
            gap: 25px;
            padding: 20px;
            min-height: 600px;
        }

        /* Card drop animation */
        .gem-card {
            width: 310px;
            background: linear-gradient(180deg, #2a2520 0%, #1a1510 100%);
            border: 4px solid #6b5a48;
            border-radius: 16px;
            overflow: hidden;
            box-shadow:
                0 10px 40px rgba(0,0,0,0.8),
                inset 0 1px 0 rgba(255,255,255,0.1);
            animation: cardDrop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
            position: relative;
        }

        @keyframes cardDrop {
            0% {
                transform: translateY(-100px) rotate(-5deg) scale(0.8);
                opacity: 0;
            }
            60% {
                transform: translateY(20px) rotate(2deg) scale(1.02);
            }
            80% {
                transform: translateY(-5px) rotate(-1deg) scale(0.99);
            }
            100% {
                transform: translateY(0) rotate(0deg) scale(1);
                opacity: 1;
            }
        }

        .gem-card.partial-magic {
            border-color: #5a6a5a;
        }

        .gem-card.partial-magic .card-header {
            background: linear-gradient(180deg, #3a4035 0%, #2a3025 100%);
        }

        .gem-card::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
            opacity: 0.04;
            pointer-events: none;
        }

        .gem-card.mundane {
            filter: grayscale(40%);
            border-color: #4a4a4a;
        }

        .card-header {
            background: linear-gradient(180deg, #3a3530 0%, #2a2520 100%);
            padding: 15px 20px;
            border-bottom: 2px solid #5a4a3a;
            text-align: center;
        }

        .card-title {
            font-family: 'Cinzel Decorative', serif;
            font-size: 1.3em;
            color: #fff;
            text-shadow: 0 0 10px var(--gem-glow, rgba(255,255,255,0.3));
        }

        .card-subtitle {
            font-size: 0.85em;
            color: #9a8a7a;
            margin-top: 5px;
        }

        .card-price {
            font-size: 1em;
            color: #ffd700;
            margin-top: 8px;
            font-weight: 600;
        }

        .card-gem-display {
            padding: 25px;
            display: flex;
            justify-content: center;
            align-items: center;
            background: radial-gradient(circle at 50% 50%, var(--gem-bg, rgba(50,50,50,0.3)) 0%, transparent 70%);
        }

        .card-gem-display svg {
            width: 150px;
            height: 150px;
            filter: drop-shadow(0 0 20px var(--gem-glow, rgba(255,255,255,0.3)));
        }

        .mundane-badge {
            background: #3a3a3a;
            color: #888;
            padding: 5px 15px;
            border-radius: 20px;
            font-size: 0.8em;
            text-align: center;
            margin: 0 20px 15px;
        }

        .card-properties {
            padding: 15px 20px 10px 20px;
            border-top: 2px solid #3a3530;
        }

        .property-section {
            margin-bottom: 12px;
        }

        .property-section:last-child {
            margin-bottom: 0;
        }

        .property-label {
            font-size: 0.7em;
            color: #8b7355;
            text-transform: uppercase;
            letter-spacing: 2px;
            margin-bottom: 4px;
        }

        .property-value {
            color: #e8dcc0;
            font-size: 0.85em;
            line-height: 1.4;
        }

        .property-value.highlight {
            color: var(--gem-accent, #d4a574);
            font-weight: 600;
        }

        .property-value.disabled {
            color: #555;
            text-decoration: line-through;
        }

        .stat-row {
            display: flex;
            justify-content: space-between;
            padding: 5px 0;
            border-bottom: 1px solid rgba(90, 74, 58, 0.3);
            font-size: 0.8em;
        }

        .stat-row:last-child {
            border-bottom: none;
        }

        .stat-name {
            color: #9a8a7a;
        }

        .stat-value {
            color: var(--gem-accent, #d4a574);
            font-weight: 600;
        }

        .card-footer {
            background: linear-gradient(180deg, #2a2520 0%, #1a1510 100%);
            padding: 10px 20px;
            border-top: 2px solid #3a3530;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .rarity-badge {
            display: inline-block;
            padding: 4px 12px;
            border-radius: 15px;
            font-size: 0.7em;
            font-weight: 600;
            letter-spacing: 1px;
            text-transform: uppercase;
        }

        .rarity-common { background: #4a4a4a; color: #c0c0c0; }
        .rarity-uncommon { background: #2a4a2a; color: #80c080; }
        .rarity-rare { background: #2a3a5a; color: #80a0e0; }
        .rarity-epic { background: #4a2a5a; color: #c080e0; }
        .rarity-legendary { background: #5a4a1a; color: #ffd700; }

        .roll-badge {
            font-size: 0.75em;
            color: #888;
        }

        .roll-badge.success {
            color: #80c080;
        }

        /* Placeholder */
        .placeholder-card {
            width: 310px;
            height: 500px;
            background: linear-gradient(180deg, #2a2520 0%, #1a1510 100%);
            border: 3px dashed #4a3a2a;
            border-radius: 16px;
            display: flex;
            align-items: center;
            justify-content: center;
            color: #5a4a3a;
            font-size: 1em;
            text-align: center;
            padding: 40px;
            position: relative;
        }

        .placeholder-card::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
            opacity: 0.05;
            border-radius: 16px;
            pointer-events: none;
        }

        /* Forge ready indicator */
        .forge-ready-count {
            background: linear-gradient(180deg, #4a3520 0%, #3a2510 100%);
            border: 2px solid #6b5a48;
            border-radius: 8px;
            padding: 10px 20px;
            margin-bottom: 15px;
            display: inline-block;
        }

        .forge-ready-count .count {
            color: #ffd700;
            font-size: 1.4em;
            font-weight: 700;
        }

        .forge-ready-count .label {
            color: #c9a86c;
            font-size: 0.9em;
        }

        /* Info panel */
        .info-panel {
            background: rgba(0,0,0,0.3);
            border: 1px solid #3a3025;
            border-radius: 6px;
            padding: 12px;
            margin-top: 12px;
            font-size: 0.8em;
            color: #8a7a6a;
            position: relative;
        }

        .info-panel strong {
            color: #d4a574;
        }

        /* Screen shake for impact */
        .screen-shake {
            animation: shake 0.3s ease-out;
        }

        @keyframes shake {
            0%, 100% { transform: translateX(0); }
            20% { transform: translateX(-5px) translateY(2px); }
            40% { transform: translateX(5px) translateY(-2px); }
            60% { transform: translateX(-3px) translateY(1px); }
            80% { transform: translateX(3px) translateY(-1px); }
        }

        /* Forge controls with modifiers */
        .forge-controls {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 15px;
        }

        .modifier-btn {
            background: linear-gradient(180deg, #4a4540 0%, #3a3530 50%, #2a2520 100%);
            border: 3px solid #5a4a3a;
            border-radius: 50%;
            width: 60px;
            height: 60px;
            font-family: 'Cinzel', serif;
            font-size: 1.8em;
            font-weight: 700;
            color: #c9a86c;
            cursor: pointer;
            transition: all 0.2s ease;
            display: flex;
            align-items: center;
            justify-content: center;
            position: relative;
        }

        .modifier-btn::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
            opacity: 0.1;
            border-radius: 50%;
            pointer-events: none;
        }

        .modifier-btn:hover {
            transform: scale(1.1);
            border-color: #8b7355;
        }

        .modifier-btn:active {
            transform: scale(0.95);
        }

        .modifier-btn.minus {
            color: #ff6666;
        }

        .modifier-btn.plus {
            color: #66ff66;
        }

        .modifier-display {
            background: rgba(0,0,0,0.4);
            border: 2px solid #4a3a2a;
            border-radius: 8px;
            padding: 8px 15px;
            margin-top: 10px;
            display: inline-block;
        }

        .modifier-display .label {
            color: #8b7355;
            font-size: 0.8em;
        }

        .modifier-display .value {
            color: #ffd700;
            font-size: 1.2em;
            font-weight: 600;
            margin-left: 8px;
        }

        .modifier-display .value.positive {
            color: #66ff66;
        }

        .modifier-display .value.negative {
            color: #ff6666;
        }

        /* Restrike button */
        .restrike-btn {
            background: linear-gradient(180deg, #3a4540 0%, #2a3530 50%, #1a2520 100%);
            border: 3px solid #4a6a5a;
            border-radius: 10px;
            padding: 12px 25px;
            font-family: 'Cinzel', serif;
            font-size: 1em;
            color: #8bba8b;
            cursor: pointer;
            transition: all 0.2s ease;
            margin-top: 15px;
        }

        .restrike-btn:hover {
            background: linear-gradient(180deg, #4a5550 0%, #3a4540 50%, #2a3530 100%);
            border-color: #6a8a7a;
            transform: translateY(-2px);
        }

        .restrike-btn:disabled {
            opacity: 0.4;
            cursor: not-allowed;
        }

        /* Share button */
        .share-btn {
            background: linear-gradient(180deg, #3a4045 0%, #2a3035 50%, #1a2025 100%);
            border: 3px solid #4a5a6a;
            border-radius: 10px;
            padding: 12px 25px;
            font-family: 'Cinzel', serif;
            font-size: 1em;
            color: #8baabb;
            cursor: pointer;
            transition: all 0.2s ease;
            margin-top: 15px;
            margin-left: 10px;
        }

        .share-btn:hover {
            background: linear-gradient(180deg, #4a5055 0%, #3a4045 50%, #2a3035 100%);
            border-color: #6a7a8a;
            transform: translateY(-2px);
        }

        /* Share modal */
        .share-modal {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0,0,0,0.9);
            z-index: 3000;
            justify-content: center;
            align-items: center;
        }

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

        .share-modal-content {
            background: linear-gradient(180deg, #3a3530 0%, #2a2520 50%, #1a1510 100%);
            border: 3px solid #5a4a3a;
            border-radius: 16px;
            padding: 30px;
            max-width: 600px;
            width: 90%;
            text-align: center;
        }

        .share-modal-content h2 {
            font-family: 'Cinzel Decorative', serif;
            color: #d4a574;
            margin-bottom: 20px;
        }

        .share-url-box {
            background: rgba(0,0,0,0.4);
            border: 2px solid #4a3a2a;
            border-radius: 8px;
            padding: 15px;
            margin: 20px 0;
            word-break: break-all;
            font-family: monospace;
            font-size: 0.8em;
            color: #8bba8b;
            max-height: 150px;
            overflow-y: auto;
        }

        .share-modal-buttons {
            display: flex;
            gap: 15px;
            justify-content: center;
            margin-top: 20px;
        }

        .share-modal-btn {
            background: linear-gradient(180deg, #4a4540 0%, #3a3530 50%, #2a2520 100%);
            border: 2px solid #5a4a3a;
            border-radius: 8px;
            padding: 12px 25px;
            font-family: 'Cinzel', serif;
            color: #c9a86c;
            cursor: pointer;
            transition: all 0.2s ease;
        }

        .share-modal-btn:hover {
            border-color: #8b7355;
            transform: translateY(-2px);
        }

        .share-modal-btn.primary {
            background: linear-gradient(180deg, #4a5540 0%, #3a4530 50%, #2a3520 100%);
            border-color: #5a6a4a;
            color: #8bba8b;
        }

        .copy-success {
            color: #80ff80;
            font-size: 0.9em;
            margin-top: 10px;
            opacity: 0;
            transition: opacity 0.3s ease;
        }

        .copy-success.show {
            opacity: 1;
        }

        /* ============================================ */
        /* VIEW-ONLY MODE (Shared Link) */
        /* ============================================ */
        body.view-only .back-link,
        body.view-only .header-banner,
        body.view-only .loot-roller-section,
        body.view-only .selection-panel,
        body.view-only .forge-section {
            display: none !important;
        }

        body.view-only .card-display {
            padding-top: 20px;
        }

        .view-only-header {
            display: none;
            text-align: center;
            padding: 20px;
            margin-bottom: 20px;
        }

        body.view-only .view-only-header {
            display: block;
        }

        .view-only-header h1 {
            font-family: 'Cinzel Decorative', serif;
            font-size: 1.8em;
            color: #d4a574;
            margin-bottom: 10px;
        }

        .view-only-header .subtitle {
            color: #8b7355;
            font-size: 0.9em;
            margin-bottom: 15px;
        }

        .create-own-btn {
            background: linear-gradient(180deg, #4a4540 0%, #3a3530 50%, #2a2520 100%);
            border: 2px solid #5a4a3a;
            border-radius: 8px;
            padding: 10px 20px;
            font-family: 'Cinzel', serif;
            font-size: 0.9em;
            color: #c9a86c;
            cursor: pointer;
            text-decoration: none;
            display: inline-block;
            transition: all 0.2s ease;
        }

        .create-own-btn:hover {
            border-color: #8b7355;
            transform: translateY(-2px);
        }

        /* ============================================ */
        /* PRINT STYLES */
        /* ============================================ */
        @media print {
            /* Hide everything except cards */
            body {
                background: white !important;
                color: black !important;
            }

            .bg-layer,
            .stone-texture,
            .spark-container,
            .dice-roll-overlay,
            .share-modal,
            .view-only-header,
            .header-banner,
            .loot-roller-section,
            .selection-panel,
            .forge-section {
                display: none !important;
            }

            .container {
                max-width: 100% !important;
                padding: 0 !important;
                margin: 0 !important;
            }

            .card-display {
                display: flex !important;
                flex-wrap: wrap !important;
                gap: 20px !important;
                justify-content: flex-start !important;
                padding: 10px !important;
                min-height: auto !important;
            }

            .placeholder-card {
                display: none !important;
            }

            /* Card print styling */
            .gem-card {
                width: 300px !important;
                background: white !important;
                border: 2px solid #333 !important;
                border-radius: 12px !important;
                box-shadow: none !important;
                animation: none !important;
                break-inside: avoid;
                page-break-inside: avoid;
                margin-bottom: 15px;
            }

            .gem-card::before {
                display: none !important;
            }

            .gem-card.mundane {
                filter: none !important;
            }

            .gem-card.partial-magic {
                border-color: #666 !important;
            }

            .card-header {
                background: #f5f5f5 !important;
                border-bottom: 1px solid #ccc !important;
                padding: 12px 15px !important;
            }

            .card-title {
                color: #222 !important;
                text-shadow: none !important;
                font-size: 1.1em !important;
            }

            .card-subtitle {
                color: #666 !important;
            }

            .card-price {
                color: #996600 !important;
            }

            .card-gem-display {
                padding: 15px !important;
                background: #fafafa !important;
            }

            .card-gem-display svg {
                width: 100px !important;
                height: 100px !important;
                filter: none !important;
            }

            .mundane-badge {
                display: none !important;
            }

            .card-properties {
                padding: 12px 15px !important;
                border-top: 1px solid #ddd !important;
            }

            .property-section {
                margin-bottom: 10px !important;
            }

            .property-label {
                color: #666 !important;
                font-size: 0.65em !important;
            }

            .property-value {
                color: #333 !important;
                font-size: 0.8em !important;
            }

            .property-value.highlight {
                color: #006600 !important;
                font-weight: 600 !important;
            }

            /* Hide inactive effects and roll info */
            .property-value.disabled,
            .print-hide,
            .roll-info {
                display: none !important;
            }

            .stat-row {
                border-bottom: 1px solid #eee !important;
                font-size: 0.75em !important;
            }

            .stat-name {
                color: #666 !important;
            }

            .stat-value {
                color: #333 !important;
            }

            .card-footer {
                background: #f0f0f0 !important;
                border-top: 1px solid #ccc !important;
                padding: 10px 15px !important;
            }

            .rarity-badge {
                background: #ddd !important;
                color: #333 !important;
                font-size: 0.65em !important;
            }

            .rarity-badge.rarity-mundane {
                background: #eee !important;
                color: #666 !important;
            }

            /* Hide roll info in print */
            .roll-badge {
                display: none !important;
            }

            /* Hide sections marked for print-hide on mundane cards */
            .gem-card.mundane .print-hide-mundane {
                display: none !important;
            }
        }
