:root {
    --bg-color: #030508;
    --card-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
    --accent-blue: #00d2ff;
    --accent-purple: #3a7bd5;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --highlight: #ffd700;
    --danger: #ff4b2b;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-color);
    background-image:
        radial-gradient(circle at 10% 20%, rgba(0, 210, 255, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 90% 80%, rgba(58, 123, 213, 0.03) 0%, transparent 50%);
    color: var(--text-primary);
    font-family: 'Inter', 'Noto Sans JP', sans-serif;
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 3rem 1.5rem;
}

header {
    text-align: center;
    margin-bottom: 4rem;
}

h1 {
    font-size: 3rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    background: linear-gradient(to right, var(--accent-blue), #fff);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.2em;
}

/* Info Bar */
.obs-info {
    display: flex;
    justify-content: space-around;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.01));
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(20px);
    padding: 1.5rem;
    border-radius: 24px;
    margin-bottom: 3rem;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

.info-item {
    text-align: center;
}

.info-label {
    display: block;
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.info-value {
    font-weight: 700;
    color: #fff;
    font-size: 1.1rem;
}

.config-time-input {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: #fff;
    font-size: 0.9rem;
    padding: 0.3rem 0.5rem;
    font-family: inherit;
    outline: none;
    cursor: pointer;
    transition: all 0.3s;
}

.config-time-input:hover,
.config-time-input:focus {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent-blue);
}

/* Chrome, Safari, etc. adjustment for datetime-local icons */
::-webkit-calendar-picker-indicator {
    filter: invert(1);
}

/* Telescope Selection */
.telescope-selection {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    text-align: center;
}

.section-title {
    font-size: 0.8rem;
    text-transform: uppercase;
    color: var(--accent-blue);
    margin-bottom: 0.5rem;
    font-weight: 700;
}

#telescope-select {
    background: #1a1a1a;
    color: #fff;
    border: 1px solid var(--accent-blue);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    width: 100%;
    max-width: 400px;
    margin: 0.5rem 0 0.5rem 0;
    outline: none;
    cursor: pointer;
}

.telescope-mag {
    font-size: 1rem;
    font-weight: 700;
    color: var(--highlight);
    margin-bottom: 0.5rem;
}

.telescope-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
    max-width: 600px;
    margin: 0 auto;
}

/* Search Bar */
.search-container {
    max-width: 600px;
    margin: 0 auto 1.5rem auto;
}

#target-search {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    padding: 1rem 1.5rem;
    border-radius: 12px;
    color: #fff;
    font-size: 1rem;
    outline: none;
    transition: all 0.3s;
}

#target-search:focus {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--accent-blue);
    box-shadow: 0 0 15px rgba(0, 210, 255, 0.2);
}

/* Filter Controls */
.filter-controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.filter-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
    padding: 0.6rem 1.5rem;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.filter-btn.active {
    background: var(--accent-purple);
    border-color: var(--accent-blue);
    color: #fff;
    box-shadow: 0 0 15px rgba(58, 123, 213, 0.4);
}

/* List container */
#list-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 3rem;
}

.target-item {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1.25rem;
    position: relative;
    transition: all 0.4s ease;
    overflow: hidden;
    animation: fadeIn 0.8s ease backwards;
}

.target-item.moon-impacted {
    border: 1px solid rgba(255, 75, 43, 0.4);
    opacity: 0.8;
}

.target-item.moon-impacted:hover {
    opacity: 1;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.target-item:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(0, 210, 255, 0.3);
}

.target-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.target-name {
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
}

.target-id {
    display: inline-block;
    font-family: monospace;
    font-size: 0.75rem;
    background: rgba(0, 210, 255, 0.1);
    color: var(--accent-blue);
    padding: 2px 8px;
    border-radius: 4px;
    margin-left: 0.4rem;
}

.best-badge {
    font-size: 0.7rem;
    background: rgba(255, 215, 0, 0.1);
    color: var(--highlight);
    border: 1px solid rgba(255, 215, 0, 0.3);
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 600;
}

.moon-warn {
    font-size: 0.65rem;
    background: rgba(255, 75, 43, 0.1);
    color: var(--danger);
    border: 1px solid rgba(255, 75, 43, 0.3);
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 700;
    margin-left: 0.5rem;
    text-transform: uppercase;
}

.target-meta {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.meta-box {
    background: rgba(0, 0, 0, 0.3);
    padding: 0.6rem;
    border-radius: 12px;
    text-align: center;
}

.meta-label {
    display: block;
    font-size: 0.65rem;
    color: var(--text-secondary);
    margin-bottom: 0.2rem;
}

.meta-value {
    font-weight: 700;
    font-size: 0.95rem;
}

.alt-val {
    color: var(--highlight);
}

/* AI Section */
#ai-recommendation-section {
    background: rgba(58, 123, 213, 0.05);
    border: 1px dashed var(--glass-border);
    border-radius: 24px;
    padding: 2rem;
    margin-top: 4rem;
}

#ai-copy-text {
    width: 100%;
    height: 150px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
    padding: 1rem;
    border-radius: 12px;
    font-size: 0.85rem;
    margin-bottom: 1rem;
    resize: none;
    outline: none;
}

#copy-btn {
    background: var(--accent-purple);
    color: #fff;
    border: none;
    padding: 0.8rem 2rem;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

#copy-btn:hover {
    filter: brightness(1.2);
    box-shadow: 0 0 20px rgba(58, 123, 213, 0.3);
}

.loading {
    text-align: center;
    padding: 4rem;
    color: var(--text-secondary);
    font-style: italic;
}

/* Sticky Header */
.sticky-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    background: rgba(3, 5, 8, 0.85);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-bottom: 1px solid var(--glass-border);
    padding: 0.75rem 0;
    transform: translateY(-100%);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    justify-content: center;
}

.sticky-header.visible {
    transform: translateY(0);
}

.sticky-content {
    max-width: 900px;
    width: 100%;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sticky-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.05em;
}

.sticky-value {
    color: var(--accent-blue);
    font-weight: 800;
    font-size: 0.95rem;
}

/* Scroll to Top Button */
.scroll-top-btn {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 50%;
    background: rgba(58, 123, 213, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    color: #fff;
    font-size: 1.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    z-index: 1000;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    outline: none;
}

.scroll-top-btn.visible {
    opacity: 1;
    transform: translateY(0);
}

.scroll-top-btn:hover {
    background: var(--accent-purple);
    border-color: var(--accent-blue);
    box-shadow: 0 0 20px rgba(58, 123, 213, 0.4);
}

.scroll-top-btn .arrow {
    transition: transform 0.3s ease;
}

.scroll-top-btn:hover .arrow {
    transform: translateY(-3px);
}

@media (max-width: 600px) {
    #list-container {
        grid-template-columns: 1fr;
    }

    .obs-info {
        flex-direction: column;
        gap: 1rem;
    }

    h1 {
        font-size: 2rem;
    }
}

/* Sky Map Modal */
.modal {
    display: none; 
    position: fixed; 
    z-index: 2000; 
    left: 0;
    top: 0;
    width: 100%; 
    height: 100%; 
    overflow: hidden; 
    background-color: rgba(3, 5, 8, 0.8); 
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.modal-content {
    background-color: rgba(3, 5, 8, 0.95);
    margin: 5vh auto;
    padding: 1.5rem;
    border: 1px solid var(--accent-blue);
    border-radius: 24px;
    width: 95%;
    max-width: 600px;
    position: relative;
    text-align: center;
    box-shadow: 0 0 30px rgba(0, 210, 255, 0.2);
    animation: zoomIn 0.3s ease-out;
}

@keyframes zoomIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

#skymap-close {
    color: var(--text-secondary);
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s;
}

#skymap-close:hover {
    color: #fff;
}

#skymap-title {
    color: #fff;
    margin-bottom: 0.5rem;
    font-size: 1.3rem;
    font-weight: 800;
}

.canvas-container {
    background-color: rgba(255, 255, 255, 0.02);
    border-radius: 50%;
    display: inline-block;
    border: 1px dashed var(--glass-border);
    margin: 1rem 0;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.5);
}

#skymap-canvas {
    display: block;
}

.skymap-info {
    font-size: 1rem;
    color: var(--accent-blue);
    font-weight: 700;
    background: rgba(0, 210, 255, 0.1);
    padding: 0.5rem;
    border-radius: 8px;
    display: inline-block;
}

.target-link {
    cursor: pointer;
}