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

body {
    font-family: 'Helvetica Neue', Arial, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

h1 {
    text-align: center;
    margin-bottom: 20px;
    color: #2c3e50;
}

.settings {
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.input-group,
.items-container,
.results-container,
#itemInputs,
#resultInputs,
.item-input,
.result-input,
.item-name,
.result-name {
}

input[type="number"] {
    width: 60px;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

button {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    margin-right: 10px;
    transition: background-color 0.3s;
}

#generate {
    background-color: #3498db;
    min-width: 200px;
}

#randomizeLines, #randomizeHorizontals {
    padding: 5px 10px;
    margin-left: 5px;
    font-size: 14px;
    background-color: #9b59b6;
}

#randomizeLines:hover, #randomizeHorizontals:hover {
    background-color: #8e44ad;
}

button:hover {
    background-color: #2980b9;
}

#reset {
    background-color: #e74c3c;
}

#reset:hover {
    background-color: #c0392b;
}

#trace {
    background-color: #2ecc71;
}

#trace:hover {
    background-color: #27ae60;
}

.speed-control {
    display: flex;
    align-items: center;
    gap: 8px;
}

.speed-control label {
    font-size: 14px;
    color: #2c3e50;
}

.speed-control input[type="range"] {
    width: 100px;
    cursor: pointer;
}

.speed-control span {
    font-size: 14px;
    font-weight: bold;
    color: #3498db;
    min-width: 20px;
    text-align: center;
}

.amidakuji-container {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 20px;
    overflow-x: auto;
}

canvas {
    display: block;
    margin: 0 auto;
    background-color: white;
}

@keyframes bounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

.ball {
    position: absolute;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    transform-origin: center;
    animation: bounce 0.5s infinite;
    z-index: 10;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.2);
}

.fruit-label {
    position: absolute;
    bottom: -20px;
    font-size: 10px;
    white-space: nowrap;
    background-color: rgba(255, 255, 255, 0.8);
    padding: 2px 4px;
    border-radius: 3px;
    font-weight: bold;
    max-width: 60px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.config-panel {
    position: fixed;
    top: 0;
    right: -300px;
    width: 280px;
    height: 100%;
    background-color: white;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.2);
    transition: right 0.3s ease;
    z-index: 1000;
}

.config-panel.active {
    right: 0;
}

.config-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background-color: #3498db;
    color: white;
}

.config-header h2 {
    margin: 0;
    font-size: 18px;
}

.config-header button {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    margin: 0;
    padding: 0;
}

.config-body {
    padding: 20px;
}

.config-group {
    margin-bottom: 20px;
}

.config-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #2c3e50;
}

.config-group input[type="range"] {
    width: 100%;
    margin-bottom: 5px;
}

#applyConfig {
    width: 100%;
    background-color: #2ecc71;
    margin-top: 15px;
}

#applyConfig:hover {
    background-color: #27ae60;
}

#toggleConfig {
    background-color: #9b59b6;
}

#toggleConfig:hover {
    background-color: #8e44ad;
}

@media (max-width: 768px) {
    .settings {
        padding: 15px;
    }
    
    button {
        margin-bottom: 10px;
        width: 100%;
    }

    .container {
        padding: 10px;
    }

    h1 {
        font-size: 1.5rem;
        margin-bottom: 10px;
    }

    .settings {
        flex-direction: column;
        gap: 10px;
        padding: 10px;
    }

    .speed-control {
        width: 100%;
    }

    .amidakuji-container {
        padding: 10px;
    }
}

@media (max-width: 480px) {
    .settings button:not(#generate):not(#trace):not(#reset) {
        display: none;
    }

    .speed-control {
        display: none;
    }
}

.desktop-only {
    display: inline-block;
}

@media (max-width: 480px) {
    .desktop-only {
        display: none;
    }
}