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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.98);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #5e60ce 0%, #5390d9 100%);
    color: white;
    padding: 40px;
    text-align: center;
    position: relative;
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.95;
    margin-bottom: 20px;
}

.language-selector {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
}

.lang-btn {
    padding: 8px 20px;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.95rem;
    font-weight: 500;
}

.lang-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.lang-btn.active {
    background: white;
    color: #5e60ce;
    border-color: white;
}

main {
    padding: 40px;
}

section {
    margin-bottom: 40px;
}

h2 {
    font-size: 1.6rem;
    color: #5e60ce;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e0e0e0;
}

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

.input-group {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 12px;
    border: 1px solid #e0e0e0;
}

.input-group label {
    display: block;
    font-weight: 600;
    color: #495057;
    margin-bottom: 10px;
}

.input-group input[type="number"] {
    width: 100%;
    padding: 12px;
    font-size: 1.1rem;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    transition: border-color 0.3s;
}

.input-group input[type="number"]:focus {
    outline: none;
    border-color: #5e60ce;
}

.binary-display {
    margin-top: 15px;
    padding: 12px;
    background: #212529;
    color: #4caf50;
    font-family: 'Courier New', monospace;
    font-size: 1.2rem;
    text-align: center;
    border-radius: 8px;
    letter-spacing: 3px;
}

.operation-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.op-btn {
    padding: 15px 20px;
    background: white;
    border: 2px solid #5e60ce;
    color: #5e60ce;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.op-btn:hover {
    background: #5e60ce;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(94, 96, 206, 0.3);
}

.op-btn.active {
    background: #5e60ce;
    color: white;
    box-shadow: 0 5px 15px rgba(94, 96, 206, 0.3);
}

.shift-amount {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.shift-amount label {
    font-weight: 600;
    color: #495057;
}

.shift-amount input {
    width: 80px;
    padding: 8px;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    font-size: 1rem;
}

.result-display {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    padding: 30px;
    border-radius: 15px;
    color: white;
}

.result-value {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    font-size: 1.2rem;
}

.result-value span:first-child {
    font-weight: 600;
}

.result-value span:last-child {
    font-family: 'Courier New', monospace;
    font-size: 1.3rem;
    font-weight: bold;
}

.binary-result {
    letter-spacing: 2px;
}

.bit-visualization {
    background: #212529;
    padding: 30px;
    border-radius: 15px;
    font-family: 'Courier New', monospace;
    color: white;
    text-align: center;
}

.bit-row {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 10px 0;
    font-size: 1.4rem;
}

.bit {
    display: inline-block;
    width: 35px;
    height: 35px;
    line-height: 35px;
    text-align: center;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.bit-zero {
    background: #495057;
    color: #adb5bd;
}

.bit-one {
    background: #4caf50;
    color: white;
    box-shadow: 0 0 10px rgba(76, 175, 80, 0.5);
}

.operation-symbol {
    font-size: 1.8rem;
    color: #ffc107;
    margin: 15px 0;
}

.bit-separator {
    color: #6c757d;
    margin: 10px 0;
    font-size: 1.2rem;
}

.result-row {
    padding-top: 10px;
    border-top: 2px solid #ffc107;
}

.explanation-content {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 12px;
    border-left: 4px solid #5e60ce;
    line-height: 1.8;
}

.explanation-content ul {
    margin: 15px 0;
    padding-left: 30px;
}

.explanation-content li {
    margin: 8px 0;
    font-family: 'Courier New', monospace;
}

.explanation-content strong {
    color: #5e60ce;
}

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

.ref-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    border: 1px solid #e0e0e0;
    transition: all 0.3s ease;
}

.ref-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border-color: #5e60ce;
}

.ref-card h3 {
    color: #5e60ce;
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.ref-card p {
    color: #6c757d;
    margin-bottom: 10px;
    font-size: 0.95rem;
}

.ref-card code {
    display: block;
    background: #f8f9fa;
    padding: 10px;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    color: #495057;
}

footer {
    background: #212529;
    color: #adb5bd;
    text-align: center;
    padding: 20px;
    font-size: 0.95rem;
}

@media (max-width: 768px) {
    h1 {
        font-size: 2rem;
    }
    
    .container {
        border-radius: 0;
    }
    
    main {
        padding: 20px;
    }
    
    .operation-buttons {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .bit {
        width: 28px;
        height: 28px;
        line-height: 28px;
        font-size: 1.1rem;
    }
    
    .bit-row {
        gap: 4px;
    }
}