/* 引入思源黑体，提供更好的中文显示效果 */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@400;500;700&display=swap');

body {
    font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: #fff; /* 更改主色调为白色，以适应深色背景 */
    line-height: 1.6;
    display: flex;
    justify-content: center; /* 居中对齐主包装器 */
    align-items: flex-start; /* 从顶部开始对齐，避免内容被裁剪 */
    min-height: 100vh;
    background: linear-gradient(135deg, #f0f4f8 0%, #d9e2ec 100%);
    overflow-x: hidden; /* 只禁止水平滚动 */
    overflow-y: auto; /* 允许垂直滚动 */
    position: relative;
    padding: 20px; /* 减少左右上下边距 */
    box-sizing: border-box;
}

.main-wrapper {
    display: flex;
    gap: 30px; /* 减少左右容器间距 */
    width: 100%;
    max-width: 1600px; /* 增加最大宽度，利用更多屏幕空间 */
    align-items: flex-start; /* 顶部对齐 */
    height: calc(100vh - 40px); /* 固定高度，减去上下边距 */
}

/* 黑客帝国风格的二进制背景动画 */
.matrix-background {
    position: fixed; /* 修复：将背景设为 fixed，使其不随内容滚动 */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #0a0a0a;
    z-index: -2;
}

.matrix-background canvas {
    display: block;
}

.container {
    background-color: rgba(26, 42, 64, 0.85); /* 半透明的深色背景 */
    padding: 25px; /* 进一步减少内边距 */
    border-radius: 16px;
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.2), inset 0 0 10px rgba(0, 255, 0, 0.1); /* 酷炫的霓虹边框和内发光 */
    flex: 1; /* 弹性布局，平分空间 */
    height: 100%; /* 使用100%高度，跟随main-wrapper */
    overflow-y: auto; /* 允许垂直滚动 */
    border: 1px solid #00ff00; /* 绿色边框 */
    position: relative;
    z-index: 1;
    backdrop-filter: blur(5px); /* 毛玻璃效果 */
    box-sizing: border-box; /* 确保padding包含在高度内 */
}

.left-container {
    flex: 6; /* 增加宽度，占据更大比例 */
    display: flex;
    flex-direction: column;
    justify-content: flex-start; /* 内容从顶部开始排列 */
    overflow-y: auto;
    /* 隐藏滚动条但保持滚动功能 */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}

.left-container::-webkit-scrollbar {
    display: none; /* Chrome/Safari/Opera */
}

.right-container {
    flex: 1.5; /* 相应减少宽度 */
    display: flex;
    flex-direction: column;
    justify-content: flex-start; /* 内容从顶部开始排列 */
    overflow-y: auto;
    /* 隐藏滚动条但保持滚动功能 */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}

.right-container::-webkit-scrollbar {
    display: none; /* Chrome/Safari/Opera */
}

/* 右侧容器内容样式 */
.placeholder-content {
    margin-top: 20px;
}

.feature-item {
    background-color: rgba(0, 255, 0, 0.1);
    border: 1px solid rgba(0, 255, 0, 0.3);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 15px;
    transition: all 0.3s ease;
}

.feature-item:hover {
    background-color: rgba(0, 255, 0, 0.15);
    border-color: rgba(0, 255, 0, 0.5);
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.2);
}

.feature-item h3 {
    color: #00ff00;
    margin: 0 0 10px 0;
    font-size: 1.2em;
}

.feature-item p {
    color: #cccccc;
    margin: 0;
    font-size: 0.9em;
    opacity: 0.8;
}

/* 联系部分样式 */
.contact-section {
    margin-top: 30px;
}

.contact-item {
    background-color: rgba(0, 255, 0, 0.1);
    border: 1px solid rgba(0, 255, 0, 0.3);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 15px;
    transition: all 0.3s ease;
}

.contact-item:hover {
    background-color: rgba(0, 255, 0, 0.15);
    border-color: rgba(0, 255, 0, 0.5);
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.2);
}

.contact-item h3 {
    color: #00ff00;
    margin: 0 0 10px 0;
    font-size: 1.1em;
}

.contact-item p {
    color: #cccccc;
    margin: 0;
    font-size: 0.9em;
}

.contact-link {
    color: #00ff00;
    text-decoration: none;
    transition: all 0.3s ease;
    font-weight: 500;
}

.contact-link:hover {
    color: #00ff88;
    text-shadow: 0 0 5px #00ff00;
    text-decoration: underline;
}

.contact-item.copyright {
    background-color: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.2);
    text-align: center;
    margin-bottom: 0;
}

.contact-item.copyright:hover {
    background-color: rgba(0, 0, 0, 0.5);
    border-color: rgba(255, 255, 255, 0.3);
}

.contact-item.copyright p {
    color: #999;
    font-size: 0.8em;
    opacity: 0.7;
}

/* 移动端适配 */
@media (max-width: 768px) {
    body {
        padding: 10px;
        overflow-y: auto;
        overflow-x: hidden;
    }
    
    .main-wrapper {
        flex-direction: column;
        gap: 20px;
        height: auto;
        min-height: auto;
    }
    
    .container {
        padding: 20px;
        min-height: auto;
        height: auto;
        margin-bottom: 0;
    }
    
    .left-container {
        flex: none;
        order: 1;
    }
    
    .right-container {
        flex: none;
        order: 2;
    }
    
    .header-row {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        text-align: left;
        margin-bottom: 20px;
        flex-wrap: wrap;
    }
    
    .header-row h1 {
        margin-bottom: 0;
        font-size: 1.5em;
        flex: 1;
        text-align: left;
        min-width: 200px;
    }
    
    .language-switcher {
        position: static;
        margin-top: 0;
        margin-left: 10px;
        flex-shrink: 0;
    }
    
    .form-row {
        flex-direction: row;
        gap: 15px;
        align-items: flex-start;
        justify-content: flex-start;
    }
    
    .form-row .form-group {
        flex: 1;
        margin-bottom: 20px;
        text-align: left;
    }
    
    .form-row .form-group label {
        text-align: left;
        margin-bottom: 8px;
        display: block;
        font-size: 14px;
        line-height: 1.3;
    }
    
    .checkbox-group {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
    
    .checkbox-group label {
        width: 100%;
        padding: 10px 0;
        border-bottom: 1px solid rgba(0, 255, 0, 0.1);
    }
    
    .checkbox-group label:last-child {
        border-bottom: none;
    }
    
    .button-group {
        flex-direction: column;
        gap: 15px;
    }
    
    button {
        padding: 18px 20px;
        font-size: 16px;
        width: 100%;
        margin: 0;
    }
    
    .password-item {
        flex-direction: row;
        align-items: center;
        padding: 12px 0;
        gap: 8px;
        flex-wrap: nowrap;
        min-height: 40px;
    }
    
    .password-item .index {
        margin-right: 0;
        margin-bottom: 0;
        flex-shrink: 0;
        width: 25px;
        text-align: left;
        font-size: 13px;
    }
    
    .password-text {
        padding-right: 0;
        margin-bottom: 0;
        font-size: 13px;
        word-break: break-all;
        line-height: 1.3;
        flex: 1;
        text-align: left;
        min-width: 0; /* 允许flex元素缩小 */
        overflow-wrap: break-word;
    }
    
    .copy-btn {
        width: auto;
        min-width: 45px;
        max-width: 70px;
        padding: 6px 8px;
        font-size: 11px;
        flex-shrink: 0;
        height: 32px;
        line-height: 1;
    }
    
    .feature-item {
        padding: 15px;
        margin-bottom: 12px;
    }
    
    .feature-item h3 {
        font-size: 1em;
        margin-bottom: 8px;
    }
    
    .feature-item p {
        font-size: 0.85em;
        line-height: 1.4;
    }
    
    .contact-item {
        padding: 15px;
        margin-bottom: 12px;
    }
    
    .contact-item h3 {
        font-size: 1em;
    }
    
    .contact-item p {
        font-size: 0.85em;
    }
    
    .description-section {
        padding: 15px;
        margin-bottom: 20px;
    }
    
    .description-section h2 {
        font-size: 18px;
        margin-bottom: 12px;
    }
    
    .description-section p {
        font-size: 14px;
        line-height: 1.5;
    }
    
    #specialCharInputs {
        padding: 15px;
        margin-top: 20px;
    }
    
    #passwordOutput {
        padding: 15px;
        margin-top: 20px;
        max-height: none;
    }
    
    .toast-message {
        bottom: 20px;
        left: 10px;
        right: 10px;
        transform: none;
        border-radius: 8px;
        font-size: 14px;
    }
}

/* 超小屏幕适配 (手机竖屏) */
@media (max-width: 480px) {
    body {
        padding: 8px;
    }
    
    .container {
        padding: 15px;
        border-radius: 12px;
    }
    
    .header-row h1 {
        font-size: 1.3em;
        flex: 1;
        text-align: left;
        min-width: 150px;
    }
    
    .language-switcher {
        margin-left: 8px;
    }
    
    .description-section h2 {
        font-size: 16px;
    }
    
    .description-section p {
        font-size: 13px;
    }
    
    .form-row {
        flex-direction: row;
        gap: 10px;
        align-items: flex-end;
        justify-content: flex-start;
    }
    
    .form-row .form-group {
        flex: 1;
        margin-bottom: 20px;
        text-align: left;
    }
    
    .form-row .form-group label {
        text-align: left;
        margin-bottom: 6px;
        font-size: 13px;
        display: block;
        line-height: 1.2;
        word-break: break-word;
    }
    
    select, input[type="number"], input[type="text"] {
        padding: 16px;
        font-size: 16px; /* 防止iOS缩放 */
    }
    
    .custom-select-container .select-selected {
        padding: 16px;
        font-size: 16px;
    }
    
    .password-text {
        font-size: 12px;
        flex: 1;
        text-align: left;
        line-height: 1.2;
        word-break: break-all;
        min-width: 0;
        overflow-wrap: break-word;
    }
    
    .password-item .index {
        width: 22px;
        font-size: 12px;
        flex-shrink: 0;
    }
    
    .copy-btn {
        width: auto;
        min-width: 40px;
        max-width: 60px;
        padding: 4px 6px;
        font-size: 10px;
        flex-shrink: 0;
        height: 28px;
        line-height: 1;
    }
    
    .feature-item {
        padding: 12px;
    }
    
    .contact-item {
        padding: 12px;
    }
}

/* 平板适配 */
@media (min-width: 769px) and (max-width: 1024px) {
    .main-wrapper {
        max-width: 1200px;
        gap: 25px;
    }
    
    .container {
        padding: 30px;
    }
    
    .left-container {
        flex: 5;
    }
    
    .right-container {
        flex: 2;
    }
}

/* 移动端触摸优化 */
@media (hover: none) and (pointer: coarse) {
    /* 移动设备特定样式 */
    button:hover {
        transform: none;
    }
    
    button:active {
        transform: scale(0.98);
        transition: transform 0.1s;
    }
    
    .copy-btn:hover {
        transform: none;
    }
    
    .copy-btn:active {
        transform: scale(0.95);
        background-color: rgba(0, 255, 0, 0.2);
    }
    
    .feature-item:hover {
        background-color: rgba(0, 255, 0, 0.1);
        border-color: rgba(0, 255, 0, 0.3);
        box-shadow: none;
    }
    
    .contact-item:hover {
        background-color: rgba(0, 255, 0, 0.1);
        border-color: rgba(0, 255, 0, 0.3);
        box-shadow: none;
    }
    
    .contact-link:hover {
        text-decoration: none;
        text-shadow: none;
    }
    
    .contact-link:active {
        color: #00ff88;
        text-shadow: 0 0 3px #00ff00;
    }
}

/* 键盘弹出时的优化 */
@media (max-width: 768px) {
    /* 当虚拟键盘弹出时，减少视口高度的影响 */
    .container {
        min-height: auto;
    }
    
    /* 确保输入框在焦点时可见 */
    input:focus, select:focus {
        position: relative;
        z-index: 1000;
    }
}

.header-row {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 30px;
    position: relative;
}

h1 {
    color: #00ff00; /* 绿色标题 */
    margin: 0;
    font-weight: 700;
    text-shadow: 0 0 5px #00ff00; /* 发光文字 */
}

.language-switcher {
    position: absolute;
    right: 0;
}

.description-section {
    text-align: left;
    margin-bottom: 30px;
    padding: 20px;
    background-color: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    border: 1px solid rgba(0, 255, 0, 0.3);
}

.description-section h2 {
    color: #00ff00;
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 15px;
    text-shadow: 0 0 3px #00ff00;
}

.description-section p {
    color: #ccc;
    font-size: 16px;
    line-height: 1.6;
    margin: 0;
}

.custom-select {
    position: relative;
    display: inline-block;
    min-width: 120px;
}

.select-selected {
    background: none;
    border: 1px solid #00ff00;
    color: #00ff00;
    padding: 8px 30px 8px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    position: relative;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    height: 36px;
}

.select-selected:after {
    content: "";
    position: absolute;
    top: 50%;
    right: 10px;
    width: 0;
    height: 0;
    border: 6px solid transparent;
    border-color: #00ff00 transparent transparent transparent;
    transform: translateY(-50%);
}

.select-selected.select-arrow-active:after {
    border-color: transparent transparent #00ff00 transparent;
    top: 40%;
}

.select-items {
    position: absolute;
    background-color: #1a1a1a;
    border: 1px solid #00ff00;
    border-top: none;
    border-radius: 0 0 5px 5px;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 99;
    box-shadow: 0 4px 8px rgba(0, 255, 0, 0.2);
}

.select-hide {
    display: none;
}

.select-items div {
    color: #00ff00;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s;
    text-align: center;
}

.select-items div:hover {
    background-color: rgba(0, 255, 0, 0.1);
}

.select-items div.same-as-selected {
    background-color: #00ff00;
    color: #0a0a0a;
    font-weight: bold;
}

.form-group {
    margin-bottom: 25px;
}

.form-group.character-rules {
    padding-top: 20px;
}

.form-row {
    display: flex;
    gap: 20px;
    align-items: flex-end;
}

.form-row .form-group {
    flex: 1;
    margin-bottom: 0;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #ccc;
}

select, input[type="number"], input[type="text"] {
    width: 100%;
    padding: 14px;
    background-color: rgba(0, 0, 0, 0.5); /* 深色输入框 */
    color: #00ff00; /* 绿色文字 */
    border: 1px solid #00a000;
    border-radius: 10px;
    font-size: 16px;
    box-sizing: border-box;
    transition: all 0.3s;
    height: 48px;
}

select option {
    background-color: #000;
    color: #0f0;
}

select:focus, input:focus {
    outline: none;
    border-color: #00ff00;
    box-shadow: 0 0 10px #00ff00, 0 0 5px #00ff00;
}

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

input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 20px 30px;
    justify-content: flex-start;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    margin-bottom: 0;
    font-weight: normal;
    cursor: pointer;
    color: #ccc;
}

.checkbox-group input[type="checkbox"] {
    margin-right: 8px;
    width: auto;
    transform: scale(1.2);
    accent-color: #00ff00;
}

#specialCharInputs {
    display: none;
    margin-top: 25px;
    padding: 20px;
    background-color: rgba(0, 0, 0, 0.4);
    border-radius: 10px;
    border: 1px solid #00a000;
}

#remainingCharsDisplay {
    margin-bottom: 15px;
    font-size: 14px;
    color: #999;
    display: flex;
    align-items: center;
}

#remainingChars {
    font-family: 'Courier New', Courier, monospace;
    background-color: rgba(0, 0, 0, 0.4);
    color: #00ff00;
    padding: 4px 8px;
    border-radius: 4px;
    margin-left: 8px;
    word-break: break-all;
    text-shadow: 0 0 3px #00ff00;
}

.button-group {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    margin-top: 30px;
}

button {
    padding: 16px 28px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    border-radius: 10px;
    transition: all 0.3s;
    flex-grow: 1;
    text-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
    color: #fff;
}

.btn-generate {
    background-color: #00cc00;
    box-shadow: 0 0 10px #00cc00, 0 0 20px #00cc00;
}

.btn-generate:hover {
    background-color: #00a000;
    transform: translateY(-2px);
    box-shadow: 0 0 15px #00ff00, 0 0 25px #00ff00;
}

.btn-clear {
    background-color: #555;
    box-shadow: 0 0 10px #555;
}

.btn-clear:hover {
    background-color: #444;
    transform: translateY(-2px);
    box-shadow: 0 0 15px #777;
}

.btn-copy-all {
    background-color: #0088cc;
    box-shadow: 0 0 10px #0088cc, 0 0 20px #0088cc;
}

.btn-copy-all:hover {
    background-color: #006699;
    transform: translateY(-2px);
    box-shadow: 0 0 15px #00aaff, 0 0 25px #00aaff;
}

#passwordOutput {
    background-color: rgba(0, 0, 0, 0.4);
    border: 1px solid #00a000;
    border-radius: 10px;
    padding: 20px;
    margin-top: 30px;
    min-height: 200px;
    max-height: 600px;
    overflow-y: auto;
    box-shadow: inset 0 0 5px rgba(0, 255, 0, 0.3);
}

#passwordOutput:empty {
    display: none;
}

.password-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid rgba(0, 255, 0, 0.2);
    flex-wrap: nowrap;
    min-height: 50px;
}

.password-item .index {
     font-weight: 600;
     color: #999;
     margin-right: 15px;
     font-family: 'Courier New', Courier, monospace;
}

.password-item:last-child {
    border-bottom: none;
}

.password-text {
    font-family: 'Courier New', Courier, monospace;
    font-size: 18px;
    color: #00ff00;
    flex-grow: 1;
    padding-right: 15px;
    word-break: break-all;
    text-shadow: 0 0 3px #00ff00;
}

.copy-btn {
    background-color: rgba(0, 0, 0, 0.5);
    border: 1px solid #00a000;
    color: #00ff00;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
    flex-shrink: 0;
    min-width: 60px;
    max-width: 100px;
    width: auto;
    text-align: center;
    text-shadow: 0 0 3px #00ff00;
}

.copy-btn:hover {
    background-color: rgba(0, 255, 0, 0.1);
    color: #fff;
    box-shadow: 0 0 5px #00ff00;
}

.custom-select-container {
    position: relative;
    width: 100%;
}

.custom-select-container .select-selected {
    padding: 14px;
    background-color: rgba(0, 0, 0, 0.5);
    color: #00ff00;
    border: 1px solid #00a000;
    border-radius: 10px;
    font-size: 16px;
    cursor: pointer;
    user-select: none;
    transition: all 0.3s;
    box-sizing: border-box;
    height: 48px;
    display: flex;
    align-items: center;
}

.custom-select-container .select-selected:after {
    position: absolute;
    content: "";
    top: 50%;
    right: 14px;
    transform: translateY(-50%) rotate(45deg);
    width: 8px;
    height: 8px;
    border: solid #00ff00;
    border-width: 0 2px 2px 0;
}

.custom-select-container .select-selected:focus, 
.custom-select-container .select-selected.active {
    outline: none;
    border-color: #00ff00;
    box-shadow: 0 0 10px #00ff00, 0 0 5px #00ff00;
}

.custom-select-container .select-items {
    position: absolute;
    background-color: rgba(0, 0, 0, 0.8);
    border: 1px solid #00a000;
    border-radius: 10px;
    margin-top: 5px;
    width: 100%;
    z-index: 99;
    max-height: 25vh;
    overflow-y: auto;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.custom-select-container .select-items div {
    padding: 12px 14px;
    cursor: pointer;
    color: #00ff00;
    transition: background-color 0.2s;
}

.custom-select-container .select-items div:hover, 
.custom-select-container .select-items .same-as-selected {
    background-color: rgba(0, 255, 0, 0.1);
}

.toast-message {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #00a000;
    color: #fff;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 16px;
    text-align: center;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    box-shadow: 0 0 10px #00ff00;
    z-index: 1000;
}

.toast-message.show {
    opacity: 1;
}