* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

header {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    color: white;
    padding: 1.5rem;
    text-align: center;
    width: 100%;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

header h1 {
    margin: 0;
    font-size: 2rem;
    font-weight: 600;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 1.5rem 0;
    width: 90%;
    max-width: 900px;
}

.chosen-characters {
    display: flex;
    justify-content: center;
    width: 100%;
    margin: 1rem 0;
    gap: 1.5rem;
    max-width: 500px;
}

.chosen-character {
    flex: 1;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 15px;
    padding: 1rem;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    text-align: center;
}

.chosen-character h3 {
    margin: 0 0 1rem 0;
    color: #333;
    font-size: 1.25rem;
    font-weight: 600;
}

.chosen-card {
    width: 100px;
    height: 133px;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    margin: 0 auto;
    position: relative;
    background: white;
    transition: all 0.3s ease;
}

.chosen-card:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}

.chosen-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.chosen-card.face-down {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 3rem;
    font-weight: bold;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.chosen-card.face-down::before {
    content: '?';
}


.board {
    width: 100%;
    background: #fff;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(4px);
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.cards-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.15rem;
    justify-content: center;
    align-content: center;
    width: 100%;
    height: 100%;
    padding: 0.35rem;
}

/* Desktop: maintain grid layout */
@media (min-width: 640px) {
    .cards-grid {
        display: grid;
        grid-template-columns: repeat(7, 85px);
        grid-template-rows: repeat(4, 113px);
    }
}

.character-card {
    width: 85px;
    height: 113px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.25);
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    background: white;
    border: 2px solid transparent;
    max-width: 100%;
    max-height: 100%;
}

.character-card:hover {
    /* transform: translateY(-5px) scale(1.5); */
    z-index: 1000;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.character-card.eliminated {
    opacity: 0.3;
    filter: grayscale(100%);
    transform: scale(0.9);
}

.llm-board {
    width: 100%;
    background: linear-gradient(135deg, #e8f5e8 0%, #d4e6d4 100%);
    border-radius: 12px;
    border: 1px solid rgba(76, 175, 80, 0.3);
    box-shadow: 0 6px 25px rgba(76, 175, 80, 0.15);
    backdrop-filter: blur(4px);
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.llm-board-header {
    text-align: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid rgba(76, 175, 80, 0.2);
}

.llm-board-header h3 {
    margin: 0;
    color: #2e7d32;
    font-size: 1.5rem;
    font-weight: 600;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.llm-board-header p {
    margin: 0.5rem 0 0 0;
    color: #4caf50;
    font-size: 0.9rem;
    font-style: italic;
}

.system-prompt-button {
    position: fixed;
    top: 20px;
    right: 20px;
    background: none;
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.system-prompt-button:hover {
    transform: scale(1.1);
    opacity: 0.8;
}

.system-prompt-button:active {
    transform: scale(0.95);
}

.system-prompt-textarea {
    width: 100%;
    height: 400px;
    padding: 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 15px;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    resize: vertical;
    outline: none;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.8);
    margin-bottom: 1.5rem;
}

.system-prompt-textarea:focus {
    border-color: #ff9800;
    box-shadow: 0 0 0 3px rgba(255, 152, 0, 0.1);
    background: white;
}

.system-prompt-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.system-prompt-actions button {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.3s ease;
    flex: 1;
    min-width: 120px;
}

.save-prompt-btn {
    background: linear-gradient(135deg, #4caf50 0%, #45a049 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
}

.save-prompt-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
}

.reset-prompt-btn {
    background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(255, 152, 0, 0.3);
}

.reset-prompt-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 152, 0, 0.4);
}

.cancel-prompt-btn {
    background: #6c757d;
    color: white;
    box-shadow: 0 4px 15px rgba(108, 117, 125, 0.3);
}

.cancel-prompt-btn:hover {
    background: #545b62;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(108, 117, 125, 0.4);
}

.loading-llm-board {
    display: flex;
    justify-content: center;
    align-items: center;
    flex: 1;
    font-size: 1.1rem;
    color: #4caf50;
    font-weight: 500;
}

.character-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.loading-board {
    display: flex;
    justify-content: center;
    align-items: center;
    flex: 1;
    font-size: 1.2rem;
    color: #666;
    font-weight: 500;
}

/* Tablet responsive - cards remain their original size */
@media (max-width: 1024px) and (min-width: 640px) {
    .cards-grid {
        grid-template-columns: repeat(7, 85px);
        grid-template-rows: repeat(4, 113px);
    }
}

/* Mobile responsive - cards flow naturally */
@media (max-width: 639px) {
    .cards-grid {
        display: flex;
        flex-wrap: wrap;
        gap: 0.3rem;
        padding: 0.5rem;
        justify-content: center;
    }
    
    .character-card {
        width: 85px;
        height: 113px;
    }
}

.chat-container {
    position: relative; /* Add this for positioning context */
    width: 100%;
    height: 600px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    padding: 1rem;
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
}

.model-indicator-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    border: 1px solid rgba(102, 126, 234, 0.2);
    border-radius: 10px;
    font-size: 0.95rem;
    color: #333;
    flex-wrap: wrap;
}

.model-indicator-bar > * {
    min-width: 100px;
}

.model-indicator-bar .current-model {
    font-weight: bold;
}

.chat-messages {
    position: relative;
    flex: 1;
    overflow-y: auto;
    margin-bottom: 1rem;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    padding: 0.75rem;
    background: #fafafa;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e0 transparent;
    display: flex;
    flex-direction: column;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

.chat-input {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.chat-input input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 25px;
    font-size: 1rem;
    outline: none;
    transition: all 0.3s ease;
    background: white;
}

.chat-input input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.chat-input button {
    padding: 0.75rem 1.5rem;
    border: none;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.chat-input button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.chat-input button:active {
    transform: translateY(0);
}
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    padding: 2rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    animation: slideIn 0.3s ease;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
}

.close-modal {
    background: none !important;
    border: none !important;
    font-size: 2rem !important;
    font-weight: normal !important;
    color: #666 !important;
    cursor: pointer;
    padding: 0 !important;
    margin: 0 !important;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
    box-shadow: none !important;
}

.close-modal:hover {
    background: rgba(0, 0, 0, 0.1) !important;
    color: #333 !important;
    transform: none !important;
    box-shadow: none !important;
}

.modal h2 {
    margin-top: 1rem;
    margin-bottom: 0;
    color: #333;
    font-size: 1.5rem;
    font-weight: 600;
}

.modal p, .modal li, .modal summary {
    color: #666;
    margin-bottom: 1.5rem;
    line-height: 1.5;
}
.modal summary {
    margin-bottom: 0.5rem;
}
.modal li {
    margin-bottom: 0.5rem;
}

.modal img {
    width: 100%;
}

.modal input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 15px;
    box-sizing: border-box;
    font-size: 1rem;
    outline: none;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.8);
}

.modal input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    background: white;
}

.modal button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    margin-right: 0.5rem;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.modal button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.modal button:last-child {
    background: #6c757d;
    box-shadow: 0 4px 15px rgba(108, 117, 125, 0.3);
}

.modal button:last-child:hover {
    background: #545b62;
    box-shadow: 0 6px 20px rgba(108, 117, 125, 0.4);
}

.error-message {
    background: linear-gradient(135deg, #f44336 0%, #e53935 100%);
    color: white;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    margin: 1rem 0;
    font-size: 0.875rem;
    box-shadow: 0 4px 15px rgba(244, 67, 54, 0.3);
    animation: slideIn 0.3s ease;
}

.success-message {
    background: linear-gradient(135deg, #4caf50 0%, #45a049 100%);
    color: white;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    margin: 1rem 0;
    font-size: 0.875rem;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
    animation: slideIn 0.3s ease;
}

.api-key-status {
    position: fixed;
    top: 20px;
    right: 20px;
    backdrop-filter: blur(10px);
    padding: 1rem;
    font-size: 1.5rem;
    transition: all 0.3s ease;
    cursor: pointer;
    user-select: none;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.api-key-status:hover {
    transform: translateY(-2px) scale(1.05);
}

.api-key-status.set::after {
    content: '';
    position: absolute;
    top: 8px;
    right: 8px;
    width: 12px;
    height: 12px;
    background: #4caf50;
    border-radius: 50%;
    border: 1px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.api-key-status.not-set::after {
    content: '';
    position: absolute;
    top: 8px;
    right: 8px;
    width: 12px;
    height: 12px;
    background: #f44336;
    border-radius: 50%;
    border: 1px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.api-key-status.not-set:hover::after {
    background: #d32f2f;
}

.provider-selection {
    display: flex;
    gap: 1rem;
    margin: 1rem 0;
}

.provider-option {
    flex: 1;
    padding: 0.75rem;
    border: 2px solid #e2e8f0;
    border-radius: 15px;
    cursor: pointer;
    text-align: center;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.8);
    position: relative;
}

.provider-option.active {
    border-color: #667eea;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.provider-option:hover {
    border-color: #667eea;
    transform: translateY(-2px);
}

.provider-option .key-status {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #f44336;
}

.provider-option .key-status.has-key {
    background: #4caf50;
}

.api-key-section {
    display: none;
}

.api-key-section.current {
    display: block;
}

.key-input-group {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.key-input-group input {
    margin: 0.5rem 0;
    flex: 1;
}

.key-input-wrapper {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
}

.key-input-wrapper input {
    width: 100%;
    padding-right: 2.5rem;
}

.toggle-password {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    user-select: none;
}

.validate-btn {
    padding: 0.5rem 1rem;
    border: 1px solid #667eea;
    background: white;
    color: #667eea;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.validate-btn:hover {
    background: #667eea;
    color: white;
}

.validate-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.key-status-text {
    font-size: 0.875rem;
    margin-top: 0.5rem;
    padding: 0.5rem;
    border-radius: 8px;
}

.key-status-text.valid {
    background: rgba(76, 175, 80, 0.1);
    color: #2e7d32;
}

.key-status-text.invalid {
    background: rgba(244, 67, 54, 0.1);
    color: #c62828;
}

.key-status-text.testing {
    background: rgba(255, 193, 7, 0.1);
    color: #f57c00;
}

.system-prompt-section {
    margin: 2rem 0 1rem 0;
    padding: 1.5rem;
    border: 2px solid #e2e8f0;
    border-radius: 15px;
    background: rgba(102, 126, 234, 0.05);
}

.system-prompt-section h3 {
    margin: 0 0 0.5rem 0;
    color: #333;
    font-size: 1.1rem;
}

.system-prompt-section p {
    margin: 0 0 1rem 0;
    color: #666;
    font-size: 0.9rem;
}

/* Game Options Section */
.game-options-section {
    margin: 1.5rem 0;
    padding: 1.5rem;
    border: 2px solid #e2e8f0;
    border-radius: 15px;
    background: rgba(102, 126, 234, 0.05);
}

.game-options-section h3 {
    margin: 0 0 1rem 0;
    color: #333;
    font-size: 1.1rem;
}

.option-item {
    margin-bottom: 1rem;
}

.option-description {
    margin: 0.5rem 0 0 0;
    color: #666;
    font-size: 0.85rem;
    line-height: 1.4;
}

/* Toggle Switch Styling */
.toggle-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    gap: 0.75rem;
    font-weight: 500;
    color: #333;
}

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

.toggle-slider {
    position: relative;
    width: 50px;
    height: 26px;
    background: #ccc;
    border-radius: 13px;
    transition: all 0.3s ease;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: white;
    top: 3px;
    left: 3px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-label input[type="checkbox"]:checked + .toggle-slider {
    background: #667eea;
}

.toggle-label input[type="checkbox"]:checked + .toggle-slider::before {
    transform: translateX(24px);
}

/* Hidden character styling - card back design */
.character-card.hidden-character {
    position: relative;
    overflow: hidden;
}

.character-card.hidden-character::before {
    content: '?';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 2.5rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    border-radius: inherit;
}

/* Larger question mark for top selected characters */
.character-card.top-selected-character.hidden-character::before {
    font-size: 3.5rem;
}

.character-card.hidden-character::after {
    display: none;
}

.character-card.hidden-character img {
    visibility: hidden;
}

/* Responsive font sizes for question mark */
@media (max-width: 768px) {
    .character-card.hidden-character::before {
        font-size: 2rem;
    }
    
    .character-card.top-selected-character.hidden-character::before {
        font-size: 2.5rem;
    }
}

@media (max-width: 480px) {
    .character-card.hidden-character::before {
        font-size: 1.5rem;
    }
    
    .character-card.top-selected-character.hidden-character::before {
        font-size: 2rem;
    }
}

.model-selection {
    margin: 1rem 0 0 0;
}

.model-selection input,
.model-selection .key-input-wrapper input {
    margin: 0.5rem 0;
}

.message {
    margin: 0.75rem 0;
    padding: 0.75rem 1rem;
    border-radius: 18px;
    max-width: 80%;
    word-wrap: break-word;
    animation: slideUp 0.3s ease;
    line-height: 1.4;
}

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

.user-message {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    align-self: flex-end;
    margin-left: auto;
    border-bottom-right-radius: 8px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.gpt-message {
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    align-self: flex-start;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-bottom-left-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.loading {
    font-style: italic;
    color: #666;
    opacity: 0.8;
}

.typing-indicator {
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    align-self: flex-start;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-bottom-left-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    margin: 0.75rem 0;
    padding: 0.75rem 1rem;
    border-radius: 18px;
    max-width: 80%;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.typing-dots {
    display: flex;
    gap: 0.25rem;
}

.typing-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #667eea;
    animation: typingAnimation 1.4s infinite;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingAnimation {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

.chat-input button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.chat-input button:disabled:hover {
    transform: none !important;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3) !important;
}

@media (max-width: 768px) {
    .game-container {
        width: 95%;
        margin: 1rem 0;
    }
    
    .chosen-characters {
        flex-direction: column;
        gap: 0.75rem;
        margin: 0.75rem 0;
    }
    
    .chosen-card {
        width: 120px;
        height: 160px;
    }
    
    .chosen-card.face-down {
        font-size: 2.5rem;
    }
    
    .chat-messages {
        height: 250px;
    }
    
    .modal-content {
        width: 95%;
        padding: 1rem;
        max-height: 95vh;
        top: 2.5%;
        left: 2.5%;
        transform: none;
        border-radius: 15px;
    }
    
    .modal-header {
        padding-bottom: 0.5rem;
        margin-bottom: 1rem;
    }
    
    .modal h2 {
        font-size: 1.3rem;
        margin: 0;
    }
    
    .provider-selection {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .provider-option {
        padding: 0.6rem;
    }
    
    .system-prompt-textarea {
        height: 200px;
        font-size: 0.85rem;
        padding: 0.75rem;
    }
    
    .system-prompt-section {
        padding: 1rem;
        margin: 1rem 0;
    }
    
    .system-prompt-actions {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .system-prompt-actions button {
        min-width: unset;
        padding: 0.65rem 1rem;
    }
    
    .api-key-status {
        position: fixed;
        top: 15px;
        right: 15px;
        width: 45px;
        height: 45px;
        font-size: 1.3rem;
        padding: 0.8rem;
    }
    
    .message {
        max-width: 90%;
    }
    
    .llm-board-header h3 {
        font-size: 1.3rem;
    }
    
    .system-prompt-button {
        top: 15px;
        right: 15px;
        width: 35px;
        height: 35px;
        font-size: 20px;
    }
}

/* Start Game Container Styles */
.start-game-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem;
    gap: 1rem;
}

.start-game-button {
    background: linear-gradient(135deg, #4caf50 0%, #45a049 100%);
    color: white;
    border: none;
    padding: 1rem 3rem;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 600;
    font-size: 1.2rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
    min-width: 150px;
}

.start-game-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
    background: linear-gradient(135deg, #45a049 0%, #388e3c 100%);
}

.start-game-button:active {
    transform: translateY(0);
}

@media (max-width: 768px) {
    .start-game-button {
        padding: 0.8rem 2rem;
        font-size: 1.1rem;
        min-width: 120px;
    }
}

.settings-button {
    font-weight: 600;
    color: #667eea;
    background: rgba(255, 255, 255, 0.8);
    padding: 0.25rem 0.75rem;
    border-radius: 15px;
    border: 1px solid rgba(102, 126, 234, 0.3);
}

.settings-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(201, 201, 201, 0.4);
    background: #fff;
}

.settings-button:active {
    transform: translateY(0);
}

/* Very small screens - cards still maintain size but flow naturally */
@media (max-width: 480px) {
    .cards-grid {
        display: flex;
        flex-wrap: wrap;
        gap: 0.25rem;
        padding: 0.25rem;
    }
    
    .character-card {
        width: 85px;
        height: 113px;
    }
    
    .tab-content {
        min-height: 320px;
    }
}

/* Tab Navigation Styles */
.tab-navigation {
    display: flex;
    gap: 0.4rem;
    margin-bottom: 1rem;
    background: rgba(255, 255, 255, 0.95);
    padding: 0.4rem;
    border-radius: 12px;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.tab-button {
    flex: 1;
    padding: 0.6rem 1.2rem;
    border: none;
    background: transparent;
    color: #666;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.tab-button:hover {
    color: #667eea;
    background: rgba(102, 126, 234, 0.1);
    transform: translateY(-1px);
}

.tab-button.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    transform: translateY(-2px);
}

.tab-button.active:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

/* Tab Content Styles */
.tab-content {
    width: 100%;
    position: relative;
    max-width: 640px;
}

.tab-panel {
    display: none !important;
    width: 100%;
    animation: fadeInSlide 0.3s ease;
}

.tab-panel.active {
    display: block !important;
}

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

/* Mobile Responsive Updates for Tabs */
@media (max-width: 768px) {
    .tab-navigation {
        gap: 0.2rem;
        padding: 0.3rem;
        margin-bottom: 0.75rem;
    }
    
    .tab-button {
        padding: 0.5rem 0.8rem;
        font-size: 0.85rem;
    }
    
    .tab-content {
        min-height: 380px;
    }
    
    .chat-container {
        height: 380px;
    }
    
    .selected-character-row {
        flex-direction: column;
        gap: 0.5rem;
        padding: 0.75rem;
        margin-bottom: 0.75rem;
    }
    
    .selected-character-row h4 {
        font-size: 1rem;
    }
    
    .character-card.top-selected-character,
    .llm-character-card.top-selected-character {
        width: 120px;
        height: 160px;
    }
    
    .character-card.top-selected-character::after,
    .llm-character-card.top-selected-character::after {
        font-size: 16px;
        width: 25px;
        height: 25px;
        top: -3px;
        right: -3px;
    }
}

/* Advanced details styling */
details summary.h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #333;
    margin: 1.5rem 0 0.5rem 0;
    cursor: pointer;
    padding: 0.25rem 0;
    border-bottom: 2px solid transparent;
    transition: all 0.3s ease;
}

details summary:hover {
    color: #667eea;
    border-bottom-color: #667eea;
}

/* Selected character row styling */
.selected-character-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 1rem;
    margin-bottom: 1rem;
}

.selected-character-row h4 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    white-space: nowrap;
}

.selected-character-container {
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Top row selected character styling */
.character-card.top-selected-character,
.llm-character-card.top-selected-character {
    width: 100px;
    height: 133px;
    border: 4px solid #fff;
    box-shadow: 0 6px 25px rgba(164, 164, 164, 0.5);
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.15) 0%, rgba(129, 199, 132, 0.15) 100%);
    position: relative;
    cursor: default;
    transform: none;
}

.character-card.top-selected-character:hover,
.llm-character-card.top-selected-character:hover {
    transform: none;
    box-shadow: 0 6px 25px rgba(76, 175, 80, 0.5);
}

/* Main grid selected character styling */
.character-card.selected-character,
.llm-character-card.selected-character {
    border: 3px solid #4caf50;
    box-shadow: 0 4px 20px rgba(76, 175, 80, 0.4);
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.1) 0%, rgba(129, 199, 132, 0.1) 100%);
    position: relative;
}

.character-card.selected-character::after,
.llm-character-card.selected-character::after {
    content: '★';
    position: absolute;
    top: 4px;
    right: 4px;
    color: #4caf50;
    font-size: 14px;
    font-weight: bold;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    z-index: 10;
}

.character-card.selected-character:hover,
.llm-character-card.selected-character:hover {
    transform: translateY(-5px) scale(1.05);
}

/* Board content layout */
.board-content,
.llm-board-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 0.5rem;
}

.cards-grid {
    flex: 1;
}

footer {
    color: white;
    padding: 1rem;
    text-align: center;
}

footer a {
    color: white;
    font-weight: bold;
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* Expand/Collapse Button */
#expandCollapseBtn {
    position: absolute;
    top: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.1);
    color: #333;
    border: none;
    border-radius: 5px;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s ease;
}

#expandCollapseBtn:hover {
    background: rgba(0, 0, 0, 0.2);
}

.chat-container.expanded {
    height: auto;
}

.chat-container.expanded .chat-messages {
    flex: 0 1 auto;
    max-height: none;
    overflow-y: visible;
}