:root {
    --bg-color: #0b0f19;
    --panel-bg: rgba(22, 28, 45, 0.6);
    --panel-border: rgba(255, 255, 255, 0.08);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --accent-red: #ff3366;
    --accent-blue: #00d2ff;
    --accent-blue-glow: rgba(0, 210, 255, 0.3);
    
    --tag-bg: rgba(255, 255, 255, 0.05);
    --tag-border: rgba(255, 255, 255, 0.1);
    --tag-hover: rgba(255, 255, 255, 0.15);
    
    --card-bg: rgba(30, 41, 59, 0.4);
    --card-hover: rgba(51, 65, 85, 0.6);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Noto Sans TC', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Dynamic Background */
.bg-animation {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    z-index: -1;
    overflow: hidden;
    background: radial-gradient(circle at center, #111827 0%, #030712 100%);
}

.glow {
    position: absolute;
    filter: blur(80px);
    border-radius: 50%;
    opacity: 0.5;
    animation: float 20s infinite ease-in-out alternate;
}

.glow-1 {
    width: 300px; height: 300px;
    background: rgba(255, 51, 102, 0.4);
    top: 10%; left: 10%;
}

.glow-2 {
    width: 400px; height: 400px;
    background: rgba(0, 210, 255, 0.3);
    bottom: 20%; right: 10%;
    animation-delay: -5s;
}

.glow-3 {
    width: 250px; height: 250px;
    background: rgba(138, 43, 226, 0.3);
    top: 40%; left: 50%;
    animation-delay: -10s;
}

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(50px, 50px) scale(1.2); }
}

/* Layout */
.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Header */
.header {
    text-align: center;
    animation: fadeInDown 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.main-title {
    font-family: 'Outfit', 'Noto Sans TC', sans-serif;
    font-size: 2.5rem;
    font-weight: 900;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
    text-shadow: 0 4px 12px rgba(0,0,0,0.5);
}

.title-highlight {
    background: linear-gradient(135deg, var(--accent-red), var(--accent-blue));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: block;
    font-size: 1.5rem;
    margin-bottom: 0.2rem;
}

.subtitle {
    color: var(--text-muted);
    font-size: 1rem;
    font-weight: 500;
}

/* Glass Panel */
.glass-panel {
    background: var(--panel-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--panel-border);
    border-radius: 24px;
    padding: 1.5rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3), inset 0 1px 1px rgba(255,255,255,0.05);
    animation: fadeIn 1s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    animation-delay: 0.2s;
    opacity: 0;
}

/* Filter Section */
.filter-group {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.sub-filter {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.sub-filter-title {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 700;
    margin-left: 0.2rem;
    letter-spacing: 1px;
}

.filter-title {
    font-size: 1.1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: white;
}

.icon {
    width: 20px;
    height: 20px;
    stroke: var(--accent-blue);
}

.divider {
    height: 1px;
    background: linear-gradient(to right, transparent, var(--panel-border), transparent);
    margin: 1.5rem 0;
}

.tag-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.tag {
    background: var(--tag-bg);
    border: 1px solid var(--tag-border);
    color: var(--text-muted);
    padding: 0.5rem 1rem;
    border-radius: 99px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    user-select: none;
    position: relative;
    overflow: hidden;
}

.tag::before {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%) scale(0);
    width: 100%; height: 100%;
    background: var(--accent-blue);
    border-radius: 99px;
    transition: transform 0.3s ease;
    z-index: -1;
    opacity: 0;
}

.tag:hover {
    background: var(--tag-hover);
    color: white;
    transform: translateY(-2px);
}

.tag.active {
    background: transparent;
    color: #fff;
    border-color: var(--accent-blue);
    text-shadow: 0 0 8px rgba(255,255,255,0.5);
    box-shadow: 0 0 15px var(--accent-blue-glow);
    font-weight: 700;
}

.tag.active::before {
    transform: translate(-50%, -50%) scale(1);
    opacity: 0.8;
}

.tag.active:hover {
    transform: translateY(-2px);
}

/* Results Section */
.results-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    animation: fadeIn 1s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    animation-delay: 0.4s;
    opacity: 0;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--panel-border);
    padding-bottom: 0.8rem;
}

.results-title {
    font-size: 1.2rem;
    font-weight: 700;
}

.badge {
    background: linear-gradient(135deg, rgba(255, 51, 102, 0.2), rgba(255, 51, 102, 0.4));
    border: 1px solid rgba(255, 51, 102, 0.5);
    padding: 0.3rem 0.8rem;
    border-radius: 99px;
    font-size: 0.85rem;
    font-weight: 700;
    color: white;
}

.hero-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

/* Hero Card */
.hero-card {
    background: var(--card-bg);
    border: 1px solid var(--panel-border);
    border-radius: 16px;
    padding: 1.25rem;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    position: relative;
    overflow: hidden;
}

.hero-card::after {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(to bottom, var(--accent-blue), var(--accent-red));
    opacity: 0.5;
    transition: opacity 0.3s ease;
}

.hero-card:hover {
    background: var(--card-hover);
    transform: translateY(-4px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.4);
    border-color: rgba(255,255,255,0.15);
}

.hero-card:hover::after {
    opacity: 1;
}

.hero-name {
    font-size: 1.4rem;
    font-weight: 900;
    margin-bottom: 0.5rem;
    color: white;
}

.hero-tags-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.hero-tag-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.hero-tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.hero-tiny-tag {
    font-size: 0.75rem;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    background: rgba(255,255,255,0.1);
    color: #e2e8f0;
    cursor: pointer;
    transition: transform 0.2s, filter 0.2s;
}

.hero-tiny-tag:hover {
    transform: scale(1.05);
    filter: brightness(1.2);
}

.hero-tiny-tag.attr {
    background: rgba(0, 210, 255, 0.15);
    border: 1px solid rgba(0, 210, 255, 0.3);
    color: #bae6fd;
}

.hero-tiny-tag.trait {
    background: rgba(255, 51, 102, 0.15);
    border: 1px solid rgba(255, 51, 102, 0.3);
    color: #fecdd3;
}

/* Animations that are triggered by JS */
.card-enter {
    animation: slideUpFade 0.4s cubic-bezier(0.16, 1, 0.3, 1) backwards;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    background: var(--card-bg);
    border-radius: 16px;
    border: 1px dashed var(--panel-border);
}

.empty-state.hidden {
    display: none;
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.7;
}

.empty-state h3 {
    margin-bottom: 0.5rem;
    color: white;
}

.empty-state p {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.reset-btn {
    background: var(--accent-red);
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 99px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(255, 51, 102, 0.4);
    transition: all 0.2s ease;
}

.reset-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 51, 102, 0.6);
}

/* Animations */
@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

/* Responsive (iPhone 16 Pro and similar) */
@media (max-width: 768px) {
    .app-container {
        padding: 1.5rem 1rem;
    }
    
    .main-title {
        font-size: 2rem;
    }
    
    .title-highlight {
        font-size: 1.2rem;
    }
    
    .glass-panel {
        padding: 1.25rem;
        border-radius: 20px;
    }
    
    .hero-grid {
        grid-template-columns: 1fr;
    }
    
    .tag {
        padding: 0.4rem 0.8rem;
        font-size: 0.85rem;
    }
}


/* --- Options Section & Toggle --- */
.options-section {
    margin-bottom: 20px;
    padding: 15px 25px;
}
.options-group {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: center;
}
.toggle-switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-color);
}
.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.slider {
    position: relative;
    width: 44px;
    height: 24px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 34px;
    margin-right: 12px;
    transition: .4s;
    border: 1px solid rgba(255, 255, 255, 0.2);
}
.slider:before {
    position: absolute;
    content: '';
    height: 18px;
    width: 18px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}
.toggle-switch input:checked + .slider {
    background-color: var(--primary-color, #ff3366);
    box-shadow: 0 0 10px rgba(255, 51, 102, 0.5);
    border-color: #ff3366;
}
.toggle-switch input:checked + .slider:before {
    transform: translateX(20px);
}

/* --- Breakthrough Tag Styling --- */
.hero-tiny-tag.breakthrough-tag {
    background: rgba(255, 215, 0, 0.15) !important;
    border: 1px solid rgba(255, 215, 0, 0.8) !important;
    color: #FFD700 !important;
    box-shadow: 0 0 8px rgba(255, 215, 0, 0.4) !important;
    text-shadow: 0 0 4px rgba(255, 215, 0, 0.8) !important;
}
.hero-tiny-tag.breakthrough-tag:hover {
    background: rgba(255, 215, 0, 0.3) !important;
    box-shadow: 0 0 12px rgba(255, 215, 0, 0.7) !important;
}
