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

body {
    background: #f5f7fa;
    font-family: 'Segoe UI', 'Roboto', 'Helvetica Neue', sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.container {
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    width: 100%;
    max-width: 720px;
    padding: 32px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

h1 {
    text-align: center;
    font-weight: 500;
    font-size: 1.8rem;
    color: #2c3e50;
    letter-spacing: 2px;
    margin-bottom: 0;
}

.realtime-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: #4a5568;
    margin-bottom: 8px;
}

.realtime-row input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.panel {
    background: #f8fafd;
    border-radius: 12px;
    padding: 20px;
    border: 1px solid #e9edf2;
}

.panel-title {
    font-weight: 600;
    font-size: 1rem;
    color: #4a5568;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.panel-title .icon {
    font-size: 1.2rem;
}

.input-area {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-size: 0.95rem;
    resize: vertical;
    font-family: 'SF Mono', 'Menlo', 'Consolas', monospace;
    background: white;
    transition: border-color 0.2s;
    line-height: 1.5;
}

textarea:focus {
    outline: none;
    border-color: #6c8ce0;
    box-shadow: 0 0 0 3px rgba(108, 140, 224, 0.1);
}

.button-row {
    display: flex;
    gap: 8px;
}

.button-row.primary-row {
    /* 主按钮行：加密/解密 */
}

.button-row.secondary-row {
    /* 辅助按钮行：清空、粘贴、复制 */
    flex-wrap: nowrap;
    overflow-x: auto;
}

button {
    background: white;
    border: 1px solid #d1d9e6;
    padding: 10px 12px;
    border-radius: 10px;
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    color: #2d3748;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    flex: 1 1 auto;
    min-width: fit-content;
    white-space: nowrap;
}

button.primary {
    background: #2c3e50;
    border-color: #2c3e50;
    color: white;
    font-weight: 600;
    flex: 2 1 auto;
}

button.primary:hover {
    background: #1e2b38;
}

button:hover {
    background: #f0f4f9;
    border-color: #b9c4d4;
}

button.primary:hover {
    background: #1e2b38;
}

button:active {
    transform: scale(0.98);
}

.result-box {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 12px 14px;
    font-family: 'SF Mono', 'Menlo', 'Consolas', monospace;
    font-size: 0.9rem;
    word-break: break-all;
    min-height: 44px;
    color: #2d3748;
    line-height: 1.5;
    white-space: pre-wrap;
}

.hint {
    font-size: 0.8rem;
    color: #8896a6;
    margin-top: 4px;
    font-style: italic;
}

@media (max-width: 500px) {
    .container {
        padding: 20px;
    }
    button {
        font-size: 0.8rem;
        padding: 8px 10px;
    }
    button.primary {
        flex: 3 1 auto;
    }
}