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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    color: #ffffff;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 5px;
    overflow: hidden;
}

.game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    width: 100%;
    max-width: 450px;
    min-height: 100vh;
    padding: 10px;
    position: relative;
}

.game-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.logo {
    display: flex;
    justify-content: center;
    align-items: center;
}

.logo-blocks {
    display: flex;
    gap: 3px;
}

.logo-block {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
}

.block-i {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a5a 100%);
    box-shadow: 0 0 12px rgba(255, 107, 107, 0.6);
}

.block-o {
    background: linear-gradient(135deg, #4ecdc4 0%, #3db8b0 100%);
    box-shadow: 0 0 12px rgba(78, 205, 196, 0.6);
}

.block-t {
    background: linear-gradient(135deg, #a8e6cf 0%, #88d4ab 100%);
    box-shadow: 0 0 12px rgba(168, 230, 207, 0.6);
}

.game-title {
    font-size: 1.4em;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: none;
    font-weight: bold;
    letter-spacing: 1.5px;
}

.bottom-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 10px;
    width: 100%;
    max-width: 300px;
    align-self: center;
    flex-shrink: 0;
    z-index: 110;
    position: relative;
}

.daily-reward-btn {
    padding: 8px 16px;
    background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
    border-radius: 15px;
    font-size: 0.8em;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(255, 152, 0, 0.4);
    animation: glow 2s ease-in-out infinite;
    flex: 1;
    text-align: center;
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.daily-reward-btn:hover {
    transform: scale(1.05);
}

@keyframes glow {
    0%, 100% { box-shadow: 0 2px 10px rgba(255, 152, 0, 0.4); }
    50% { box-shadow: 0 2px 15px rgba(255, 152, 0, 0.8); }
}

.game-area {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    width: 100%;
    flex: 1;
    min-height: 0;
    justify-content: center;
    position: relative;
    flex-wrap: nowrap;
}

.game-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    max-width: 300px;
    width: 100%;
}

#gameCanvas {
    border: 3px solid rgba(102, 126, 234, 0.5);
    border-radius: 15px;
    background: linear-gradient(180deg, #1a1a2e 0%, #0d1117 100%);
    display: block;
    max-width: 100%;
    box-shadow: 0 0 30px rgba(102, 126, 234, 0.3),
                inset 0 0 20px rgba(0, 0, 0, 0.5);
    flex-shrink: 0;
    touch-action: none;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

.game-info {
    background: linear-gradient(135deg, rgba(26, 26, 46, 0.8) 0%, rgba(15, 52, 96, 0.8) 100%);
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: 8px;
    padding: 4px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 120px;
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.2);
    flex-shrink: 0;
}

.info-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(102, 126, 234, 0.5), transparent);
    margin: 2px 0;
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    padding: 2px 6px;
    border-radius: 4px;
}

.powerup-item {
    background: linear-gradient(135deg, rgba(255, 152, 0, 0.2) 0%, rgba(255, 87, 34, 0.2) 100%);
    border: 1px solid rgba(255, 152, 0, 0.3);
}

.powerup-item span:last-child {
    color: #ff9800;
    text-shadow: 0 0 6px rgba(255, 152, 0, 0.5);
}

.powerup-btn-container {
    display: flex;
    justify-content: center;
    padding: 2px 4px;
}

.powerup-btn-container .powerup-btn {
    width: 100%;
    padding: 3px 6px;
    font-size: 0.65em;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.8) 0%, rgba(118, 75, 162, 0.8) 100%);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
    font-weight: bold;
}

.label {
    font-weight: bold;
    color: #a0a0a0;
    font-size: 0.65em;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.info-item span:last-child {
    font-size: 0.9em;
    font-weight: bold;
    color: #667eea;
    text-shadow: 0 0 6px rgba(102, 126, 234, 0.5);
}

.next-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
    margin-top: 4px;
}

.next-block h3 {
    font-size: 0.65em;
    color: #a0a0a0;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin: 0;
}

#nextCanvas {
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: 6px;
    background: linear-gradient(180deg, #1a1a2e 0%, #0d1117 100%);
    display: block;
    box-shadow: 0 0 8px rgba(102, 126, 234, 0.2);
}

/* ── Game Controls ───────────────────────────────────────────────── */
.game-controls {
    width: 100%;
    margin-top: 8px;
}

.controls-left {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.controls-row {
    display: flex;
    gap: 6px;
    justify-content: center;
    align-items: stretch;
}

.controls-row .control-btn {
    flex: 1;
    padding: 10px;
    font-size: 0.9em;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.8) 0%, rgba(118, 75, 162, 0.8) 100%);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
    font-weight: bold;
    text-align: center;
}

.control-btn:hover {
    background: linear-gradient(135deg, rgba(102, 126, 234, 1) 0%, rgba(118, 75, 162, 1) 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.control-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.3);
}

/* Rotate button: below info panel, circular, red */
.game-info .rotate-btn {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 50% !important;
    font-size: 1.3em !important;
    padding: 8px !important;
    background: linear-gradient(135deg, rgba(255, 107, 107, 0.9) 0%, rgba(238, 90, 90, 0.9) 100%) !important;
    box-shadow: 0 2px 12px rgba(255, 107, 107, 0.5) !important;
    margin-top: 6px;
    max-width: 100%;
}

.game-info .rotate-btn:hover {
    background: linear-gradient(135deg, rgba(255, 107, 107, 1) 0%, rgba(238, 90, 90, 1) 100%) !important;
    transform: translateY(-2px) scale(1.05) !important;
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.7) !important;
}

/* Pause button: amber */
.pause-btn {
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.8) 0%, rgba(255, 152, 0, 0.8) 100%) !important;
}

.pause-btn:hover {
    background: linear-gradient(135deg, rgba(255, 193, 7, 1) 0%, rgba(255, 152, 0, 1) 100%) !important;
}

/* Music button: purple */
.music-btn {
    background: linear-gradient(135deg, rgba(156, 39, 176, 0.8) 0%, rgba(103, 58, 183, 0.8) 100%) !important;
}

.music-btn:hover {
    background: linear-gradient(135deg, rgba(156, 39, 176, 1) 0%, rgba(103, 58, 183, 1) 100%) !important;
}

.controls-hint {
    margin-top: 8px;
    text-align: center;
}

.controls-hint p {
    font-size: 0.75em;
    color: #888;
    letter-spacing: 0.5px;
    margin: 2px 0;
}

.controls-hint .mobile-hint {
    font-size: 0.7em;
    color: #777;
    letter-spacing: 0.3px;
}

/* ── Language selector ───────────────────────────────────────────── */
.lang-selector {
    margin-top: 4px;
}

.lang-selector select {
    padding: 3px 8px;
    font-size: 0.75em;
    background: rgba(102, 126, 234, 0.3);
    color: #ccc;
    border: 1px solid rgba(102, 126, 234, 0.4);
    border-radius: 12px;
    cursor: pointer;
    outline: none;
    transition: all 0.3s ease;
}

.lang-selector select:hover {
    background: rgba(102, 126, 234, 0.5);
    color: #fff;
}

.lang-selector select option {
    background: #1a1a2e;
    color: #ccc;
}

.start-screen .lang-selector,
.game-over .lang-selector {
    margin-top: 8px;
}

.start-screen .lang-selector select,
.game-over .lang-selector select {
    font-size: 0.85em;
    padding: 4px 12px;
}

/* 开始界面 */
.start-screen {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(26, 26, 46, 0.95) 0%, rgba(15, 52, 96, 0.95) 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 25px;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.start-screen h2 {
    font-size: 2.5em;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: bold;
    letter-spacing: 3px;
    text-align: center;
}

.start-screen p {
    font-size: 1.2em;
    color: #ffffff;
    text-align: center;
}

.start-btn {
    padding: 15px 50px;
    font-size: 1.5em;
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
    letter-spacing: 1px;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.4);
    animation: pulse 2s ease-in-out infinite;
}

.start-btn:hover {
    background: linear-gradient(135deg, #45a049 0%, #3d8b40 100%);
    transform: translateY(-3px);
    box-shadow: 0 6px 25px rgba(76, 175, 80, 0.6);
}

.start-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(76, 175, 80, 0.3);
}

.game-over {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(26, 26, 46, 0.95) 0%, rgba(15, 52, 96, 0.95) 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 25px;
    z-index: 100;
    display: none;
    backdrop-filter: blur(10px);
}

.clear-effect {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    z-index: 99;
    pointer-events: none;
}

.confetti {
    position: fixed;
    top: -10px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    animation: confetti-fall 2s ease-in-out forwards;
    z-index: 98;
    pointer-events: none;
}

@keyframes confetti-fall {
    0% { transform: translateY(0) rotate(0deg); opacity: 1; }
    100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

.game-over h2 {
    font-size: 3em;
    background: linear-gradient(135deg, #f44336 0%, #e91e63 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: bold;
    letter-spacing: 3px;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.game-over p {
    font-size: 1.5em;
    color: #ffffff;
}

.game-over span {
    color: #667eea;
    font-weight: bold;
    font-size: 1.2em;
    text-shadow: 0 0 15px rgba(102, 126, 234, 0.5);
}

#restartBtn {
    padding: 15px 40px;
    font-size: 1.3em;
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
    letter-spacing: 1px;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.4);
}

#restartBtn:hover {
    background: linear-gradient(135deg, #45a049 0%, #3d8b40 100%);
    transform: translateY(-3px);
    box-shadow: 0 6px 25px rgba(76, 175, 80, 0.6);
}

#restartBtn:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(76, 175, 80, 0.3);
}

/* 道具效果提示 */
.powerup-effect {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2em;
    font-weight: bold;
    color: #ff9800;
    text-shadow: 0 0 20px rgba(255, 152, 0, 0.8);
    z-index: 200;
    animation: powerup-pop 1.5s ease-out forwards;
    pointer-events: none;
}

@keyframes powerup-pop {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
    30% { opacity: 1; transform: translate(-50%, -50%) scale(1.2); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(1) translateY(-50px); }
}

/* ── Mobile responsive ─────────────────────────────────────────────── */
@media (max-width: 480px) {
    .game-area {
        flex-direction: column;
        align-items: center;
    }

    .game-info {
        flex-direction: row;
        flex-wrap: wrap;
        min-width: auto;
        width: 100%;
        max-width: 300px;
        justify-content: center;
        gap: 2px 6px;
        padding: 4px;
    }

    .game-info .info-item {
        padding: 2px 6px;
        gap: 4px;
    }

    .game-info .info-divider {
        width: 100%;
        margin: 1px 0;
    }

    .game-info .next-block {
        width: 100%;
    }

    .game-content {
        max-width: 280px;
    }

    .controls-hint {
        display: none;
    }
}

@media (max-width: 375px) {
    .game-title {
        font-size: 1.5em;
    }

    .game-info {
        max-width: 280px;
    }

    .controls-row .control-btn {
        padding: 10px;
        font-size: 1em;
    }

    .game-over h2 {
        font-size: 2.2em;
    }

    .game-over p {
        font-size: 1.2em;
    }

    .logo-block {
        width: 20px;
        height: 20px;
    }

    .daily-reward-btn {
        font-size: 0.8em;
        padding: 6px 12px;
    }
}

@media (max-width: 320px) {
    .game-title {
        font-size: 1.3em;
    }

    .game-info {
        max-width: 250px;
    }

    .controls-row .control-btn {
        padding: 8px;
        font-size: 0.9em;
    }
}
