/* style.css */ @import url(https://fonts.googleapis.com/css?family=Noto+Sans+TC); /* Reset default browser styles */ * { box-sizing: border-box; margin: 0; padding: 0; } html, body { width: 100%; height: 100%; overflow: hidden; } body { background-color: #000; /* Black background */ position: relative; font-family: 'Noto Sans TC',sans-serif !important; isolation: isolate; transition: opacity 0.5s ease-in-out; } .fade-out { opacity: 0; } .fade-in { opacity: 1; } .content { text-align: center; margin-top: 50px; } /* Loading Screen Styles */ #loading-screen { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.7); display: flex; align-items: center; justify-content: center; z-index: 9999; /* Ensure it appears above everything else */ color: white; font-size: 3vh; font-weight: bold; visibility: visible; opacity: 1; transition: opacity 0.5s ease-in-out; } #loading-screen.hidden { visibility: hidden; opacity: 0; } /* Optional: Hide Scrollbar Appearance */ #wrapper { scrollbar-width: none; /* For Firefox */ } /* Hide scrollbar for WebKit-based browsers */ #wrapper::-webkit-scrollbar { display: none; } input { --c: orange; /* active color */ --g: 3rem; /* the gap */ --l: 5rem; /* line thickness*/ --s: 15rem; /* thumb size*/ width: 100%; height: var(--s); /* needed for Firefox*/ --_c: color-mix(in srgb, var(--c), #000 var(--p,0%)); -webkit-appearance :none; -moz-appearance :none; appearance :none; background: none; cursor: pointer; overflow: hidden; } input:focus-visible, input:hover{ --p: 25%; } input:active, input:focus-visible{ --_b: var(--s) } #wrapper { width: 4096px; /* Same as background width */ height: 7280px; /* Same as background height */ overflow: hidden; position: relative; background-color: #000; /* Match body's background */ } /* Background styling */ #background { position: absolute; width: 100%; /* Span full wrapper width */ height: 100%; /* Span full wrapper height */ transform-origin: top left; /* Scale from top-left corner */ transform: scale(1); /* Initial scale */ /* overflow: hidden; Prevent overflowing */ } #background img { width: 100%; /* Fill background container */ height: 100%; /* Fill background container */ object-fit: cover; /* Cover without distortion */ pointer-events: none; /* Prevent interactions */ } /* Board styling */ #board { position: absolute; bottom: 0; /* Position at the bottom of the background */ left: 50%; /* Start from the horizontal center */ transform: translateX(-50%); /* Center horizontally */ width: 100%; /* Span full wrapper width */ height: auto; /* Maintain aspect ratio */ } #board img { width: 100%; /* Fill board container */ height: auto; /* Maintain aspect ratio */ object-fit: cover; /* Cover without distortion */ /* pointer-events: none; */ /* Ensure this is removed as per your request */ } /* Game container styling */ #game-container { position: absolute; top: 0; left: 0; width: 100%; /* Match board's width */ height: 100%; /* Match board's height */ display: flex; flex-direction: column; align-items: center; justify-content: flex-start; pointer-events: none; /* Allow interactions with children */ } /* Grid styling */ #grid { position: absolute; /* Absolute positioning within the board */ top: 0; /* Start from the top of the board */ left: 50%; /* Center horizontally */ transform: translateX(-50%); /* Adjust for centering */ display: grid; /* Use CSS Grid for layout */ grid-template-columns: repeat(var(--numCols), 1fr); /* Define columns */ grid-template-rows: repeat(var(--numRows), 1fr); /* Define rows */ gap: var(--spacing)px; /* Dynamic spacing */ width: 100%; /* Span full board width */ height: 100%; /* Span full board height */ pointer-events: auto; /* Allow interactions */ touch-action: none; user-select: none; contain: strict; padding: 2px; /* 創造邊界緩衝空間 */ box-sizing: border-box; /* 保持原有尺寸計算 */ background-clip: content-box; will-change: transform; transform-style: preserve-3d; perspective: 1000px; } /* Cell styling */ .cell { position: relative; display: flex; align-items: center; justify-content: center; overflow: visible; transform-style: preserve-3d; z-index: auto !important; } /* Jewel styling */ .jewel { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); margin: 0; transition: transform 0.15s ease-in; /* 确保过渡属性存在 */ backface-visibility: hidden; image-rendering: -webkit-optimize-contrast; z-index: 2; will-change: transform; } .jewel.dragging { z-index: 1001 !important; /* 强制最高层级 */ /* 新增层叠上下文控制 */ position: relative; transform-style: preserve-3d; } /* 消除效果 */ .jewel.removing { transform: scale(0); opacity: 0; } .jewel.swapping { animation: swapFlash 0.3s ease; } .jewel.dragging-copy { cursor: grabbing; filter: brightness(1.1); transform: translateZ(0); backface-visibility: hidden; perspective: 1000px; contain: strict; } .ghost { transition: none !important; transform: translate(-50%, -50%); /* 强制居中 */ opacity: 0.5; z-index: 100 !important; isolation: isolate; filter: saturate(0.8); } /* Flash effect for matched jewels */ @keyframes flash { 0% { opacity: 1; } 50% { opacity: 0.5; } 100% { opacity: 1; } } @keyframes swapFlash { 0% { opacity: 0.8; transform: scale(0.9); } 50% { opacity: 1; transform: scale(1.1); } 100% { opacity: 1; transform: scale(1); } } .cell.match { animation: flash 0.5s ease; } .cloneA, .cloneB { position: fixed; pointer-events: none; width: 50%; /* 根據需要調整 */ z-index: 1000; transform: translateZ(0); backface-visibility: hidden; transition: none !important; /* 禁用其他過渡效果 */ will-change: transform, filter; /* 提示瀏覽器優化 */ filter: blur(0px); } /* 定義動畫類 */ .animateA, .animateB { backface-visibility: hidden; transition: none !important; /* 禁用其他過渡效果 */ will-change: transform; /* 提示瀏覽器優化 */ transform-origin: center center; /* 變換原點設為中心 */ /* 沒有需要在 CSS 中定義的內容,所有動畫由 JavaScript 動態生成 */ } #button-container { position: absolute; top: -60%; /* 按鈕放在 board 的上方 */ left: 50%; transform: translateX(-50%); width: 70%; height: auto; display: flex; gap: 10px; z-index: 1000; background-color: rgba(255, 255, 255, 0.8); /* 半透明背景 */ padding: 0px; border-radius: 10px; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); margin-top: 10px; /* 與 board 上方的間距 */ justify-content: center; /* 按鈕居中排列 */ } .jewel-button { width: 20%; /* 按鈕寬度為 board 寬度的 8% */ height: auto; /* 高度根據寬度自動調整 */ aspect-ratio: 1 / 1; /* 保持按鈕為正方形 */ padding: 0; border: none; border-radius: 5px; cursor: pointer; background-color: transparent; transition: transform 0.2s ease, box-shadow 0.2s ease; cursor: pointer; -moz-user-select: none; -webkit-user-select: none; -ms-user-select: none; user-select: none; -webkit-user-drag: none; -webkit-touch-callout: none; } .jewel-button img { width: 100%; height: 100%; object-fit: contain; } .jewel-button.active { background-color: #cf872a; border: 2px solid #cc8a2c; /* 選中狀態的邊框 */ } .jewel-button:hover { background-color: #a07745; box-shadow: 0 0 8px rgba(0, 0, 0, 0.3); } #checkbox-container { position: absolute; top: -35%; /* 根據需要調整,使 checkbox 放在 board 上方 */ left: 50%; transform: translateX(-50%); width: 100%; /* 與 board 寬度對應 */ display: flex; justify-content: center; /* 水平居中對齊 */ align-items: center; /* 垂直居中對齊 */ z-index: 1000; /* 確保在最上層 */ } /* Customize the label (the container) */ .falling-jewels-checkbox { width: 50%; /* 根據 board 寬度調整 */ transform: translateX(10%); display: flex; align-items: center; /* 垂直居中對齊 */ position: relative; cursor: pointer; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; } .free-grabbing-checkbox { width: 50%; /* 根據 board 寬度調整 */ transform: translateX(10%); display: flex; align-items: center; /* 垂直居中對齊 */ position: relative; cursor: pointer; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; } /* Hide the browser's default checkbox */ .falling-jewels-checkbox input { position: absolute; opacity: 0; cursor: pointer; height: 0; width: 0; } .free-grabbing-checkbox input { position: absolute; opacity: 0; cursor: pointer; height: 0; width: 0; } /* Create a custom checkbox */ .checkmark { aspect-ratio: 1 / 1; /* 保持按鈕為正方形 */ height: 15%; width: 15%; background-color: #393939; border: 1px solid #353535; border-radius: 10%; margin-right: 5%; /* 控制 checkmark 與文字之間的間距 */ position: relative; box-sizing: border-box; flex-shrink: 0; /* 防止縮小 */ } /* On mouse-over, add a grey background color */ .falling-jewels-checkbox:hover input ~ .checkmark { background-color: #4b4b4b; } /* When the checkbox is checked, add a blue background */ .falling-jewels-checkbox input:checked ~ .checkmark { background-color: #2b6a9e; border-color: #23679f; } /* On mouse-over, add a grey background color */ .free-grabbing-checkbox:hover input ~ .checkmark { background-color: #4b4b4b; } /* When the checkbox is checked, add a blue background */ .free-grabbing-checkbox input:checked ~ .checkmark { background-color: #2b6a9e; border-color: #23679f; } /* Create the checkmark/indicator (hidden when not checked) */ .checkmark:after { position: absolute; content: ""; display: none; left: 6.5rem; top: 2rem; width: 5rem; height: 10rem; border: solid rgb(61, 61, 61); border-width: 0 1.5vh 1.5vh 0; -webkit-transform: rotate(45deg); -ms-transform: rotate(45deg); transform: rotate(45deg); } /* Show the checkmark when checked */ .falling-jewels-checkbox input:checked ~ .checkmark:after { display: block; } /* Show the checkmark when checked */ .free-grabbing-checkbox input:checked ~ .checkmark:after { display: block; } /* Style the checkmark/indicator */ .checkbox-label { font-weight: 800; font-size: 18rem; /* 根據需求調整 */ color: #b1b1b1; } #return-container { position: absolute; top: 15%; /* 根據需要調整,使 checkbox 放在 board 上方 */ left: 2%; /* transform: translateX(-50%); */ display: flex; justify-content: center; /* 水平居中對齊 */ align-items: center; /* 垂直居中對齊 */ z-index: 1000; /* 確保在最上層 */ } .myButton{ background:url(https://images2.imgbox.com/aa/87/Ih0SAycM_o.png) no-repeat; cursor: pointer; border: none; width: 32rem; height: 32rem; transform: scale(0.85); /* 懸停時放大 */ } .myButton:active /* use Dot here */ { transform: scale(0.9); } /* 新增的重置按鈕樣式 */ #reset-board-button { position: absolute; top: -20%; /* 根據需要調整,使 checkbox 放在 board 上方 */ left: 17%; /* transform: translateX(-50%); */ display: flex; justify-content: center; /* 水平居中對齊 */ align-items: center; /* 垂直居中對齊 */ z-index: 1000; /* 確保在最上層 */ background-color: rgba(255, 255, 255, 0.8); /* 半透明背景 */ border: none; border-radius: 3rem; /* 圓角 */ padding: 0.5% 1.5%; /* 內邊距 */ font-size: 18rem; /* 字體大小 */ font-weight: 600; color: #333; /* 文字顏色 */ cursor: pointer; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); /* 陰影 */ transition: background-color 0.2s ease, transform 0.2s ease; } #reset-board-button:hover { background-color: rgba(255, 255, 255, 1); /* 懸停時背景變亮 */ transform-origin: center center; transform: scale(1.05); /* 懸停時放大 */ } #restore-board-button { position: absolute; top: -20%; /* 根據需要調整,使 checkbox 放在 board 上方 */ right: 17%; /* transform: translateX(-50%); */ display: flex; justify-content: center; /* 水平居中對齊 */ align-items: center; /* 垂直居中對齊 */ z-index: 1000; /* 確保在最上層 */ background-color: rgba(255, 255, 255, 0.8); /* 半透明背景 */ border: none; border-radius: 3rem; /* 圓角 */ padding: 0.5% 1.5%; /* 內邊距 */ font-size: 18rem; /* 字體大小 */ font-weight: 600; color: #333; /* 文字顏色 */ cursor: pointer; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); /* 陰影 */ transition: background-color 0.2s ease, transform 0.2s ease; } #restore-board-button:hover { background-color: rgba(255, 255, 255, 1); /* 懸停時背景變亮 */ transform-origin: center center; transform: scale(1.05); /* 懸停時放大 */ } #replay-button { position: absolute; top: -18.5%; /* 根據需要調整,使 checkbox 放在 board 上方 */ left: 3%; /* transform: translateX(-50%); */ display: flex; justify-content: center; /* 水平居中對齊 */ align-items: center; /* 垂直居中對齊 */ z-index: 1000; /* 確保在最上層 */ background-color: rgba(255, 255, 255, 0.8); /* 半透明背景 */ border: none; border-radius: 3rem; /* 圓角 */ padding: 0.5% 1.5%; /* 內邊距 */ font-size: 18rem; /* 字體大小 */ font-weight: 600; color: #333; /* 文字顏色 */ cursor: pointer; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); /* 陰影 */ transition: background-color 0.2s ease, transform 0.2s ease; } #replay-button:hover { background-color: rgba(255, 255, 255, 1); /* 懸停時背景變亮 */ transform-origin: center center; transform: scale(1.05); /* 懸停時放大 */ } #share-button { position: absolute; top: -18.5%; /* 根據需要調整,使 checkbox 放在 board 上方 */ right: 3%; /* transform: translateX(-50%); */ display: flex; justify-content: center; /* 水平居中對齊 */ align-items: center; /* 垂直居中對齊 */ z-index: 1000; /* 確保在最上層 */ background-color: rgba(255, 255, 255, 0.8); /* 半透明背景 */ border: none; border-radius: 3rem; /* 圓角 */ padding: 0.5% 1.5%; /* 內邊距 */ font-size: 18rem; /* 字體大小 */ font-weight: 600; color: #333; /* 文字顏色 */ cursor: pointer; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); /* 陰影 */ transition: background-color 0.2s ease, transform 0.2s ease; } #share-button:hover { background-color: rgba(255, 255, 255, 1); /* 懸停時背景變亮 */ transform-origin: center center; transform: scale(1.05); /* 懸停時放大 */ } #timer-container { position: absolute; top: -2%; /* 根據需要調整,使時間條放在 board 上方 */ left: 50%; transform: translateX(-50%); width: 100%; /* 與 board 寬度對應 */ height: 2%; /* 時間條高度 */ background-color: rgba(255, 255, 255, 0.8); /* 半透明背景 */ border-radius: 10px; overflow: hidden; z-index: 1000; /* 確保在最上層 */ } #timer-bar { width: 100%; height: 100%; background-color: #2b6a9e; /* 時間條顏色 */ transform-origin: left; transition: transform 0.1s linear; } #slidecontainer { position: absolute; top: -40%; /* 根據需要調整,使滑動條放在 board 上方 */ left: 50%; transform: translateX(-50%); width: 170rem; /* 與 board 寬度對應 */ height: 2rem; /* 與 board 寬度對應 */ display: flex; align-items: center; gap: 10rem; z-index: 1000; /* 確保在最上層 */ border: none ; } #rangeValue { position: absolute; left: -23rem; display: block; text-align: center; font-size: 8em; color: #999; font-weight: 400; } /* chromium */ input[type="range" i]::-webkit-slider-thumb{ height: var(--s); aspect-ratio: 1; border-radius: 50%; box-shadow: 0 0 0 var(--_b,var(--l)) inset var(--_c); border-image: linear-gradient(90deg,var(--_c) 50%,#ababab 0) 0 1/calc(50% - var(--l)/2) 200rem/0 calc(200rem + var(--g)); -webkit-appearance: none; appearance: none; transition: .3s; } /* Firefox */ input[type="range"]::-moz-range-thumb { height: var(--s); width: var(--s); background: none; border-radius: 50%; box-shadow: 0 0 0 var(--_b,var(--l)) inset var(--_c); border-image: linear-gradient(90deg,var(--_c) 50%,#ababab 0) 0 1/calc(50% - var(--l)/2) 200rem/0 calc(200rem + var(--g)); -moz-appearance: none; appearance: none; transition: .3s; } @supports not (color: color-mix(in srgb,red,red)) { input { --_c: var(--c); } } /* 路径样式 */ #path-container { transition: all 0.3s; } @keyframes path-fade { 0% { opacity: 0.8; } 50% { opacity: 0.4; } 100% { opacity: 0.8; } }