style.css 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. * {
  2. box-sizing: border-box;
  3. }
  4. :root {
  5. --darkest: #171B19;
  6. --dark: #1D2B26;
  7. --med: #2D3B36;
  8. --light: #39574C;
  9. --lightest: #475650;
  10. --size-scale: 50;
  11. --size-scale-px: calc(var(--size-scale) * 1px);
  12. }
  13. body {
  14. margin: 0;
  15. min-height: 100vh;
  16. background-color: var(--light);
  17. color: var(--darkest);
  18. /* 為文字顏色添加一個變量 */
  19. font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  20. /* 選擇一個基本字體 */
  21. }
  22. header {
  23. background-color: var(--darkest);
  24. color: var(--lightest);
  25. padding: 0.25em;
  26. display: flex;
  27. justify-content: space-between;
  28. align-items: center;
  29. /* 垂直居中對齊 */
  30. }
  31. header h1 {
  32. margin: 0;
  33. padding: 0;
  34. font-size: 1.5em;
  35. }
  36. .displayNone {
  37. display: none;
  38. }
  39. .card {
  40. display: inline-block;
  41. background: var(--lightest);
  42. box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  43. border-radius: 5px;
  44. /* 卡片圓角 */
  45. overflow: hidden;
  46. max-width: 350px;
  47. /* 最大寬度設定 */
  48. margin: 8px;
  49. /* 卡片之間的間隔 */
  50. }
  51. .card-size-1 {
  52. width: calc(150px - 20px);
  53. }
  54. /* 調整寬度以補償邊距 */
  55. .card-size-2 {
  56. width: calc(200px - 20px);
  57. }
  58. .card-size-3 {
  59. width: calc(250px - 20px);
  60. }
  61. .card-size-4 {
  62. width: calc(300px - 20px);
  63. }
  64. .mood-image {
  65. width: 100%;
  66. /* 使圖片寬度適應容器 */
  67. height: auto;
  68. /* 高度自動 */
  69. object-fit: cover;
  70. /* 保持圖片比例,並填滿整個格子 */
  71. border-radius: 5px;
  72. /* 圖片圓角 */
  73. }
  74. /* 模態視窗背景樣式 */
  75. .modal {
  76. display: none;
  77. /* Hidden by default */
  78. position: fixed;
  79. /* Stay in place */
  80. z-index: 3;
  81. /* Sit on top */
  82. left: 0;
  83. top: 0;
  84. width: 100%;
  85. /* Full width */
  86. height: 100%;
  87. /* Full height */
  88. overflow: auto;
  89. /* Enable scroll if needed */
  90. background-color: rgb(0, 0, 0);
  91. /* Fallback color */
  92. background-color: rgba(0, 0, 0, 0.4);
  93. /* Black w/ opacity */
  94. }
  95. /* 模態視窗內容樣式 */
  96. .modal-content {
  97. background-color: #fefefe;
  98. margin: 15% auto;
  99. /* 15% from the top and centered */
  100. padding: 20px;
  101. border: 1px solid #888;
  102. width: 80%;
  103. /* Could be more or less, depending on screen size */
  104. }
  105. /* The Close Button */
  106. .close {
  107. color: #aaa;
  108. float: right;
  109. font-size: 28px;
  110. font-weight: bold;
  111. }
  112. .close:hover,
  113. .close:focus {
  114. color: black;
  115. text-decoration: none;
  116. cursor: pointer;
  117. }
  118. .mood-image-small {
  119. transform: scale(0.9);
  120. /* 縮小圖片 */
  121. transition: transform 0.3s ease;
  122. /* 平滑過渡效果 */
  123. }
  124. .card-buttons {
  125. position: absolute;
  126. top: 0;
  127. right: 0;
  128. display: none;
  129. flex-direction: column;
  130. align-items: flex-end;
  131. height: 100%;
  132. padding: 10px;
  133. }
  134. .button-group {
  135. display: flex;
  136. margin-bottom: -10px;
  137. }
  138. .button-group.vertical {
  139. flex-direction: column;
  140. margin-right: -27px;
  141. margin-top: -8px;
  142. }
  143. .button-group.horizontal {
  144. flex-direction: row;
  145. position: absolute;
  146. bottom: 10px;
  147. margin-left: -45px;
  148. transform: translateX(-50%);
  149. }
  150. .button {
  151. margin: 4px;
  152. /* 為按鈕添加一些空間 */
  153. }
  154. .card .button {
  155. padding: 0.3em 0.6em;
  156. /* 按鈕的內邊距,使用 em 單位 */
  157. margin: 0.1em;
  158. /* 按鈕之間的外邊距,使用 em 單位 */
  159. border: none;
  160. border-radius: 5px;
  161. /* 圓角 */
  162. background-color: var(--med);
  163. /* 使用 CSS 變量設定背景色 */
  164. color: white;
  165. cursor: pointer;
  166. line-height: 1;
  167. /* 行高與按鈕大小相匹配 */
  168. white-space: nowrap;
  169. /* 防止圖示換行 */
  170. }
  171. .button:hover {
  172. background-color: var(--dark);
  173. /* 滑鼠懸停時的背景色 */
  174. }
  175. /* Tabler 圖示的基本樣式 */
  176. .tabler-icon {
  177. display: inline-block;
  178. vertical-align: middle;
  179. }
  180. .card-selected .card-buttons {
  181. display: flex;
  182. /* 顯示按鈕 */
  183. }
  184. /* 根據卡片大小設定按鈕尺寸的樣式 */
  185. .card-size-1 .card-buttons {
  186. font-size: 4vw;
  187. }
  188. .card-size-2 .card-buttons {
  189. font-size: 3.5vw;
  190. }
  191. .card-size-3 .card-buttons {
  192. font-size: 3vw;
  193. }
  194. .card-size-4 .card-buttons {
  195. font-size: 2.5vw;
  196. }
  197. /* 卡片縮小時的轉換效果 */
  198. .card-selected .mood-image {
  199. transform: scale(0.7);
  200. /* 縮小圖片 */
  201. transform-origin: top left;
  202. /* 從左上角開始縮放 */
  203. transition: transform 0.3s ease;
  204. /* 平滑過渡效果 */
  205. }
  206. /* 卡片被選中時的樣式 */
  207. .card-selected .mood-image {
  208. transform-origin: top left;
  209. transform: scale(0.7);
  210. transition: transform 0.3s ease;
  211. }
  212. /* 卡片被選中時顯示按鈕 */
  213. .card-selected .card-buttons {
  214. display: flex;
  215. justify-content: space-around;
  216. position: absolute;
  217. width: calc(100% - 20px);
  218. /* 考慮到 padding */
  219. bottom: 5px;
  220. left: 10px;
  221. }