:root {
    --primary-color: #4a6fa8;
    --primary-light: #6a8fc7;
    --primary-dark: #3a5a8f;
    --primary-vibrant: #5b8cff;
    --secondary-color: #7eb8d0;
    --success-color: #8fbc8f;
    --warning-color: #e6b422;
    --danger-color: #d1666a;
    --text-primary: #e5e9f0;
    --text-secondary: #d8dee9;
    --text-tertiary: #b8c5d6;
    --background: #1e222d;
    --surface: #282d3a;
    --surface-variant: #333a48;
    --surface-highlight: #3d4555;
    --border-radius: 8px;
    --box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    --transition: all 0.3s ease;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'MiSansLatin', sans-serif;
    background: linear-gradient(135deg, var(--background) 0%, #242a36 100%);
    color: var(--text-primary);
    min-height: 100vh;
    padding: 20px;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1880px;
    margin: 0 auto;
    background-color: var(--surface);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    overflow: hidden;
    border: 1px solid var(--surface-highlight);
    opacity: 1;
    transition: opacity 0.3s ease-in-out;
}

.container.hide {
    opacity: 0;
}

header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    color: white;
    padding: 3px;
    text-align: center;
    border-bottom: 1px solid var(--primary-dark);
}

header h1 {
    font-size: 2.2rem;
    margin-bottom: 10px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

header p {
    opacity: 0.9;
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.85);
}

.main-content {
    padding: 25px;
    flex: 1;
    display: flex;
    gap: 20px;
}

.input-section {
    flex: 0 0 25%;
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 500px;
}

.results-section {
    flex: 1;
}

.scan-section {
    background-color: var(--surface-variant);
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    border: 1px solid var(--surface-highlight);
}

.scan-section h2 {
    color: var(--primary-vibrant);
    margin-top: 0;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--surface-highlight);
}

label {
    display: block;
    margin-bottom: 2px;
    font-weight: 300;
    color: var(--text-secondary);
}

select, textarea {
    width: 100%;
    padding: 5px 15px;
    border: 1px solid var(--surface-highlight);
    background-color: var(--surface);
    color: var(--text-primary);
    border-radius: var(--border-radius);
    font-family: inherit;
    font-size: 1rem;
    transition: var(--transition);
}

select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary-vibrant);
    box-shadow: 0 0 0 2px rgba(91, 140, 255, 0.3);
}

textarea {
    min-height: 150px;
    resize: vertical;
}

.btn {
    background: linear-gradient(135deg, var(--primary-vibrant) 0%, var(--primary-light) 100%);
    color: white;
    border: none;
    padding: 12px 25px;
    font-size: 1rem;
    font-weight: 500;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 8px rgba(91, 140, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(91, 140, 255, 0.3);
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary-vibrant) 100%);
}

.btn:active {
    transform: translateY(1px);
}

.btn-small {
    padding: 3px 8px;
    font-size: 0.8em;
    margin: 0 2px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
}

.btn-small:hover {
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary-vibrant) 100%);
}

.submit-combined {
    width: 100%;
    padding: 15px;
    font-size: 1.1em;
}

.controls {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    align-items: center;
}

.language-selector, .filter-option {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-option input[type="checkbox"] {
    accent-color: var(--primary-vibrant);
}

.recon-ships {
    margin-top: 15px;
    border-top: 1px solid var(--surface-highlight);
    padding-top: 15px;
}

.recon-ships h3 {
    margin-top: 0;
    margin-bottom: 10px;
    color: var(--text-secondary);
}

.recon-ship {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    justify-content: space-between;
}

.recon-ship label {
    flex: 1;
    margin-bottom: 0;
}

.recon-ship .counter {
    display: flex;
    align-items: center;
}

.recon-ship input {
    width: 60px;
    text-align: center;
    margin: 0 5px;
    padding: 5px;
    background-color: var(--surface);
    color: var(--text-primary);
    border: 1px solid var(--surface-highlight);
    border-radius: var(--border-radius);
}

.error {
    color: var(--danger-color);
    background-color: rgba(209, 102, 106, 0.2);
    padding: 15px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    display: none;
    border: 1px solid rgba(209, 102, 106, 0.3);
}

.loading {
    display: none;
    text-align: center;
    padding: 20px;
    color: var(--text-secondary);
}

.spinner {
    border: 4px solid rgba(229, 233, 240, 0.1);
    border-radius: 50%;
    border-top: 4px solid var(--primary-vibrant);
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.results {
    display: none;
    background-color: var(--surface-variant);
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    margin-top: 20px;
    border: 1px solid var(--surface-highlight);
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    border-bottom: 2px solid var(--surface-highlight);
    padding-bottom: 10px;
}

.results-header h2 {
    color: var(--primary-vibrant);
    margin: 0;
}

.results-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.copy-screenshot-btn {
    background: linear-gradient(135deg, var(--success-color) 0%, #7eb88a 100%);
    color: white;
    border: none;
    padding: 12px 20px;
    font-size: 1rem;
    font-weight: 500;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 8px rgba(143, 188, 143, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.copy-screenshot-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(143, 188, 143, 0.3);
    background: linear-gradient(135deg, #7eb88a 0%, var(--success-color) 100%);
}

.copy-screenshot-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.share-url {
    background-color: var(--surface);
    padding: 12px 15px;
    border-radius: var(--border-radius);
    border: 1px solid var(--surface-highlight);
    word-break: break-all;
    font-family: monospace;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.share-url:hover {
    background-color: var(--surface-highlight);
}

.timestamp {
    color: var(--text-tertiary);
    font-size: 0.9em;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 25px;
    box-shadow: var(--box-shadow);
    border-radius: var(--border-radius);
    overflow: hidden;
    background-color: var(--surface);
}

th, td {
    padding: 12px 15px;
    text-align: left;
    border: 1px solid var(--surface-highlight);
}

th {
    background-color: var(--primary-color);
    color: white;
    font-weight: 500;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
}

tr:nth-child(even) {
    background-color: var(--surface-variant);
}

tr:hover {
    background-color: var(--surface-highlight);
}

.distance-stats {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.distance-stat {
    flex: 1;
    background-color: var(--surface);
    padding: 15px; 
    border-radius: var(--border-radius);
    text-align: center;
    border: 1px solid var(--surface-highlight);
    display: flex;
    flex-direction: column;
    justify-content: center; 
    align-items: center; 
    min-height: 150px; 
}

.distance-stat h3 {
    margin-top: 0;
    margin-bottom: 10px; 
    color: var(--text-secondary);
}

.distance-stat span {
    font-size: 1.5em;
    font-weight: bold;
    color: var(--text-primary);
    margin: 10px 0; 
}

#distanceTable {
    margin-top: 0;
    margin-bottom: 0; 
    width: 100%;
}

#distanceTable th, 
#distanceTable td {
    padding: 8px 12px;
    text-align: center;
}

#channelResults {
    display: none;
}

.stats-container {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.stats-container > div {
    flex: 1;
}

footer {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-color) 100%);
    color: white;
    padding: 6px 0;
    text-align: center;
    font-size: 1rem;
    border-bottom-left-radius: var(--border-radius); 
    border-bottom-right-radius: var(--border-radius); 
    margin-top: 10px;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.beian {
    margin-top: 4px;
    opacity: 0.9;
}

.beian a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: var(--transition);
}

.beian a:hover {
    color: white;
    text-decoration: underline;
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    header h1 {
        font-size: 1.5rem;
    }
    
    .main-content {
        padding: 15px;
        flex-direction: column;
    }
    
    .input-section, .results-section {
        flex: 1 1 100%;
        width: 100%;
    }
    
    .distance-stats, .stats-container {
        flex-direction: column;
    }
    
    th, td {
        padding: 8px 10px;
        font-size: 0.9rem;
    }
}

.ship-stats-container {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}
.ship-stats-container > div {
    flex: 1;
}
@media (max-width: 768px) {
    .ship-stats-container {
        flex-direction: column;
    }
}

.modal {
    display: none;
    position: fixed;
    z-index: 1001;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(3px);
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background-color: var(--surface);
    margin: 5% auto;
    padding: 25px;
    border-radius: var(--border-radius);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    width: 67%;
    max-width: 2160px;
    max-height: 80vh;
    overflow-y: auto;
    border: 1px solid var(--surface-highlight);
    position: relative;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.close-modal {
    color: var(--text-tertiary);
    position: absolute;
    right: 25px;
    top: 20px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: var(--transition);
}

.close-modal:hover {
    color: var(--primary-vibrant);
    transform: scale(1.1);
}

.modal-content h3 {
    color: var(--primary-vibrant);
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--surface-highlight);
}

.character-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 10px;
    margin-top: 15px;
}

.character-item {
    background-color: var(--surface-variant);
    padding: 12px 15px;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    transition: var(--transition);
    border: 1px solid transparent;
}

.character-item:hover {
    background-color: var(--surface-highlight);
    border-color: var(--primary-vibrant);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.character-item img {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    margin-right: 10px;
    object-fit: cover;
    border: 1px solid var(--surface-highlight);
}

.modal-content::-webkit-scrollbar {
    width: 8px;
}

.modal-content::-webkit-scrollbar-track {
    background: var(--surface-variant);
    border-radius: 4px;
}

.modal-content::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

.modal-content::-webkit-scrollbar-thumb:hover {
    background: var(--primary-light);
}

@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        margin: 10% auto;
        padding: 20px 15px;
    }
    
    .character-list {
        grid-template-columns: 1fr;
    }
    
    .close-modal {
        right: 15px;
        top: 15px;
    }
}

.site-stats {
    margin-top: 8px;
    color: var(--text-tertiary);
    font-size: 0.95em;
    text-align: center;
    opacity: 0.85;
}

.perf-stats {
    font-size: 0.85em;
    color: var(--text-tertiary);
    margin-top: 8px;
    text-align: right;
    line-height: 1.4;
    padding: 6px 12px;
    background: var(--surface-variant);
    border-radius: var(--border-radius);
    display: inline-block;
}

.perf-stats b {
    color: var(--text-secondary);
    font-weight: 500;
}

.perf-stats div + div {
    margin-top: 2px;
}

/* 截图弹窗样式 */
.screenshot-modal {
    max-width: 800px;
    text-align: center;
}

.screenshot-message {
    font-size: 1.1em;
    color: var(--text-secondary);
    margin: 20px 0;
}

.screenshot-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 30px 0;
}

.screenshot-loading .spinner {
    width: 40px;
    height: 40px;
    margin-bottom: 15px;
}

.screenshot-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.screenshot-preview {
    max-width: 100%;
    max-height: 400px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    border: 2px solid var(--surface-highlight);
}

.screenshot-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.screenshot-buttons .btn {
    min-width: 160px;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.btn-secondary {
    background: linear-gradient(135deg, var(--secondary-color) 0%, #6a9bb7 100%);
    color: white;
    border: none;
    padding: 12px 25px;
    font-size: 1rem;
    font-weight: 500;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 8px rgba(126, 184, 208, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-secondary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(126, 184, 208, 0.3);
    background: linear-gradient(135deg, #6a9bb7 0%, var(--secondary-color) 100%);
}

@media (max-width: 768px) {
    .screenshot-modal {
        max-width: 95%;
    }
    
    .screenshot-buttons {
        flex-direction: column;
        width: 100%;
        gap: 10px;
    }
    
    .screenshot-buttons .btn {
        width: 100%;
        min-width: auto;
    }
    
    .screenshot-preview {
        max-height: 300px;
    }
}