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

body {
    font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, serif;
    background-color: #E8DCC8;
    background-image:
        radial-gradient(ellipse at top, rgba(139, 131, 120, 0.1) 0%, transparent 60%),
        radial-gradient(ellipse at bottom, rgba(120, 113, 108, 0.1) 0%, transparent 60%);
    color: #3A2F23;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    background-color: #C9B898;
    background-image: linear-gradient(to bottom, #D4C4A8 0%, #C9B898 100%);
    padding: 1rem 2rem;
    border-bottom: 3px solid #8B7355;
    border-top: 3px solid #8B7355;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 2px 8px rgba(0, 0, 0, 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.header h1 {
    font-size: 1.8rem;
    color: #3A2F23;
    font-weight: 600;
    font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, serif;
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.5);
    letter-spacing: 0.5px;
}

.controls {
    display: flex;
    gap: 1rem;
    align-items: center;
}

/* Buttons */
.btn {
    padding: 0.5rem 1rem;
    border-radius: 0.25rem;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s;
    border: 2px solid;
    cursor: pointer;
    font-size: 0.875rem;
    font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, serif;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.btn-primary {
    background-color: #8B7355;
    color: #F5E6D3;
    border-color: #6B5843;
}

.btn-primary:hover {
    background-color: #6B5843;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
}

.btn-secondary {
    background-color: #A0896B;
    color: #F5E6D3;
    border-color: #8B7355;
}

.btn-secondary:hover {
    background-color: #8B7355;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
}

.dm-badge {
    background-color: #8B4542;
    color: #F5E6D3;
    padding: 0.5rem 1rem;
    border-radius: 0.25rem;
    border: 2px solid #6B3532;
    font-weight: 600;
    font-size: 0.875rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Map Container */
.map-container {
    flex: 1;
    background-color: #E8DCC8;
    background-image:
        repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(139, 131, 120, 0.03) 2px, rgba(139, 131, 120, 0.03) 4px),
        repeating-linear-gradient(90deg, transparent, transparent 2px, rgba(139, 131, 120, 0.03) 2px, rgba(139, 131, 120, 0.03) 4px);
    overflow: auto;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

#hexmap {
    background-color: #F5EFE0;
    border-radius: 0;
    border: 4px solid #8B7355;
    box-shadow:
        inset 0 0 30px rgba(139, 115, 85, 0.2),
        0 4px 12px rgba(0, 0, 0, 0.3);
    max-width: 100%;
    max-height: 100%;
}

/* Hex styles */
.hex {
    transition: all 0.2s ease;
}

/* Info Panel */
.info-panel {
    background-color: #C9B898;
    background-image: linear-gradient(to top, #D4C4A8 0%, #C9B898 100%);
    padding: 1.5rem 2rem;
    border-top: 3px solid #8B7355;
    box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.3), 0 -2px 8px rgba(0, 0, 0, 0.2);
}

.info-panel h3 {
    color: #3A2F23;
    margin-bottom: 0.75rem;
    font-size: 1.125rem;
    font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, serif;
    font-weight: 600;
}

.info-panel p {
    color: #5A4A3A;
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

.info-panel ul {
    list-style: none;
    margin: 0.75rem 0;
}

.info-panel li {
    color: #cbd5e1;
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

.info-panel .status {
    color: #4ade80;
    font-weight: 500;
    margin-top: 1rem;
}

.hex-revealed {
    color: #4ade80;
    font-weight: 600;
}

.hex-unrevealed {
    color: #6b7280;
    font-weight: 600;
}

/* Login Container */
.login-container {
    max-width: 400px;
    margin: 4rem auto;
    padding: 2rem;
    background-color: #1e293b;
    border-radius: 0.5rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}

.login-container h1 {
    color: #f1f5f9;
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.login-container p {
    color: #cbd5e1;
    margin-bottom: 1.5rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    color: #cbd5e1;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    background-color: #0f172a;
    border: 2px solid #334155;
    border-radius: 0.375rem;
    color: #e2e8f0;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: #3b82f6;
}

.error-message {
    background-color: #7f1d1d;
    color: #fecaca;
    padding: 0.75rem;
    border-radius: 0.375rem;
    margin-bottom: 1.5rem;
    border: 1px solid #991b1b;
}

.login-footer {
    margin-top: 1.5rem;
    text-align: center;
}

.login-footer a {
    color: #60a5fa;
    text-decoration: none;
    font-size: 0.875rem;
}

.login-footer a:hover {
    color: #93c5fd;
    text-decoration: underline;
}

/* DM View specific styles */
.dm-view .map-container {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
}

/* Responsive Design */
@media (max-width: 768px) {
    .header {
        padding: 1rem;
    }

    .header h1 {
        font-size: 1.25rem;
    }

    .map-container {
        padding: 1rem;
    }

    .info-panel {
        padding: 1rem;
    }

    .login-container {
        margin: 2rem 1rem;
        padding: 1.5rem;
    }
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: #0f172a;
}

::-webkit-scrollbar-thumb {
    background: #475569;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

/* Sidebar styling */
.sidebar {
    display: none;
    position: fixed;
    top: 0;
    right: 0;
    width: 400px;
    height: 100%;
    background-color: #D4C4A8;
    background-image: linear-gradient(to left, #D4C4A8 0%, #C9B898 100%);
    z-index: 1000;
    overflow-y: auto;
    box-shadow: -5px 0 20px rgba(0, 0, 0, 0.4);
    border-left: 4px solid #8B7355;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.sidebar.active {
    display: block;
    transform: translateX(0);
}

.sidebar-content {
    padding: 2rem;
}

@media (max-width: 768px) {
    .sidebar {
        width: 100%;
    }
}

.sidebar h2 {
    color: #3A2F23;
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
    font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, serif;
    font-weight: 600;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #8B7355;
}

.sidebar-close {
    background: none;
    border: none;
    color: #5A4A3A;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
    transition: color 0.2s;
}

.sidebar-close:hover {
    color: #3A2F23;
}

.sidebar .hex-coords {
    color: #6B5843;
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
    font-weight: 600;
}

.sidebar .form-group {
    margin-bottom: 1rem;
}

.sidebar .form-group label {
    display: block;
    color: #3A2F23;
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, serif;
}

.sidebar .form-group input,
.sidebar .form-group select,
.sidebar .form-group textarea {
    width: 100%;
    padding: 0.5rem;
    background-color: #F5EFE0;
    border: 2px solid #8B7355;
    border-radius: 0.25rem;
    color: #3A2F23;
    font-size: 0.875rem;
    font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, serif;
}

.sidebar .form-group textarea {
    min-height: 80px;
    resize: vertical;
}

.sidebar .form-group input:focus,
.sidebar .form-group select:focus,
.sidebar .form-group textarea:focus {
    outline: none;
    border-color: #6B5843;
    box-shadow: 0 0 0 2px rgba(139, 115, 85, 0.2);
}

.sidebar .form-group input:read-only {
    background-color: #E8DCC8;
    cursor: not-allowed;
    border-style: dashed;
}

.sidebar-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1.5rem;
    justify-content: flex-end;
}

.sidebar-actions .btn {
    padding: 0.5rem 1rem;
}

.terrain-legend, .terrain-painter {
    background-color: #C9B898;
    padding: 1rem;
    border-radius: 0.25rem;
    margin-top: 1rem;
    border: 2px solid #8B7355;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.terrain-legend h4 {
    color: #3A2F23;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, serif;
}

.terrain-legend-items {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.terrain-item {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.terrain-color-box {
    width: 16px;
    height: 16px;
    border-radius: 0.125rem;
    border: 1px solid #6B5843;
}

.terrain-name {
    color: #5A4A3A;
    font-size: 0.75rem;
    font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, serif;
}

/* Terrain Painter Styles */
.terrain-palette {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.terrain-paint-item {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem;
    border-radius: 0.25rem;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.terrain-paint-item:hover {
    background-color: rgba(139, 115, 85, 0.2);
    border-color: #8B7355;
}

.terrain-paint-item.active {
    background-color: #8B7355;
    border-color: #6B5843;
}

.terrain-paint-item.active .terrain-name {
    color: #F5E6D3;
    font-weight: 600;
}

.selected-terrain {
    margin-top: 0.5rem;
    color: #3A2F23;
    font-size: 0.875rem;
}

.selected-terrain strong {
    color: #6B5843;
}
