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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 2000px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.main-content {
    display: grid;
    grid-template-columns: 1fr minmax(400px, 600px);
    gap: 30px;
}

h1 {
    text-align: center;
    color: #333;
    margin-bottom: 10px;
    font-size: 2.5em;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 30px;
    font-size: 1em;
}

.subtitle ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: inline-block;
    text-align: left;
}

.subtitle li {
    padding: 5px 0;
    position: relative;
    padding-left: 20px;
}

.subtitle li:before {
    content: "•";
    position: absolute;
    left: 0;
    color: #667eea;
    font-weight: bold;
}

.layout {
    display: grid;
    grid-template-columns: 2fr 5fr 1fr;
    gap: 20px;
    position: relative;
}

.column {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.column-header {
    font-size: 1.5em;
    font-weight: bold;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 3px solid;
    text-align: center;
}

.column.base .column-header {
    color: #4CAF50;
    border-color: #4CAF50;
}

.column.evolved .column-header {
    color: #2196F3;
    border-color: #2196F3;
}

.column.ultimate .column-header {
    color: #9C27B0;
    border-color: #9C27B0;
}

.balls-grid {
    display: grid;
    gap: 10px;
}

.column.base .balls-grid {
    grid-template-columns: repeat(3, 1fr);
}

.column.evolved .balls-grid {
    grid-template-columns: repeat(7, 1fr);
}

.column.ultimate .balls-grid {
    grid-template-columns: 1fr;
}

.ball-item {
    cursor: pointer;
    padding: 10px;
    border-radius: 10px;
    background: white;
    transition: all 0.3s ease;
    text-align: center;
    border: 2px solid transparent;
}

.ball-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.ball-item.selected {
    border-color: #FF9800;
    background: #FFF3E0;
}

.ball-item.highlighted {
    border-color: #4CAF50;
    background: #E8F5E9;
}

.ball-item.faded {
    opacity: 0.3;
    filter: grayscale(50%);
}

.ball-item.combinable {
    border-color: #9C27B0;
    background: #F3E5F5;
    box-shadow: 0 0 12px rgba(156, 39, 176, 0.4);
}

.ball-item.hover-combinable {
    border-color: #9C27B0;
    background: #F3E5F5;
    box-shadow: 0 0 8px rgba(156, 39, 176, 0.3);
}

.connection-line {
    position: absolute;
    pointer-events: none;
    z-index: 1000;
}

.connection-line svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.connection-path {
    stroke: #9C27B0;
    stroke-width: 3;
    fill: none;
    stroke-dasharray: 8, 4;
    animation: dash 20s linear infinite;
}

@keyframes dash {
    to {
        stroke-dashoffset: -100;
    }
}

.recipe-ball.recipe-color-0 {
    background: #FFCDD2;
    border: 2px solid #F44336;
}

.recipe-ball.recipe-color-1 {
    background: #C5CAE9;
    border: 2px solid #3F51B5;
}

.recipe-ball.recipe-color-2 {
    background: #C8E6C9;
    border: 2px solid #4CAF50;
}

.recipe-ball.recipe-color-3 {
    background: #FFE082;
    border: 2px solid #FFC107;
}

.recipe-ball.recipe-color-4 {
    background: #FFCCBC;
    border: 2px solid #FF5722;
}

.ball-item.recipe-color-0 {
    border-color: #F44336;
    background: #FFCDD2;
}

.ball-item.recipe-color-1 {
    border-color: #3F51B5;
    background: #C5CAE9;
}

.ball-item.recipe-color-2 {
    border-color: #4CAF50;
    background: #C8E6C9;
}

.ball-item.recipe-color-3 {
    border-color: #FFC107;
    background: #FFE082;
}

.ball-item.recipe-color-4 {
    border-color: #FF5722;
    background: #FFCCBC;
}

.ball-item.multi-recipe {
    background: linear-gradient(135deg, var(--color1) 0%, var(--color1) 50%, var(--color2) 50%, var(--color2) 100%);
    border: 3px solid;
    border-image: linear-gradient(135deg, var(--border1) 0%, var(--border1) 50%, var(--border2) 50%, var(--border2) 100%) 1;
}

.ball-item.multi-recipe-3 {
    background: linear-gradient(120deg, var(--color1) 0%, var(--color1) 33%, var(--color2) 33%, var(--color2) 66%, var(--color3) 66%, var(--color3) 100%);
    border: 3px solid;
    border-image: linear-gradient(120deg, var(--border1) 0%, var(--border1) 33%, var(--border2) 33%, var(--border2) 66%, var(--border3) 66%, var(--border3) 100%) 1;
}

.ball-item img {
    width: 60px;
    height: 60px;
    object-fit: contain;
    margin-bottom: 5px;
}

.ball-item .ball-name {
    font-size: 0.75em;
    font-weight: 600;
    color: #333;
    word-wrap: break-word;
    line-height: 1.2;
}

.info-panel {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    height: calc(100vh - 200px);
    overflow-y: auto;
    position: sticky;
    top: 20px;
}

.info-panel h2 {
    color: #333;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.info-panel h2 img {
    width: 80px;
    height: 80px;
}

.info-panel .description {
    color: #666;
    line-height: 1.6;
    margin-bottom: 20px;
    font-size: 1.05em;
}

.info-panel .recipes {
    margin-top: 20px;
}

.info-panel .recipes h3 {
    color: #555;
    margin-bottom: 10px;
    font-size: 1.2em;
}

.recipe-item {
    background: #f0f0f0;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.recipe-ball {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: white;
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s;
}

.recipe-ball:hover {
    background: #e3f2fd;
    transform: scale(1.05);
}

.recipe-ball img {
    width: 30px;
    height: 30px;
}

.plus-sign {
    font-size: 1.2em;
    font-weight: bold;
    color: #999;
}

.evolves-into {
    margin-top: 20px;
}

.evolves-into h3 {
    color: #555;
    margin-bottom: 10px;
    font-size: 1.2em;
}

.evolves-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
}

.evolve-ball {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    background: white;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid #e0e0e0;
}

.evolve-ball:hover {
    background: #e3f2fd;
    transform: scale(1.05);
    border-color: #2196F3;
}

.evolve-ball img {
    width: 50px;
    height: 50px;
}

.evolve-ball .name {
    font-size: 0.85em;
    font-weight: 600;
    color: #333;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.evolve-ball-with-ingredients {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    background: white;
    padding: 12px;
    border-radius: 8px;
    border: 2px solid #e0e0e0;
}

.evolve-ball-with-ingredients:hover {
    background: #e3f2fd;
    transform: scale(1.05);
    border-color: #2196F3;
}

.evolve-ball-with-ingredients .name {
    font-size: 0.85em;
    font-weight: 600;
    color: #333;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.ingredient-icons {
    display: flex;
    gap: 4px;
    align-items: center;
}

.ingredient-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
    opacity: 0.7;
}

.ingredient-plus {
    font-size: 0.7em;
    color: #999;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.empty-state img {
    width: 120px;
    height: 120px;
    opacity: 0.3;
    margin-bottom: 20px;
}

.empty-state p {
    font-size: 1.3em;
    font-weight: 500;
}

.tier-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: bold;
    margin-left: 10px;
}

.tier-2 { background: #2196F3; color: white; }
.tier-3 { background: #FF9800; color: white; }
.tier-4 { background: #9C27B0; color: white; }

@media (max-width: 1600px) {
    .column.evolved .balls-grid {
        grid-template-columns: repeat(6, 1fr);
    }
}

@media (max-width: 1400px) {
    .main-content {
        grid-template-columns: 1fr;
    }

    .info-panel {
        position: static;
        height: 400px;
        max-height: 600px;
    }

    .column.evolved .balls-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

@media (max-width: 1200px) {
    .layout {
        grid-template-columns: 1fr;
    }

    .column.base .balls-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 900px) {
    .column.evolved .balls-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

@media (max-width: 768px) {
    .subtitle {
        font-size: 0.9em;
    }

    h1 {
        font-size: 2em;
    }
}

@media (max-width: 600px) {
    .column.evolved .balls-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 480px) {
    .column.evolved .balls-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    h1 {
        font-size: 1.5em;
    }

    .container {
        padding: 15px;
    }
}
