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

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

/* Deep mountain stone background */
.mountain-hall {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        /* Ambient forge glow from below */
        radial-gradient(ellipse 120% 40% at 50% 110%, rgba(255, 100, 30, 0.12) 0%, transparent 60%),
        /* Torch light from sides */
        radial-gradient(ellipse at 5% 30%, rgba(255, 150, 50, 0.06) 0%, transparent 40%),
        radial-gradient(ellipse at 95% 30%, rgba(255, 150, 50, 0.06) 0%, transparent 40%),
        /* Base stone gradient */
        linear-gradient(180deg,
            #1a1815 0%,
            #252220 20%,
            #1f1c1a 40%,
            #181614 60%,
            #1a1512 80%,
            #0d0b0a 100%);
    z-index: -3;
}

/* Rough stone texture overlay */
.stone-texture {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        /* Large stone blocks */
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 120px,
            rgba(0,0,0,0.3) 120px,
            rgba(0,0,0,0.1) 123px,
            transparent 126px
        ),
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 200px,
            rgba(0,0,0,0.2) 200px,
            rgba(0,0,0,0.05) 204px,
            transparent 208px
        ),
        /* Stone grain */
        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.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    opacity: 0.15;
    z-index: -2;
    pointer-events: none;
}

/* Metal beam accents */
.metal-beams {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
}

.beam-horizontal {
    position: absolute;
    width: 100%;
    height: 16px;
    background: linear-gradient(180deg,
        #3a3632 0%,
        #4a4540 15%,
        #2a2825 50%,
        #1a1815 85%,
        #0a0908 100%);
    box-shadow:
        0 3px 10px rgba(0,0,0,0.8),
        inset 0 1px 0 rgba(255,255,255,0.1),
        inset 0 -1px 0 rgba(0,0,0,0.5);
}

.beam-horizontal.top { top: 60px; }
.beam-horizontal.bottom { bottom: 30px; }

/* Rivets on beams */
.rivet {
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%,
        #5a5550 0%,
        #3a3530 40%,
        #2a2520 70%,
        #1a1510 100%);
    box-shadow:
        inset 0 1px 2px rgba(255,255,255,0.2),
        inset 0 -1px 2px rgba(0,0,0,0.5),
        0 2px 4px rgba(0,0,0,0.6);
    top: 3px;
}

/* Main container */
.container {
    max-width: 100%;
    margin: 0 auto;
    padding: 100px 40px 80px;
    position: relative;
    z-index: 2;
}

/* 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: 20px;
}

.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;
}

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

.stone-banner {
    display: inline-block;
    padding: 25px 60px;
    background: linear-gradient(180deg,
        #3a3530 0%,
        #4a4540 10%,
        #3a3530 30%,
        #2a2520 70%,
        #1a1510 100%);
    border-radius: 8px;
    position: relative;
    box-shadow:
        0 8px 32px 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);
}

/* Decorative corner brackets */
.stone-banner::before,
.stone-banner::after {
    content: '';
    position: absolute;
    width: 30px;
    height: 30px;
    border: 3px solid #8b7355;
    box-shadow:
        inset 0 0 6px rgba(0,0,0,0.5),
        0 0 8px rgba(0,0,0,0.4);
}

.stone-banner::before {
    top: 8px;
    left: 8px;
    border-right: none;
    border-bottom: none;
    border-radius: 4px 0 0 0;
}

.stone-banner::after {
    top: 8px;
    right: 8px;
    border-left: none;
    border-bottom: none;
    border-radius: 0 4px 0 0;
}

.corner-bracket-bl,
.corner-bracket-br {
    position: absolute;
    width: 30px;
    height: 30px;
    border: 3px solid #8b7355;
    box-shadow:
        inset 0 0 6px rgba(0,0,0,0.5),
        0 0 8px rgba(0,0,0,0.4);
}

.corner-bracket-bl {
    bottom: 8px;
    left: 8px;
    border-right: none;
    border-top: none;
    border-radius: 0 0 0 4px;
}

.corner-bracket-br {
    bottom: 8px;
    right: 8px;
    border-left: none;
    border-top: none;
    border-radius: 0 0 4px 0;
}

h1 {
    font-family: 'Cinzel Decorative', serif;
    font-size: 2.2em;
    font-weight: 700;
    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: 12px;
    letter-spacing: 4px;
    text-transform: uppercase;
    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),
        0 2px 4px rgba(0,0,0,0.6);
    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),
            0 2px 4px rgba(0,0,0,0.6);
    }
    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),
            0 2px 4px rgba(0,0,0,0.6);
    }
}

/* Rune decorations */
.runes {
    margin-top: 15px;
    font-size: 1.2em;
    letter-spacing: 12px;
    color: transparent;
    background: linear-gradient(180deg,
        #ffd080 0%,
        #ff9944 40%,
        #ff6622 70%,
        #cc3300 100%);
    -webkit-background-clip: text;
    background-clip: text;
    text-shadow:
        0 0 10px rgba(255, 150, 50, 0.8),
        0 0 20px rgba(255, 100, 30, 0.6),
        0 0 40px rgba(255, 60, 10, 0.4);
    animation: runeGlow 3s ease-in-out infinite alternate;
}

@keyframes runeGlow {
    0% {
        text-shadow:
            0 0 10px rgba(255, 150, 50, 0.8),
            0 0 20px rgba(255, 100, 30, 0.6),
            0 0 40px rgba(255, 60, 10, 0.4);
    }
    100% {
        text-shadow:
            0 0 15px rgba(255, 180, 80, 1),
            0 0 30px rgba(255, 130, 50, 0.8),
            0 0 50px rgba(255, 80, 20, 0.6);
    }
}

/* Tab System - Iron Plates */
.tab-container {
    max-width: 100%;
    margin: 0 auto 30px;
}

.tab-bar {
    display: flex;
    gap: 4px;
    margin-bottom: 0;
    justify-content: center;
}

.tab-btn {
    background: linear-gradient(180deg,
        #4a4540 0%,
        #3a3530 30%,
        #2a2520 70%,
        #1a1510 100%);
    color: #8b7355;
    border: 2px solid #5a4a3a;
    border-bottom: none;
    padding: 14px 30px;
    border-radius: 8px 8px 0 0;
    cursor: pointer;
    font-family: 'Cinzel', serif;
    font-size: 1em;
    transition: all 0.3s ease;
    position: relative;
    box-shadow:
        0 -4px 12px rgba(0,0,0,0.3),
        inset 0 2px 4px rgba(255,255,255,0.05);
}

.tab-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.08;
    border-radius: 8px 8px 0 0;
    pointer-events: none;
}

.tab-btn:hover {
    color: #c9a86c;
    border-color: #8b7355;
    background: linear-gradient(180deg,
        #5a5550 0%,
        #4a4540 30%,
        #3a3530 70%,
        #2a2520 100%);
}

.tab-btn.active {
    background: linear-gradient(180deg,
        #3a3530 0%,
        #2a2520 50%,
        #1a1510 100%);
    color: #d4a574;
    border-color: #6b5a48;
    text-shadow: 0 0 15px rgba(255, 150, 80, 0.3);
}

.tab-content {
    display: none;
    background: linear-gradient(180deg,
        #3a3530 0%,
        #2a2520 50%,
        #1a1510 100%);
    border: 3px solid #5a4a3a;
    border-radius: 0 0 12px 12px;
    padding: 25px;
    box-shadow:
        0 8px 30px rgba(0,0,0,0.6),
        inset 0 1px 0 rgba(255,255,255,0.08);
    position: relative;
}

.tab-content::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: 0 0 12px 12px;
    pointer-events: none;
}

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

/* Drawing Tool Styles */
.drawing-section {
    max-width: 900px;
    margin: 0 auto;
    text-align: center;
    position: relative;
}

.drawing-instructions {
    font-family: 'Cinzel', serif;
    color: #9a8a7a;
    font-size: 0.9em;
    margin-bottom: 15px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

/* Drawing Area with Toolbar */
.drawing-area {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 0;
}

/* Toolbar - Bronze/Iron Panel */
.drawing-toolbar {
    background: linear-gradient(180deg,
        #4a4540 0%,
        #3a3530 30%,
        #2a2520 70%,
        #1a1510 100%);
    border: 2px solid #5a4a3a;
    border-right: none;
    border-radius: 12px 0 0 12px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    box-shadow:
        -4px 0 15px rgba(0,0,0,0.4),
        inset 0 1px 0 rgba(255,255,255,0.08);
    position: relative;
}

.drawing-toolbar::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.08;
    border-radius: 12px 0 0 12px;
    pointer-events: none;
}

.toolbar-item {
    position: relative;
}

.toolbar-btn {
    background: linear-gradient(180deg,
        #3a3530 0%,
        #2a2520 100%);
    color: #c9a86c;
    border: 2px solid #4a3a2a;
    padding: 10px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-family: 'Cinzel', serif;
    font-size: 0.85em;
    width: 100%;
    text-align: left;
    transition: all 0.2s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.toolbar-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.1;
    border-radius: 6px;
    pointer-events: none;
}

.toolbar-btn:hover {
    border-color: #8b7355;
    background: linear-gradient(180deg,
        #4a4540 0%,
        #3a3530 100%);
    color: #e8dcc0;
}

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

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

.toolbar-btn .arrow {
    font-size: 0.7em;
    margin-left: 8px;
    color: #8b7355;
}

/* Flyout menu - Parchment Style */
.flyout-menu {
    position: absolute;
    left: 100%;
    top: 0;
    background: linear-gradient(180deg,
        #3a3530 0%,
        #2a2520 100%);
    border: 2px solid #5a4a3a;
    border-radius: 6px;
    padding: 6px 0;
    min-width: 150px;
    display: none;
    z-index: 100;
    box-shadow: 0 6px 20px rgba(0,0,0,0.5);
}

.flyout-menu::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: 6px;
    pointer-events: none;
}

.toolbar-item:hover .flyout-menu {
    display: block;
}

.toolbar-item.disabled:hover .flyout-menu {
    display: none;
}

.flyout-menu button {
    background: none;
    color: #c9a86c;
    border: none;
    padding: 10px 16px;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font-family: 'Cinzel', serif;
    font-size: 0.85em;
    transition: all 0.2s ease;
    position: relative;
}

.flyout-menu button:hover {
    background: rgba(212, 165, 116, 0.15);
    color: #e8dcc0;
}

.flyout-menu button.selected {
    background: rgba(212, 165, 116, 0.25);
    color: #fff;
    text-shadow: 0 0 8px rgba(255, 150, 80, 0.3);
}

/* Toolbar separator and label */
.toolbar-separator {
    height: 2px;
    background: linear-gradient(90deg,
        transparent 0%,
        #5a4a3a 20%,
        #8b7355 50%,
        #5a4a3a 80%,
        transparent 100%);
    margin: 10px 0;
}

.toolbar-label {
    font-family: 'Metamorphous', serif;
    color: #8b7355;
    font-size: 0.75em;
    padding: 4px 10px;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Canvas size controls */
.canvas-size-controls {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 4px 8px;
}

.canvas-size-controls label {
    display: flex;
    align-items: center;
    gap: 4px;
    color: #c9a86c;
    font-family: 'Cinzel', serif;
    font-size: 0.8em;
}

.canvas-size-controls input {
    width: 50px;
    background: linear-gradient(180deg, #2a2520 0%, #1a1510 100%);
    border: 2px solid #4a3a2a;
    border-radius: 4px;
    color: #d4a574;
    padding: 4px 6px;
    font-family: 'Cinzel', serif;
    font-size: 0.85em;
    text-align: center;
}

.canvas-size-controls input:focus {
    outline: none;
    border-color: #8b7355;
    box-shadow: 0 0 10px rgba(255, 150, 80, 0.2);
}

/* Mode indicator */
.mode-indicator {
    font-family: 'Metamorphous', serif;
    color: #8b7355;
    font-size: 0.8em;
    padding: 10px;
    text-align: center;
    border-top: 2px solid #4a3a2a;
    margin-top: 6px;
    letter-spacing: 1px;
}

.mode-indicator.active {
    color: #80c080;
    text-shadow: 0 0 8px rgba(100, 200, 100, 0.3);
}

/* Drawing Canvas - Parchment Surface */
.drawing-canvas {
    background: linear-gradient(180deg,
        #2a2520 0%,
        #1a1510 100%);
    border: 2px solid #5a4a3a;
    border-left: none;
    border-radius: 0 12px 12px 0;
    padding: 20px;
    display: inline-block;
    box-shadow:
        inset 0 0 30px rgba(0,0,0,0.4),
        4px 0 15px rgba(0,0,0,0.3);
    position: relative;
}

.drawing-canvas::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;
    border-radius: 0 12px 12px 0;
    pointer-events: none;
}

#drawingGrid {
    cursor: crosshair;
    border: 2px solid #5a4a3a;
    border-radius: 4px;
    box-shadow: 0 0 20px rgba(0,0,0,0.3);
}

/* Modal - Stone Slab */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

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

.modal {
    background: linear-gradient(180deg,
        #3a3530 0%,
        #2a2520 50%,
        #1a1510 100%);
    border: 3px solid #5a4a3a;
    border-radius: 12px;
    padding: 28px;
    min-width: 320px;
    box-shadow:
        0 15px 50px rgba(0, 0, 0, 0.7),
        inset 0 1px 0 rgba(255,255,255,0.1);
    position: relative;
}

.modal::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.06;
    border-radius: 12px;
    pointer-events: none;
}

.modal h3 {
    font-family: 'Cinzel Decorative', serif;
    margin: 0 0 20px 0;
    color: #d4a574;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
    position: relative;
}

.modal input[type="text"] {
    width: 100%;
    padding: 12px 14px;
    background: linear-gradient(180deg, #2a2520 0%, #1a1510 100%);
    border: 2px solid #4a3a2a;
    border-radius: 6px;
    color: #e8dcc0;
    font-family: 'Cinzel', serif;
    font-size: 1em;
    margin-bottom: 20px;
    position: relative;
}

.modal input[type="text"]:focus {
    outline: none;
    border-color: #8b7355;
    box-shadow: 0 0 15px rgba(255, 150, 80, 0.2);
}

.modal-buttons {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    position: relative;
}

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

.modal-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.1;
    border-radius: 6px;
    pointer-events: none;
}

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

.modal-btn.cancel {
    background: linear-gradient(180deg,
        #3a3530 0%,
        #2a2520 50%,
        #1a1510 100%);
    color: #8b7355;
}

.modal-btn.cancel:hover {
    color: #c9a86c;
}

/* Dungeon Builder */
.dungeon-builder-layout {
    display: flex;
    gap: 20px;
    justify-content: flex-start;
    align-items: flex-start;
    width: 100%;
}

/* Room Palette - Iron Panel */
.room-palette {
    background: linear-gradient(180deg,
        #4a4540 0%,
        #3a3530 30%,
        #2a2520 70%,
        #1a1510 100%);
    border: 3px solid #5a4a3a;
    border-radius: 12px;
    padding: 16px;
    width: 220px;
    max-height: 800px;
    display: flex;
    flex-direction: column;
    box-shadow:
        0 8px 25px rgba(0,0,0,0.5),
        inset 0 1px 0 rgba(255,255,255,0.08);
    position: relative;
}

.room-palette::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;
}

.room-palette h3 {
    font-family: 'Cinzel Decorative', serif;
    color: #d4a574;
    margin: 0 0 12px 0;
    font-size: 1em;
    text-align: center;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
    position: relative;
}

.palette-rooms {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 200px;
    position: relative;
}

.palette-room {
    background: linear-gradient(180deg,
        #3a3530 0%,
        #2a2520 100%);
    border: 2px solid #4a3a2a;
    border-radius: 8px;
    padding: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.palette-room::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;
}

.palette-room:hover {
    border-color: #8b7355;
    background: linear-gradient(180deg,
        #4a4540 0%,
        #3a3530 100%);
}

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

.palette-room-dimensions {
    font-family: 'Cinzel', serif;
    color: #c9a86c;
    font-size: 0.75em;
    text-align: center;
    margin-top: 6px;
    position: relative;
}

.palette-room-preview {
    background: #f5f5f0;
    border: 2px solid #5a4a3a;
    border-radius: 4px;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.palette-room-preview svg {
    max-width: 100%;
    max-height: 100%;
}

.palette-room-actions {
    display: flex;
    gap: 6px;
    margin-top: 8px;
    position: relative;
}

.palette-room-actions button {
    flex: 1;
    background: linear-gradient(180deg,
        #3a3530 0%,
        #2a2520 100%);
    color: #c9a86c;
    border: 1px solid #4a3a2a;
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-family: 'Cinzel', serif;
    font-size: 0.75em;
    transition: all 0.2s ease;
}

.palette-room-actions button:hover {
    border-color: #8b7355;
    color: #e8dcc0;
}

.palette-room-actions button.delete:hover {
    background: linear-gradient(180deg,
        #5a3530 0%,
        #4a2520 100%);
    border-color: #8b4a4a;
    color: #ff8866;
}

.palette-controls {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 2px solid #4a3a2a;
    position: relative;
}

.no-rooms-msg {
    font-family: 'Cinzel', serif;
    color: #6b5a48;
    font-size: 0.85em;
    text-align: center;
    padding: 25px 12px;
    font-style: italic;
    position: relative;
}

/* Dungeon Canvas Area */
.dungeon-canvas-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    min-width: 0;
}

.dungeon-toolbar {
    background: linear-gradient(180deg,
        #4a4540 0%,
        #3a3530 50%,
        #2a2520 100%);
    border: 3px solid #5a4a3a;
    border-bottom: none;
    border-radius: 12px 12px 0 0;
    padding: 12px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow:
        0 -4px 15px rgba(0,0,0,0.3),
        inset 0 1px 0 rgba(255,255,255,0.08);
    position: relative;
    width: 100%;
}

.dungeon-toolbar::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.08;
    border-radius: 12px 12px 0 0;
    pointer-events: none;
}

.dungeon-toolbar .toolbar-label {
    position: relative;
}

.dungeon-toolbar .canvas-size-controls {
    flex-direction: row;
    gap: 10px;
    position: relative;
}

.dungeon-canvas-wrapper {
    background: linear-gradient(180deg,
        #2a2520 0%,
        #1a1510 100%);
    border: 3px solid #5a4a3a;
    border-top: none;
    border-radius: 0 0 12px 12px;
    padding: 20px;
    overflow: auto;
    width: 100%;
    max-height: 960px;
    box-shadow:
        0 8px 25px rgba(0,0,0,0.5),
        inset 0 0 30px rgba(0,0,0,0.3);
    position: relative;
}

.dungeon-canvas-wrapper::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;
    border-radius: 0 0 12px 12px;
    pointer-events: none;
}

#dungeonCanvas {
    border: 2px solid #5a4a3a;
    border-radius: 4px;
    cursor: crosshair;
    box-shadow: 0 0 20px rgba(0,0,0,0.3);
    position: relative;
    display: block;
    min-width: 600px;
}

.dungeon-instructions {
    font-family: 'Cinzel', serif;
    color: #9a8a7a;
    font-size: 0.9em;
    margin-top: 12px;
    text-align: center;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

/* Flyout menu scrollable */
.flyout-menu.scrollable {
    max-height: 300px;
    overflow-y: auto;
}

.flyout-menu .room-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
}

.flyout-menu .room-item:hover {
    background: rgba(212, 165, 116, 0.15);
}

.flyout-menu .room-item-name {
    flex: 1;
    cursor: pointer;
    font-family: 'Cinzel', serif;
    color: #c9a86c;
}

.flyout-menu .room-item-name:hover {
    color: #e8dcc0;
}

.flyout-menu .room-item-delete {
    background: none;
    border: none;
    color: #8b7355;
    cursor: pointer;
    padding: 2px 6px;
    font-size: 0.9em;
    transition: color 0.2s ease;
}

.flyout-menu .room-item-delete:hover {
    color: #ff6666;
}

/* Load menu inside modal */
.load-menu {
    min-width: 280px;
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 18px;
    position: relative;
}

.load-menu .room-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.load-menu .room-item:hover {
    background: rgba(212, 165, 116, 0.15);
}

.load-menu .room-item-name {
    flex: 1;
    cursor: pointer;
    font-family: 'Cinzel', serif;
    color: #c9a86c;
}

.load-menu .room-item-name:hover {
    color: #e8dcc0;
    text-shadow: 0 0 8px rgba(255, 150, 80, 0.3);
}

.load-menu .room-item-delete {
    background: none;
    border: none;
    color: #8b7355;
    cursor: pointer;
    padding: 2px 8px;
    font-size: 1.1em;
    transition: color 0.2s ease;
}

.load-menu .room-item-delete:hover {
    color: #ff6666;
}

/* Export Modal */
.export-options {
    margin-bottom: 20px;
}

.export-size-row {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.export-size-row label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #c9a86c;
    font-size: 0.9em;
}

.export-size-row input[type="number"] {
    width: 80px;
    padding: 8px 10px;
    background: linear-gradient(180deg, #2a2520 0%, #1a1510 100%);
    border: 2px solid #4a3a2a;
    border-radius: 6px;
    color: #e8dcc0;
    font-family: 'Cinzel', serif;
    font-size: 0.9em;
    text-align: right;
}

.export-size-row input[type="number"]:focus {
    outline: none;
    border-color: #8b7355;
    box-shadow: 0 0 15px rgba(255, 150, 80, 0.2);
}

.export-format-row {
    display: flex;
    align-items: center;
    gap: 16px;
}

.export-format-row > label:first-child {
    color: #c9a86c;
    font-size: 0.9em;
}

.export-radio {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #d4d0c8;
    font-size: 0.9em;
    cursor: pointer;
}

.export-radio input[type="radio"] {
    appearance: none;
    width: 16px;
    height: 16px;
    border: 2px solid #5a4a3a;
    border-radius: 50%;
    background: linear-gradient(180deg, #2a2520 0%, #1a1510 100%);
    cursor: pointer;
    position: relative;
}

.export-radio input[type="radio"]:checked {
    border-color: #8b7355;
}

.export-radio input[type="radio"]:checked::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 6px;
    height: 6px;
    background: #d4a574;
    border-radius: 50%;
}

.toolbar-btn.small {
    padding: 6px 10px;
    font-size: 0.75em;
}

/* Responsive */
@media (max-width: 900px) {
    .container {
        padding: 80px 20px 60px;
    }

    h1 {
        font-size: 1.6em;
    }

    .stone-banner {
        padding: 20px 30px;
    }

    .dungeon-builder-layout {
        flex-direction: column;
        align-items: center;
    }

    .room-palette {
        width: 100%;
        max-width: 400px;
        max-height: 300px;
    }

    .drawing-area {
        flex-direction: column;
    }

    .drawing-toolbar {
        border-radius: 12px 12px 0 0;
        border-right: 2px solid #5a4a3a;
        border-bottom: none;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
    }

    .drawing-canvas {
        border-radius: 0 0 12px 12px;
        border-left: 2px solid #5a4a3a;
        border-top: none;
    }

    .beam-horizontal {
        display: none;
    }
}
