@import url('https://fonts.googleapis.com/css2?family=IM+Fell+English+SC&family=Roboto:wght@400;700&display=swap');

body {
    background-color: #1a1a2e;
    color: #e0e0e0;
    font-family: 'Roboto', sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 20px;
}

#root {
    /* To ensure the React app has a base for positioning */
    position: relative;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    background-color: #162447;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    border: 1px solid #1f4068;
}

header {
    text-align: center;
    margin-bottom: 30px;
    border-bottom: 1px solid #1f4068;
    padding-bottom: 20px;
    position: relative;
}

#user-info {
    color: #b3cde0;
    font-size: 0.9em;
    margin-top: 15px;
}

#display-creator-name {
    font-weight: bold;
    color: #e43f5a;
}

#change-name-btn {
    background: none;
    border: none;
    color: #b3cde0;
    text-decoration: underline;
    cursor: pointer;
    font-size: 1em;
    padding: 0 5px;
    display: inline;
    width: auto;
    margin: 0;
    line-height: normal; /* Override button styles */
}

#change-name-btn.hidden {
    display: none;
}

#change-name-btn:hover {
    color: #fff;
    transform: none; /* Override button styles */
    box-shadow: none; /* Override button styles */
}

.nav-buttons {
    margin-top: 20px;
    display: flex;
    justify-content: center;
    gap: 15px;
}

.nav-buttons button {
    background: none;
    border: 2px solid #1f4068;
    color: #b3cde0;
    padding: 10px 20px;
    font-family: 'IM Fell English SC', serif;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.1em;
    border-radius: 6px;
}

.nav-buttons button:hover, .nav-buttons button.active {
    background-color: #e43f5a;
    border-color: #e43f5a;
    color: #fff;
}

h1, h2, h3 {
    font-family: 'IM Fell English SC', serif;
    color: #e43f5a;
    margin: 0;
}

h1 {
    font-size: 3em;
    text-shadow: 2px 2px 4px #000;
}

h2 {
    font-size: 2.5em;
    text-align: center;
    margin-bottom: 20px;
}

h3 {
    font-size: 1.8em;
    margin-top: 30px;
    margin-bottom: 15px;
    border-bottom: 1px solid #1f4068;
    padding-bottom: 5px;
}

p {
    margin-top: 0;
}

#weapon-rarity-display {
    font-size: 1.1em;
    font-weight: bold;
    color: #b3cde0;
    margin-bottom: 20px;
    text-align: center;
    padding: 8px;
    border-radius: 6px;
    background-color: rgba(0,0,0,0.2);
    border: 1px solid #1f4068;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

label {
    margin-bottom: 8px;
    font-weight: bold;
    color: #b3cde0;
}

input, select, textarea {
    width: 100%;
    padding: 12px;
    background-color: #1b1b3a;
    border: 1px solid #1f4068;
    border-radius: 6px;
    color: #e0e0e0;
    font-size: 1em;
    box-sizing: border-box;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #e43f5a;
    box-shadow: 0 0 8px rgba(228, 63, 90, 0.5);
}

textarea {
    resize: vertical;
}

button {
    display: block;
    width: 100%;
    padding: 15px;
    background: linear-gradient(45deg, #e43f5a, #b3446c);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 1.2em;
    font-family: 'IM Fell English SC', serif;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(228, 63, 90, 0.4);
}

button:disabled {
    background: #555;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

#share-btn {
    background: linear-gradient(45deg, #1f4068, #162447);
    border: 1px solid #b3cde0;
    margin-top: 30px;
}

#share-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(179, 205, 224, 0.4);
}

#share-btn:disabled {
    background: #555;
    cursor: not-allowed;
    color: #888;
    border-color: #555;
    transform: none;
    box-shadow: none;
}

#share-controls {
    margin-top: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
    background-color: rgba(0,0,0,0.2);
    padding: 15px;
    border-radius: 8px;
}

#share-controls button {
    margin-top: 0;
    width: auto;
    padding: 12px 25px;
}

.privacy-control {
    display: flex;
    align-items: center;
    gap: 10px;
}

.privacy-control label {
    margin-bottom: 0;
}

.privacy-control select {
    width: auto;
    padding: 10px;
}

.hidden {
    display: none !important;
}

#loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    margin-top: 30px;
}

.spinner {
    border: 6px solid #1f4068;
    border-top: 6px solid #e43f5a;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#result-container {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #1f4068;
}

.weapon-display {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    align-items: start;
}

#weapon-image {
    width: 100%;
    height: auto;
    border-radius: 8px;
    border: 3px solid #1f4068;
    background-color: #1a1a2e;
}

#weapon-description {
    background-color: rgba(0,0,0,0.2);
    padding: 15px;
    border-radius: 6px;
    font-style: italic;
}

#gallery-view h2 {
    text-align: center;
    margin-bottom: 10px;
}

#gallery-view p {
    text-align: center;
    margin-bottom: 30px;
    color: #b3cde0;
}

#gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.gallery-card {
    background-color: #1b1b3a;
    border: 1px solid #1f4068;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
}

.gallery-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
}

.card-image-container {
    height: 250px;
}

.gallery-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background-color: #1a1a2e;
}

.gallery-card-info {
    padding: 15px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.gallery-card-info h4 {
    margin: 0 0 5px 0;
    font-family: 'IM Fell English SC', serif;
    color: #e43f5a;
    font-size: 1.3em;
}

.gallery-card-info p {
    margin: 0;
    color: #b3cde0;
}

.gallery-card-info .weapon-rarity {
    font-size: 0.9em;
    font-weight: bold;
    margin-bottom: 5px;
}

.gallery-card-info .weapon-creator {
    font-size: 0.8em;
    font-style: italic;
    color: #9db2d1;
}

.gallery-card-privacy {
    padding: 0px 15px 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #1f4068;
    margin-top: 10px;
    padding-top: 10px;
}

.privacy-status {
    font-size: 1.5em;
    cursor: default;
}

.privacy-toggle-btn {
    font-family: 'Roboto', sans-serif;
    font-size: 0.8em;
    padding: 5px 10px;
    width: auto;
    margin: 0;
    background: #1f4068;
    border: 1px solid #b3cde0;
    line-height: 1.2;
}

.privacy-toggle-btn:hover {
    background-color: #e43f5a;
    border-color: #e43f5a;
    box-shadow: none;
    transform: none;
}

#weapon-reviews {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
}

.review-card {
    background-color: #1b1b3a;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #1f4068;
}

.review-card p {
    margin: 0;
}

.review-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.reviewer-name {
    font-weight: bold;
    color: #b3cde0;
}

.review-stars .star {
    color: #ffc107;
}

.review-stars .star-empty {
    color: #4a4e69;
}

/* Arena Styles */
#arena-setup {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

.combatant-panel {
    background-color: #1b1b3a;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #1f4068;
}

.combatant-panel h3 {
    text-align: center;
    margin-top: 0;
}

.character-setup {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

.character-image-upload {
    text-align: center;
}

.character-image-upload img {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #1f4068;
    background-color: #1a1a2e;
    margin-bottom: 10px;
}

.image-upload-label {
    display: inline-block;
    padding: 8px 15px;
    background-color: #1f4068;
    color: #b3cde0;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9em;
}

.image-upload-label:hover {
    background-color: #e43f5a;
}

.choose-weapon-btn {
    width: 100%;
    padding: 10px;
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1em;
    background: linear-gradient(45deg, #1f4068, #162447);
    border: 1px solid #b3cde0;
}

.selected-weapon-display {
    background-color: rgba(0,0,0,0.2);
    padding: 10px;
    border-radius: 6px;
    min-height: 100px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.selected-weapon-display img {
    max-width: 60px;
    height: auto;
    border-radius: 4px;
    margin-bottom: 5px;
}

.selected-weapon-display h5 {
    margin: 0;
    font-family: 'IM Fell English SC', serif;
    color: #e43f5a;
}

.selected-weapon-display p {
    font-size: 0.9em;
    color: #b3cde0;
    margin: 0;
}

.arena-options {
    margin: 0 auto 20px auto;
    max-width: 600px;
}

#start-battle-btn {
    font-size: 1.5em;
}

#battle-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    margin-top: 30px;
}

#battle-result-container {
    margin-top: 30px;
    padding: 20px;
    background-color: #1b1b3a;
    border: 1px solid #1f4068;
    border-radius: 8px;
}

#battle-result-container h3 {
    text-align: center;
}

#battle-narrative {
    white-space: pre-wrap; /* Preserve formatting from AI */
    line-height: 1.8;
}

@media (max-width: 768px) {
    .weapon-display {
        grid-template-columns: 1fr;
    }
    #arena-setup {
        grid-template-columns: 1fr;
    }
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background-color: #162447;
    padding: 30px;
    border-radius: 12px;
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    border: 1px solid #1f4068;
}

#modal-close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    color: #e0e0e0;
    font-size: 2em;
    cursor: pointer;
    padding: 0;
    width: auto;
    margin: 0;
}

.modal-content h3 {
    text-align: center;
}

#modal-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 15px;
}

/* Music Player Styles */
#music-player {
    position: fixed;
    bottom: 20px;
    left: 20px;
    background-color: #162447;
    padding: 15px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    border: 1px solid #1f4068;
    z-index: 1001;
    color: #b3cde0;
    font-family: 'Roboto', sans-serif;
    min-width: 280px;
    transition: all 0.3s ease-in-out;
}

#music-player.collapsed {
    padding: 0;
    min-width: 0;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    overflow: hidden;
}

#music-player.collapsed #music-player-content {
    opacity: 0;
    visibility: hidden;
}

#music-player-content {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    transition: all 0.2s ease-in-out;
}

#toggle-music-player-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    background: none;
    border: none;
    color: #b3cde0;
    cursor: pointer;
    width: 24px;
    height: 24px;
    font-size: 1.2em;
    padding: 0;
    margin: 0;
    line-height: 1;
    border-radius: 4px;
    z-index: 1002;
    transition: all 0.3s ease-in-out;
}

#toggle-music-player-btn:hover {
    background-color: #1f4068;
    transform: scale(1.1);
}

#music-player.collapsed #toggle-music-player-btn {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.5em;
}

#music-player .controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

#music-player button {
    background: none;
    border: 1px solid #1f4068;
    color: #b3cde0;
    cursor: pointer;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 1.1em;
    padding: 0;
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background-color 0.2s, color 0.2s, transform 0.2s;
    line-height: 1; /* Aligns unicode emojis better */
}
#music-player button:hover {
    background-color: #1f4068;
    color: #fff;
}

#music-player button:active {
    transform: scale(0.9);
}

#song-info {
    font-size: 0.9em;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    width: 100%;
    line-height: 1.2;
}

#song-title {
    font-weight: bold;
    color: #e43f5a;
}

#volume-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100px;
    height: 8px;
    background: #1f4068;
    outline: none;
    border-radius: 5px;
    transition: opacity .2s;
    padding: 0;
    margin: 0;
}

#volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: #e43f5a;
    cursor: pointer;
    border-radius: 50%;
}

#volume-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #e43f5a;
    cursor: pointer;
    border-radius: 50%;
}