body { 
    font-family: 'Inter', 'Noto Sans SC', sans-serif; 
}

/* 输入区域样式 */
.input-grid-container {
    position: relative;
    border: 1px solid #cbd5e1; /* border-slate-300 */
    border-radius: 0.5rem; /* rounded-lg */
    padding: 0.5rem; /* p-2 */
    width: 100%;
    min-height: 10rem;
    transition: all 150ms cubic-bezier(0.4, 0, 0.2, 1);
    overflow: auto; /* 允许水平和垂直滚动 */
    background-color: #e2e8f0; /* slate-200, 作为表格线颜色 */
    outline: none; /* 移除容器的默认outline */
    cursor: text; /* 指示可以输入文本 */
}

.input-grid-container:focus,
.input-grid-container:focus-within {
    outline: 2px solid transparent;
    outline-offset: 2px;
    --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);
    --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);
    box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);
    --tw-ring-color: #3b82f6; /* ring-blue-500 */
    border-color: #3b82f6; /* border-blue-500 */
}

.input-grid-placeholder {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    color: #9ca3af; /* text-gray-400 */
    pointer-events: none;
    display: block;
    transition: opacity 0.2s ease;
}

.input-grid-container:focus-within .input-grid-placeholder {
    opacity: 0.5;
}

.input-grid {
    display: grid;
    gap: 1px; /* 利用gap和背景色制造表格线效果 */
    min-height: 100%;
    width: 100%;
}

.grid-cell {
    padding: 2px 6px;
    background-color: white;
    outline: none;
    white-space: normal; /* 允许内容换行 */
    word-break: break-all; /* 强制长单词或数字串换行 */
    text-align: right;
    font-variant-numeric: tabular-nums; /* 优化等宽数字显示 */
    min-height: 28px; /* 确保单元格有足够的高度 */
    transition: background-color 0.15s ease;
    /* overflow: hidden; */ /* 移除以防止内容被隐藏 */
    /* text-overflow: ellipsis; */ /* 移除以防止显示省略号 */
}

.grid-cell:focus {
    background-color: #f0f9ff; /* 轻微的高亮显示，表示当前焦点 */
    box-shadow: inset 0 0 0 1px #bfdbfe; /* 内边框高亮 */
}

/* 非数值内容的单元格样式 */
.grid-cell.non-numeric {
    background-color: #f8fafc; /* slate-50 */
    color: #94a3b8; /* slate-400 */
    font-style: italic;
    text-align: left;
}

/* 清除按钮样式 */
.clear-btn, .action-btn {
    padding: 0.25rem;
    border-radius: 0.375rem;
    color: #64748b; /* slate-500 */
    transition: all 0.2s ease-in-out;
}
.clear-btn:hover {
    color: #dc2626; /* red-600 */
    background-color: #f1f5f9; /* slate-100 */
}
.action-btn:hover {
    color: #3b82f6; /* blue-600 */
    background-color: #f1f5f9; /* slate-100 */
}

/* 添加行按钮样式 */
.add-row-btn {
    position: absolute;
    bottom: 0.5rem;
    left: 50%;
    transform: translateX(-50%);
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background-color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    border: 1px solid #e2e8f0;
    color: #64748b; /* slate-500 */
    transition: all 0.2s ease-in-out;
    z-index: 10;
}

.add-row-btn:hover {
    color: #3b82f6; /* blue-600 */
    background-color: #f1f5f9; /* slate-100 */
    transform: translateX(-50%) scale(1.1);
}

/* 移动端适配 */
@media (max-width: 640px) {
    .grid-cell {
        padding: 2px 4px;
        font-size: 0.875rem;
    }
    
    .add-row-btn {
        width: 1.75rem;
        height: 1.75rem;
    }
    
    .add-row-btn svg {
        width: 1rem;
        height: 1rem;
    }
}

/* 结果列表样式 */
pre {
    white-space: pre-wrap; 
    word-wrap: break-word; 
    max-height: 300px;
    overflow-y: auto; 
    background-color: #ffffff; 
    padding: 1rem; 
    border-radius: 0.5rem;
}

/* 模式切换开关样式 */
.switch { 
    position: relative; 
    display: inline-block; 
    width: 60px; 
    height: 34px; 
}
.switch input { 
    opacity: 0; 
    width: 0; 
    height: 0; 
}
.slider { 
    position: absolute; 
    cursor: pointer; 
    top: 0; 
    left: 0; 
    right: 0; 
    bottom: 0; 
    background-color: #ccc; 
    transition: .4s; 
    border-radius: 34px; 
}
.slider:before { 
    position: absolute; 
    content: ""; 
    height: 26px; 
    width: 26px; 
    left: 4px; 
    bottom: 4px; 
    background-color: white; 
    transition: .4s; 
    border-radius: 50%; 
}
input:checked + .slider { 
    background-color: #2563eb; 
}
input:checked + .slider:before { 
    transform: translateX(26px); 
}

/* 悬浮提示样式 */
.tooltip-container { 
    position: relative; 
    display: inline-flex; 
    align-items: center; 
}
.tooltip-icon { 
    cursor: help; 
}
.tooltip-text {
    visibility: hidden; 
    width: 220px; 
    background-color: #27272a; /* zinc-800 */
    color: #fff; 
    text-align: center; 
    border-radius: 6px; 
    padding: 8px;
    position: absolute; 
    z-index: 1; 
    bottom: 125%; 
    left: 50%; 
    margin-left: -110px;
    opacity: 0; 
    transition: opacity 0.3s; 
    font-size: 0.875rem; 
    line-height: 1.25rem;
}
.tooltip-text::after {
    content: ""; 
    position: absolute; 
    top: 100%; 
    left: 50%; 
    margin-left: -5px;
    border-width: 5px; 
    border-style: solid; 
    border-color: #27272a transparent transparent transparent;
}
.tooltip-container:hover .tooltip-text { 
    visibility: visible; 
    opacity: 1; 
}

/* 禁用状态样式 */
.action-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}