:root {
    --bg-color: #0a0a1a;
    --panel-color: rgba(255, 255, 255, 0.1);
    --text-color: #fff;
    --accent-color: #00f2ff;
    --gem-size: 60px;
    --board-size: 8;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    background-image: 
        radial-gradient(circle at 20% 30%, #1a1a3a 0%, transparent 40%),
        radial-gradient(circle at 80% 70%, #2a1a3a 0%, transparent 40%);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
}

.game-container {
    background: var(--panel-color);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5), 0 0 20px rgba(0, 242, 255, 0.2);
    text-align: center;
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
    background: linear-gradient(45deg, #00f2ff, #0066ff, #7000ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 10px rgba(0, 242, 255, 0.5);
}

.stats {
    display: flex;
    justify-content: space-around;
    margin-bottom: 1.5rem;
    background: rgba(0, 0, 0, 0.3);
    padding: 1rem;
    border-radius: 10px;
}

.stat-item {
    display: flex;
    flex-direction: column;
}

.stat-item .label {
    font-size: 0.8rem;
    color: #aaa;
    text-transform: uppercase;
}

.stat-item span:not(.label) {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--accent-color);
}

.game-board-container {
    position: relative;
    margin: 0 auto;
    width: calc(var(--gem-size) * var(--board-size));
    height: calc(var(--gem-size) * var(--board-size));
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 5px;
    overflow: hidden;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

.game-board-container::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(112, 0, 255, 0.1) 0%, transparent 70%);
    animation: rotate 20s linear infinite;
    pointer-events: none;
}

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

.game-board {
    display: grid;
    grid-template-columns: repeat(var(--board-size), var(--gem-size));
    grid-template-rows: repeat(var(--board-size), var(--gem-size));
    gap: 0;
    position: relative;
}

.gem {
    width: var(--gem-size);
    height: var(--gem-size);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: transform 0.2s, filter 0.2s;
    position: absolute;
    user-select: none;
}

.gem:hover {
    transform: scale(1.1);
    z-index: 10;
}

.gem.selected {
    transform: scale(1.15);
    filter: brightness(1.5) drop-shadow(0 0 15px var(--accent-color));
    z-index: 10;
    animation: pulse 1s infinite alternate;
}

.gem.hint {
    filter: brightness(1.8) drop-shadow(0 0 20px #fff);
    z-index: 10;
    animation: pulse 0.5s infinite alternate;
}

@keyframes pulse {
    from { transform: scale(1.1); }
    to { transform: scale(1.2); }
}

.gem-inner {
    width: 80%;
    height: 80%;
    border-radius: 20%;
    box-shadow: inset 0 0 15px rgba(255, 255, 255, 0.5), 0 5px 15px rgba(0, 0, 0, 0.3);
    position: relative;
}

/* 宝石颜色与样式 - 增加内阴影和高光 */
.gem-inner {
    width: 80%;
    height: 80%;
    border-radius: 30%;
    box-shadow: 
        inset -5px -5px 10px rgba(0, 0, 0, 0.4),
        inset 5px 5px 10px rgba(255, 255, 255, 0.6),
        0 5px 15px rgba(0, 0, 0, 0.5);
    position: relative;
    overflow: hidden;
}

.gem-inner::after {
    content: '';
    position: absolute;
    top: 10%;
    left: 10%;
    width: 30%;
    height: 30%;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    filter: blur(2px);
}

.gem-1 .gem-inner { background: radial-gradient(circle at 30% 30%, #ff5e5e, #c70039); } /* 红 - 火星 */
.gem-2 .gem-inner { background: radial-gradient(circle at 30% 30%, #5eff5e, #1e8449); } /* 绿 - 翠星 */
.gem-3 .gem-inner { background: radial-gradient(circle at 30% 30%, #5e5eff, #2874a6); } /* 蓝 - 水星 */
.gem-4 .gem-inner { background: radial-gradient(circle at 30% 30%, #ffff5e, #d4ac0d); } /* 黄 - 土星 */
.gem-5 .gem-inner { background: radial-gradient(circle at 30% 30%, #ff5eff, #884ea0); } /* 紫 - 冥王星 */
.gem-6 .gem-inner { background: radial-gradient(circle at 30% 30%, #5effff, #117a65); } /* 青 - 海王星 */

/* 特殊宝石样式 */
.special-bomb .gem-inner {
    border: 3px solid #fff;
    box-shadow: 0 0 20px #fff, inset 0 0 10px #fff;
}

.special-bomb .gem-inner::before {
    content: '💥';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.2rem;
}

.special-supernova .gem-inner {
    border: 3px solid var(--accent-color);
    box-shadow: 0 0 30px var(--accent-color), inset 0 0 15px var(--accent-color);
    animation: rotate 2s linear infinite;
}

.special-supernova .gem-inner::before {
    content: '🌟';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.5rem;
}

/* 粒子特效 */
.particle {
    position: absolute;
    pointer-events: none;
    border-radius: 50%;
    background: white;
    box-shadow: 0 0 10px white;
    z-index: 1000;
}

/* 动态背景星空 */
.stars {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.star {
    position: absolute;
    background: white;
    border-radius: 50%;
    opacity: 0.5;
    animation: twinkle var(--duration) infinite ease-in-out;
}

@keyframes twinkle {
    0%, 100% { opacity: 0.3; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.2); }
}

.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 10px;
    z-index: 100;
}

.hidden {
    display: none;
}

.message {
    background: #1a1a3a;
    padding: 2rem;
    border-radius: 15px;
    border: 2px solid var(--accent-color);
}

.message h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.message p {
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
}

button {
    padding: 0.8rem 1.5rem;
    font-size: 1rem;
    background: linear-gradient(45deg, #0066ff, #7000ff);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: transform 0.2s, opacity 0.2s;
    margin: 0.5rem;
}

button:hover {
    transform: translateY(-2px);
    opacity: 0.9;
}

.controls {
    margin-top: 1.5rem;
}

/* 动画特效 */
@keyframes explode {
    0% { transform: scale(1); opacity: 1; }
    100% { transform: scale(2); opacity: 0; }
}

.gem.removing {
    animation: explode 0.3s ease-out forwards;
}

@keyframes drop {
    0% { transform: translateY(-100px); }
    100% { transform: translateY(0); }
}

.gem.falling {
    /* transition is handled in JS for precise control */
}

.floating-text {
    position: absolute;
    color: var(--accent-color);
    font-weight: bold;
    font-size: 1.2rem;
    pointer-events: none;
    z-index: 1000;
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.8);
    animation: float-up 1s ease-out forwards;
    white-space: nowrap;
}

@keyframes float-up {
    0% { transform: translateY(0); opacity: 1; }
    100% { transform: translateY(-50px); opacity: 0; }
}
