/* 星星花小游戏页面样式 */
body, html {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    padding: clamp(16px, 4vw, 32px);
    box-sizing: border-box;
    overflow-x: hidden;
    background: linear-gradient(135deg, var(--bg-start, #ffffff), var(--surface-contrast, #eef2ff));
}

.game-container {
    max-width: 900px;
    width: 100%;
    text-align: center;
    position: relative;
}

.game-header {
    margin-bottom: 2em;
}

.game-title {
    font-size: 2.5rem;
    color: var(--gold-accent);
    margin-bottom: 0.5em;
    text-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.5),
        0 0 20px rgba(212, 175, 55, 0.3);
    font-weight: 700;
    animation: titleGlow 3s ease-in-out infinite;
}

.game-subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    opacity: 0.8;
    margin-bottom: 1em;
}

.game-board {
    background: var(--bg-dark, rgba(255, 255, 255, 0.96));
    border-radius: 20px;
    padding: clamp(20px, 5vw, 36px);
    margin: 20px auto;
    box-shadow:
        0 12px 32px rgba(15, 23, 42, 0.12),
        0 6px 20px rgba(15, 23, 42, 0.08);
    border: 1px solid rgba(148, 163, 184, 0.35);
    position: relative;
    overflow: hidden;
}

.game-board::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg,
        transparent 0%,
        #9b59b6 25%,
        var(--gold-accent) 50%,
        #9b59b6 75%,
        transparent 100%);
    border-radius: 20px 20px 0 0;
}

.flower-garden {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: clamp(8px, 1.5vw, 22px);
    margin: 20px 0;
    padding: clamp(12px, 3vw, 28px);
    background: rgba(59, 130, 246, 0.05);
    border-radius: 18px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    width: 100%;
}

.flower-slot {
    width: 100%;
    aspect-ratio: 1 / 1;
    background: rgba(15, 23, 42, 0.04);
    border: 1px dashed rgba(59, 130, 246, 0.35);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.flower-slot:hover {
    background: rgba(59, 130, 246, 0.12);
    border-color: rgba(59, 130, 246, 0.6);
    transform: scale(1.04);
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.25);
}

.flower-slot.planted {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.18), rgba(16, 185, 129, 0.12));
    border: 1px solid rgba(59, 130, 246, 0.5);
    animation: flowerGrow 0.5s ease-out;
}

.flower-slot .flower {
    font-size: clamp(1.8em, 6vw, 2.3em);
    animation: flowerSway 3s ease-in-out infinite;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.game-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
    margin: 20px 0;
    padding: 16px;
    background: rgba(59, 130, 246, 0.08);
    border-radius: 16px;
    border: 1px solid rgba(148, 163, 184, 0.35);
}

.game-stats,
.flower-garden {
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
}

.stat-item {
    min-width: 0;
    text-align: center;
    padding: 6px 4px;
}

.stat-value {
    font-size: 1.15em;
    font-weight: 700;
    color: var(--accent-color);
    line-height: 1.1;
}

.stat-label {
    font-size: 0.75em;
    color: var(--text-secondary);
    opacity: 0.85;
    margin-top: 2px;
}

.game-controls {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin: 20px 0;
    flex-wrap: wrap;
}

.game-btn {
    background: transparent;
    color: var(--accent-color);
    border: 1.5px solid rgba(59, 130, 246, 0.65);
    padding: 9px 18px;
    border-radius: 999px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: none;
    font-size: 0.92em;
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    white-space: nowrap;
    -webkit-user-select: none;
    user-select: none;
}

.game-btn:hover {
    color: var(--text-primary);
    background: rgba(59, 130, 246, 0.08);
    border-color: rgba(59, 130, 246, 0.95);
    transform: translateY(-1px);
}

.game-btn:active {
    transform: translateY(0);
    transition: transform 0.1s ease;
}

.game-btn:disabled {
    color: rgba(148, 163, 184, 0.85);
    border-color: rgba(148, 163, 184, 0.65);
    cursor: not-allowed;
    background: transparent;
    opacity: 0.6;
}

.back-button {
    position: fixed !important;
    top: 16px;
    left: 16px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 18px;
    border-radius: 999px;
    border: 1.5px solid rgba(59, 130, 246, 0.75);
    background: rgba(255, 255, 255, 0.96);
    text-decoration: none;
    font-weight: 600;
    color: var(--secondary-color);
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.15);
    font-size: 0.92em;
    z-index: 30;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.back-button:hover {
    color: var(--text-primary);
    border-color: rgba(59, 130, 246, 0.95);
    background: rgba(59, 130, 246, 0.08);
    transform: translateY(-1px);
}

.game-info {
    margin-top: 24px;
}

@media (max-width: 768px) {
    body, html {
        padding: 16px;
    }

    .game-title {
        font-size: 2rem;
    }

    .game-subtitle {
        font-size: 1rem;
    }

    .game-btn {
        flex: 1 1 calc(50% - 12px);
        min-width: 130px;
        white-space: normal;
    }
}

@media (max-width: 520px) {
    body, html {
        padding: 12px;
    }

    .game-header {
        margin-bottom: 1.2em;
    }

    .game-board {
        padding: 18px 16px;
    }

    .game-stats {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 6px;
        padding: 10px;
    }

    .stat-item {
        background: rgba(58, 89, 152, 0.05);
        border-radius: 8px;
        padding: 6px;
        text-align: center;
    }

    .stat-value {
        font-size: 1.05em;
        line-height: 1.2;
    }

    .stat-label {
        font-size: 0.75em;
        margin-top: 3px;
    }

    .flower-garden {
        max-width: 100%;
        padding: 10px;
        gap: 6px;
    }

    .game-controls {
        gap: 10px;
    }

    .game-btn {
        flex: 1 1 100%;
    }
}

.game-message {
    margin: 20px 0;
    padding: 15px;
    border-radius: 12px;
    font-weight: 500;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.game-message.success {
    background: linear-gradient(135deg, rgba(74, 155, 94, 0.2), rgba(91, 179, 110, 0.15));
    border: 1px solid rgba(74, 155, 94, 0.4);
    color: #5bb36e;
}

.game-message.info {
    background: linear-gradient(135deg, rgba(58, 89, 152, 0.2), rgba(123, 163, 217, 0.15));
    border: 1px solid rgba(58, 89, 152, 0.4);
    color: var(--accent-color);
}

.game-message.warning {
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.2), rgba(212, 175, 55, 0.15));
    border: 1px solid rgba(212, 175, 55, 0.4);
    color: var(--gold-accent);
}

.game-stats,
.flower-garden,
.game-message {
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
}

/* 动画定义 */
@keyframes titleGlow {
    0%, 100% {
        text-shadow: 
            0 2px 8px rgba(0, 0, 0, 0.5),
            0 0 20px rgba(212, 175, 55, 0.3);
    }
    50% {
        text-shadow: 
            0 3px 12px rgba(0, 0, 0, 0.6),
            0 0 30px rgba(212, 175, 55, 0.5);
    }
}

@keyframes flowerGrow {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes flowerSway {
    0%, 100% {
        transform: rotate(-2deg);
    }
    50% {
        transform: rotate(2deg);
    }
}

@keyframes floatAround {
    0% {
        transform: translateY(0px) rotate(0deg);
    }
    25% {
        transform: translateY(-20px) rotate(90deg);
    }
    50% {
        transform: translateY(0px) rotate(180deg);
    }
    75% {
        transform: translateY(-10px) rotate(270deg);
    }
    100% {
        transform: translateY(0px) rotate(360deg);
    }
}

/* 游戏信息样式 */
.game-info {
    margin-top: 2em;
}

.game-info-title {
    color: var(--gold-accent);
    margin-top: 0;
    margin-bottom: 1em;
}

.flower-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 8px;
    margin-bottom: 1.5em;
}

.flower-item {
    padding: 8px 12px;
    background: rgba(59, 130, 246, 0.08);
    border-radius: 10px;
    border-left: 3px solid var(--accent-color);
    font-size: 0.92em;
}

.game-features h4,
.game-controls-info h4 {
    color: var(--gold-accent);
    margin: 1.5em 0 0.8em 0;
    font-size: 1.1em;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 10px;
    margin-bottom: 1em;
}

.feature-item {
    padding: 12px;
    background: rgba(148, 163, 184, 0.12);
    border-radius: 10px;
    border-left: 3px solid var(--accent-color);
    font-size: 0.88em;
    line-height: 1.45;
}

.controls-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 8px;
    font-size: 0.85em;
}

.controls-grid span {
    padding: 8px 10px;
    background: rgba(59, 130, 246, 0.08);
    border-radius: 8px;
    text-align: center;
}

/* 商店界面美化 */
.shop-tier-header {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(16, 185, 129, 0.08));
    padding: 12px 20px;
    border-radius: 12px;
    margin: 20px 0 15px 0;
    border-left: 4px solid var(--accent-color);
    box-shadow: 0 2px 10px rgba(59, 130, 246, 0.2);
}

.shop-item {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(248, 250, 255, 0.95));
    border-radius: 14px;
    padding: 16px;
    margin: 10px 0;
    border: 1px solid rgba(148, 163, 184, 0.4);
    transition: all 0.3s ease;
    box-shadow: 0 6px 20px rgba(15, 23, 42, 0.08);
}

.shop-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.15);
    border-color: rgba(59, 130, 246, 0.4);
}

.shop-item.ultimate {
    background: linear-gradient(135deg, rgba(241, 196, 15, 0.2), rgba(243, 156, 18, 0.1));
    border: 2px solid #f1c40f;
    box-shadow: 0 0 20px rgba(241, 196, 15, 0.3);
}

.shop-button {
    background: linear-gradient(135deg, var(--verina-green), #27ae60);
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    color: white;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 3px 12px rgba(46, 204, 113, 0.4);
    min-width: 140px;
}

.shop-button:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 4px 16px rgba(46, 204, 113, 0.6);
}

.shop-button:disabled {
    background: linear-gradient(135deg, #95a5a6, #7f8c8d);
    cursor: not-allowed;
    opacity: 0.7;
    transform: none;
    box-shadow: none;
}

.shop-button.owned {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    box-shadow: 0 2px 8px rgba(39, 174, 96, 0.3);
}

.shop-auto-controls {
    background: rgba(59, 130, 246, 0.08);
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 20px;
    text-align: center;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.shop-auto-controls button {
    background: linear-gradient(135deg, var(--verina-green), #27ae60);
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    color: white;
    font-weight: bold;
    cursor: pointer;
    margin: 0 5px;
    transition: all 0.2s ease;
}

.shop-auto-controls button:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 12px rgba(46, 204, 113, 0.4);
}

.shop-wealth-status {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.12), rgba(16, 185, 129, 0.12));
    padding: 20px;
    border-radius: 16px;
    margin-top: 25px;
    text-align: center;
    border: 1px solid rgba(59, 130, 246, 0.3);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}

.cosmic-flower-item {
    background: linear-gradient(135deg, rgba(241, 196, 15, 0.2), rgba(243, 156, 18, 0.1));
    border-left-color: #f1c40f !important;
    box-shadow: 0 0 15px rgba(241, 196, 15, 0.3);
    animation: cosmicGlow 3s ease-in-out infinite;
}

@keyframes cosmicGlow {
    0%, 100% {
        box-shadow: 0 0 15px rgba(241, 196, 15, 0.3);
    }
    50% {
        box-shadow: 0 0 25px rgba(241, 196, 15, 0.5);
    }
}
