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

.container {
    background: rgba(255, 255, 255, 0.95);
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    max-width: 1000px;
    width: 100%;
}

h1 {
    color: #333;
    text-align: center;
    margin-bottom: 10px;
    font-size: 2.5em;
}

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

.main-content {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.input-section, .output-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    position: relative;
}

h2 {
    color: #333;
    margin-bottom: 15px;
    font-size: 1.3em;
}

h3 {
    color: #555;
    margin-bottom: 10px;
    font-size: 1.1em;
}

textarea {
    width: 100%;
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    font-family: 'Consolas', 'Monaco', monospace;
    resize: vertical;
    transition: border-color 0.3s;
}

textarea:focus {
    outline: none;
    border-color: #667eea;
}

.input-info {
    position: absolute;
    bottom: 30px;
    right: 30px;
    color: #999;
    font-size: 0.9em;
}

.conversion-section {
    background: #fff;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.conversion-controls {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

select {
    flex: 1;
    min-width: 200px;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    background: white;
    cursor: pointer;
}

.button-group {
    display: flex;
    gap: 10px;
}

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

.btn-encode {
    background: #667eea;
    color: white;
}

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

.btn-decode {
    background: #48bb78;
    color: white;
}

.btn-decode:hover {
    background: #38a169;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(72, 187, 120, 0.4);
}

.btn-primary {
    background: #764ba2;
    color: white;
}

.btn-primary:hover {
    background: #6b46c1;
    transform: translateY(-2px);
}

.btn-small {
    padding: 8px 16px;
    font-size: 14px;
    background: #e2e8f0;
    color: #333;
}

.btn-small:hover {
    background: #cbd5e0;
}

.chain-mode {
    margin-top: 15px;
}

.chain-mode label {
    display: flex;
    align-items: center;
    cursor: pointer;
    color: #555;
}

.chain-mode input[type="checkbox"] {
    margin-right: 8px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.chain-controls {
    margin-top: 15px;
    padding: 15px;
    background: #f7fafc;
    border-radius: 8px;
}

.chain-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 15px;
}

.chain-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    background: white;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}

.chain-item select {
    flex: 1;
    min-width: 150px;
    padding: 6px;
    font-size: 14px;
}

.chain-item button {
    padding: 4px 8px;
    background: #fc8181;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.output-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.history-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
}

.history-list {
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 15px;
}

.history-item {
    padding: 10px;
    margin-bottom: 8px;
    background: white;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
    cursor: pointer;
    transition: all 0.2s;
}

.history-item:hover {
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.history-item-type {
    font-weight: 600;
    color: #667eea;
    margin-bottom: 4px;
}

.history-item-text {
    color: #666;
    font-size: 0.9em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-item-time {
    color: #999;
    font-size: 0.8em;
    margin-top: 4px;
}

.info-section {
    background: #e6fffa;
    padding: 20px;
    border-radius: 10px;
    border: 1px solid #81e6d9;
}

.info-section ul {
    list-style-position: inside;
    color: #555;
    line-height: 1.8;
}

.hidden {
    display: none !important;
}

.copy-feedback {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #48bb78;
    color: white;
    padding: 15px 30px;
    border-radius: 8px;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    animation: fadeInOut 2s ease-in-out;
}

@keyframes fadeInOut {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
    20% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    80% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
}

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

    h1 {
        font-size: 2em;
    }

    .conversion-controls {
        flex-direction: column;
    }

    select {
        width: 100%;
    }

    .button-group {
        width: 100%;
        justify-content: space-between;
    }

    .btn {
        flex: 1;
    }
}