* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #ffffff;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

header {
    text-align: center;
    margin-bottom: 40px;
    padding: 20px;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.subtitle {
    font-size: 1.1em;
    color: #b0b0b0;
}

.setup-section {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.input-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.input-group {
    margin-bottom: 0;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 1.1em;
}

.input-group select,
.input-group input {
    width: 100%;
    padding: 12px;
    font-size: 1em;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    color: #ffffff;
    transition: all 0.3s ease;
}

.input-group select:focus,
.input-group input:focus {
    outline: none;
    border-color: #8b5cf6;
    background: rgba(255, 255, 255, 0.25);
}

.input-group select option {
    background: #1a1a2e;
    color: #ffffff;
}

.generate-btn,
.regenerate-btn {
    width: 100%;
    padding: 15px;
    font-size: 1.2em;
    font-weight: 600;
    background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
}

.generate-btn:hover,
.regenerate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.6);
}

.generate-btn:active,
.regenerate-btn:active {
    transform: translateY(0);
}

.results-section {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    animation: fadeIn 0.5s ease;
}

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

.hidden {
    display: none;
}

.results-section h2 {
    margin-bottom: 20px;
    text-align: center;
    font-size: 2em;
}

.distribution-info {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 30px;
}

.distribution-info p {
    margin-bottom: 10px;
    font-size: 1.1em;
}

.distribution-breakdown {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px;
}

.badge {
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.95em;
}

.badge.townsfolk {
    background: #10b981;
    color: white;
}

.badge.outsiders {
    background: #3b82f6;
    color: white;
}

.badge.minions {
    background: #ef4444;
    color: white;
}

.badge.demons {
    background: #8b5cf6;
    color: white;
}

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

.character-group {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    padding: 20px;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.character-group h3 {
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
    font-size: 1.3em;
}

.character-group h3.townsfolk {
    color: #10b981;
}

.character-group h3.outsiders {
    color: #3b82f6;
}

.character-group h3.minions {
    color: #ef4444;
}

.character-group h3.demons {
    color: #8b5cf6;
}

.character-list {
    list-style: none;
}

.character-list li {
    padding: 10px;
    margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    border-left: 4px solid;
    transition: all 0.2s ease;
}

.character-list li:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateX(5px);
}

.character-group h3.townsfolk + ul li {
    border-left-color: #10b981;
}

.character-group h3.outsiders + ul li {
    border-left-color: #3b82f6;
}

.character-group h3.minions + ul li {
    border-left-color: #ef4444;
}

.character-group h3.demons + ul li {
    border-left-color: #8b5cf6;
}

.reference-section {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 30px;
    margin-top: 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    animation: fadeIn 0.5s ease;
}

.reference-section h2 {
    margin-bottom: 25px;
    text-align: center;
    font-size: 1.8em;
}

.reference-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.reference-group {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    padding: 20px;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.reference-group h3 {
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
    font-size: 1.3em;
}

.reference-group h3.townsfolk {
    color: #10b981;
}

.reference-group h3.outsiders {
    color: #3b82f6;
}

.reference-group h3.minions {
    color: #ef4444;
}

.reference-group h3.demons {
    color: #8b5cf6;
}

.reference-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.reference-character {
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.95em;
    font-weight: 500;
    transition: all 0.2s ease;
    border: 2px solid;
    width: 100%;
    display: block;
}

.reference-character.townsfolk {
    background: rgba(16, 185, 129, 0.2);
    border-color: #10b981;
    color: #10b981;
}

.reference-character.outsiders {
    background: rgba(59, 130, 246, 0.2);
    border-color: #3b82f6;
    color: #3b82f6;
}

.reference-character.minions {
    background: rgba(239, 68, 68, 0.2);
    border-color: #ef4444;
    color: #ef4444;
}

.reference-character.demons {
    background: rgba(139, 92, 246, 0.2);
    border-color: #8b5cf6;
    color: #8b5cf6;
}

.reference-character.selected {
    font-weight: 900;
    font-size: 1.05em;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
    transform: scale(1.02);
    border-width: 3px;
}

.reference-character.selected.townsfolk {
    background: rgba(16, 185, 129, 0.8);
    border-color: #10b981;
    color: #ffffff;
    box-shadow: 0 0 25px rgba(16, 185, 129, 0.8), inset 0 0 10px rgba(16, 185, 129, 0.3);
}

.reference-character.selected.outsiders {
    background: rgba(59, 130, 246, 0.8);
    border-color: #3b82f6;
    color: #ffffff;
    box-shadow: 0 0 25px rgba(59, 130, 246, 0.8), inset 0 0 10px rgba(59, 130, 246, 0.3);
}

.reference-character.selected.minions {
    background: rgba(239, 68, 68, 0.8);
    border-color: #ef4444;
    color: #ffffff;
    box-shadow: 0 0 25px rgba(239, 68, 68, 0.8), inset 0 0 10px rgba(239, 68, 68, 0.3);
}

.reference-character.selected.demons {
    background: rgba(139, 92, 246, 0.8);
    border-color: #8b5cf6;
    color: #ffffff;
    box-shadow: 0 0 25px rgba(139, 92, 246, 0.8), inset 0 0 10px rgba(139, 92, 246, 0.3);
}

.distribution-table-section {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 30px;
    margin-top: 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    animation: fadeIn 0.5s ease;
}

.distribution-table-section h2 {
    margin-bottom: 25px;
    text-align: center;
    font-size: 1.8em;
}

.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    overflow: hidden;
}

table thead {
    background: rgba(0, 0, 0, 0.4);
}

table th {
    padding: 12px;
    text-align: center;
    font-weight: 600;
    font-size: 1em;
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
}

table th:first-child {
    text-align: left;
    padding-left: 20px;
}

table td {
    padding: 12px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.2s ease;
}

table tbody tr:last-child td {
    border-bottom: none;
}

.character-type {
    font-weight: 600;
    text-align: left;
    padding-left: 20px;
}

.character-type.townsfolk {
    color: #10b981;
}

.character-type.outsiders {
    color: #3b82f6;
}

.character-type.minions {
    color: #ef4444;
}

.character-type.demons {
    color: #8b5cf6;
}

.player-col {
    font-weight: 500;
    font-size: 1.1em;
}

.player-col.highlighted {
    background: rgba(139, 92, 246, 0.3);
    font-weight: 700;
    font-size: 1.2em;
    box-shadow: inset 0 0 10px rgba(139, 92, 246, 0.5);
}

.player-col.highlighted.townsfolk {
    background: rgba(16, 185, 129, 0.3);
    box-shadow: inset 0 0 10px rgba(16, 185, 129, 0.5);
}

.player-col.highlighted.outsiders {
    background: rgba(59, 130, 246, 0.3);
    box-shadow: inset 0 0 10px rgba(59, 130, 246, 0.5);
}

.player-col.highlighted.minions {
    background: rgba(239, 68, 68, 0.3);
    box-shadow: inset 0 0 10px rgba(239, 68, 68, 0.5);
}

.player-col.highlighted.demons {
    background: rgba(139, 92, 246, 0.3);
    box-shadow: inset 0 0 10px rgba(139, 92, 246, 0.5);
}

@media (max-width: 768px) {
    header h1 {
        font-size: 2em;
    }
    
    .input-row {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .characters-grid,
    .reference-grid {
        grid-template-columns: 1fr;
    }
    
    .table-container {
        font-size: 0.9em;
    }
    
    table th,
    table td {
        padding: 8px;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .input-row {
        grid-template-columns: 1fr 1fr;
    }
}

footer {
    text-align: center;
    padding: 30px 20px;
    margin-top: 40px;
    color: #b0b0b0;
    font-size: 0.9em;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

footer p {
    margin: 5px 0;
}

