@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/*==== Service messages ====*/
.error-message {
    background-color: #ff6b6b;
    color: white;
    box-sizing: border-box;
    min-width: min(100%, 180px);
    overflow-wrap: anywhere;
    padding: 10px;
    margin-bottom: 10px;
    border-radius: 5px;
    text-align: center;
}

.info-message {
    background-color: #2f6f8f;
    color: white;
    padding: 10px;
    margin-bottom: 10px;
    border-radius: 5px;
    text-align: center;
    overflow-wrap: anywhere;
}

.landing-container {
    padding: 6px 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.auth-strip {
    box-sizing: border-box;
    margin: 0 auto 18px;
    max-width: 620px;
    padding: 0 20px;
    width: 100%;
}

.auth-form,
.auth-session {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.auth-session span {
    color: #ddd;
    font-size: 0.9rem;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.auth-mode {
    background: #202020;
    border: 1px solid #3a3a3a;
    border-radius: 8px;
    display: inline-grid;
    grid-template-columns: 1fr 1fr;
    min-height: 38px;
    overflow: hidden;
}

.auth-mode-btn {
    background: transparent;
    border: none;
    border-radius: 0;
    color: #bbb;
    font-size: 0.82rem;
    font-weight: 700;
    margin: 0;
    min-width: 74px;
    padding: 8px 10px;
}

.auth-mode-btn:hover,
.auth-mode-btn.active {
    background: #2f2f2f;
    color: #fff;
}

.auth-input {
    background: #1a1a1a;
    border: 1px solid #444;
    border-radius: 6px;
    box-sizing: border-box;
    color: #fff;
    font-size: 0.9rem;
    min-height: 38px;
    min-width: 0;
    padding: 8px 10px;
    width: 150px;
}

.auth-input:focus {
    border-color: #4CAF50;
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2);
    outline: none;
}

.auth-primary-btn,
.auth-secondary-btn {
    border: none;
    border-radius: 6px;
    color: #fff;
    font-size: 0.85rem;
    font-weight: 700;
    margin: 0;
    min-height: 38px;
    padding: 8px 12px;
}

.auth-primary-btn {
    background: #4CAF50;
}

.auth-primary-btn:hover {
    background: #45a049;
}

.auth-secondary-btn {
    background: #333;
    border: 1px solid #555;
}

.auth-secondary-btn:hover {
    background: #3c3c3c;
}

.theme-selector {
    width: 100%;
    max-width: 800px;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-sizing: border-box;
    /*
    padding: 1rem;
    margin: 1rem auto;
    */
}
.theme-description {
    width: 100%;
    max-width: 600px;
    padding: 0 10px;
    margin: 0 auto;
    box-sizing: border-box;
}
.theme-textarea {
    width: 100%;
    min-height: 100px;
    padding: 12px;
    border-radius: 8px;
    background: #2a2a2a;
    color: white;
    border: 2px solid #333;
    box-sizing: border-box;
    max-width: 100%;  /* Ensures it doesn't overflow */
    resize: vertical;  /* Allows vertical resizing only */
    margin-bottom: 8px;  /* Changed from 15px to reduce gap */
}
.launch-button {
    background-color: #4CAF50;
    color: white;
    padding: 20px 40px;
    font-size: 24px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.launch-button:hover {
    background-color: #45a049;
    transform: scale(1.05);
}
.control-button {
    background-color: #2c3e50;
    border: 1px solid #34495e;
    color: white;
    padding: 10px 20px;
    margin: 5px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.control-button:hover {
    background-color: #34495e;
}
.game-controls {
    text-align: center;
    margin-bottom: 20px;
}
.header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    background-color: #1a1a1a;
    border-bottom: 1px solid #333;
    margin-bottom: 20px;
}

.header-controls {
    display: flex;
    gap: 10px;
}

.header-bar h1 {
    margin: 0;
    font-size: 2em;
    color: #ffffff;
}

.header-bar h1 small {
    font-size: 0.6em;
    color: #aaa;
}

.theme-options {
    display: flex;
    gap: 30px;
    justify-content: center;
    margin: 0 0 20px 0;
    width: 100%;
    flex-wrap: wrap; /* Changed from nowrap to wrap */
    padding: 0 10px;
    box-sizing: border-box;
}

.theme-option {
    cursor: pointer;
}

.language-selector {
    margin: 40px 0px 20px 0;
    text-align: center;
}
.theme-option input[type="radio"] {
    display: none;
}

.theme-card {
    min-width: 150px;
    min-height: 130px;
    width: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 5px; /* Reduced from 10px */
    border: 2px solid #333;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    padding: 15px; /* Reduced from 20px */
    border-radius: 8px;
    background: #2a2a2a;
}

.theme-selector h2 {
    margin-top: 10px;
    margin-bottom: 10px;
}
.theme-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
    background: #3a3a3a;
}

.theme-card i {
    transition: color 0.3s ease;
}

.theme-card:hover i {
    color: #4CAF50;
}

.theme-card h3 {
    transition: color 0.3s ease;
    margin-top: 0;
}

.theme-card:hover h3 {
    color: #4CAF50;
}
.theme-option input[type="radio"]:checked + label .theme-card {
    border-color: #4CAF50;
    box-shadow: 0 0 15px rgba(76, 175, 80, 0.3);
}

.theme-card img {
    width: 120px;
    height: 120px;
    object-fit: cover;
    margin: 1rem 0;
}
.theme-description {
    width: 100%;
    max-width: 600px;
    padding: 0 20px;
    margin: 0 auto;
    box-sizing: border-box;
}

.theme-description textarea {
    width: 100%;
    box-sizing: border-box;
    margin: 0;
    margin-bottom: 1rem;
}
.theme-description textarea:focus {
    border-color: #4CAF50;
    outline: none;
    box-shadow: 0 0 10px rgba(76, 175, 80, 0.2);
}

.launch-btn {
    background-color: #4CAF50;
    color: white;
    padding: 1rem 2rem;
    margin: 0.5rem auto;
    border: none;
    border-radius: 8px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.launch-btn:hover {
    background-color: #45a049;
}

.launch-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: #4CAF50;  /* Keep the same green color as enabled state */
}

.world-list-state {
    color: #ddd;
    padding: 12px;
    text-align: center;
}

.world-tabs {
    display: grid;
    gap: 6px;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    margin-bottom: 10px;
    width: 100%;
}

.world-tab {
    background: #202020;
    border: 1px solid #3a3a3a;
    border-radius: 8px;
    color: #ddd;
    font-size: 0.85rem;
    font-weight: 700;
    margin: 0;
    min-height: 40px;
    padding: 8px 10px;
}

.world-tab:hover,
.world-tab.active {
    background: #2f2f2f;
    border-color: #4CAF50;
    color: #fff;
}

.world-picker {
    display: grid;
    gap: 8px;
    margin-bottom: 12px;
    width: 100%;
}

.world-option {
    background: #242424;
    border: 1px solid #3a3a3a;
    border-radius: 8px;
    cursor: pointer;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 4px;
    padding: 10px 12px;
    text-align: left;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.world-option:hover,
.world-option.selected {
    background: #2f2f2f;
    border-color: #4CAF50;
}

.world-option input {
    display: none;
}

.world-copy {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.world-title {
    color: #fff;
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.world-meta {
    color: #aaa;
    font-size: 0.78rem;
    line-height: 1.3;
}

.world-start-btn {
    background-color: #4CAF50;
    border: none;
    border-radius: 6px;
    color: #fff;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 700;
    padding: 8px 12px;
    white-space: nowrap;
}

.world-start-btn:hover {
    background-color: #45a049;
}

.world-preview {
    border-top: 1px solid #3a3a3a;
    display: grid;
    gap: 10px;
    grid-column: 1 / -1;
    margin-top: 8px;
    padding-top: 10px;
    text-align: left;
    width: 100%;
}

.world-preview-facts {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin: 0;
}

.world-preview-facts div {
    min-width: 0;
}

.world-preview-facts dt {
    color: #aaa;
    font-size: 0.72rem;
    font-weight: 700;
    margin-bottom: 2px;
    text-transform: uppercase;
}

.world-preview-facts dd {
    color: #eee;
    font-size: 0.82rem;
    line-height: 1.3;
    margin: 0;
    overflow-wrap: anywhere;
}

.world-preview-theme {
    color: #ddd;
    font-size: 0.86rem;
    line-height: 1.45;
    margin: 0;
}

.world-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.world-secondary-btn {
    background: #2f6f8f;
    border: none;
    border-radius: 6px;
    color: #fff;
    font-size: 0.82rem;
    font-weight: 700;
    margin: 0;
    padding: 8px 12px;
}

.world-secondary-btn:hover {
    background: #255c78;
}

.world-visibility-control {
    align-items: center;
    color: #ddd;
    display: flex;
    flex-wrap: wrap;
    font-size: 0.82rem;
    font-weight: 700;
    gap: 6px;
}

.world-visibility-control select {
    background: #1a1a1a;
    border: 1px solid #444;
    border-radius: 6px;
    color: #fff;
    min-height: 34px;
    padding: 6px 8px;
}

.dev-shortcuts {
    display: flex;
    justify-content: center;
    margin: 2px 0 12px;
}

.dev-shortcuts button {
    background: #333;
    border: 1px solid #555;
    border-radius: 6px;
    color: #eee;
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 700;
    padding: 8px 10px;
}

.dev-shortcuts button:hover {
    background: #3c3c3c;
    border-color: #777;
}

@media (max-width: 560px) {
    .auth-form {
        align-items: stretch;
        flex-direction: column;
    }

    .auth-mode,
    .auth-input,
    .auth-primary-btn {
        width: 100%;
    }

    .world-option {
        grid-template-columns: minmax(0, 1fr);
    }

    .world-start-btn {
        width: 100%;
    }

    .world-preview-facts {
        grid-template-columns: minmax(0, 1fr);
    }
}

.language-selector {
    margin: 0px 0px 20px 0;
    text-align: center;
}

.language-selector h2 {
    margin-top: 10px;
    margin-bottom: 10px;
}

.language-options {
    display: flex;
    justify-content: center;
}

.language-select {
    padding: 10px 16px;
    font-size: 1.0em;
    background-color: #2a2a2a;
    color: white;
    border: 2px solid #333;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 200px;
}

.language-select:hover {
    border-color: #4CAF50;
}

.language-select:focus {
    outline: none;
    border-color: #4CAF50;
    box-shadow: 0 0 10px rgba(76, 175, 80, 0.2);
}

.language-select option {
    background-color: #2a2a2a;
    color: white;
    padding: 10px;
}

/* Custom checkbox styles */
.custom-checkbox {
    text-align: center;
    margin: 5px 0;
    padding: 5px 0;
    padding-top: 0;
}

.custom-checkbox label {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.custom-checkbox input[type="checkbox"] {
    display: none;
}

.checkbox-custom {
    width: 20px;
    height: 20px;
    border: 2px solid #333;
    border-radius: 4px;
    margin-right: 10px;
    position: relative;
    background: #2a2a2a;
    transition: all 0.3s ease;
}

.custom-checkbox input[type="checkbox"]:checked + .checkbox-custom {
    background: #4CAF50;
    border-color: #4CAF50;
}

.custom-checkbox input[type="checkbox"]:checked + .checkbox-custom::after {
    content: '\2714';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 14px;
}

.checkbox-label {
    color: #e0e0e0;
    font-size: 0.9em;
}

.custom-checkbox:hover .checkbox-custom {
    border-color: #4CAF50;
}

/* Add media queries */
@media screen and (max-width: 768px) {
    .game-container {
        flex-direction: column;
        padding: 0 10px;
    }

    .game-sidebar {
        width: 100%;
    }

    /* Keep Player Status and Equipment side by side */
    .player-status-row {
        flex-direction: row;  /* Keep horizontal layout */
        gap: 10px;  /* Reduce gap between status and equipment */
    }

    .player-status, .equipment-slots {
        flex: 1;  /* Each takes equal width */
        min-width: 0;  /* Allow flexbox to shrink items if needed */
        margin: 0;
    }

    /* Map and controls layout */
    .game-left-column {
        flex-direction: row;
        align-items: flex-start;
        gap: 20px;
    }

    .game-map {
        flex: 0 0 auto;
    }

    .controls, .combat-ui {
        flex: 1;
        margin-top: 0;
    }

    .combat-ui {
        min-width: 200px;
    }

    .controls {
        margin-left: 10px;
        margin-top: 20px;
        padding-right: 10px;
    }

    .combat-ui {
        min-width: 200px;
    }
}

@media screen and (max-width: 180mm) {
    .theme-options {
        gap: 10px;  /* Reduce gap on mobile */
        padding: 0 10px;
    }

    .theme-card {
        min-width: auto; /* Remove min-width constraint */
        min-height: 100px;
        padding: 10px;
    }

    .theme-card i {
        font-size: 2em;    /* Slightly smaller icons */
    }

    .theme-card h3 {
        font-size: 1.0em;  /* Slightly smaller text */
    }

    .theme-description {
        width: 100%;
        padding: 0 15px;
    }
    .theme-description textarea {
        font-size: 1.1em;
    }

    .custom-checkbox {
        padding: 0 15px;
    }
}

@media screen and (max-width: 600px) {
    .theme-options {
        gap: 10px;
        padding: 0 5px;
    }

    .theme-option {
        flex: 1;
        min-width: 100px; /* Minimum width for very small screens */
        max-width: calc(33.33% - 10px); /* Ensure 3 cards fit with gap */
    }

    .theme-card {
        min-width: auto;
        min-height: 100px;
        padding: 10px;
        margin: 3px;
    }

    .theme-card h3 {
        font-size: 0.9em;
        margin-bottom: 8px;
    }

    .theme-card i {
        font-size: 2em;
    }
}

@media screen and (max-width: 400px) {
    .theme-options {
        gap: 5px;
    }

    .theme-card {
        padding: 8px;
    }

    .theme-card h3 {
        font-size: 0.8em;
        margin-bottom: 5px;
    }

    .theme-card i {
        font-size: 1.8em;
    }
}
