* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

body {
    background: white;
    color: #333;
    line-height: 1.6;
    padding-top: 60px;
}

.container {
    max-width: 1800px;
    margin: 20px auto;
    background: white;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
    overflow: hidden;
}

#topNav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: linear-gradient(to bottom right, #f0f0f0, #fafafa);
    padding: 12px 0;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

#topNav::-webkit-scrollbar {
    display: none;
}

#topNav .nav-container {
    display: flex;
    margin: 0 auto;
    padding: 0 20px;
    min-width: max-content;
}

#topNav a {
    color: #007bff;
    text-decoration: none;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 10px;
    transition: all 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

#topNav a:hover {
    background: rgba(123, 104, 238, 0.3);
}

.table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -5px;
    padding: 0 5px;
}

table {
    width: 100%;
    min-width: 1000px;
    border-collapse: collapse;
    font-size: 14px;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    background: white;
}

table a {
    font-size: 15px;
    padding: 2px 4px;
    margin: 2px 0;
    color: #1a73e8;
    word-break: break-word;
    line-height: 1.4;
    text-decoration: none;
}

th,
td {
    text-align: center;
    padding: 10px;
    border-bottom: 1px solid #dee2e6;
}

th {
    background: #1976d2;
    color: white;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
    font-size: 13px;
    position: sticky;
    top: 0;
}

tr:nth-child(even) {
    background-color: #f5f9ff;
}

tr:hover {
    background-color: rgba(123, 104, 238, 0.2);
}

.help-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
}

.help-modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    max-width: 600px;
    background: #fff;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    z-index: 1001;
    max-height: 80vh;
    overflow-y: auto;
}

.close-btn {
    position: absolute;
    top: 15px;
    right: 30px;
    background: none;
    border: none;
    font-size: 33px;
    cursor: pointer;
    color: #666;
    transition: color 0.3s;
}

.close-btn:hover {
    color: #f00;
}

.help-content {
    margin-top: 20px;
    line-height: 1.6;
    color: #333;
}

.help-content h2 {
    color: #2c3e50;
    border-bottom: 2px solid #eee;
    padding-bottom: 10px;
    margin-bottom: 15px;
}

.help-content ul {
    padding-left: 20px;
}

.help-content li {
    margin-bottom: 10px;
}

.help-btn {
    background-color: #1976d2;
    color: white;
    border: none;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    margin-left: 5px;
    font-weight: bold;
    letter-spacing: 1px;
}

.help-btn:hover {
    background-color: #3a5a80;
    transform: translateY(2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

.help-btn:active {
    transform: translateY(1px);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

#loadingRow td {
	text-align: center;
	padding: 10px;
	font-size: 14px;
	color: #555;
	background-color: #f1f1f1;
}

a {
	color: #007bff;
	text-align: center;
	text-decoration: none;
}

.controls {
    display: flex;
    flex-wrap: wrap;
    margin-bottom: 15px;
    gap: 8px;
    align-items: stretch;
}

.controls > div {
    flex: 1 1 auto;
    min-width: 150px;
}

.controls input[type="text"] {
    width: 100%;
    padding: 10px 12px;
    padding-right: 40px;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-sizing: border-box;
    font-size: 14px;
    transition: all 0.3s;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231976d2' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3ccircle cx='11' cy='11' r='8'%3e%3c/circle%3e%3cline x1='21' y1='21' x2='16.65' y2='16.65'%3e%3c/line%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    background-color: white;
}

.controls select {
    width: 100%;
    padding: 10px 12px;
    padding-right: 36px;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-sizing: border-box;
    font-size: 14px;
    transition: all 0.3s;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231976d2' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 14px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-color: white;
}

.controls input[type="text"]:focus,
.controls select:focus {
    border-color: #1976d2;
    box-shadow: 0 0 0 2px rgba(25, 118, 210, 0.2);
    outline: none;
}

@media (max-width: 768px) {
    body {
        padding-top: 50px;
        font-size: 14px;
        -webkit-overflow-scrolling: touch;
        overflow-y: scroll;
    }
    
    #topNav {
        padding: 8px 0;
    }
    
    #topNav a {
        padding: 8px 10px;
        font-size: 12px;
        margin: 0 2px;
        min-height: 40px;
        display: flex;
        align-items: center;
    }
    
    .container {
        margin: 10px 5px;
        padding: 8px;
        box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
    }
    
    .controls {
        flex-direction: column;
        gap: 4px;
        margin-bottom: 8px;
    }
    
    .controls > div {
        width: 100%;
        margin: 0;
    }
    
    .skill-selectors {
        display: flex;
        gap: 4px;
        width: 100%;
    }
    
    .skill-selectors > div {
        flex: 1;
        min-width: 0;
    }

    .controls input[type="text"] {
        width: 100%;
        padding: 8px 10px;
        padding-right: 34px;
        min-height: 38px;
        font-size: 13px;
        border: 1px solid #ccc;
        border-radius: 4px;
        margin: 0;
        box-sizing: border-box;
        background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231976d2' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3ccircle cx='11' cy='11' r='8'%3e%3c/circle%3e%3cline x1='21' y1='21' x2='16.65' y2='16.65'%3e%3c/line%3e%3c/svg%3e");
        background-repeat: no-repeat;
        background-position: right 8px center;
        background-size: 14px;
        background-color: white;
    }
    
    .controls select {
        width: 100%;
        padding: 8px 10px;
        padding-right: 30px;
        min-height: 38px;
        font-size: 13px;
        border: 1px solid #ccc;
        border-radius: 4px;
        margin: 0;
        box-sizing: border-box;
        background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231976d2' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
        background-repeat: no-repeat;
        background-position: right 8px center;
        background-size: 12px;
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
        background-color: white;
    }
    
    .controls input[type="text"]:focus,
    .controls select:focus {
        border-color: #1976d2;
        box-shadow: 0 0 0 1px rgba(25, 118, 210, 0.2);
        outline: none;
    }
    
    .table-container {
        margin: 0 -3px;
        padding: 0 3px;
    }
    
    table {
        min-width: 100%;
        font-size: 12px;
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border-radius: 6px;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    }
    
    table::-webkit-scrollbar {
        height: 3px;
    }
    
    table::-webkit-scrollbar-thumb {
        background: #1976d2;
        border-radius: 1.5px;
    }
    
    th, td {
        padding: 6px 3px;
        word-break: break-word;
    }
    
    th {
        font-size: 11px;
        padding: 7px 3px;
        white-space: nowrap;
    }
    
    /* 隐藏不重要的列 */
    td:nth-child(2), /* 类型 */
    th:nth-child(2),
    td:nth-child(3), /* 稀有度 */
    th:nth-child(3),
    td:nth-child(7), /* RANK */
    th:nth-child(7),
    td:nth-child(8), /* 费用 */
    th:nth-child(8),
    td:nth-child(10), /* 说明 */
    th:nth-child(10) {
        display: none;
    }
    
    /* 调整重要列的宽度 */
    td:nth-child(1) { /* 名称 */
        min-width: 110px;
        max-width: 130px;
        position: sticky;
        left: 0;
        background: inherit;
        z-index: 1;
        box-shadow: 1px 0 3px rgba(0,0,0,0.1);
    }
    
    td:nth-child(2) { /* 类型/GR */
        min-width: 55px;
        max-width: 65px;
    }
    
    td:nth-child(4) { /* 耐性 */
        min-width: 70px;
        max-width: 85px;
    }
    
    td:nth-child(5) { /* 技能 */
        min-width: 90px;
        max-width: 120px;
    }
    
    td:nth-child(6) { /* 防/洞 */
        min-width: 65px;
        max-width: 75px;
    }
    
    td:nth-child(9) { /* 素材 */
        min-width: 130px;
        max-width: 160px;
    }
    
    /* 优化素材列的显示 */
    .material-column {
        font-size: 11px;
    }
    
    .material-line {
        margin-bottom: 2px;
        line-height: 1.2;
    }
    
    /* 加载提示优化 */
    .loading {
        font-size: 13px;
        padding: 12px;
    }
    
    /* 帮助按钮优化 */
    .help-btn {
        min-height: 38px;
        font-size: 13px;
        margin: 8px auto;
        display: block;
        width: 90%;
        border-radius: 6px;
        padding: 6px 12px;
    }
}

@media (min-width: 481px) and (max-width: 768px) {
    .controls {
        flex-direction: row;
        gap: 6px;
        margin-bottom: 10px;
    }
    
    .controls > div:first-child {
        flex: 2 1 200px;
    }
    
    .skill-selectors {
        flex: 1;
        gap: 6px;
    }
    
    .controls input[type="text"] {
        padding: 9px 10px;
        padding-right: 34px;
        min-height: 40px;
        font-size: 14px;
    }
    
    .controls select {
        padding: 9px 10px;
        padding-right: 30px;
        min-height: 40px;
        font-size: 14px;
    }
}

@media (min-width: 769px) {
    .controls {
        gap: 10px;
        margin-bottom: 20px;
    }
    
    .controls > div {
        flex: 1 1 200px;
    }
    
    td:nth-child(1),
    th:nth-child(1) {
        min-width: 120px;
        font-size: 16px;
    }

    td:nth-child(5),
    th:nth-child(5) {
        min-width: 100px;
        font-size: 16px;
    }

    td:first-child div {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
    }

    td:first-child div a {
        margin-top: 5px;
    }

    td:nth-child(9) .material-line {
        margin-bottom: 4px;
        line-height: 1.3;
    }
}

@media (hover: none) and (pointer: coarse) {
    #topNav a {
        padding: 10px 12px;
        margin: 0 3px;
        min-height: 44px;
        display: flex;
        align-items: center;
    }
    
    .controls input[type="text"],
    .controls select {
        min-height: 44px;
        font-size: 16px;
    }
    
    tr {
        min-height: 44px;
    }
    
    td a {
        padding: 8px;
        display: inline-block;
        min-height: 44px;
        line-height: 1.4;
    }
    
    tr:hover {
        background-color: inherit;
    }
    
    tr:active {
        background-color: rgba(123, 104, 238, 0.2);
    }
}

.loading {
    text-align: center;
    padding: 20px;
    font-size: 18px;
    color: #888;
}

.hidden {
    display: none;
}

.material-column {
    font-size: 14px;
}

.material-line {
    display: block;
    margin-bottom: 4px;
    line-height: 1.3;
}

select option[disabled] {
    background-color: #97e075;
    color: #002b00;
    font-weight: bold;
}

* {
    -webkit-tap-highlight-color: transparent;
}

td, 
.material-column,
.material-line {
    user-select: text;
    -webkit-user-select: text;
}

#topNav,
.table-container,
table {
    scrollbar-width: thin;
    -ms-overflow-style: -ms-autohiding-scrollbar;
}

td, th {
    overflow: hidden;
    text-overflow: ellipsis;
}