:root {
    --bg-dark: #0f172a;
    --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-main: #f8fafc;
    --text-muted: #cbd5e1;
    --accent: #38bdf8;
    --accent-hover: #0ea5e9;
    --card-bg: rgba(30, 41, 59, 0.7);
}

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

body {
    font-family: 'Inter', 'Noto Sans TC', sans-serif;
    background: var(--bg-gradient);
    background-attachment: fixed;
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow-x: hidden;
}

/* Background Animation */
.background-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    background: 
        radial-gradient(circle at 15% 50%, rgba(56, 189, 248, 0.15), transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(139, 92, 246, 0.15), transparent 25%);
    animation: pulse 15s ease-in-out infinite alternate;
}

@keyframes pulse {
    0% { transform: scale(1); }
    100% { transform: scale(1.1); }
}

/* Hero Section */
.hero {
    text-align: center;
    padding: 6rem 2rem 4rem;
    display: flex;
    justify-content: center;
}

.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    padding: 3rem 4rem;
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    max-width: 800px;
    animation: slideDown 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

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

h1 {
    font-size: 3.5rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    background: linear-gradient(to right, #38bdf8, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.subtitle {
    font-size: 1.5rem;
    color: var(--accent);
    font-weight: 600;
    margin-bottom: 1.5rem;
    letter-spacing: 2px;
}

.desc {
    font-size: 1.1rem;
    color: var(--text-muted);
    line-height: 1.6;
}

/* Main Container & Cards */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    flex: 1;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2.5rem;
    padding: 1rem;
}

.card {
    position: relative;
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 2.5rem 2rem;
    text-decoration: none;
    color: var(--text-main);
    overflow: hidden;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.4s ease;
    display: flex;
    flex-direction: column;
    backdrop-filter: blur(10px);
    cursor: pointer;
    animation: fadeIn 1s ease backwards;
}

.card:nth-child(1) { animation-delay: 0.2s; }
.card:nth-child(2) { animation-delay: 0.4s; }
.card:nth-child(3) { animation-delay: 0.6s; }

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

.card:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    border-color: rgba(56, 189, 248, 0.4);
}

.card-content {
    position: relative;
    z-index: 2;
}

.icon {
    font-size: 3rem;
    margin-bottom: 1.5rem;
    display: inline-block;
    transition: transform 0.3s ease;
}

.card:hover .icon {
    transform: scale(1.1) rotate(5deg);
}

.card h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    font-weight: 700;
}

.card p {
    color: var(--text-muted);
    line-height: 1.6;
    font-size: 1.05rem;
}

.card-hover-effect {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, rgba(56, 189, 248, 0.1) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: 1;
    pointer-events: none;
}

.card:hover .card-hover-effect {
    opacity: 1;
}

/* Modal for HF Space */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: var(--bg-dark);
    width: 90%;
    max-width: 1200px;
    height: 85vh;
    border-radius: 20px;
    border: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    position: relative;
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 30px 60px rgba(0,0,0,0.6);
}

.modal-overlay.active .modal-content {
    transform: scale(1);
}

.close-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 2rem;
    cursor: pointer;
    transition: color 0.2s;
    z-index: 10;
}

.close-btn:hover {
    color: #fff;
}

.modal-title {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--glass-border);
    font-size: 1.4rem;
    color: var(--accent);
}

.iframe-container {
    flex: 1;
    position: relative;
    border-radius: 0 0 20px 20px;
    overflow: hidden;
}

.iframe-container iframe {
    width: 100%;
    height: 100%;
    background: #ffffff; /* Fallback for iframe content */
}

.iframe-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-dark);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 5;
}

.overlay-msg {
    text-align: center;
    padding: 3rem;
    background: rgba(255,255,255,0.05);
    border: 1px dashed var(--accent);
    border-radius: 16px;
    max-width: 600px;
}

.overlay-msg h3 {
    color: #f59e0b;
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.overlay-msg p {
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 0.5rem;
}

.overlay-msg code {
    background: rgba(0,0,0,0.5);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    color: var(--accent);
}

footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    border-top: 1px solid var(--glass-border);
    margin-top: auto;
}

@media (max-width: 768px) {
    h1 { font-size: 2.5rem; }
    .glass-panel { padding: 2rem; }
    .card-grid { grid-template-columns: 1fr; }
}
