* { box-sizing: border-box; }
body {
    font-family: system-ui, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    background: #eef3e9;
    margin: 0;
    padding: 20px;
}
.container {
    max-width: 1000px;
    margin: 0 auto;
    background: white;
    border-radius: 40px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    padding: 20px 30px 30px;
}
h1 {
    color: #2b5e2f;
    text-align: center;
    margin-bottom: 1rem;
}
.hero {
    text-align: center;
    margin-bottom: 2rem;
}
.search-box {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 1.2rem;
}
#petInput {
    flex: 2;
    min-width: 200px;
    padding: 12px 20px;
    border-radius: 60px;
    border: 2px solid #cbdcc2;
    font-size: 1rem;
    outline: none;
}
#petInput:focus {
    border-color: #2b5e2f;
}
button, .btn {
    background: #2b5e2f;
    border: none;
    color: white;
    padding: 10px 24px;
    border-radius: 40px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.2s;
}
button:hover {
    background: #1e4521;
}
.btn-gold {
    background: linear-gradient(135deg, #f5b042, #e08e1a);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.btn-gold:hover {
    background: linear-gradient(135deg, #e89e2e, #c97a10);
}
a {
    text-decoration: none;
}
.result-card {
    background: #fefef7;
    border-radius: 28px;
    border: 1px solid #dee6d6;
    padding: 1.2rem 1.8rem;
    margin-top: 1.5rem;
}
.pet-title {
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 1rem;
    border-left: 5px solid #f5b642;
    padding-left: 12px;
}
.badge-group {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}
.egg-badge {
    background: #e5efdb;
    border-radius: 60px;
    padding: 6px 20px;
    cursor: pointer;
    transition: 0.1s;
    font-weight: 600;
    color: #2c5e2a;
}
.egg-badge:hover {
    background: #cfe2c2;
    transform: scale(1.02);
}
#groupPetsPanel {
    margin-top: 1.5rem;
    background: #f5faf0;
    border-radius: 28px;
    padding: 1rem 1.5rem;
}
.pet-chip {
    display: inline-block;
    background: white;
    border-radius: 40px;
    padding: 4px 16px;
    margin: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.autocomplete-items {
    position: absolute;
    background: white;
    border-radius: 20px;
    max-height: 200px;
    overflow-y: auto;
    width: calc(100% - 40px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.1);
    z-index: 10;
    margin-top: 4px;
}
.autocomplete-item {
    padding: 8px 20px;
    cursor: pointer;
}
.autocomplete-item:hover {
    background: #eef5e8;
}
.ranking-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}
.ranking-table th, .ranking-table td {
    text-align: left;
    padding: 12px;
    border-bottom: 1px solid #e0ead5;
}
.ranking-table tr:hover {
    background: #f9fef4;
    cursor: pointer;
}
.admin-table {
    width: 100%;
    overflow-x: auto;
}
.admin-table table {
    width: 100%;
    border-collapse: collapse;
}
.admin-table th, .admin-table td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: center;
}
.admin-table input {
    width: 100%;
    border: none;
    padding: 6px;
}
.nav-links {
    text-align: center;
    margin-bottom: 20px;
}
.nav-links a {
    margin: 0 12px;
    font-weight: bold;
}
/* 我的宠物仓 样式 */
.pet-garage {
    margin-top: 2rem;
    background: #fefef7;
    border-radius: 28px;
    border: 1px solid #dee6d6;
    padding: 1.2rem 1.8rem;
}
.garage-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}
.add-pet-form {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
    background: #f5f8f0;
    padding: 12px;
    border-radius: 28px;
}
.add-pet-form select, .add-pet-form input, .add-pet-form textarea {
    padding: 8px 12px;
    border-radius: 40px;
    border: 1px solid #cbdcc2;
    font-family: inherit;
}
.filter-bar {
    margin: 15px 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 15px;
}
.nature-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}
.nature-checkbox {
    background: #eef3e9;
    border-radius: 30px;
    padding: 4px 12px;
    font-size: 0.8rem;
    cursor: pointer;
}
.nature-checkbox.selected {
    background: #f1b82e;
    color: #2c2b1f;
}
.pet-table {
    width: 100%;
    border-collapse: collapse;
}
.pet-table th, .pet-table td {
    padding: 10px 6px;
    border-bottom: 1px solid #e9eddf;
    text-align: left;
    vertical-align: middle;
}
.stud-badge {
    background: #f1b82e;
    color: #2c2b1f;
    border-radius: 20px;
    padding: 2px 8px;
    font-size: 0.7rem;
    font-weight: bold;
    display: inline-block;
}
.overlap-warning {
    background: #ffeedd;
    color: #c96f0e;
    border-radius: 20px;
    padding: 2px 8px;
    font-size: 0.7rem;
}
.delete-pet {
    color: #d95b5b;
    cursor: pointer;
    font-weight: bold;
}
.nature-tooltip {
    border-bottom: 1px dashed #aaa;
    cursor: help;
}
.threshold-slider {
    display: flex;
    align-items: center;
    gap: 10px;
}
/* 折叠卡片样式补充 */
.collapsible {
    margin-bottom: 1.5rem;
    border-radius: 28px;
    background: #fff;
    overflow: hidden;
    border: 1px solid #dee6d6;
}
.collapsible-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding: 0.8rem 1.5rem;
    background: #faf6e9;
    font-weight: bold;
    font-size: 1.1rem;
    transition: background 0.2s;
}
.collapsible-header:hover {
    background: #f5efdd;
}
.collapse-icon {
    font-size: 1.2rem;
    transition: transform 0.2s;
}
.collapsible-content {
    padding: 0;
    background: #fefef7;
}
.collapsed .collapsible-content {
    display: none;
}
.collapsed .collapse-icon {
    transform: rotate(-90deg);
}
/* 原有卡片边距重置 */
.result-card, .stud-list, #groupPetsPanel, .pet-garage {
    margin: 0;
    border: none;
    background: transparent;
}
.result-card {
    margin-top: 0;
}
.stud-list {
    padding: 1rem;
}
#groupPetsList {
    padding: 1rem;
}
/* 种公匹配列表排版修复 */
#studMatchList {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}
.stud-item {
    display: inline-flex;
    align-items: center;
    background: #fff0cc;
    border-radius: 40px;
    padding: 6px 18px;
    cursor: pointer;
    transition: 0.1s;
    font-weight: 500;
    color: #b45f06;
    border: 1px solid #f5d48a;
    white-space: nowrap;
}
.stud-item .stud-count,
.stud-item .common-groups {
    margin-left: 8px;
    font-size: 0.7rem;
}
.stud-list {
    background: #fef7e0;
    border-radius: 28px;
    padding: 1rem;
}