/* styles.css */
body {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    margin: 0;
    background-color: #f0f0f0;
    font-family: 'Courier New', Courier, monospace;
    position: relative;
    transition: background-color 0.5s;
}

@keyframes pulse-red {
    0%, 100% { background-color: #f0f0f0; }
    50% { background-color: #FF0000; }
}

@keyframes pulse-yellow {
    0%, 100% { background-color: #f0f0f0; }
    50% { background-color: #FFFF00; }
}

#game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: #fff;
    border: 2px solid #000;
    padding: 10px;
    text-align: center;
    position: relative;
    border-radius: 10px;
}

#game-grid {
    display: grid;
    grid-template-columns: repeat(30, 20px);
    gap: 1px;
}

.tile {
    width: 20px;
    height: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 16px;
    user-select: none;
    transition: opacity 0.2s;
}

#info-panel {
    position: absolute;
    width: 300px;
    height: 400px;
    background-color: #fff;
    border: 2px solid #000;
    padding: 20px;
    margin: 20px;
    visibility: hidden;
    flex-direction: column;
    right: 0px;
    border-radius: 10px;
    box-shadow: 2px 2px 3px rgba(0, 0, 0, 0.295);
    z-index: 50;
}

#info-panel.active {
    visibility: visible;
    display: flex;
}

#info-ascii {
    white-space: pre;
    font-family: 'Courier New', monospace;
    text-align: center;
    margin: 0;
    overflow: hidden;
}

#info-title {
    font-size: 18px;
    font-weight: bold;
    margin: 10px 0;
    padding-bottom: 5px;
    border-bottom: 1px solid #000;
}

#info-subtitle {
    font-size: 14px;
    color: #666;
    margin-bottom: 10px;
}

#info-description {
    flex: 1;
    overflow-y: auto;
    font-size: 14px;
    text-align: left;
}

#inventory {
    margin-top: 10px;
    font-size: 14px;
    width: 100%;
    text-align: center;
}

.held-item {
    position: absolute;
    width: 20px;
    height: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 13px;
    z-index: 10;
    rotate: -20deg;
}

#inventory-panel {
    position: absolute;
    width: 300px;
    height: 400px;
    background-color: #fff;
    border: 2px solid #000;
    padding: 20px;
    margin: 20px;
    visibility: hidden;
    flex-direction: column;
    left: 0px;
    border-radius: 10px;
    box-shadow: 2px 2px 3px rgba(0, 0, 0, 0.295);
    z-index: 50;
}

#inventory-panel.active {
    visibility: visible;
    display: flex;
}

#stats-title,
#inventory-title {
    font-size: 18px;
    font-weight: bold;
    margin: 10px 0;
    padding-bottom: 5px;
    text-align: center;
    border-bottom: 1px solid #000;
}

#stats-content {
    white-space: pre;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    text-align: left;
    margin: 0 0 20px 0;
    line-height: 1.5;
}

#inventory-grid {
    display: grid;
    grid-template-columns: repeat(3, 60px);
    grid-template-rows: repeat(3, 60px);
    gap: 5px;
    justify-content: center;
    flex: 1;
}

.inventory-slot {
    border: 1px solid #666;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-family: 'Courier New', monospace;
    font-size: 16px;
    position: relative;
    user-select: none;
    border-radius: 5px;
}

.inventory-slot.held {
    border: 2px solid rgb(0, 0, 0);
}

.slot-number {
    position: absolute;
    top: 2px;
    left: 2px;
    font-size: 12px;
    color: #666;
}

.slot-symbol {
    font-size: 16px;
    margin: 5px 0;
}

.slot-value {
    font-size: 12px;
    color: #666;
    text-align: center;
    max-width: 50px;
    overflow: hidden;
    text-overflow: ellipsis;
}

#inventory-instructions {
    font-size: 12px;
    color: #666;
    text-align: center;
    margin-top: 10px;
}

#info-instructions {
    font-size: 12px;
    color: #666;
    text-align: center;
    margin-top: 10px;
    line-height: 20px;
}

#instructions {
    position: absolute;
    bottom: 10px;
    font-size: 12px;
    color: #666;
    text-align: center;
    width: 100%;
}

.speech-bubble {
    position: absolute;
    background: linear-gradient(to bottom, #eee, #fff);
    border: 2px solid #000;
    padding: 10px;
    border-radius: 8px;
    max-width: 200px;
    min-width: 100px;
    font-size: 12px;
    text-align: left;
    word-wrap: break-word;
    box-shadow: 3px 3px 5px rgba(0, 0, 0, 0.3);
    z-index: 20;
    line-height: 1.4;
}

.player-bubble {
    color: #00f;
    border-color: #00f;
}

.npc-bubble {
    color: #0a0;
    border-color: #0a0;
}

.response-bubble {
    background-color: rgba(240, 240, 240, 0.95);
    color: #333;
    padding: 8px;
    margin-top: 10px;
    cursor: pointer;
    transition: background-color 0.2s;
    z-index: 20;
}

.response-bubble:hover {
    background-color: #ddd;
}

.response-bubble.selected {
    background-color: #ccc;
    font-weight: bold;
}

.speech-bubble-header {
    font-weight: bold;
    text-align: center;
    border-bottom: 1px solid #000;
    margin-bottom: 5px;
    padding-bottom: 5px;
    font-size: 12px;
}

#dialog-panel {
    position: absolute;
    bottom: 80px;
    width: 600px;
    max-height: 200px;
    background-color: rgb(255, 255, 255);
    border: 2px solid #000;
    padding: 10px;
    border-radius: 8px;
    visibility: hidden;
    flex-direction: column;
    align-items: center;
    box-shadow: 3px 3px 5px rgba(0, 0, 0, 0.3);
    z-index: 51;
}

#dialog-panel.active {
    visibility: visible;
    display: flex;
}

#dialog-header {
    font-weight: bold;
    font-size: 20px;
    text-align: center;
    border-bottom: 1px solid #000;
    width: 100%;
    padding-bottom: 5px;
    margin-bottom: 10px;
}

#dialog-content {
    flex: 1;
    overflow-y: auto;
    font-size: 16px;
    text-align: left;
    width: 100%;
    line-height: 1.4;
}

#dialog-responses {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
    width: 100%;
    justify-content: center;
}

.dialog-response-button {
    background-color: #f0f0f0;
    border: 1px solid #000;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.2s;
    text-align: left;
    min-width: 100px;
}

.dialog-response-button:hover {
    background-color: #ddd;
}

.dialog-response-button.selected {
    background-color: #ccc;
    font-weight: bold;
}

.dialog-response-button.disabled {
    background-color: #e0e0e0;
    cursor: not-allowed;
}

#dialog-instructions {
    font-size: 10px;
    color: #666;
    text-align: center;
    margin-top: 10px;
    width: 100%;
}

.facing-tile {
    box-shadow: inset 0 0 0 1px #6666668a;
    border-radius: 3px;
}

.player-overlay {
    position: absolute;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: none;
}