* { box-sizing: border-box; } :root { --darkest: #171B19; --dark: #1D2B26; --med: #2D3B36; --light: #39574C; --lightest: #475650; --size-scale: 50; --size-scale-px: calc(var(--size-scale) * 1px); } body { margin: 0; min-height: 100vh; background-color: var(--light); color: var(--darkest); /* 為文字顏色添加一個變量 */ font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; /* 選擇一個基本字體 */ } header { background-color: var(--darkest); color: var(--lightest); padding: 0.25em; display: flex; justify-content: space-between; align-items: center; /* 垂直居中對齊 */ } header h1 { margin: 0; padding: 0; font-size: 1.5em; } .displayNone { display: none; } .card { display: inline-block; background: var(--lightest); box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2); border-radius: 5px; /* 卡片圓角 */ overflow: hidden; max-width: 350px; /* 最大寬度設定 */ margin: 8px; /* 卡片之間的間隔 */ } .card-size-1 { width: calc(150px - 20px); } /* 調整寬度以補償邊距 */ .card-size-2 { width: calc(200px - 20px); } .card-size-3 { width: calc(250px - 20px); } .card-size-4 { width: calc(300px - 20px); } .mood-image { width: 100%; /* 使圖片寬度適應容器 */ height: auto; /* 高度自動 */ object-fit: cover; /* 保持圖片比例,並填滿整個格子 */ border-radius: 5px; /* 圖片圓角 */ } /* 模態視窗背景樣式 */ .modal { display: none; /* Hidden by default */ position: fixed; /* Stay in place */ z-index: 3; /* Sit on top */ left: 0; top: 0; width: 100%; /* Full width */ height: 100%; /* Full height */ overflow: auto; /* Enable scroll if needed */ background-color: rgb(0, 0, 0); /* Fallback color */ background-color: rgba(0, 0, 0, 0.4); /* Black w/ opacity */ } /* 模態視窗內容樣式 */ .modal-content { background-color: #fefefe; margin: 15% auto; /* 15% from the top and centered */ padding: 20px; border: 1px solid #888; width: 80%; /* Could be more or less, depending on screen size */ } /* The Close Button */ .close { color: #aaa; float: right; font-size: 28px; font-weight: bold; } .close:hover, .close:focus { color: black; text-decoration: none; cursor: pointer; } .mood-image-small { transform: scale(0.9); /* 縮小圖片 */ transition: transform 0.3s ease; /* 平滑過渡效果 */ } .card-buttons { position: absolute; top: 0; right: 0; display: none; flex-direction: column; align-items: flex-end; height: 100%; padding: 10px; } .button-group { display: flex; margin-bottom: -10px; } .button-group.vertical { flex-direction: column; margin-right: -27px; margin-top: -8px; } .button-group.horizontal { flex-direction: row; position: absolute; bottom: 10px; margin-left: -45px; transform: translateX(-50%); } .button { margin: 4px; /* 為按鈕添加一些空間 */ } .card .button { padding: 0.3em 0.6em; /* 按鈕的內邊距,使用 em 單位 */ margin: 0.1em; /* 按鈕之間的外邊距,使用 em 單位 */ border: none; border-radius: 5px; /* 圓角 */ background-color: var(--med); /* 使用 CSS 變量設定背景色 */ color: white; cursor: pointer; line-height: 1; /* 行高與按鈕大小相匹配 */ white-space: nowrap; /* 防止圖示換行 */ } .button:hover { background-color: var(--dark); /* 滑鼠懸停時的背景色 */ } /* Tabler 圖示的基本樣式 */ .tabler-icon { display: inline-block; vertical-align: middle; } .card-selected .card-buttons { display: flex; /* 顯示按鈕 */ } /* 根據卡片大小設定按鈕尺寸的樣式 */ .card-size-1 .card-buttons { font-size: 4vw; } .card-size-2 .card-buttons { font-size: 3.5vw; } .card-size-3 .card-buttons { font-size: 3vw; } .card-size-4 .card-buttons { font-size: 2.5vw; } /* 卡片縮小時的轉換效果 */ .card-selected .mood-image { transform: scale(0.7); /* 縮小圖片 */ transform-origin: top left; /* 從左上角開始縮放 */ transition: transform 0.3s ease; /* 平滑過渡效果 */ } /* 卡片被選中時的樣式 */ .card-selected .mood-image { transform-origin: top left; transform: scale(0.7); transition: transform 0.3s ease; } /* 卡片被選中時顯示按鈕 */ .card-selected .card-buttons { display: flex; justify-content: space-around; position: absolute; width: calc(100% - 20px); /* 考慮到 padding */ bottom: 5px; left: 10px; }