tools.css 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628
  1. * {
  2. padding: 0;
  3. margin: 0;
  4. }
  5. html,
  6. body {
  7. width: 100%;
  8. height: 100%;
  9. background: linear-gradient(160deg, #fff9f2 0%, #ffeedd 100%);
  10. transition: none;
  11. -webkit-tap-highlight-color: transparent; /*消除移动端的灰色背景闪烁*/
  12. -webkit-touch-callout: none; /*系统默认菜单被禁用*/
  13. -webkit-user-select: none; /*webkit浏览器*/
  14. -khtml-user-select: none; /*早期浏览器*/
  15. -moz-user-select: none; /*火狐*/
  16. -ms-user-select: none; /*IE10*/
  17. user-select: none;
  18. }
  19. input,
  20. textarea {
  21. -webkit-user-select: auto; /*webkit浏览器*/
  22. margin: 0px;
  23. padding: 0px;
  24. outline: none;
  25. }
  26. #container {
  27. display: flex;
  28. flex-direction: column;
  29. position: absolute;
  30. left: 0;
  31. top: 0;
  32. height: 100% !important;
  33. width: 100%;
  34. }
  35. /* ── 根布局:全 Flex,无 fixed/absolute 主结构 ──────────── */
  36. /* 竖屏:body flex column */
  37. /* sidebar → display:contents,子项直接排入 body */
  38. /* logo-bar(order:1) → game-col(order:2) → cta(order:10) */
  39. /* 横屏:body flex row,game-col 左(flex:1) + sidebar 右 */
  40. body {
  41. display: flex;
  42. flex-direction: column;
  43. position: relative;
  44. overflow: hidden;
  45. }
  46. /* ── 游戏列:canvas 区 + 工具栏 ── */
  47. #game-col {
  48. order: 2; /* 竖屏:位于 logo(1) 与 cta(10) 之间 */
  49. flex: 1;
  50. min-height: 0; /* 防止 flex 子项无法收缩 */
  51. display: flex;
  52. flex-direction: column;
  53. position: relative; /* promo-screen absolute 定位的父容器 */
  54. }
  55. /* 纯填色区域,flex:1 铺满 game-col 剩余空间 */
  56. #game-area {
  57. flex: 1;
  58. min-height: 0;
  59. position: relative;
  60. }
  61. /* canvas 绝对填满 game-area;syncCanvasSize() 同步像素尺寸 */
  62. #canvas {
  63. position: absolute;
  64. inset: 0;
  65. width: 100%;
  66. height: 100%;
  67. z-index: 1;
  68. }
  69. /* ── 竖屏:sidebar 用 display:contents,子项直接排入 body ── */
  70. #sidebar {
  71. display: contents;
  72. }
  73. .sidebar-flex-spacer {
  74. order: 5;
  75. display: none; /* 竖屏不需要 */
  76. }
  77. /* ── 横屏:body flex row,sidebar 作为右侧固定栏 ─────────── */
  78. @media (orientation: landscape) {
  79. body {
  80. flex-direction: row;
  81. }
  82. #game-col {
  83. order: 1;
  84. flex: 1;
  85. min-width: 0;
  86. }
  87. #sidebar {
  88. display: flex;
  89. order: 2;
  90. flex-direction: column;
  91. align-items: center;
  92. justify-content: center;
  93. gap: clamp(12px, 2.5vh, 24px);
  94. width: clamp(140px, 36%, 260px);
  95. background: transparent;
  96. padding: clamp(12px, 2vh, 20px) clamp(10px, 2vw, 16px);
  97. box-sizing: border-box;
  98. box-shadow: none;
  99. pointer-events: auto;
  100. }
  101. .sidebar-flex-spacer {
  102. display: none;
  103. }
  104. }
  105. #progress-toolbar {
  106. height: 20px;
  107. }
  108. #toolbar-bottom {
  109. /* 在 game-col flex column 中正常流,不与 canvas 重叠 */
  110. flex-shrink: 0;
  111. text-align: center;
  112. z-index: 2;
  113. pointer-events: none;
  114. transition:
  115. transform 1s ease-in-out,
  116. opacity 1s ease-in-out;
  117. }
  118. .hidden-toolbar-bottom {
  119. transform: translateY(100%); /* 移出屏幕下方 */
  120. opacity: 0; /* 完全透明 */
  121. }
  122. .hidden-toolbar-right {
  123. transform: translateX(150%); /* 移出屏幕右方 */
  124. opacity: 0; /* 完全透明 */
  125. }
  126. #color-btns {
  127. display: flex;
  128. flex-direction: row;
  129. justify-content: flex-start;
  130. padding: 0px 10px 10px 10px;
  131. overflow-x: scroll;
  132. height: 60px;
  133. align-items: center;
  134. gap: 10px;
  135. user-select: none;
  136. /* 隐藏滚动条但保留滚动功能 */
  137. scrollbar-width: none;
  138. -ms-overflow-style: none;
  139. }
  140. #color-btns::-webkit-scrollbar {
  141. display: none;
  142. }
  143. .color-btn-container {
  144. position: relative;
  145. min-width: 48px;
  146. width: 48px;
  147. height: 48px;
  148. }
  149. .color-btn-container-selected {
  150. transform: scale(1.2);
  151. }
  152. /* SVG 充满容器 */
  153. .color-btn-progress-ring {
  154. width: 100%;
  155. height: 100%;
  156. }
  157. /* 进度条轨道 */
  158. .color-btn-progress-ring-track {
  159. transition: none;
  160. }
  161. /* 动态进度条 */
  162. .color-btn-progress-ring-value {
  163. transition: stroke-dashoffset 0.5s ease-in-out;
  164. transform: rotate(-90deg);
  165. transform-origin: 50% 50%;
  166. }
  167. .color-btn {
  168. position: absolute;
  169. min-width: 40px;
  170. width: 40px;
  171. height: 40px;
  172. line-height: 40px;
  173. text-align: center;
  174. border-radius: 50%;
  175. box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  176. top: 50%;
  177. left: 50%;
  178. transform: translate(-50%, -50%);
  179. z-index: 2;
  180. box-sizing: border-box;
  181. cursor: pointer;
  182. pointer-events: auto; /*允许button接收事件*/
  183. transition: all 0.2s;
  184. }
  185. #progress-wrapper {
  186. box-sizing: border-box;
  187. display: flex;
  188. align-items: center;
  189. flex-direction: row;
  190. width: 100%;
  191. padding-left: 10px;
  192. padding-right: 10px;
  193. gap: 10px;
  194. }
  195. #progress-bar {
  196. box-sizing: border-box;
  197. flex-grow: 1;
  198. overflow: hidden;
  199. text-align: left;
  200. background-color: lightgray;
  201. border-radius: 2px;
  202. height: 4px;
  203. }
  204. #progress {
  205. transition: width 0.5s ease-in-out;
  206. width: 0%;
  207. height: 4px;
  208. background-color: rgb(7, 206, 7);
  209. }
  210. #percent {
  211. font-size: 12px;
  212. color: rgb(7, 206, 7);
  213. line-height: 12px;
  214. font-weight: 500;
  215. font-family: Arial, Helvetica, sans-serif;
  216. }
  217. /* 各种工具buuton */
  218. .btn-img {
  219. width: 100%;
  220. height: 100%;
  221. }
  222. .btn-img-mask {
  223. position: absolute;
  224. width: 100%;
  225. height: 100%;
  226. top: 0%;
  227. border-radius: 50%;
  228. opacity: 0;
  229. background: black;
  230. }
  231. /* 有兼容性问题, 干脆不用了,直接js代码里监听各种事件来做吧*/
  232. @media (hover: hover) and (pointer: fine) {
  233. .btn-img-mask:hover {
  234. opacity: 0.5;
  235. }
  236. }
  237. /* 移动端,解决按钮按下去再没复原的问题 */
  238. .btn-img-mask:active {
  239. opacity: 0.5;
  240. }
  241. .btn {
  242. z-index: 120;
  243. width: 40px;
  244. height: 40px;
  245. border-radius: 50%;
  246. box-shadow: 0 0 4px 0 rgba(0, 0, 0, 0.16);
  247. }
  248. /*adapt firefox*/
  249. @-moz-document url-prefix() {
  250. .star-rating input:checked ~ label::before {
  251. font-size: 36px;
  252. line-height: 21px;
  253. }
  254. }
  255. /*全部完成的撒花动画wrapper*/
  256. .finish-ani-wrapper {
  257. position: absolute;
  258. pointer-events: none;
  259. width: 95vw;
  260. height: 95vh;
  261. z-index: 90;
  262. top: 0%;
  263. }
  264. /*撒花动画的花片样式*/
  265. .finish-ani-div {
  266. position: absolute;
  267. width: 10px;
  268. height: 10px;
  269. top: 0%;
  270. opacity: 1;
  271. z-index: 90;
  272. transition:
  273. top 3s,
  274. left 3s,
  275. opacity 3s;
  276. }
  277. /*爆破动画canvas*/
  278. .finish-ani-canvas {
  279. position: fixed;
  280. pointer-events: none;
  281. bottom: 0px;
  282. z-index: 300;
  283. }
  284. .toast {
  285. position: fixed;
  286. bottom: 20px;
  287. left: 50%;
  288. transform: translateX(-50%);
  289. background: rgba(0, 0, 0, 0.8);
  290. color: white;
  291. padding: 12px 24px;
  292. border-radius: 4px;
  293. animation: fadeInOut 2.5s;
  294. z-index: 9999;
  295. }
  296. .toast-hidden {
  297. display: none;
  298. }
  299. @keyframes fadeInOut {
  300. 0% {
  301. opacity: 0;
  302. bottom: -20px;
  303. }
  304. 20% {
  305. opacity: 1;
  306. bottom: 20px;
  307. }
  308. 80% {
  309. opacity: 1;
  310. bottom: 20px;
  311. }
  312. 100% {
  313. opacity: 0;
  314. bottom: -20px;
  315. }
  316. }
  317. /* ── Canvas 缩小消失动画 ────────────────────────────── */
  318. #canvas.canvas-shrink-out {
  319. transition:
  320. transform 0.55s ease-in,
  321. opacity 0.55s ease-in;
  322. transform: scale(0.05);
  323. opacity: 0;
  324. pointer-events: none;
  325. }
  326. /* ── Logo 栏 ────────────────────────────────────────────── */
  327. /* 竖屏(display:contents 子项):横排,order:1 置顶,z:200 浮于 promo */
  328. /* 横屏(sidebar 内 flex 子项) :竖排,充满宽度 */
  329. #app-logo-bar {
  330. order: 1; /* 竖屏:body 第一行 */
  331. flex: 0 0 18dvh; /* ← 竖屏固定占屏高 18% */
  332. display: flex;
  333. flex-direction: row; /* 竖屏:图标+文字横排 */
  334. align-items: center;
  335. justify-content: center;
  336. gap: clamp(8px, 3vw, 18px);
  337. padding: 0 20px;
  338. box-sizing: border-box;
  339. pointer-events: none;
  340. position: relative;
  341. z-index: 200;
  342. }
  343. #app-logo {
  344. height: 12dvh; /* ≈ 55% of 20dvh bar */
  345. width: auto;
  346. display: block;
  347. flex-shrink: 0;
  348. object-fit: contain;
  349. }
  350. #app-logo-txt {
  351. height: 12dvh;
  352. width: auto;
  353. max-width: 55%;
  354. display: block;
  355. object-fit: contain;
  356. }
  357. @media (orientation: landscape) {
  358. #app-logo-bar {
  359. flex: 0 0 auto;
  360. order: 1;
  361. flex-direction: column;
  362. gap: clamp(4px, 1vh, 8px);
  363. padding: 0;
  364. width: 80%;
  365. position: static;
  366. z-index: auto;
  367. }
  368. #app-logo {
  369. width: 85%;
  370. height: auto;
  371. max-width: none;
  372. object-fit: contain;
  373. }
  374. #app-logo-txt {
  375. width: 70%;
  376. height: auto;
  377. max-width: none;
  378. object-fit: contain;
  379. }
  380. }
  381. /* ── 广告标识 ────────────────────────────────────────── */
  382. #ad-badge {
  383. position: fixed;
  384. top: 6px;
  385. right: 8px;
  386. z-index: 300;
  387. background: rgba(0, 0, 0, 0.35);
  388. color: #fff;
  389. font-size: 10px;
  390. font-family: Arial, Helvetica, sans-serif;
  391. font-weight: 600;
  392. letter-spacing: 0.5px;
  393. padding: 2px 6px;
  394. border-radius: 4px;
  395. pointer-events: none;
  396. }
  397. /* ── CTA 按钮容器 ────────────────────────────────────────── */
  398. /* 竖屏(display:contents 子项):order:10 置底,z:200 浮于 promo */
  399. /* 横屏(sidebar 内 flex 子项) :在 spacer 之后贴底 */
  400. #cta-btn-wrapper {
  401. order: 10; /* 竖屏:body 最末行 */
  402. flex: 0 0 14dvh; /* ← 竖屏固定占屏高 14%(含按钮+上下间距) */
  403. display: flex;
  404. align-items: center;
  405. justify-content: center;
  406. pointer-events: none;
  407. padding: 0 16px;
  408. box-sizing: border-box;
  409. position: relative;
  410. z-index: 200; /* 竖屏:浮于 promo-screen 之上 */
  411. }
  412. @media (orientation: landscape) {
  413. #cta-btn-wrapper {
  414. flex: 0 0 auto;
  415. order: 10;
  416. width: 90%;
  417. padding: 0 0 clamp(20px, 5vh, 44px);
  418. position: static;
  419. z-index: auto;
  420. }
  421. #cta-btn {
  422. width: 100%;
  423. max-width: none;
  424. height: clamp(42px, 10vh, 54px);
  425. font-size: clamp(13px, 3.5vh, 17px);
  426. }
  427. }
  428. #cta-btn {
  429. pointer-events: auto;
  430. width: min(300px, 80vw);
  431. height: 44px;
  432. border: none;
  433. border-radius: 22px;
  434. background: linear-gradient(135deg, #ff5f1f 0%, #ffb300 100%);
  435. color: #fff;
  436. font-size: 18px;
  437. font-weight: 800;
  438. letter-spacing: 3px;
  439. font-family: Arial, Helvetica, sans-serif;
  440. cursor: pointer;
  441. /* 立体感阴影 */
  442. box-shadow:
  443. 0 4px 10px rgba(255, 95, 31, 0.45),
  444. 0 2px 0 rgba(255, 255, 255, 0.25) inset,
  445. 0 -3px 0 rgba(0, 0, 0, 0.18) inset;
  446. /* 按压效果 */
  447. transition:
  448. transform 0.1s ease,
  449. box-shadow 0.1s ease;
  450. /* 脉冲光晕动画 */
  451. animation: cta-pulse 2s ease-in-out infinite;
  452. }
  453. #cta-btn:active {
  454. transform: scale(0.96) translateY(2px);
  455. box-shadow:
  456. 0 2px 8px rgba(255, 95, 31, 0.4),
  457. 0 1px 0 rgba(255, 255, 255, 0.2) inset;
  458. }
  459. @keyframes cta-pulse {
  460. 0%,
  461. 100% {
  462. box-shadow:
  463. 0 4px 10px rgba(255, 95, 31, 0.45),
  464. 0 2px 0 rgba(255, 255, 255, 0.25) inset,
  465. 0 -3px 0 rgba(0, 0, 0, 0.18) inset;
  466. }
  467. 50% {
  468. box-shadow:
  469. 0 4px 16px rgba(255, 95, 31, 0.7),
  470. 0 2px 0 rgba(255, 255, 255, 0.25) inset,
  471. 0 -3px 0 rgba(0, 0, 0, 0.18) inset;
  472. }
  473. }
  474. /* 填色完成后的强化 CTA 状态 */
  475. @keyframes cta-highlight-pulse {
  476. 0%,
  477. 100% {
  478. transform: scale(1.08);
  479. box-shadow:
  480. 0 6px 24px rgba(255, 95, 31, 0.8),
  481. 0 2px 0 rgba(255, 255, 255, 0.3) inset,
  482. 0 -3px 0 rgba(0, 0, 0, 0.2) inset;
  483. }
  484. 50% {
  485. transform: scale(1.14);
  486. box-shadow:
  487. 0 8px 32px rgba(255, 95, 31, 1),
  488. 0 2px 0 rgba(255, 255, 255, 0.3) inset,
  489. 0 -3px 0 rgba(0, 0, 0, 0.2) inset;
  490. }
  491. }
  492. #cta-btn.cta-highlight {
  493. animation: cta-highlight-pulse 0.8s ease-in-out infinite;
  494. }
  495. /* ── 宣传界面 ──────────────────────────────────────────── */
  496. /* 在 game-area 内 position:absolute 展开,填满整个填色区域 */
  497. /* logo-bar(z:200) 和 cta-wrapper(z:200) 叠在其上 */
  498. #promo-screen {
  499. position: absolute;
  500. inset: 0;
  501. display: none;
  502. flex-direction: column;
  503. align-items: center;
  504. justify-content: center;
  505. gap: clamp(4px, 1vh, 8px);
  506. /* 背景由 body 提供,此处透明 */
  507. background: transparent;
  508. z-index: 10;
  509. /* padding-top 把重心下移,远离顶部 logo;overflow:hidden 防止 scale 动画溢出 */
  510. padding: clamp(24px, 12vh, 64px) 4vw clamp(8px, 2vh, 20px);
  511. box-sizing: border-box;
  512. overflow: hidden;
  513. }
  514. #promo-screen.visible {
  515. display: flex;
  516. }
  517. /* coloring-pages:从小(远)到大(近) */
  518. #promo-coloring {
  519. width: 96vw;
  520. max-width: 96vw;
  521. max-height: 56vh;
  522. object-fit: contain;
  523. opacity: 0;
  524. transform: scale(0.12);
  525. transition:
  526. transform 0.7s cubic-bezier(0.175, 0.885, 0.32, 1.275) 0.05s,
  527. opacity 0.4s ease 0.05s;
  528. }
  529. #promo-coloring.animate-in {
  530. transform: scale(1);
  531. opacity: 1;
  532. }
  533. /* slogan:从超大(近)到正常,比 coloring-pages 晚 0.25s,加强弹跳感 */
  534. #promo-slogon {
  535. width: 90vw;
  536. max-width: 90vw;
  537. max-height: 22vh;
  538. object-fit: contain;
  539. opacity: 0;
  540. transform: scale(4);
  541. transition:
  542. transform 0.75s cubic-bezier(0.175, 0.885, 0.32, 1.6) 0.3s,
  543. opacity 0.25s ease 0.3s;
  544. }
  545. #promo-slogon.animate-in {
  546. transform: scale(1);
  547. opacity: 1;
  548. }
  549. /* ── 横屏:promo 占游戏区宽度 90% ── */
  550. @media (orientation: landscape) {
  551. #promo-screen {
  552. padding: clamp(12px, 10vh, 36px) 5% clamp(4px, 2vh, 12px);
  553. }
  554. #promo-coloring {
  555. width: 95%;
  556. max-width: 95%;
  557. max-height: 54vh;
  558. }
  559. #promo-slogon {
  560. width: 90%;
  561. max-width: 90%;
  562. max-height: 44vh;
  563. }
  564. }