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

body {
    font-family: 'Georgia', serif;
    background: linear-gradient(135deg, #2c1810 0%, #1a0f0a 100%);
    color: #2c1810;
    overflow: hidden;
}

#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

header {
    background: linear-gradient(135deg, #8B4513 0%, #654321 100%);
    color: #F4E8D8;
    padding: 1rem 2rem;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    border-bottom: 3px solid #4a3f35;
}

header h1 {
    font-size: 2rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    margin-bottom: 0.25rem;
}

.subtitle {
    font-size: 0.9rem;
    opacity: 0.9;
    font-style: italic;
}

.main-container {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.control-panel,
.details-panel {
    width: 280px;
    background: #F4E8D8;
    padding: 1rem;
    overflow-y: auto;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
    border: 2px solid #8B4513;
}

.control-panel {
    border-right: none;
}

.details-panel {
    border-left: none;
}

.panel-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #d4c4b0;
}

.panel-section:last-child {
    border-bottom: none;
}

.panel-section h3 {
    color: #654321;
    margin-bottom: 0.75rem;
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

label {
    display: block;
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
    color: #4a3f35;
}

select,
input[type="range"],
input[type="text"] {
    width: 100%;
    padding: 0.5rem;
    margin-top: 0.25rem;
    border: 2px solid #8B4513;
    background: #fff;
    border-radius: 4px;
    font-family: inherit;
}

input[type="range"] {
    padding: 0;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: auto;
    cursor: pointer;
}

.primary-btn {
    width: 100%;
    padding: 0.75rem;
    background: linear-gradient(135deg, #8B4513 0%, #654321 100%);
    color: #F4E8D8;
    border: 2px solid #4a3f35;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 8px rgba(0, 0, 0, 0.3);
}

.primary-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.export-btn {
    width: 100%;
    padding: 0.5rem;
    background: #D2B48C;
    border: 2px solid #8B4513;
    border-radius: 4px;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.export-btn:hover {
    background: #C4A67A;
    transform: translateY(-1px);
}

.seed-label {
    margin-top: 1rem;
}

.canvas-container {
    flex: 1;
    position: relative;
    background: #3a3a3a;
    overflow: hidden;
}

#dungeonCanvas {
    width: 100%;
    height: 100%;
    cursor: grab;
}

#dungeonCanvas:active {
    cursor: grabbing;
}

.canvas-controls {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: flex;
    gap: 0.5rem;
    z-index: 10;
}

.canvas-controls button {
    width: 40px;
    height: 40px;
    background: rgba(139, 69, 19, 0.9);
    color: #F4E8D8;
    border: 2px solid #4a3f35;
    border-radius: 4px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s;
}

.canvas-controls button:hover {
    background: rgba(101, 67, 33, 0.9);
    transform: scale(1.1);
}

.loading-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(139, 69, 19, 0.95);
    color: #F4E8D8;
    padding: 1.5rem 2rem;
    border-radius: 8px;
    font-size: 1.2rem;
    display: none;
    z-index: 100;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.5);
    border: 3px solid #4a3f35;
}

.flavor-text {
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: #F4E8D8;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-style: italic;
    opacity: 0;
    transition: opacity 0.5s;
    pointer-events: none;
}

.legend {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    font-size: 0.85rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.legend-icon {
    display: inline-block;
    width: 20px;
    height: 20px;
    text-align: center;
    border: 1px solid #8B4513;
}

#dungeonStats p {
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

#roomInfo {
    font-size: 0.85rem;
    line-height: 1.5;
}

#roomInfo .hint {
    font-style: italic;
    color: #666;
}

#roomInfo ul {
    margin-left: 1.5rem;
    margin-top: 0.5rem;
}

.dungeon-name {
    font-size: 1.1rem;
    font-weight: bold;
    color: #654321;
    text-align: center;
    padding: 0.75rem;
    background: rgba(210, 180, 140, 0.3);
    border-radius: 6px;
    border: 2px dashed #8B4513;
}

footer {
    background: #1a0f0a;
    color: #F4E8D8;
    padding: 0.75rem;
    text-align: center;
    font-size: 0.85rem;
    border-top: 2px solid #8B4513;
}

footer a {
    color: #FFD700;
    text-decoration: none;
    font-weight: bold;
}

footer a:hover {
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .details-panel {
        display: none;
    }
}

@media (max-width: 768px) {
    .main-container {
        flex-direction: column;
    }
    
    .control-panel {
        width: 100%;
        max-height: 200px;
        border-right: 2px solid #8B4513;
        border-bottom: none;
    }
    
    .canvas-container {
        flex: 1;
    }
    
    header h1 {
        font-size: 1.5rem;
    }
    
    .subtitle {
        font-size: 0.8rem;
    }
}

/* Scrollbar Styling */
.control-panel::-webkit-scrollbar,
.details-panel::-webkit-scrollbar {
    width: 8px;
}

.control-panel::-webkit-scrollbar-track,
.details-panel::-webkit-scrollbar-track {
    background: #d4c4b0;
}

.control-panel::-webkit-scrollbar-thumb,
.details-panel::-webkit-scrollbar-thumb {
    background: #8B4513;
    border-radius: 4px;
}

.control-panel::-webkit-scrollbar-thumb:hover,
.details-panel::-webkit-scrollbar-thumb:hover {
    background: #654321;
}