/* Font styles */
@font-face {
    font-family: 'Geist Mono';
    src: url('https://cdn.jsdelivr.net/npm/geist-font@latest/fonts/geist-mono/GeistMono-Regular.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Geist Mono';
    src: url('https://cdn.jsdelivr.net/npm/geist-font@latest/fonts/geist-mono/GeistMono-Bold.woff2') format('woff2');
    font-weight: bold;
    font-style: normal;
    font-display: swap;
}

.font-geist-mono {
    font-family: 'Geist Mono', monospace;
}

body {
    font-family: 'Noto Sans SC', sans-serif;
    touch-action: manipulation;
    overscroll-behavior: none;
    -webkit-tap-highlight-color: transparent;
    background: url('assets/background.png') no-repeat center center fixed;
    background-size: cover;
    min-height: 100vh;
    width: 100vw;
    margin: 0;
    padding: 0;
    position: relative;
    z-index: 0;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: inherit;
    background-size: cover;
    z-index: -1;
}

/* Button styles */
.difficulty-btn {
    @apply bg-white/80 hover:bg-white/90 text-gray-900 font-medium py-4 px-6 rounded-xl transition-all duration-300 ease-in-out;
    @apply border border-white/30;
    @apply active:bg-white/70;
    @apply shadow-lg hover:shadow-xl;
    @apply relative overflow-hidden backdrop-blur-sm;
    transform: translateZ(0);
}

.difficulty-btn:hover {
    transform: translateZ(0) translateY(-2px);
}

.difficulty-btn:active {
    transform: translateZ(0) scale(0.98);
}

.primary-btn {
    @apply bg-gray-900 hover:bg-gray-800 text-white font-medium py-3 px-6 rounded-lg transition-all duration-300 ease-in-out;
    @apply active:bg-gray-700;
    @apply shadow-lg hover:shadow-xl hover:-translate-y-0.5;
    @apply relative overflow-hidden;
}

.secondary-btn {
    @apply bg-white hover:bg-gray-50 text-gray-900 font-medium py-3 px-6 rounded-lg transition-all duration-300 ease-in-out;
    @apply border border-gray-200/50;
    @apply active:bg-gray-100;
    @apply shadow-sm hover:shadow-md hover:-translate-y-0.5;
}

.settings-btn {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 
        0 4px 12px -2px rgba(0, 0, 0, 0.05),
        0 0 1px 0 rgba(255, 255, 255, 0.3) inset;
    color: rgb(55, 65, 81);
    font-weight: 500;
    padding: 0.75rem 1.25rem;
    border-radius: 0.75rem;
    transition: all 0.3s ease;
    width: 100%;
    margin-top: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.settings-btn:hover {
    background: rgba(255, 255, 255, 0.8);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-2px);
    box-shadow: 
        0 6px 16px -4px rgba(0, 0, 0, 0.1),
        0 0 1px 0 rgba(255, 255, 255, 0.4) inset;
}

.settings-btn:active {
    transform: translateY(0) scale(0.98);
    background: rgba(255, 255, 255, 0.6);
    box-shadow: 
        0 2px 8px -2px rgba(0, 0, 0, 0.05),
        0 0 1px 0 rgba(255, 255, 255, 0.3) inset;
}

.settings-btn svg {
    width: 1.25rem;
    height: 1.25rem;
    margin-left: 0.25rem;
}

.settings-btn span {
    line-height: 1;
}

.reset-btn {
    @apply bg-red-50 hover:bg-red-100 text-red-600 font-medium py-2 px-4 rounded-lg transition-all duration-300 ease-in-out w-full;
    @apply border border-red-100;
    @apply hover:shadow-md hover:-translate-y-0.5;
}

.icon-btn {
    @apply p-2 rounded-lg text-gray-600 hover:bg-gray-100 transition-all duration-300;
    @apply hover:shadow-sm;
}

/* Setting styles */
.setting-item {
    @apply bg-gray-50 p-4 rounded-md border border-gray-100 mb-4;
}

.setting-label {
    @apply block text-sm font-medium text-gray-700 mb-2;
}

.file-name {
    @apply flex-1 text-gray-500 text-sm truncate mr-2;
}

.file-upload-btn {
    @apply flex items-center justify-center p-2 bg-white hover:bg-gray-100 text-gray-600 border border-gray-200 rounded-md cursor-pointer transition-colors;
}

.image-preview {
    @apply max-w-full h-40 object-contain mx-auto;
    background-color: rgba(243, 244, 246, 0.5);
}

/* Game board styles */
#game-board {
    max-width: 500px;
    margin: 0 auto;
    width: 100%;
    position: relative;
    transform: translateZ(0);
    backface-visibility: hidden;
    will-change: transform;
    overflow: hidden;
    height: 100vh;
    background-color: white;
}

/* Add a subtle pattern background */
#game-board::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle at 1px 1px, rgba(0,0,0,0.05) 1px, transparent 0);
    background-size: 20px 20px;
    z-index: 0;
    pointer-events: none;
}

.grid-cols-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
}

.tile-container {
    height: 100%;
    position: relative;
    overflow: visible;
    padding: 0 5px;
    box-sizing: border-box;
    transform: translateZ(0);
    will-change: transform;
    pointer-events: none;
}

.tile {
    position: absolute;
    background-color: #333;
    border: 1px solid rgba(255,255,255,0.1);
    z-index: 10;
    user-select: none;
    -webkit-user-select: none;
    width: calc(100% - 10px);
    height: 180px;
    margin: 5px;
    box-sizing: border-box;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    will-change: transform;
    transform: translateZ(0);
    backface-visibility: hidden;
    left: 0;
    pointer-events: auto;
    transition: transform 0.05s linear;
}

.tile:active {
    transform: scale(0.98) translateZ(0);
}

/* Custom tile styling when image is used */
.custom-tile {
    background-size: contain !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    background-color: rgba(255,255,255,0.9) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.tile-clicked {
    transform: scale(0.95) translateZ(0);
    opacity: 0.7;
    transition: all 0.2s ease-out;
}

/* Animation classes */
.animate-slide-down {
    opacity: 1;
    transform: translateZ(0);
}

@keyframes fadeIn {
    from { 
        opacity: 0;
        transform: translate3d(0, 0, 0) scale(0.95);
    }
    to { 
        opacity: 1;
        transform: translate3d(0, 0, 0) scale(1);
    }
}

.animate-fade-in {
    animation: fadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    will-change: transform, opacity;
}

/* Modal styles */
.modal-content {
    @apply bg-white/90 backdrop-blur-md rounded-2xl shadow-2xl;
    @apply border border-gray-100;
    @apply transform transition-all duration-300;
}

.modal-content.show {
    @apply scale-100 opacity-100;
}

.modal-content.hide {
    @apply scale-95 opacity-0;
}

/* Gap between sections */
.space-y-6 > * + * {
    margin-top: 1.5rem;
}

/* Ensure space between setting items */
.setting-item + .setting-item {
    margin-top: 1.25rem;
}

/* Responsive adaptations */
@media (max-width: 480px) {
    .difficulty-btn, .primary-btn, .secondary-btn {
        @apply py-4;
    }
    
    .tile {
        height: 200px;
        border-radius: 8px;
    }
}

.red-tile {
    background: linear-gradient(45deg, #ff3b3b, #ff5757) !important;
    box-shadow: 0 0 15px rgba(255, 59, 59, 0.5) !important;
    border: 2px solid rgba(255, 255, 255, 0.3) !important;
    position: absolute !important;
    z-index: 20 !important;
}

.red-tile::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    animation: shine 2s infinite;
    pointer-events: none;
}

@keyframes shine {
    0% {
        transform: translateX(-100%) rotate(45deg);
    }
    100% {
        transform: translateX(100%) rotate(45deg);
    }
}

.speed-boost {
    animation: speedBoostFlash 0.5s ease-out;
}

@keyframes speedBoostFlash {
    0% {
        background-color: rgba(255, 59, 59, 0);
    }
    50% {
        background-color: rgba(255, 59, 59, 0.1);
    }
    100% {
        background-color: rgba(255, 59, 59, 0);
    }
}

/* Hell mode button */
.difficulty-btn[data-difficulty="hell"] {
    background: linear-gradient(45deg, #ff3b3b, #ff5757);
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    border: none;
    box-shadow: 0 4px 15px rgba(255, 59, 59, 0.3);
    position: relative;
    overflow: hidden;
}

.difficulty-btn[data-difficulty="hell"]:hover {
    background: linear-gradient(45deg, #ff5757, #ff7070);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 59, 59, 0.4);
}

.difficulty-btn[data-difficulty="hell"]:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(255, 59, 59, 0.3);
}

.difficulty-btn[data-difficulty="hell"]::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent,
        rgba(255, 255, 255, 0.1),
        transparent
    );
    transform: rotate(45deg);
    animation: shine 3s infinite;
}

@keyframes shine {
    0% {
        transform: rotate(45deg) translateX(-200%);
    }
    100% {
        transform: rotate(45deg) translateX(200%);
    }
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    z-index: 100;
}

.right-controls {
    display: flex;
    gap: 1rem;
}

.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    color: #333;
}

.icon-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    background: rgba(255, 255, 255, 1);
}

.icon-btn:active {
    transform: scale(0.95);
}

.icon-btn i {
    font-size: 1.2rem;
    color: inherit;
}

#back-btn {
    color: #333;
}

#back-btn:hover {
    color: #000;
}

/* 音乐播放状态样式 */
.icon-btn.music-playing {
    color: #4CAF50;
    animation: pulse 2s infinite;
}

.icon-btn.music-playing i {
    color: inherit;
}

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

.menu-content-wrapper {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 3.5rem 3rem;
    border-radius: 32px;
    box-shadow: 
        0 8px 32px -4px rgba(0, 0, 0, 0.12),
        0 0 0 1px rgba(255, 255, 255, 0.1) inset,
        0 0 32px 0 rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    transform: translateZ(0);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    width: min(440px, 90%);
    margin: 0 auto;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.menu-content-wrapper .relative {
    width: 100%;
    text-align: center;
    margin-bottom: 3rem;
}

.menu-buttons-container {
    width: min(320px, 100%);
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.difficulty-btn {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 
        0 4px 16px -4px rgba(0, 0, 0, 0.1),
        0 0 0 1px rgba(255, 255, 255, 0.05) inset;
    color: rgba(255, 255, 255, 0.95);
    font-weight: 500;
    padding: 1.125rem 2rem;
    border-radius: 16px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    width: 100%;
    position: relative;
    overflow: hidden;
    transform: translateZ(0);
    margin: 0;
    letter-spacing: 0.5px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.difficulty-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.12);
    transform: translateY(-2px);
    box-shadow: 
        0 8px 24px -6px rgba(0, 0, 0, 0.15),
        0 0 0 1px rgba(255, 255, 255, 0.08) inset;
}

.difficulty-btn:active {
    transform: translateY(0) scale(0.98);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 
        0 2px 8px -2px rgba(0, 0, 0, 0.1),
        0 0 0 1px rgba(255, 255, 255, 0.05) inset;
}

.menu-title {
    font-size: 3.5rem;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.7));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    letter-spacing: 0.02em;
    margin-bottom: 1rem;
    display: block;
    font-weight: 700;
}

.menu-subtitle {
    color: rgba(255, 255, 255, 0.7);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    letter-spacing: 0.05em;
    font-size: 1.25rem;
    font-weight: 400;
}

/* Hell mode button special styling */
.difficulty-btn[data-difficulty="hell"] {
    background: linear-gradient(135deg, rgba(255, 45, 85, 0.9), rgba(255, 59, 59, 0.9));
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    box-shadow: 
        0 8px 24px -4px rgba(255, 45, 85, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.05) inset;
    overflow: hidden;
}

.difficulty-btn[data-difficulty="hell"]:hover {
    background: linear-gradient(135deg, rgba(255, 59, 85, 0.95), rgba(255, 71, 71, 0.95));
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px) scale(1.02);
    box-shadow: 
        0 12px 32px -6px rgba(255, 45, 85, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.08) inset;
}

.difficulty-btn[data-difficulty="hell"]:active {
    transform: translateY(0) scale(0.98);
    background: linear-gradient(135deg, rgba(255, 45, 85, 0.85), rgba(255, 59, 59, 0.85));
    box-shadow: 
        0 4px 16px -2px rgba(255, 45, 85, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.05) inset;
}

.difficulty-btn[data-difficulty="hell"]::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent,
        rgba(255, 255, 255, 0.15),
        transparent
    );
    transform: rotate(45deg);
    animation: shine 3s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.settings-btn {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 
        0 4px 16px -4px rgba(0, 0, 0, 0.1),
        0 0 0 1px rgba(255, 255, 255, 0.03) inset;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 500;
    padding: 1rem 1.5rem;
    border-radius: 16px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    width: 100%;
    margin-top: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    letter-spacing: 0.3px;
}

.settings-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.08);
    transform: translateY(-2px);
    box-shadow: 
        0 8px 24px -6px rgba(0, 0, 0, 0.15),
        0 0 0 1px rgba(255, 255, 255, 0.05) inset;
    color: rgba(255, 255, 255, 0.95);
}

.settings-btn:active {
    transform: translateY(0) scale(0.98);
    background: rgba(255, 255, 255, 0.06);
    box-shadow: 
        0 2px 8px -2px rgba(0, 0, 0, 0.1),
        0 0 0 1px rgba(255, 255, 255, 0.03) inset;
}

.settings-btn svg {
    width: 1.5rem;
    height: 1.5rem;
    margin-left: 0.25rem;
    opacity: 0.9;
}
