/* 全局重置与基础排版 */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: #f3f4f6;
    color: #1f2937;
    padding: 20px;
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    justify-content: center;
}

.container {
    width: 100%;
    max-width: 1200px;
}

/* -----------------------
   顶部提示词参考区
   ----------------------- */
.tips-row {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    margin-bottom: 20px;
    background: #ffffff;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    border: 1px solid #e5e7eb;
    flex-wrap: wrap;
}

.tip-col { flex: 1; min-width: 120px; }

.tip-col h3 {
    font-size: 14px;
    font-weight: 600;
    color: #4b5563;
    margin-bottom: 10px;
    border-bottom: 1px dashed #e5e7eb;
    padding-bottom: 6px;
}

.tip-col ul { list-style: none; }

.tip-col li {
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 6px;
    font-family: monospace;
    background: #f9fafb;
    padding: 2px 6px;
    border-radius: 4px;
    display: inline-block;
    margin-right: 4px;
}

/* -----------------------
   字母输入网格区
   ----------------------- */
.input-area {
    background: #ffffff;
    padding: 20px;
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
    border: 1px solid #e5e7eb;
    margin-bottom: 20px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.input-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.input-header label {
    font-size: 16px;
    font-weight: 600;
    color: #374151;
}

#wordLengthInput {
    padding: 8px 12px;
    font-size: 16px;
    font-weight: 500;
    color: #111827;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background-color: #f9fafb;
    outline: none;
    cursor: pointer;
}

.letter-grid {
    display: grid;
    gap: 8px;
    justify-content: start;
    min-width: max-content;
    padding-bottom: 5px;
}

.letter-row-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.letter-box {
    width: 38px;
    height: 38px;
    text-align: center;
    font-size: 18px;
    font-weight: 700;
    text-transform: lowercase;
    color: #111827;
    background-color: #ffffff;
    border: 2px solid #d1d5db;
    border-radius: 8px;
    outline: none;
    transition: border-color 0.15s, background-color 0.15s;
}

.letter-box:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

/* -----------------------
   状态按钮 (默认带有浅色背景和符号)
   ----------------------- */
.fb-btn {
    width: 32px;
    height: 32px;
    border: 1px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
    transition: all 0.15s ease;
    user-select: none;
}

/* 黄色按钮默认状态 */
.fb-btn.yellow {
    background-color: #fef3c7; /* 浅黄底 */
    border-color: #fcd34d;
    color: #b45309; /* 深黄字 */
}
.fb-btn.yellow::before { content: "○"; } /* 默认空心圆圈提示 */

/* 绿色按钮默认状态 */
.fb-btn.green {
    background-color: #d1fae5; /* 浅绿底 */
    border-color: #6ee7b7;
    color: #047857; /* 深绿字 */
}
.fb-btn.green::before { content: "○"; }

/* 悬浮状态 */
.fb-btn.yellow:hover { background-color: #fde68a; }
.fb-btn.green:hover { background-color: #a7f3d0; }

/* 激活(选中)状态 */
.fb-btn.yellow.active {
    background-color: #f59e0b;
    border-color: #d97706;
    color: #ffffff;
    box-shadow: 0 2px 4px rgba(245, 158, 11, 0.4);
}
.fb-btn.yellow.active::before { content: "△"; } /* 选中变成实心三角 */

.fb-btn.green.active {
    background-color: #10b981;
    border-color: #059669;
    color: #ffffff;
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.4);
}
.fb-btn.green.active::before { content: "✓"; } /* 选中变成对勾 */

/* -----------------------
   底部控制与结果区
   ----------------------- */
.bottom-area {
    display: flex;
    gap: 20px;
    align-items: stretch;
    flex-wrap: wrap;
}

.filter-panel {
    flex: 1;
    min-width: 300px;
    background: #ffffff;
    padding: 20px;
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
    border: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.filter-group label {
    font-size: 13px;
    font-weight: 600;
    color: #4b5563;
}

.filter-group input, 
.filter-group textarea {
    width: 100%;
    padding: 12px;
    font-size: 16px; 
    font-family: monospace;
    color: #374151;
    background-color: #f9fafb;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    outline: none;
}

.filter-group textarea {
    resize: vertical;
    min-height: 60px;
}

#searchBtn {
    margin-top: 10px;
    padding: 14px;
    font-size: 16px;
    font-weight: 600;
    color: #ffffff;
    background-color: #3b82f6;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
}

.result-panel {
    flex: 2;
    min-width: 300px;
    background: #ffffff;
    padding: 20px;
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
    border: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.result-panel label {
    font-size: 15px;
    font-weight: 600;
    color: #374151;
}

#resultList {
    flex: 1;
    width: 100%;
    min-height: 300px;
    padding: 15px;
    font-size: 16px;
    font-family: monospace;
    color: #111827;
    background-color: #f9fafb;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    resize: none;
    outline: none;
    line-height: 1.8;
    letter-spacing: 1px;
}

/* -----------------------
   移动端专享响应式适配
   ----------------------- */
@media (max-width: 768px) {
    body { padding: 10px; }

    .tips-row {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding: 15px;
        gap: 20px;
        scrollbar-width: none;
    }
    .tips-row::-webkit-scrollbar { display: none; }
    .tip-col { min-width: 100px; }
    
    .input-area { padding: 15px; }
    .letter-grid { gap: 6px; }
    .letter-box {
        width: 32px;
        height: 32px;
        font-size: 16px;
        border-width: 1px;
    }
    .fb-btn {
        width: 26px;
        height: 26px;
        border-radius: 4px;
        font-size: 12px;
    }
    .letter-row-item { gap: 3px; }

    .bottom-area { flex-direction: column; }
    .filter-panel, .result-panel { min-width: 100%; padding: 15px; }
    #resultList { min-height: 200px; }
}