body {
    margin: 0;
    padding: 0;
    background: #1a1a1a;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: hidden;
}
canvas {
    display: block;
}
/* UI System Styles */
.ui-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    padding: 20px;
    box-sizing: border-box;
    gap: 15px; /* Adds space between UI sections */
}
/* New Top Bar Container */
.ui-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    pointer-events: auto; /* Enable clicks on items inside */
}
/* New Left Column for stacked panels */
.ui-left-column {
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: flex-start;
}
.panel {
    background: rgba(10, 15, 20, 0.75);
    color: #e0e0e0;
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.37);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0;
    transition: opacity 0.4s ease, transform 0.4s ease;
    pointer-events: none;
    border: 1px solid rgba(255, 255, 255, 0.18);
    position: relative; /* All panels are relative now */
}
.panel.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}
.panel.spawn-options-panel {
    min-width: 220px;
    padding: 15px;
    transform: translateX(-20px);
    pointer-events: auto; /* It's not visible by default, but needs events when it is */
}
.panel-header {
    font-size: 12px;
    color: #8899aa;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
}
.action-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.action-button {
    background-color: rgba(255, 255, 255, 0.1);
    color: #e0e0e0;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 10px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s ease, border-color 0.2s ease;
    font-family: inherit;
}
.action-button:hover {
    background-color: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
}
.action-button.active {
    background-color: #00AFFF;
    color: #ffffff;
    border-color: #00AFFF;
    font-weight: bold;
}
.object-selection {
    background: rgba(0,0,0,0.2);
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    font-weight: 500;
}
.texture-selection {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
    gap: 8px;
    padding: 8px;
    background: rgba(0,0,0,0.15);
    border-radius: 8px;
    min-height: 40px; /* Ensure it has a size even when empty */
    align-content: flex-start;
}
.texture-selection .action-button {
    width: 40px;
    height: 40px;
    padding: 0;
    overflow: hidden;
    background-size: cover;
    background-position: center;
}
.texture-selection .no-textures-message {
    grid-column: 1 / -1; /* Span all columns */
    color: #8899aa;
    font-size: 12px;
    text-align: center;
    align-self: center;
    padding: 10px 0;
}
#character-panel {
    padding: 20px;
    border: 2px solid #4a9eff;
    min-width: 300px;
    box-shadow: 0 0 15px rgba(74, 158, 255, 0.5), inset 0 0 5px rgba(74, 158, 255, 0.3);
    transform: translateY(-20px);
}
.character-panel-header {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}
.character-panel-indicator {
    width: 12px;
    height: 12px;
    background: #ff4444;
    border-radius: 50%;
    margin-right: 10px;
}
.character-panel-title {
    color: #ff8c42;
    font-weight: bold;
}
.character-panel-body {
    font-size: 14px;
    line-height: 1.6;
}
.character-panel-body span {
    color: #ffffff;
    background: rgba(74, 158, 255, 0.2);
    padding: 2px 8px;
    border-radius: 5px;
    border: 1px solid rgba(74, 158, 255, 0.5);
    font-family: 'Courier New', Courier, monospace;
}
#interaction-panel {
    position: absolute;
    bottom: 20px; /* Position relative to viewport bottom */
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: linear-gradient(135deg, rgba(0,0,0,0.9), rgba(30,30,30,0.95));
    padding: 25px 35px;
    border-radius: 20px;
    border: 2px solid #66ff66;
    max-width: 500px;
    text-align: center;
    box-shadow: 0 6px 25px rgba(102,255,102,0.4);
}
.interaction-title {
    color: #66ff66;
    font-weight: bold;
    margin-bottom: 10px;
}
#interaction-text {
    font-size: 16px;
    line-height: 1.5;
}
.interaction-tip {
    margin-top: 15px;
    padding: 8px 16px;
    background: rgba(102,255,102,0.2);
    border-radius: 15px;
    font-size: 14px;
}
.interaction-tip span {
    color: #66ff66;
}
#control-hints {
    background: rgba(0, 0, 0, 0.7);
    padding: 12px;
    border-radius: 12px;
    border: 1px solid #ffc400;
    font-size: 24px;
    box-shadow: 0 0 15px rgba(255, 196, 0, 0.6);
    opacity: 1;
    cursor: pointer;
    color: #ffc400;
}
/* Confirmation Modal Styles */
.confirmation-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.confirmation-modal-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}
.confirmation-modal-content {
    background: #2a2d35;
    padding: 30px 40px;
    border-radius: 12px;
    color: #f0f0f0;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}
.confirmation-modal-overlay.visible .confirmation-modal-content {
    transform: scale(1);
}
#confirmation-modal-message {
    font-size: 18px;
    margin: 0 0 25px 0;
    line-height: 1.5;
}
.confirmation-modal-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
}
.confirmation-modal-buttons button {
    padding: 12px 25px;
    border-radius: 8px;
    border: none;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
}
.confirmation-modal-buttons button:hover {
    transform: translateY(-2px);
}
#confirmation-modal-confirm {
    background-color: #e53935; /* Red */
    color: white;
}
#confirmation-modal-confirm:hover {
    background-color: #f44336;
}
#confirmation-modal-cancel {
    background-color: #546e7a; /* Blue-grey */
    color: white;
}
#confirmation-modal-cancel:hover {
    background-color: #78909c;
}