main.css 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765
  1. @import url(fonts/clear-sans.css);
  2. html,
  3. body {
  4. margin: 0;
  5. padding: 0;
  6. background: #faf8ef;
  7. color: #776e65;
  8. font-family: "Clear Sans", "Helvetica Neue", Arial, sans-serif;
  9. font-size: 18px;
  10. }
  11. h1.title {
  12. font-size: 80px;
  13. font-weight: bold;
  14. display: block;
  15. position: absolute;
  16. }
  17. @-webkit-keyframes move-up {
  18. 0% {
  19. top: 25px;
  20. opacity: 1;
  21. }
  22. 100% {
  23. top: -50px;
  24. opacity: 0;
  25. }
  26. }
  27. @-moz-keyframes move-up {
  28. 0% {
  29. top: 25px;
  30. opacity: 1;
  31. }
  32. 100% {
  33. top: -50px;
  34. opacity: 0;
  35. }
  36. }
  37. @keyframes move-up {
  38. 0% {
  39. top: 25px;
  40. opacity: 1;
  41. }
  42. 100% {
  43. top: -50px;
  44. opacity: 0;
  45. }
  46. }
  47. .scores-container {
  48. display: block;
  49. margin-top: 300px;
  50. float: left;
  51. text-align: right;
  52. }
  53. .best-container{
  54. margin-right: 100px;
  55. }
  56. .score-container,
  57. .best-container {
  58. width: 100px;
  59. height: 50px;
  60. position: relative;
  61. display: inline-block;
  62. background: #bbada0;
  63. padding: 15px 25px;
  64. font-size: 25px;
  65. height: 25px;
  66. line-height: 47px;
  67. font-weight: bold;
  68. border-radius: 3px;
  69. color: white;
  70. margin-top: 8px;
  71. text-align: center;
  72. }
  73. .score-container:after,
  74. .best-container:after {
  75. position: absolute;
  76. width: 100%;
  77. top: 10px;
  78. left: 0;
  79. text-transform: uppercase;
  80. font-size: 13px;
  81. line-height: 13px;
  82. text-align: center;
  83. color: #eee4da;
  84. }
  85. .score-container .score-addition,
  86. .best-container .score-addition {
  87. position: absolute;
  88. right: 30px;
  89. color: red;
  90. font-size: 25px;
  91. line-height: 25px;
  92. font-weight: bold;
  93. color: rgba(119, 110, 101, 0.9);
  94. z-index: 100;
  95. -webkit-animation: move-up 600ms ease-in;
  96. -moz-animation: move-up 600ms ease-in;
  97. animation: move-up 600ms ease-in;
  98. -webkit-animation-fill-mode: both;
  99. -moz-animation-fill-mode: both;
  100. animation-fill-mode: both;
  101. }
  102. .score-container:after {
  103. content: "我的分数";
  104. }
  105. .best-container:after {
  106. content: "最高分数";
  107. }
  108. p {
  109. margin-top: 0;
  110. margin-bottom: 10px;
  111. line-height: 1.65;
  112. }
  113. a {
  114. color: #776e65;
  115. font-weight: bold;
  116. text-decoration: underline;
  117. cursor: pointer;
  118. }
  119. strong.important {
  120. text-transform: uppercase;
  121. }
  122. hr {
  123. border: none;
  124. border-bottom: 1px solid #d8d4d0;
  125. margin-top: 20px;
  126. margin-bottom: 30px;
  127. }
  128. .container {
  129. width: 1280px;
  130. height: 720px;
  131. }
  132. @-webkit-keyframes fade-in {
  133. 0% {
  134. opacity: 0;
  135. }
  136. 100% {
  137. opacity: 1;
  138. }
  139. }
  140. @-moz-keyframes fade-in {
  141. 0% {
  142. opacity: 0;
  143. }
  144. 100% {
  145. opacity: 1;
  146. }
  147. }
  148. @keyframes fade-in {
  149. 0% {
  150. opacity: 0;
  151. }
  152. 100% {
  153. opacity: 1;
  154. }
  155. }
  156. .game-container {
  157. margin-left: 560px;
  158. margin-top: 30px;
  159. position: relative;
  160. padding: 15px;
  161. cursor: default;
  162. -webkit-touch-callout: none;
  163. -ms-touch-callout: none;
  164. -webkit-user-select: none;
  165. -moz-user-select: none;
  166. -ms-user-select: none;
  167. -ms-touch-action: none;
  168. touch-action: none;
  169. background: #bbada0;
  170. border-radius: 6px;
  171. width: 660px;
  172. height: 660px;
  173. -webkit-box-sizing: border-box;
  174. -moz-box-sizing: border-box;
  175. box-sizing: border-box;
  176. }
  177. .game-container .game-message {
  178. display: none;
  179. position: absolute;
  180. top: 0;
  181. right: 0;
  182. bottom: 0;
  183. left: 0;
  184. background: rgba(238, 228, 218, 0.5);
  185. z-index: 100;
  186. text-align: center;
  187. -webkit-animation: fade-in 800ms ease 1200ms;
  188. -moz-animation: fade-in 800ms ease 1200ms;
  189. animation: fade-in 800ms ease 1200ms;
  190. -webkit-animation-fill-mode: both;
  191. -moz-animation-fill-mode: both;
  192. animation-fill-mode: both;
  193. }
  194. .game-container .game-message p {
  195. font-size: 60px;
  196. font-weight: bold;
  197. height: 60px;
  198. line-height: 60px;
  199. margin-top: 222px;
  200. }
  201. .game-container .game-message .lower {
  202. display: block;
  203. margin-top: 59px;
  204. }
  205. .game-container .game-message a {
  206. display: inline-block;
  207. background: #8f7a66;
  208. border-radius: 3px;
  209. padding: 0 20px;
  210. text-decoration: none;
  211. color: #f9f6f2;
  212. height: 40px;
  213. line-height: 42px;
  214. margin-left: 9px;
  215. }
  216. .game-container .game-message a.keep-playing-button {
  217. display: none;
  218. }
  219. .game-container .game-message.game-won {
  220. background: rgba(237, 194, 46, 0.5);
  221. color: #f9f6f2;
  222. }
  223. .game-container .game-message.game-won a.keep-playing-button {
  224. display: inline-block;
  225. }
  226. .game-container .game-message.game-won,
  227. .game-container .game-message.game-over {
  228. display: block;
  229. }
  230. .grid-container {
  231. position: absolute;
  232. z-index: 1;
  233. }
  234. .grid-row {
  235. margin-bottom: 15px;
  236. }
  237. .grid-row:last-child {
  238. margin-bottom: 0;
  239. }
  240. .grid-row:after {
  241. content: "";
  242. display: block;
  243. clear: both;
  244. }
  245. .grid-cell {
  246. width: 146.5px;
  247. height: 146.5px;
  248. margin-right: 15px;
  249. float: left;
  250. border-radius: 3px;
  251. background: rgba(238, 228, 218, 0.35);
  252. }
  253. .grid-cell:last-child {
  254. margin-right: 0;
  255. }
  256. .tile-container {
  257. width: 631px;
  258. height: 631px;
  259. position: absolute;
  260. z-index: 2;
  261. }
  262. .tile,
  263. .tile .tile-inner {
  264. width: 146.5px;
  265. height: 146.5px;
  266. line-height: 146.5px;
  267. }
  268. .tile.tile-position-1-1 {
  269. -webkit-transform: translate(0px, 0px);
  270. -moz-transform: translate(0px, 0px);
  271. transform: translate(0px, 0px);
  272. }
  273. .tile.tile-position-1-2 {
  274. -webkit-transform: translate(0px, 161.5px);
  275. -moz-transform: translate(0px, 161.5px);
  276. transform: translate(0px, 161.5px);
  277. }
  278. .tile.tile-position-1-3 {
  279. -webkit-transform: translate(0px, 323px);
  280. -moz-transform: translate(0px, 323px);
  281. transform: translate(0px, 323px);
  282. }
  283. .tile.tile-position-1-4 {
  284. -webkit-transform: translate(0px, 484.5px);
  285. -moz-transform: translate(0px, 484.5px);
  286. transform: translate(0px, 484.5px);
  287. }
  288. .tile.tile-position-2-1 {
  289. -webkit-transform: translate(161.5px, 0px);
  290. -moz-transform: translate(161.5px, 0px);
  291. transform: translate(161.5px, 0px);
  292. }
  293. .tile.tile-position-2-2 {
  294. -webkit-transform: translate(161.5px, 161.5px);
  295. -moz-transform: translate(161.5px, 161.5px);
  296. transform: translate(161.5px, 161.5px);
  297. }
  298. .tile.tile-position-2-3 {
  299. -webkit-transform: translate(161.5px, 323px);
  300. -moz-transform: translate(161.5px, 323px);
  301. transform: translate(161.5px, 323px);
  302. }
  303. .tile.tile-position-2-4 {
  304. -webkit-transform: translate(161.5px, 484.5px);
  305. -moz-transform: translate(161.5px, 484.5px);
  306. transform: translate(161.5px, 484.5px);
  307. }
  308. .tile.tile-position-3-1 {
  309. -webkit-transform: translate(323px, 0px);
  310. -moz-transform: translate(323px, 0px);
  311. transform: translate(323px, 0px);
  312. }
  313. .tile.tile-position-3-2 {
  314. -webkit-transform: translate(323px, 161.5px);
  315. -moz-transform: translate(323px, 161.5px);
  316. transform: translate(323px, 161.5px);
  317. }
  318. .tile.tile-position-3-3 {
  319. -webkit-transform: translate(323px, 323px);
  320. -moz-transform: translate(323px, 323px);
  321. transform: translate(323px, 323px);
  322. }
  323. .tile.tile-position-3-4 {
  324. -webkit-transform: translate(323px, 484.5px);
  325. -moz-transform: translate(323px, 484.5px);
  326. transform: translate(323px, 484.5px);
  327. }
  328. .tile.tile-position-4-1 {
  329. -webkit-transform: translate(484.5px, 0px);
  330. -moz-transform: translate(484.5px, 0px);
  331. transform: translate(484.5px, 0px);
  332. }
  333. .tile.tile-position-4-2 {
  334. -webkit-transform: translate(484.5px, 161.5px);
  335. -moz-transform: translate(484.5px, 161.5px);
  336. transform: translate(484.5px, 161.5px);
  337. }
  338. .tile.tile-position-4-3 {
  339. -webkit-transform: translate(484.5px, 323px);
  340. -moz-transform: translate(484.5px, 323px);
  341. transform: translate(484.5px, 323px);
  342. }
  343. .tile.tile-position-4-4 {
  344. -webkit-transform: translate(484.5px, 484.5px);
  345. -moz-transform: translate(484.5px, 484.5px);
  346. transform: translate(484.5px, 484.5px);
  347. }
  348. .tile {
  349. position: absolute;
  350. -webkit-transition: 100ms ease-in-out;
  351. -moz-transition: 100ms ease-in-out;
  352. transition: 100ms ease-in-out;
  353. -webkit-transition-property: -webkit-transform;
  354. -moz-transition-property: -moz-transform;
  355. transition-property: transform;
  356. }
  357. .tile .tile-inner {
  358. border-radius: 3px;
  359. background: #eee4da;
  360. text-align: center;
  361. font-weight: bold;
  362. z-index: 10;
  363. font-size: 55px;
  364. }
  365. .tile.tile-2 .tile-inner {
  366. background: #eee4da;
  367. box-shadow: 0 0 30px 10px rgba(243, 215, 116, 0), inset 0 0 0 1px rgba(255, 255, 255, 0);
  368. }
  369. .tile.tile-4 .tile-inner {
  370. background: #ede0c8;
  371. box-shadow: 0 0 30px 10px rgba(243, 215, 116, 0), inset 0 0 0 1px rgba(255, 255, 255, 0);
  372. }
  373. .tile.tile-8 .tile-inner {
  374. color: #f9f6f2;
  375. background: #f2b179;
  376. }
  377. .tile.tile-16 .tile-inner {
  378. color: #f9f6f2;
  379. background: #f59563;
  380. }
  381. .tile.tile-32 .tile-inner {
  382. color: #f9f6f2;
  383. background: #f67c5f;
  384. }
  385. .tile.tile-64 .tile-inner {
  386. color: #f9f6f2;
  387. background: #f65e3b;
  388. }
  389. .tile.tile-128 .tile-inner {
  390. color: #f9f6f2;
  391. background: #edcf72;
  392. box-shadow: 0 0 30px 10px rgba(243, 215, 116, 0.2381), inset 0 0 0 1px rgba(255, 255, 255, 0.14286);
  393. font-size: 45px;
  394. }
  395. @media screen and (max-width: 520px) {
  396. .tile.tile-128 .tile-inner {
  397. font-size: 25px;
  398. }
  399. }
  400. .tile.tile-256 .tile-inner {
  401. color: #f9f6f2;
  402. background: #edcc61;
  403. box-shadow: 0 0 30px 10px rgba(243, 215, 116, 0.31746), inset 0 0 0 1px rgba(255, 255, 255, 0.19048);
  404. font-size: 45px;
  405. }
  406. @media screen and (max-width: 520px) {
  407. .tile.tile-256 .tile-inner {
  408. font-size: 25px;
  409. }
  410. }
  411. .tile.tile-512 .tile-inner {
  412. color: #f9f6f2;
  413. background: #edc850;
  414. box-shadow: 0 0 30px 10px rgba(243, 215, 116, 0.39683), inset 0 0 0 1px rgba(255, 255, 255, 0.2381);
  415. font-size: 45px;
  416. }
  417. @media screen and (max-width: 520px) {
  418. .tile.tile-512 .tile-inner {
  419. font-size: 25px;
  420. }
  421. }
  422. .tile.tile-1024 .tile-inner {
  423. color: #f9f6f2;
  424. background: #edc53f;
  425. box-shadow: 0 0 30px 10px rgba(243, 215, 116, 0.47619), inset 0 0 0 1px rgba(255, 255, 255, 0.28571);
  426. font-size: 35px;
  427. }
  428. @media screen and (max-width: 520px) {
  429. .tile.tile-1024 .tile-inner {
  430. font-size: 15px;
  431. }
  432. }
  433. .tile.tile-2048 .tile-inner {
  434. color: #f9f6f2;
  435. background: #edc22e;
  436. box-shadow: 0 0 30px 10px rgba(243, 215, 116, 0.55556), inset 0 0 0 1px rgba(255, 255, 255, 0.33333);
  437. font-size: 35px;
  438. }
  439. @media screen and (max-width: 520px) {
  440. .tile.tile-2048 .tile-inner {
  441. font-size: 15px;
  442. }
  443. }
  444. .tile.tile-super .tile-inner {
  445. color: #f9f6f2;
  446. background: #3c3a32;
  447. font-size: 30px;
  448. }
  449. @media screen and (max-width: 520px) {
  450. .tile.tile-super .tile-inner {
  451. font-size: 10px;
  452. }
  453. }
  454. @-webkit-keyframes appear {
  455. 0% {
  456. opacity: 0;
  457. -webkit-transform: scale(0);
  458. -moz-transform: scale(0);
  459. transform: scale(0);
  460. }
  461. 100% {
  462. opacity: 1;
  463. -webkit-transform: scale(1);
  464. -moz-transform: scale(1);
  465. transform: scale(1);
  466. }
  467. }
  468. @-moz-keyframes appear {
  469. 0% {
  470. opacity: 0;
  471. -webkit-transform: scale(0);
  472. -moz-transform: scale(0);
  473. transform: scale(0);
  474. }
  475. 100% {
  476. opacity: 1;
  477. -webkit-transform: scale(1);
  478. -moz-transform: scale(1);
  479. transform: scale(1);
  480. }
  481. }
  482. @keyframes appear {
  483. 0% {
  484. opacity: 0;
  485. -webkit-transform: scale(0);
  486. -moz-transform: scale(0);
  487. transform: scale(0);
  488. }
  489. 100% {
  490. opacity: 1;
  491. -webkit-transform: scale(1);
  492. -moz-transform: scale(1);
  493. transform: scale(1);
  494. }
  495. }
  496. .tile-new .tile-inner {
  497. -webkit-animation: appear 200ms ease 100ms;
  498. -moz-animation: appear 200ms ease 100ms;
  499. animation: appear 200ms ease 100ms;
  500. -webkit-animation-fill-mode: backwards;
  501. -moz-animation-fill-mode: backwards;
  502. animation-fill-mode: backwards;
  503. }
  504. @-webkit-keyframes pop {
  505. 0% {
  506. -webkit-transform: scale(0);
  507. -moz-transform: scale(0);
  508. transform: scale(0);
  509. }
  510. 50% {
  511. -webkit-transform: scale(1.2);
  512. -moz-transform: scale(1.2);
  513. transform: scale(1.2);
  514. }
  515. 100% {
  516. -webkit-transform: scale(1);
  517. -moz-transform: scale(1);
  518. transform: scale(1);
  519. }
  520. }
  521. @-moz-keyframes pop {
  522. 0% {
  523. -webkit-transform: scale(0);
  524. -moz-transform: scale(0);
  525. transform: scale(0);
  526. }
  527. 50% {
  528. -webkit-transform: scale(1.2);
  529. -moz-transform: scale(1.2);
  530. transform: scale(1.2);
  531. }
  532. 100% {
  533. -webkit-transform: scale(1);
  534. -moz-transform: scale(1);
  535. transform: scale(1);
  536. }
  537. }
  538. @keyframes pop {
  539. 0% {
  540. -webkit-transform: scale(0);
  541. -moz-transform: scale(0);
  542. transform: scale(0);
  543. }
  544. 50% {
  545. -webkit-transform: scale(1.2);
  546. -moz-transform: scale(1.2);
  547. transform: scale(1.2);
  548. }
  549. 100% {
  550. -webkit-transform: scale(1);
  551. -moz-transform: scale(1);
  552. transform: scale(1);
  553. }
  554. }
  555. .tile-merged .tile-inner {
  556. z-index: 20;
  557. -webkit-animation: pop 200ms ease 100ms;
  558. -moz-animation: pop 200ms ease 100ms;
  559. animation: pop 200ms ease 100ms;
  560. -webkit-animation-fill-mode: backwards;
  561. -moz-animation-fill-mode: backwards;
  562. animation-fill-mode: backwards;
  563. }
  564. .above-game{
  565. position: absolute;
  566. left: 120px;
  567. top:550px;
  568. width: 300px;
  569. height: 50px;
  570. }
  571. .game-intro {
  572. float: left;
  573. line-height: 42px;
  574. margin-bottom: 0;
  575. }
  576. .restart-button {
  577. display: inline-block;
  578. background: #8f7a66;
  579. border-radius: 3px;
  580. padding: 20px 80px;
  581. text-decoration: none;
  582. color: #f9f6f2;
  583. height: 40px;
  584. line-height: 42px;
  585. display: block;
  586. text-align: center;
  587. float: right;
  588. font-size: 30px;
  589. }
  590. .game-explanation {
  591. margin-top: 50px;
  592. }
  593. @media screen and (max-width: 520px) {
  594. html,
  595. body {
  596. font-size: 15px;
  597. }
  598. body {
  599. margin: 20px 0;
  600. padding: 0 20px;
  601. }
  602. h1.title {
  603. font-size: 27px;
  604. margin-top: 15px;
  605. }
  606. .score-container,
  607. .best-container {
  608. margin-top: 0;
  609. padding: 15px 10px;
  610. min-width: 40px;
  611. }
  612. .heading {
  613. position: absolute;
  614. left: 50px;
  615. top: 50px;
  616. display: inline-block;
  617. width: 50px;
  618. height: 400px;
  619. }
  620. .game-intro {
  621. width: 55%;
  622. display: block;
  623. box-sizing: border-box;
  624. line-height: 1.65;
  625. }
  626. .restart-button {
  627. width: 42%;
  628. padding: 0;
  629. display: block;
  630. box-sizing: border-box;
  631. margin-top: 2px;
  632. }
  633. .tile .tile-inner {
  634. font-size: 35px;
  635. }
  636. .game-message p {
  637. font-size: 30px !important;
  638. height: 30px !important;
  639. line-height: 30px !important;
  640. margin-top: 90px !important;
  641. }
  642. .game-message .lower {
  643. margin-top: 30px !important;
  644. }
  645. }