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

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

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

h1 {
    text-align: center;
    color: #78350f;
    margin-bottom: 10px;
    font-size: 2em;
}

.subtitle {
    text-align: center;
    color: #92400e;
    margin-bottom: 30px;
}

.controls {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 25px;
}

.input-group {
    display: flex;
    gap: 15px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.input-group input,
.input-group select {
    padding: 10px 15px;
    font-size: 18px;
    border: 2px solid #d97706;
    border-radius: 8px;
    width: 120px;
}

.input-group label {
    font-weight: bold;
    color: #78350f;
}

.button-group {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

button {
    padding: 12px 24px;
    font-size: 16px;
    font-weight: bold;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-start {
    background: #16a34a;
    color: white;
}

.btn-check {
    background: #2563eb;
    color: white;
}

.btn-solution {
    background: #dc2626;
    color: white;
}

.btn-reset {
    background: #6b7280;
    color: white;
}

.status-panel {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 25px;
    text-align: center;
}

.problem {
    font-size: 32px;
    font-weight: bold;
    color: #78350f;
    margin-bottom: 10px;
}

.current-value {
    font-size: 48px;
    font-weight: bold;
    color: #d97706;
    margin: 15px 0;
}

.step-description {
    font-size: 18px;
    color: #92400e;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.feedback {
    padding: 15px;
    border-radius: 8px;
    margin-top: 15px;
    font-weight: bold;
    font-size: 18px;
}

.feedback.correct {
    background: #d1fae5;
    color: #065f46;
    border: 2px solid #10b981;
}

.feedback.incorrect {
    background: #fee2e2;
    color: #991b1b;
    border: 2px solid #ef4444;
}

.abacus-frame {
    background: #78350f;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
    margin-bottom: 25px;
}

.abacus-row {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 30px;
    padding: 10px;
    border-radius: 8px;
    transition: background-color 0.3s ease;
}

.place-label {
    color: #fcd34d;
    font-weight: bold;
    width: 100px;
    text-align: right;
    font-size: 14px;
    transition: all 0.3s ease;
}

.place-label.quotient-area {
    color: #22c55e;
    font-weight: bold;
    text-shadow: 0 0 8px rgba(34, 197, 94, 0.5);
}

.place-label.dividend-area {
    color: #fcd34d;
    font-weight: bold;
    text-shadow: 0 0 8px rgba(252, 211, 77, 0.5);
}

.place-label.inactive-area {
    color: #9ca3af;
    font-weight: normal;
}

.rod-container {
    flex: 1;
    display: flex;
    align-items: center;
    position: relative;
}

.upper-section {
    display: flex;
    gap: 10px;
    width: 80px;
    justify-content: flex-end;
}

.center-bar {
    width: 8px;
    height: 60px;
    background: #fcd34d;
    border-radius: 4px;
    margin: 0 20px;
}

.lower-section {
    display: flex;
    gap: 10px;
}

.bead {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    transition: all 0.5s ease;
}

.bead:hover {
    transform: scale(1.1);
}

.bead.upper {
    background: #dc2626;
}

.bead.upper.active {
    background: #991b1b;
    transform: translateX(32px);
}

.bead.lower {
    background: #2563eb;
}

.bead.lower.active {
    background: #1e40af;
    transform: translateX(-32px);
}

.column-value {
    color: #fcd34d;
    font-weight: bold;
    font-size: 22px;
    width: 50px;
    text-align: center;
}

.instructions {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.instructions h2 {
    color: #78350f;
    margin-bottom: 15px;
}

.instructions ul {
    list-style-position: inside;
    color: #92400e;
}

.instructions li {
    margin-bottom: 10px;
    line-height: 1.6;
}

.instructions ul ul {
    margin-left: 20px;
    margin-top: 5px;
}

.instructions ul ul li {
    margin-bottom: 5px;
    font-size: 0.95em;
}

.animation-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: center;
    margin-top: 15px;
}

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

.speed-control input {
    width: 150px;
}

#abacusSizeLabel {
    font-weight: bold;
    color: #78350f;
}

#abacusSize {
    width: 25%;
    min-width: 240px;
}

.operator-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 5px;
}

.radio-label {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    font-size: 20px;
    font-weight: bold;
    color: #78350f;
    cursor: pointer;
}

.radio-label input[type="radio"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}