:root {
    --bg-color: #0d1117;
    --panel-bg: rgba(22, 27, 34, 0.85);
    --primary: #00ffcc;
    --secondary: #e6b800;
    --text: #e0e0e0;
    --border: #30363d;
    --danger: #ff4d4d;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Noto Serif TC', serif;
}

body {
    background-color: var(--bg-color);
    background-image: radial-gradient(circle at 50% 50%, #1a202c 0%, #0d1117 100%);
    color: var(--text);
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    overflow: hidden;
    user-select: none;
}

h1.title, h2 {
    font-family: 'Ma Shan Zheng', cursive;
    color: var(--primary);
    text-shadow: 0 0 10px rgba(0, 255, 204, 0.5);
    text-align: center;
    margin-bottom: 20px;
    letter-spacing: 2px;
}

h1.title { font-size: 42px; }
h2 { font-size: 28px; border-bottom: 1px solid var(--border); padding-bottom: 10px; margin-bottom: 15px; }

#particle-container {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: 0;
    pointer-events: none;
}

.game-container {
    position: relative;
    z-index: 10;
    display: flex;
    gap: 30px;
    width: 900px;
    height: 650px;
}

.panel {
    background: var(--panel-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 0 30px rgba(0,0,0,0.8), inset 0 0 20px rgba(0, 255, 204, 0.05);
    display: flex;
    flex-direction: column;
}

.character-panel { flex: 1.2; align-items: center; }
.right-panel { flex: 1; display: flex; flex-direction: column; gap: 20px; }
.section { flex: 1; display: flex; flex-direction: column; }

/* Stats box */
.stats-box {
    width: 100%;
    background: rgba(0,0,0,0.5);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.stat { font-size: 16px; }
.label { color: #8b949e; }
.highlight { color: var(--secondary); font-weight: bold; font-size: 18px; text-shadow: 0 0 5px rgba(230, 184, 0, 0.5); }

/* Cultivation Circle */
.cultivation-area {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    position: relative;
}

.array-circle {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    border: 2px dashed var(--primary);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    position: relative;
    animation: rotate 20s linear infinite;
    box-shadow: 0 0 20px rgba(0,255,204,0.2), inset 0 0 20px rgba(0,255,204,0.1);
    transition: 0.2s;
}

.array-circle:hover {
    box-shadow: 0 0 30px rgba(0,255,204,0.5), inset 0 0 30px rgba(0,255,204,0.3);
    transform: scale(1.05);
}

.array-circle:active {
    transform: scale(0.95);
    border-color: #fff;
}

.inner-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0,255,204,0.1) 0%, transparent 80%);
    border: 1px solid rgba(0,255,204,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: 'Ma Shan Zheng', cursive;
    font-size: 32px;
    color: var(--primary);
    text-shadow: 0 0 10px var(--primary);
    animation: reverse-rotate 20s linear infinite;
}

/* Progress Section */
.progress-section {
    width: 100%;
    text-align: center;
    margin-top: 20px;
}

.qi-text { margin-bottom: 8px; font-size: 14px; color: #8b949e; }
.progress-bar {
    width: 100%;
    height: 12px;
    background: #21262d;
    border-radius: 6px;
    border: 1px solid var(--border);
    overflow: hidden;
    position: relative;
}

.fill {
    height: 100%;
    background: linear-gradient(90deg, #00b386, var(--primary));
    width: 0%;
    transition: width 0.1s;
    box-shadow: 0 0 10px var(--primary);
}

button {
    margin-top: 15px;
    padding: 12px 20px;
    font-size: 18px;
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary);
    border-radius: 6px;
    cursor: pointer;
    transition: 0.2s;
    text-shadow: 0 0 5px var(--primary);
    box-shadow: inset 0 0 5px rgba(0,255,204,0.2);
}

button:hover { background: rgba(0,255,204,0.1); box-shadow: 0 0 15px rgba(0,255,204,0.4); text-shadow: 0 0 10px var(--primary); }
button.hidden { display: none; }

#breakthrough-btn {
    width: 100%;
    background: rgba(230, 184, 0, 0.1);
    border-color: var(--secondary);
    color: var(--secondary);
    text-shadow: 0 0 5px var(--secondary);
    font-size: 22px;
    font-weight: bold;
    animation: pulse 1s infinite alternate;
}
#breakthrough-btn:hover { background: rgba(230, 184, 0, 0.3); box-shadow: 0 0 20px rgba(230, 184, 0, 0.6); }

.small-btn { font-size: 12px; padding: 5px 10px; margin: 0 5px; border-color: var(--border); color: #8b949e; text-shadow: none; box-shadow: none;}
.small-btn:hover { border-color: #fff; color: #fff; background: rgba(255,255,255,0.1); }
.small-btn.danger:hover { border-color: var(--danger); color: var(--danger); }

/* Store Items */
.store-items {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-right: 5px;
}
.store-items::-webkit-scrollbar { width: 5px; }
.store-items::-webkit-scrollbar-thumb { background: var(--border); border-radius: 5px; }

.store-item {
    background: rgba(0,0,0,0.4);
    border: 1px solid var(--border);
    padding: 10px;
    border-radius: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: 0.2s;
}
.store-item:hover { border-color: var(--primary); background: rgba(0,255,204,0.05); }
.store-item .info h3 { font-size: 16px; color: #fff; }
.store-item .info p { font-size: 12px; color: #8b949e; margin-top: 4px; }
.store-item button {
    margin-top: 0; padding: 6px 12px; font-size: 14px; color: var(--secondary); border-color: var(--secondary);
}
.store-item button:disabled { border-color: var(--border); color: #666; cursor: not-allowed; text-shadow: none; box-shadow: none; background: transparent; }

/* Logs */
.log-box {
    flex: 1;
    background: rgba(0,0,0,0.5);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 10px;
    overflow-y: auto;
    font-size: 14px;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
}
.log-box::-webkit-scrollbar { width: 5px; }
.log-box::-webkit-scrollbar-thumb { background: var(--border); border-radius: 5px; }

.log-entry { margin-bottom: 5px; border-bottom: 1px solid rgba(255,255,255,0.05); padding-bottom: 5px; animation: fade-in 0.3s ease-out; }
.log-entry.system { color: #8b949e; }
.log-entry.gain { color: var(--primary); }
.log-entry.breakthrough { color: var(--secondary); font-weight: bold; }
.log-entry.fail { color: var(--danger); }
.log-entry.event { color: #b366ff; } /* Purple for serendipity */

/* Animations */
@keyframes rotate { 100% { transform: rotate(360deg); } }
@keyframes reverse-rotate { 100% { transform: rotate(-360deg); } }
@keyframes pulse { 0% { box-shadow: 0 0 5px var(--secondary); } 100% { box-shadow: 0 0 20px var(--secondary); } }
@keyframes fade-in { 0% { opacity: 0; transform: translateY(5px); } 100% { opacity: 1; transform: translateY(0); } }

/* Qi Particles */
.particle {
    position: absolute;
    width: 6px; height: 6px;
    background: var(--primary);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--primary);
    pointer-events: none;
    opacity: 0;
}

.back-btn {
    position: absolute;
    top: 20px; left: 20px;
    padding: 10px 20px;
    color: #8b949e;
    text-decoration: none;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--panel-bg);
    transition: 0.2s;
    font-size: 14px;
}
.back-btn:hover { color: #fff; border-color: #fff; }
