@font-face {
    font-family: 'PrintChar21';
    src: url('fonts/pr/PrintChar21.ttf') format('truetype');
}

@font-face {
    font-family: 'PRNumber3';
    src: url('fonts/pr/PRNumber3.ttf') format('truetype');
}

body, html {
    height: 100%;
    margin: 0;
    padding: 0;
    background: linear-gradient(135deg, #2d3436 0%, #1a1d1e 100%);
    color: #d4cfc0;
    font-family: 'PrintChar21', monospace;
    overflow: auto;
}

#game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    min-height: 100%;
    text-align: center;
    padding: 1.5rem 1rem;
    box-sizing: border-box;
}

.screen {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
}

.screen.active {
    display: flex;
}

h1 {
    font-family: 'PrintChar21', monospace;
    font-size: 2rem;
    margin: 0.5rem 0;
    color: #a88860;
    text-shadow: 2px 2px 0px rgba(0,0,0,0.4);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

h2 {
    font-size: 1.3rem;
    margin: 0.5rem 0 1rem;
    color: #8b7355;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border-bottom: 2px solid #5a4a3a;
    padding-bottom: 0.3rem;
}

h3 {
    color: #9b8b6f;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.8rem;
    font-size: 1.1rem;
}

h4 {
    color: #8b7a5f;
    font-size: 0.9rem;
    margin: 0.3rem 0;
    text-transform: uppercase;
}

button {
    background: linear-gradient(to bottom, #5a5244 0%, #3d3830 100%);
    color: #d4cfc0;
    border: 2px solid #6b5d4f;
    padding: 8px 16px;
    font-family: 'PrintChar21', monospace;
    cursor: pointer;
    font-size: 1rem;
    margin-top: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.1);
    transition: all 0.2s ease;
    position: relative;
}

button:hover {
    background: linear-gradient(to bottom, #6b5d4f 0%, #4d4438 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 8px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.15);
}

button:active {
    transform: translateY(0px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.1);
}

#army-setup-screen {
    max-width: 900px;
    width: 100%;
}

.army-setup-container {
    display: flex;
    flex-direction: row;
    gap: 1.5rem;
    margin: 0.5rem 0;
}

.army-setup-column {
    margin: 0;
    padding: 1rem;
    background: rgba(0,0,0,0.3);
    border-radius: 4px;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.5);
    min-width: 280px;
    flex: 1;
}

.army-setup-column > div {
    margin: 0.5rem 0;
    padding: 0.5rem;
    background: rgba(255,255,255,0.02);
    border-left: 2px solid rgba(139,115,85,0.3);
}

#player-army-box {
    border: 3px solid #4a6fa5;
    box-shadow: 0 0 20px rgba(74, 111, 165, 0.3), inset 0 0 20px rgba(0,0,0,0.5);
}

#player-army-box h3 {
    color: #6b9bd1;
    text-shadow: 0 0 10px rgba(107, 155, 209, 0.5);
}

#enemy-army-box {
    border: 3px solid #b83b3b;
    box-shadow: 0 0 20px rgba(184, 59, 59, 0.3), inset 0 0 20px rgba(0,0,0,0.5);
}

#enemy-army-box h3 {
    color: #d16b6b;
    text-shadow: 0 0 10px rgba(209, 107, 107, 0.5);
}

#begin-battle-button {
    background: linear-gradient(to bottom, #8b9d5f 0%, #5a6b3a 100%);
    color: #1a1d1e;
    border: 2px solid #6b7d4a;
    font-size: 1.1rem;
    padding: 10px 24px;
    margin-top: 0.5rem;
    font-weight: bold;
    box-shadow: 0 6px 12px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.2);
}

#begin-battle-button:hover {
    background: linear-gradient(to bottom, #9bad6f 0%, #6a7b4a 100%);
    box-shadow: 0 8px 16px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.3);
}

#army-setup-screen span {
    margin: 0 0.8rem;
    font-weight: bold;
    color: #e4dfc0;
    font-size: 1rem;
}

#army-setup-screen p {
    font-size: 1rem;
    margin: 0.5rem 0;
    color: #c4bfa0;
}

.add-unit, .remove-unit {
    background: linear-gradient(to bottom, #4a5244 0%, #2d3330 100%);
    border: 2px solid #5b6d5f;
    padding: 6px 16px;
    font-size: 1.1rem;
    margin: 0 0.2rem;
    min-width: 40px;
}

.add-unit:hover, .remove-unit:hover {
    background: linear-gradient(to bottom, #5a6254 0%, #3d4340 100%);
}

canvas {
    border: 3px solid #5a4a3a;
    border-radius: 0 0 4px 4px;
    box-shadow: 0 0 30px rgba(0,0,0,0.5);
    background: #1a1d1e;
    display: block;
}

#battle-screen {
    gap: 0;
    width: 100%;
}

#battle-ui {
    width: 80vw;
}

#battle-stats-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0,0,0,0.4);
    border: 3px solid #5a4a3a;
    border-bottom: none;
    padding: 0.6rem 2rem;
    border-radius: 4px 4px 0 0;
    box-shadow: 0 4px 8px rgba(0,0,0,0.4), inset 0 0 15px rgba(0,0,0,0.3);
    gap: 2rem;
}

.army-health-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
}

.army-label {
    font-size: 0.9rem;
    color: #9b8b6f;
    letter-spacing: 0.08em;
    font-weight: bold;
    text-transform: uppercase;
}

.health-value {
    font-size: 1.8rem;
    font-weight: bold;
    color: #e4dfc0;
    text-shadow: 0 0 8px rgba(228, 223, 192, 0.4);
}

#battle-stats-container .army-health-display:first-child .health-value {
    color: #6b9bd1;
    text-shadow: 0 0 10px rgba(107, 155, 209, 0.5);
}

#battle-stats-container .army-health-display:last-child .health-value {
    color: #d16b6b;
    text-shadow: 0 0 10px rgba(209, 107, 107, 0.5);
}

#post-battle-popup {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(to bottom, #2d3436 0%, #1a1d1e 100%);
    padding: 1.4rem 2rem;
    border: 3px solid #6b5d4f;
    box-shadow: 0 0 30px rgba(0,0,0,0.8), inset 0 0 12px rgba(0,0,0,0.4);
    display: none;
    border-radius: 4px;
    min-width: 220px;
    max-width: 320px;
}

#post-battle-popup.active {
    display: block;
}

#post-battle-popup h2 {
    font-size: 1.4rem;
    color: #a88860;
    margin-bottom: 0.6rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

#post-battle-popup p {
    font-size: 0.9rem;
    color: #c4bfa0;
    margin: 0.5rem 0;
}

#pause-button {
    position: relative;
    padding: 10px 24px;
    font-size: 1.1rem;
    background: linear-gradient(to bottom, #5a5244 0%, #3d3830 100%);
    border: 2px solid #6b5d4f;
    box-shadow: 0 4px 6px rgba(0,0,0,0.4);
    margin: 0;
    min-width: 150px;
}

#settings-button {
    margin-top: 1.5rem;
    font-size: 1.1rem;
    padding: 10px 24px;
}

#settings-screen {
    max-width: 1000px;
    width: 100%;
}

.settings-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
    margin: 1rem 0;
}

.unit-settings-container {
    border: 3px solid #5a4a3a;
    padding: 0.8rem;
    margin: 0;
    background: rgba(0,0,0,0.3);
    border-radius: 4px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3), inset 0 0 15px rgba(0,0,0,0.4);
    min-width: 280px;
}

#settings-screen input[type="number"] {
    width: 6em;
    background: rgba(0,0,0,0.4);
    border: 2px solid #5a4a3a;
    color: #d4cfc0;
    font-family: 'PrintChar21', monospace;
    padding: 6px 10px;
    font-size: 1rem;
    border-radius: 2px;
}

#settings-screen input[type="number"]:focus {
    outline: none;
    border-color: #8b7355;
    box-shadow: 0 0 8px rgba(139, 115, 85, 0.4);
}

#settings-screen input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-right: 8px;
    cursor: pointer;
}

#settings-screen .unit-settings-container div {
    margin-bottom: 1rem;
}

#settings-screen .unit-settings-container label {
    display: block;
    margin-bottom: 0.8rem;
    color: #b4af90;
    font-size: 0.95rem;
}

#settings-screen .unit-settings-container > div > label {
    display: inline-flex;
    align-items: center;
    margin-right: 1.5rem;
    margin-bottom: 0.5rem;
}

#settings-screen > div {
    background: rgba(0,0,0,0.3);
    border: 3px solid #5a4a3a;
    padding: 0.8rem;
    border-radius: 4px;
    margin: 0.5rem 0;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3), inset 0 0 15px rgba(0,0,0,0.4);
}

/* New unit row layout */
.unit-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem;
    margin: 0.4rem 0;
    background: rgba(255,255,255,0.03);
    border-left: 2px solid rgba(139,115,85,0.4);
    border-radius: 2px;
}

.unit-row h4 {
    flex: 1;
    margin: 0;
    text-align: left;
    font-size: 0.9rem;
    color: #b4af90;
}

.unit-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    justify-content: center;
}

.unit-count {
    display: inline-block;
    min-width: 40px;
    text-align: center;
    font-weight: bold;
    color: #e4dfc0;
    font-size: 1rem;
    background: rgba(0,0,0,0.4);
    padding: 0.2rem 0.6rem;
    border-radius: 2px;
    border: 1px solid rgba(139,115,85,0.3);
}

.unit-count-input {
    width: 60px;
    text-align: center;
    font-weight: bold;
    color: #e4dfc0;
    font-size: 1rem;
    background: rgba(0,0,0,0.5);
    padding: 0.4rem 0.6rem;
    border-radius: 2px;
    border: 2px solid rgba(139,115,85,0.4);
    font-family: 'PrintChar21', monospace;
    transition: all 0.2s ease;
}

.unit-count-input:focus {
    outline: none;
    border-color: #a88860;
    box-shadow: 0 0 8px rgba(168, 136, 96, 0.4);
    background: rgba(0,0,0,0.6);
}

.unit-count-input:hover {
    border-color: rgba(168, 136, 96, 0.6);
}

.unit-cost {
    flex: 0.7;
    text-align: right;
    font-size: 0.85rem;
    color: #9b8b6f;
    font-weight: bold;
}

.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    margin-top: 0.5rem;
    justify-content: center;
    align-items: center;
}

/* Advantage multiplier section */
.advantage-multiplier-section {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 2px solid rgba(139,115,85,0.3);
}

.advantage-multiplier-section label {
    display: block;
    color: #b4af90;
    font-size: 1rem;
}

.advantage-multiplier-section input {
    margin-left: 1rem;
}

/* Relationships section */
.relationships {
    min-width: 400px;
}

.relationships h4 {
    color: #9b8b6f;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
}

/* Battle stats */
.battle-stats {
    margin: 0.6rem 0;
}

.battle-stats p {
    margin: 0.3rem 0;
    color: #9b8b6f;
}

.battle-stats span {
    color: #e4dfc0;
    font-weight: bold;
    font-size: 1rem;
}

/* Additional polish and responsive touches */
#army-setup-screen h1 {
    margin-top: 0;
}

#army-setup-screen p {
    background: rgba(0,0,0,0.3);
    padding: 0.5rem 0.8rem;
    border-radius: 3px;
    border: 2px solid rgba(139,115,85,0.3);
}

#army-setup-screen p span {
    color: #a88860;
    font-size: 1.1rem;
    text-shadow: 0 0 6px rgba(168, 136, 96, 0.3);
}

/* Enhanced save button */
#save-settings-button {
    background: linear-gradient(to bottom, #8b9d5f 0%, #5a6b3a 100%);
    color: #1a1d1e;
    border: 3px solid #6b7d4a;
    font-size: 1.5rem;
    padding: 14px 40px;
    margin-top: 2rem;
    font-weight: bold;
}

#save-settings-button:hover {
    background: linear-gradient(to bottom, #9bad6f 0%, #6a7b4a 100%);
}

/* Return to menu button */
#return-to-menu-button {
    font-size: 1rem;
    padding: 8px 20px;
    margin-top: 0.6rem;
}

/* Subtle animation on hover for unit rows */
.unit-row:hover {
    background: rgba(255,255,255,0.05);
    border-left-color: rgba(139,115,85,0.6);
    transition: all 0.2s ease;
}

/* Better spacing for settings screen */
#settings-screen h1 {
    margin-bottom: 0.5rem;
}

/* Victory message enhancement */
#post-battle-popup h2 {
    animation: victoryGlow 2s ease-in-out infinite alternate;
}

@keyframes victoryGlow {
    from {
        text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    }
    to {
        text-shadow: 2px 2px 4px rgba(0,0,0,0.5), 0 0 20px rgba(168, 136, 96, 0.6);
    }
}

/* Resources configuration section */
.resources-config {
    background: rgba(0,0,0,0.4);
    border: 2px solid #6b5d4f;
    padding: 0.8rem 1rem;
    margin: 0.5rem auto;
    border-radius: 4px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.4), inset 0 0 15px rgba(0,0,0,0.3);
    max-width: 380px;
}

.resources-config label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: #9b8b6f;
    letter-spacing: 0.06em;
    font-weight: bold;
}

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

.resource-controls input[type="number"] {
    width: 80px;
    background: rgba(0,0,0,0.5);
    border: 2px solid #5a4a3a;
    color: #e4dfc0;
    font-family: 'PrintChar21', monospace;
    padding: 6px 10px;
    font-size: 1.1rem;
    text-align: center;
    border-radius: 3px;
    font-weight: bold;
}

.resource-controls input[type="number"]:focus {
    outline: none;
    border-color: #a88860;
    box-shadow: 0 0 8px rgba(168, 136, 96, 0.4);
}

#decrease-resources, #increase-resources {
    background: linear-gradient(to bottom, #4a5244 0%, #2d3330 100%);
    border: 2px solid #5b6d5f;
    padding: 6px 16px;
    font-size: 1.2rem;
    margin: 0;
    min-width: 40px;
}

#decrease-resources:hover, #increase-resources:hover {
    background: linear-gradient(to bottom, #5a6254 0%, #3d4340 100%);
}
