:root {
    --bg-dark: #020412;
    --card-glass: rgba(13, 17, 38, 0.65);
    --card-border: rgba(255, 255, 255, 0.08);
    --accent: #00f2ff; /* Cyber Cyan */
    --accent-alt: #ff007a; /* Neon Magenta */
    --gold: #FFD700;
    --text: #ffffff;
    --text-muted: rgba(255, 255, 255, 0.6);
    --grad-main: linear-gradient(135deg, #00f2ff, #7000ff);
    --grad-surface: linear-gradient(145deg, rgba(255,255,255,0.05), rgba(255,255,255,0.01));
    --shadow-neon: 0 0 30px rgba(0, 242, 255, 0.2);
}

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

body {
    font-family: 'Outfit', 'Noto Sans TC', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}

/* Moving Aura Background */
.background {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: -1;
    background: radial-gradient(circle at 20% 30%, #1a1b4b 0%, transparent 40%),
                radial-gradient(circle at 80% 70%, #2e0854 0%, transparent 40%);
    overflow: hidden;
}

.background::after {
    content: '';
    position: absolute; width: 200%; height: 200%;
    top: -50%; left: -50%;
    background-image: url('https://www.transparenttextures.com/patterns/stardust.png');
    opacity: 0.2;
    animation: rotateBg 120s linear infinite;
}

@keyframes rotateBg {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 60px 20px;
}

header {
    text-align: center;
    margin-bottom: 80px;
}

h1 {
    font-family: 'Noto Serif TC', serif;
    font-weight: 900;
    font-size: 5.5rem;
    letter-spacing: 12px;
    background: linear-gradient(to right, #fff, var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-transform: uppercase;
    text-shadow: 0 0 40px rgba(0, 242, 255, 0.3);
}

header p {
    color: var(--text-muted);
    letter-spacing: 6px;
    font-size: 0.9rem;
    margin-top: -10px;
}

/* Glass Card Global */
.glass-card {
    background: var(--card-glass);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid var(--card-border);
    border-radius: 32px;
    padding: 40px;
    box-shadow: 0 25px 50px rgba(0,0,0,0.5);
    margin-bottom: 40px;
    position: relative;
    overflow: hidden;
}

.glass-card::before {
    content: '';
    position: absolute; top: 0; left: -100%; width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.03), transparent);
    animation: sweep 8s infinite;
}

@keyframes sweep {
    0% { left: -100%; }
    20% { left: 100%; }
    100% { left: 100%; }
}

/* Form Styling */
.tabs {
    display: flex; gap: 15px; margin-bottom: 40px; justify-content: center;
}

.tab {
    padding: 12px 30px;
    border-radius: 50px;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--card-border);
    color: #fff;
    cursor: pointer;
    transition: 0.3s;
    font-weight: 600;
}

.tab.active {
    background: var(--accent);
    color: #000;
    box-shadow: 0 0 20px var(--accent);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

.input-group label {
    display: block; margin-bottom: 12px; font-size: 0.85rem; color: var(--accent); font-weight: 600;
}

input[type="number"], input[type="text"] {
    width: 100%;
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--card-border);
    padding: 18px;
    border-radius: 16px;
    color: #fff;
    font-size: 1.2rem;
    font-weight: bold;
    text-align: center;
    transition: 0.2s;
    box-sizing: border-box;
}

input:focus {
    border-color: var(--accent);
    background: rgba(0,0,0,0.5);
    outline: none;
    box-shadow: 0 0 15px var(--accent);
}

.primary-btn {
    width: 100%;
    padding: 22px;
    border-radius: 70px;
    background: var(--grad-main);
    color: #000;
    font-size: 1.3rem;
    font-weight: 800;
    border: none;
    cursor: pointer;
    transition: 0.4s;
    text-transform: uppercase;
    letter-spacing: 3px;
    box-shadow: 0 10px 40px rgba(0,242,255,0.2);
}

.primary-btn:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 20px 60px rgba(0,242,255,0.4);
    filter: brightness(1.1);
}

/* Grid Design (Pillars) */
.master-grid {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    gap: 15px;
    margin-top: 50px;
}

.pillar {
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 20px 10px;
    text-align: center;
    transition: 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    min-height: 480px;
    position: relative;
}

.pillar:hover {
    background: rgba(255,255,255,0.06);
    transform: translateY(-8px);
    border-color: var(--accent);
}

.pillar.natal-pillar { border-width: 1px; }
.pillar.temporal-pillar { background: rgba(0, 242, 255, 0.03); }
.pillar.cycle-active { border-color: var(--accent); box-shadow: 0 0 20px rgba(0,242,255,0.1); }

.pillar-name { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; margin-bottom: 20px; letter-spacing: 2px; }
.shishen { font-size: 0.8rem; font-weight: bold; color: var(--gold); margin-bottom: 15px; min-height: 1.2em; }

.gan, .zhi {
    font-family: 'Noto Serif TC', serif;
    font-size: 3.2rem;
    font-weight: 900;
    line-height: 1;
    margin: 8px 0;
    cursor: pointer;
    transition: 0.3s;
}

.gan.active-taiji { color: var(--accent); text-shadow: 0 0 15px var(--accent); }

/* Elements */
.element-wood { color: #2ecc71; }
.element-fire { color: #ff4757; }
.element-earth { color: #f1c40f; }
.element-metal { color: #ecf0f1; }
.element-water { color: #3498db; }

/* Relation Tags */
.rel-row { min-height: 24px; display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; margin: 4px 0; }
.rel-tag {
    font-size: 0.65rem; padding: 2px 6px; border-radius: 4px; color: #000; font-weight: 900;
}
.rel-合 { background: #2ecc71; }
.rel-沖 { background: #ff4757; }
.rel-刑 { background: #f39c12; }
.rel-害 { background: #e67e22; }

.canggan-box { margin: 20px 0; padding: 10px; border-radius: 12px; background: rgba(255,255,255,0.03); }
.canggan-item { display: flex; justify-content: space-between; font-size: 0.75rem; margin: 3px 0; padding: 0 5px; }

.shishen-zhi { font-size: 0.7rem; color: var(--text-muted); border-top: 1px solid rgba(255,255,255,0.05); padding-top: 10px; margin-top: 10px; line-height: 1.8; }
.zhi-ss { display: block; color: var(--gold); }

.shensha-box { margin-top: 15px; display: flex; flex-direction: column; gap: 4px; min-height: 60px; }
.ss-tag { font-size: 0.65rem; background: rgba(0,242,255,0.1); border: 1px solid rgba(0,242,255,0.2); color: var(--accent); padding: 3px 6px; border-radius: 4px; }
.ss-tag-minor { background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1); color: #fff; }

/* Memory Slots - TRENDY STYLE */
.memory-slots { margin-top: 60px; }
.slots-grid { display: grid; grid-template-columns: repeat(10, 1fr); gap: 10px; }

.slot-btn {
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    min-height: 50px;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-muted);
    font-size: 0.8rem;
    cursor: pointer;
    transition: 0.3s;
    position: relative;
    padding: 5px;
}

.slot-btn:hover {
    background: rgba(255,255,255,0.1);
    border-color: var(--accent);
    color: #fff;
    transform: translateY(-3px);
}

.slot-btn.has-data {
    border-color: rgba(0, 242, 255, 0.4);
    color: var(--accent);
}

.slot-del {
    position: absolute; top: -5px; right: -5px; width: 22px; height: 22px;
    background: #ff4757; color: #fff; border-radius: 50%;
    display: none; align-items: center; justify-content: center; font-size: 14px;
    box-shadow: 0 5px 15px rgba(255, 71, 87, 0.4);
}

.slot-btn:hover .slot-del { display: flex; }

/* Cycle Explorer */
.cycle-columns {
    display: grid; grid-template-columns: repeat(5, 1fr); gap: 15px; margin-top: 40px;
}
.cycle-col h4 { font-size: 0.85rem; color: var(--accent); margin-bottom: 20px; text-transform: uppercase; text-align: center; }
.scroll-list { height: 450px; overflow-y: auto; padding-right: 5px; }

/* Scrollbar */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

.cycle-item {
    background: rgba(255,255,255,0.03);
    border-radius: 12px; padding: 12px; margin-bottom: 10px;
    border: 1px solid transparent; cursor: pointer; transition: 0.2s;
    display: flex; justify-content: space-between; align-items: center;
}

.cycle-item:hover { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.1); transform: translateX(5px); }
.cycle-item.active { background: rgba(0, 242, 255, 0.1); border-color: var(--accent); box-shadow: 0 0 15px rgba(0,242,255,0.1); }

/* Person Info Header */
.chart-header { text-align: center; margin-bottom: 40px; padding: 25px; border-radius: 24px; background: rgba(255,255,255,0.02); }
#person-info { font-size: 1.4rem; font-weight: 800; letter-spacing: 2px; }

footer { text-align: center; margin-top: 100px; padding: 60px; border-top: 1px solid var(--card-border); opacity: 1; font-weight: bold; font-size: 0.9rem; }

/* Responsive */
@media (max-width: 1200px) {
    .master-grid { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
    .pillar { min-height: auto; }
}

@media (max-width: 800px) {
    .cycle-columns { grid-template-columns: 1fr; }
    h1 { font-size: 3rem; }
    #slots-grid { grid-template-columns: repeat(5, 1fr); }
}
