* {
    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;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    max-width: 1200px;
    width: 100%;
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

header {
    text-align: center;
    margin-bottom: 30px;
    position: relative;
}

.back-button {
    position: absolute;
    left: 0;
    top: 0;
    padding: 10px 20px;
    background: #667eea;
    color: white;
    text-decoration: none;
    border-radius: 10px;
    font-size: 14px;
    transition: background 0.3s;
}

.back-button:hover {
    background: #5568d3;
}

h1 {
    color: #667eea;
    font-size: 2.5em;
    margin-bottom: 10px;
}

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

.game-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.controls {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.info-panel {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 30px;
}

.score-display, .moves-display {
    font-size: 1.3em;
    font-weight: bold;
}

.score-display .label, .moves-display .label {
    color: #666;
}

#score {
    color: #48bb78;
}

#moves {
    color: #667eea;
}

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

.btn {
    padding: 12px 30px;
    font-size: 1.1em;
    font-weight: bold;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
}

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

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #f0f0f0;
    color: #667eea;
}

.btn-secondary:hover {
    background: #e0e0e0;
    transform: translateY(-2px);
}

.btn-toggle {
    background: white;
    color: #667eea;
    border: 2px solid #667eea;
}

.btn-toggle:hover {
    background: #f0f0f0;
    transform: translateY(-2px);
}

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

.custom-controls {
    width: 100%;
    max-width: 600px;
    padding: 20px;
    background: #fff3cd;
    border: 2px solid #ffc107;
    border-radius: 10px;
    text-align: center;
    margin: 0 auto;
}

.custom-instructions {
    margin-bottom: 15px;
    color: #856404;
    line-height: 1.6;
}

.custom-inputs {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 15px;
}

.custom-input-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.custom-input-group label {
    font-weight: bold;
    color: #667eea;
    font-size: 1.1em;
}

.custom-input-group input {
    width: 100px;
    padding: 10px;
    font-size: 1.2em;
    font-weight: bold;
    text-align: center;
    border: 2px solid #667eea;
    border-radius: 8px;
    outline: none;
}

.custom-input-group input:focus {
    border-color: #764ba2;
    box-shadow: 0 0 10px rgba(118, 75, 162, 0.3);
}

/* Hide number input arrows */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="number"] {
    -moz-appearance: textfield;
}

.building-container {
    display: flex;
    gap: 40px;
    justify-content: center;
    align-items: flex-start;
    flex-wrap: wrap;
    margin: 20px 0;
}

.person-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.person-section h3 {
    color: #667eea;
    font-size: 1.5em;
}

.floor-display {
    font-size: 1.2em;
    font-weight: bold;
    color: #333;
    background: #f0f0f0;
    padding: 10px 20px;
    border-radius: 10px;
    min-width: 180px;
    text-align: center;
}

.floor-display span {
    color: #667eea;
    font-size: 1.3em;
    display: inline-block;
    min-width: 11ch;
    text-align: center;
}

.building-visual {
    width: 220px;
    height: 400px;
    background: linear-gradient(to bottom, #e3f2fd 0%, #90caf9 100%);
    border: 3px solid #667eea;
    border-radius: 10px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.building-visual::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 39px,
            rgba(102, 126, 234, 0.2) 39px,
            rgba(102, 126, 234, 0.2) 40px
        );
    pointer-events: none;
    z-index: 1;
}

.elevator {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 120px;
    height: 70px;
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    border: 3px solid #f9a825;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    transition: bottom 0.5s ease-in-out;
    z-index: 2;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.elevator-person {
    font-size: 2em;
    line-height: 1;
}

.elevator-floor {
    font-size: 0.8em;
    font-weight: bold;
    color: #333;
    background: rgba(255, 255, 255, 0.9);
    padding: 2px 6px;
    border-radius: 4px;
    min-width: 100px;
    text-align: center;
    white-space: nowrap;
}

.floor-numbers {
    position: absolute;
    left: 5px;
    top: 0;
    bottom: 0;
    width: 50px;
    font-size: 10px;
    color: #667eea;
    font-weight: bold;
    display: flex;
    flex-direction: column-reverse;
    justify-content: space-between;
    padding: 10px 0;
    z-index: 0;
}

.floor-number {
    text-align: center;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    line-height: 1;
}

.elevator-controls {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 10px;
    width: 220px;
}

.elevator-btn {
    padding: 12px 8px;
    font-size: 1.1em;
    font-weight: bold;
    border: 2px solid #667eea;
    border-radius: 10px;
    background: white;
    color: #667eea;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 50px;
}

.elevator-btn:hover:not(:disabled) {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 3px 10px rgba(102, 126, 234, 0.4);
}

.elevator-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.elevator-btn:active:not(:disabled) {
    transform: scale(0.95);
}

.elevator-btn.pressed {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #764ba2;
    box-shadow: 0 0 15px rgba(102, 126, 234, 0.6);
}

.feedback {
    min-height: 60px;
    padding: 15px;
    border-radius: 10px;
    font-size: 1.1em;
    font-weight: bold;
    text-align: center;
    transition: all 0.3s;
    width: 100%;
    max-width: 700px;
    line-height: 1.5;
}

.feedback.success {
    background: #e6ffed;
    color: #22543d;
    border: 2px solid #48bb78;
}

.feedback.error {
    background: #fee;
    color: #742a2a;
    border: 2px solid #e53e3e;
}

.feedback.info {
    background: #ebf8ff;
    color: #2c5282;
    border: 2px solid #4299e1;
}

.rules {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    margin-top: 20px;
    width: 100%;
    max-width: 600px;
}

.rules h3 {
    color: #667eea;
    margin-bottom: 10px;
}

.rules ul {
    list-style-position: inside;
    color: #666;
    line-height: 1.8;
}

.rules strong {
    color: #667eea;
}

@keyframes celebration {
    0%, 100% { 
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    }
    50% { 
        box-shadow: 0 0 30px rgba(72, 187, 120, 0.8), 0 5px 15px rgba(0, 0, 0, 0.3);
    }
}

.elevator.celebrating {
    animation: celebration 0.5s ease-in-out 3;
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 20px;
    }

    h1 {
        font-size: 2em;
    }

    .building-container {
        gap: 20px;
    }

    .building-visual {
        width: 170px;
        height: 300px;
    }

    .elevator {
        width: 100px;
        height: 60px;
        gap: 1px;
    }

    .elevator-person {
        font-size: 1.5em;
    }
    
    .elevator-floor {
        font-size: 0.65em;
        min-width: 85px;
        padding: 1px 4px;
    }

    .elevator-controls {
        width: 180px;
        gap: 6px;
    }

    .elevator-btn {
        padding: 10px 5px;
        font-size: 0.9em;
        min-height: 40px;
    }
}

