@font-face {
    font-family: 'DTM-Mono';
    src: url('assets/fonts/DTM-Mono.woff') format('woff'),
         url('assets/fonts/DTM-Mono.otf') format('opentype');
    font-weight: normal;
    font-style: normal;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

body {
    background-color: #000;
    color: #fff;
    font-family: 'DTM-Mono', 'Courier New', monospace;
    /* FONT SIZE CONFIG: Change this value to adjust the overall font size */
    font-size: 32px;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
    tap-highlight-color: rgba(0, 0, 0, 0);
}

/* This new rule now handles centering the dialogue box */
.main-content {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 10px; /* We moved the padding here */
}

.dialogue-container {
    display: flex;
    gap: 20px;
    padding: 20px;
    background-color: #000;
    border: 4px solid #fff;
    width: 660px; /* Fixed width to accommodate portrait + text */
    height: 180px;
    max-width: 100%;
}

.portrait-container {
    width: 120px;
    height: 120px;
    flex-shrink: 0;
    display: none; /* Hidden by default */
    align-items: center;
    justify-content: center;
}

.portrait-container.visible {
    display: flex;
}

.portrait-container img {
    width: 100%; /* Force image to fill container width */
    height: 100%; /* Force image to fill container height */
    object-fit: contain; /* Scale to fit while maintaining aspect ratio */
    image-rendering: pixelated;
}

.text-container {
    height: 120px;
    /* VERTICAL TEXT SPACING CONFIG: Adjust padding to change gap between border and text */
    padding: 10px; /* Increased from 10px */
    line-height: 1.2;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow: hidden;
    position: relative;
    flex: 1; /* Takes remaining space */
}

.text-container.with-portrait {
    width: 480px; /* Smaller width when portrait is shown */
}

.text-container.no-portrait {
    width: 620px; /* Full width when no portrait */
}

.text-content {
    text-align: left;
    position: absolute;
    /* VERTICAL TEXT SPACING CONFIG: These values should match the padding above */
    top: -3px;
    left: 15px;
    right: -5px;
    word-break: keep-all;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    color: #888;
    font-size: 24px;
}

@media (max-width: 700px) {
    .dialogue-container {
        transform: scale(0.9);
        transform-origin: center;
    }
}

@media (max-width: 600px) {
    .dialogue-container {
        transform: scale(0.75);
        transform-origin: center;
    }
}

@media (max-width: 500px) {
    .dialogue-container {
        transform: scale(0.6);
        transform-origin: center;
    }
}

@media (max-width: 400px) {
    .dialogue-container {
        transform: scale(0.5);
        transform-origin: center;
    }
}

.warning-message {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    color: #fff;
    padding: 20px;
}

.warning-content {
    max-width: 300px;
}

.warning-content p {
    margin: 10px 0;
    font-size: 16px;
    line-height: 1.5;
}

.warning-content p:first-child {
    font-size: 48px;
    margin-bottom: 20px;
}

@keyframes shake {
    0%, 100% { transform: translate(0, 0); }
    10% { transform: translate(-1px, -1px); }
    20% { transform: translate(1px, 1px); }
    30% { transform: translate(-1px, 1px); }
    40% { transform: translate(1px, -1px); }
    50% { transform: translate(-1px, 0); }
    60% { transform: translate(1px, 0); }
    70% { transform: translate(0, -1px); }
    80% { transform: translate(0, 1px); }
    90% { transform: translate(-1px, 0); }
}

.shake {
    display: inline-block !important;
    animation: shake 0.5s infinite;
}

.text-content span {
    display: inline;
    word-break: keep-all;
}

/* Battle UI System */
.battle-ui-container {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 150px; /* Adjust if needed for larger sprites */
    display: flex;
    justify-content: center;
    align-items: flex-end;
    pointer-events: none;
    z-index: 1000;
    transform: translateY(100%);
    transition: transform 0.4s ease-out; /* No more bounce! */
}

.battle-ui-container.visible {
    transform: translateY(0);
}

.battle-ui-tabs {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    /* TAB SPACING CONFIG: Change this value to adjust space between battle tabs */
    gap: 240px;
}

.battle-ui-tabs img {
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    display: block;
}

/* Hide battle UI on small screens */
@media (max-width: 500px) {
    .battle-ui-container {
        display: none;
    }
}