styles.css 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753
  1. /* Constants */
  2. :root {
  3. --icon-size: 24px;
  4. --primary-color: #4285f4;
  5. --peer-width: 120px;
  6. color-scheme: light dark;
  7. /* both supported */
  8. }
  9. /* Layout */
  10. html {
  11. height: 100%;
  12. }
  13. html,
  14. body {
  15. margin: 0;
  16. display: flex;
  17. flex-direction: column;
  18. width: 100%;
  19. overflow-x: hidden;
  20. }
  21. body {
  22. flex-grow: 1;
  23. align-items: center;
  24. justify-content: center;
  25. overflow-y: hidden;
  26. }
  27. .row-reverse {
  28. display: flex;
  29. flex-direction: row-reverse;
  30. }
  31. .row {
  32. display: flex;
  33. flex-direction: row;
  34. }
  35. .column {
  36. display: flex;
  37. flex-direction: column;
  38. }
  39. .center {
  40. display: flex;
  41. align-items: center;
  42. justify-content: center;
  43. }
  44. .grow {
  45. flex-grow: 1;
  46. }
  47. .full {
  48. position: absolute;
  49. top: 0;
  50. left: 0;
  51. right: 0;
  52. bottom: 0;
  53. }
  54. header {
  55. position: absolute;
  56. top: 0;
  57. left: 0;
  58. right: 0;
  59. height: 56px;
  60. align-items: center;
  61. padding: 16px;
  62. box-sizing: border-box;
  63. }
  64. [hidden] {
  65. display: none !important;
  66. }
  67. /* Typography */
  68. body {
  69. font-family: -apple-system, BlinkMacSystemFont, Roboto, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
  70. -webkit-font-smoothing: antialiased;
  71. -moz-osx-font-smoothing: grayscale;
  72. }
  73. h1 {
  74. font-size: 34px;
  75. font-weight: 400;
  76. letter-spacing: -.01em;
  77. line-height: 40px;
  78. margin: 8px 0 0;
  79. }
  80. h2 {
  81. font-size: 24px;
  82. font-weight: 400;
  83. letter-spacing: -.012em;
  84. line-height: 32px;
  85. }
  86. h3 {
  87. font-size: 20px;
  88. font-weight: 500;
  89. margin: 16px 0;
  90. }
  91. .font-subheading {
  92. font-size: 16px;
  93. font-weight: 400;
  94. line-height: 24px;
  95. }
  96. .font-body1,
  97. body {
  98. font-size: 14px;
  99. font-weight: 400;
  100. line-height: 20px;
  101. }
  102. .font-body2 {
  103. font-size: 12px;
  104. line-height: 18px;
  105. }
  106. a {
  107. text-decoration: none;
  108. color: currentColor;
  109. cursor: pointer;
  110. }
  111. /* Icons */
  112. .icon {
  113. width: var(--icon-size);
  114. height: var(--icon-size);
  115. fill: currentColor;
  116. }
  117. /* Shadows */
  118. [shadow="1"] {
  119. box-shadow: 0 3px 4px 0 rgba(0, 0, 0, 0.14),
  120. 0 1px 8px 0 rgba(0, 0, 0, 0.12),
  121. 0 3px 3px -2px rgba(0, 0, 0, 0.4);
  122. }
  123. [shadow="2"] {
  124. box-shadow: 0 4px 5px 0 rgba(0, 0, 0, 0.14),
  125. 0 1px 10px 0 rgba(0, 0, 0, 0.12),
  126. 0 2px 4px -1px rgba(0, 0, 0, 0.4);
  127. }
  128. /* Animations */
  129. @keyframes fade-in {
  130. 0% {
  131. opacity: 0;
  132. }
  133. }
  134. /* Main Header */
  135. body>header a {
  136. margin-left: 8px;
  137. }
  138. /* Peers List */
  139. x-peers {
  140. width: 100%;
  141. overflow: hidden;
  142. flex-flow: row wrap;
  143. z-index: 2;
  144. }
  145. /* Empty Peers List */
  146. x-no-peers {
  147. padding: 8px;
  148. text-align: center;
  149. /* prevent flickering on load */
  150. animation: fade-in 300ms;
  151. animation-delay: 500ms;
  152. animation-fill-mode: backwards;
  153. }
  154. x-no-peers h2,
  155. x-no-peers a {
  156. color: var(--primary-color);
  157. }
  158. x-peers:not(:empty)+x-no-peers {
  159. display: none;
  160. }
  161. /* Peer */
  162. x-peer {
  163. -webkit-user-select: none;
  164. user-select: none;
  165. }
  166. x-peer label {
  167. width: var(--peer-width);
  168. padding: 8px;
  169. cursor: pointer;
  170. touch-action: manipulation;
  171. -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
  172. position: relative;
  173. }
  174. x-peer .name {
  175. width: var(--peer-width);
  176. white-space: nowrap;
  177. overflow: hidden;
  178. text-overflow: ellipsis;
  179. text-align: center;
  180. }
  181. input[type="file"] {
  182. visibility: hidden;
  183. position: absolute;
  184. }
  185. x-peer x-icon {
  186. --icon-size: 40px;
  187. width: var(--icon-size);
  188. padding: 12px;
  189. border-radius: 50%;
  190. background: var(--primary-color);
  191. color: white;
  192. display: flex;
  193. margin-bottom: 8px;
  194. transition: transform 150ms;
  195. will-change: transform;
  196. }
  197. x-peer:not([transfer]):hover x-icon,
  198. x-peer:not([transfer]):focus x-icon {
  199. transform: scale(1.05);
  200. }
  201. x-peer[transfer] x-icon {
  202. box-shadow: none;
  203. opacity: 0.8;
  204. transform: scale(1);
  205. }
  206. .status,
  207. .device-name {
  208. height: 18px;
  209. opacity: 0.7;
  210. }
  211. x-peer[transfer] .status:before {
  212. content: 'Transferring...';
  213. }
  214. x-peer:not([transfer]) .status,
  215. x-peer[transfer] .device-name {
  216. display: none;
  217. }
  218. x-peer x-icon {
  219. animation: pop 600ms ease-out 1;
  220. }
  221. @keyframes pop {
  222. 0% {
  223. transform: scale(0.7);
  224. }
  225. 40% {
  226. transform: scale(1.2);
  227. }
  228. }
  229. x-peer[drop] x-icon {
  230. transform: scale(1.1);
  231. }
  232. /* Footer */
  233. footer {
  234. position: absolute;
  235. bottom: 0;
  236. left: 0;
  237. right: 0;
  238. align-items: center;
  239. padding: 0 0 16px 0;
  240. text-align: center;
  241. }
  242. footer .logo {
  243. --icon-size: 80px;
  244. margin-bottom: 8px;
  245. color: var(--primary-color);
  246. }
  247. footer .font-body2 {
  248. color: var(--primary-color);
  249. }
  250. @media (min-height: 800px) {
  251. footer {
  252. margin-bottom: 16px;
  253. }
  254. }
  255. /* Dialog */
  256. x-dialog x-background {
  257. background: rgba(0, 0, 0, 0.61);
  258. z-index: 10;
  259. transition: opacity 300ms;
  260. will-change: opacity;
  261. padding: 16px;
  262. }
  263. x-dialog x-paper {
  264. z-index: 3;
  265. background: white;
  266. border-radius: 8px;
  267. padding: 16px 24px;
  268. width: 100%;
  269. max-width: 400px;
  270. box-sizing: border-box;
  271. transition: transform 300ms;
  272. will-change: transform;
  273. }
  274. x-dialog:not([show]) {
  275. pointer-events: none;
  276. }
  277. x-dialog:not([show]) x-paper {
  278. transform: scale(0.1);
  279. }
  280. x-dialog:not([show]) x-background {
  281. opacity: 0;
  282. }
  283. x-dialog .row-reverse>.button {
  284. margin-top: 16px;
  285. margin-left: 8px;
  286. }
  287. x-dialog a {
  288. color: var(--primary-color);
  289. }
  290. /* Receive Dialog */
  291. #receiveDialog .row {
  292. margin-top: 24px;
  293. margin-bottom: 8px;
  294. }
  295. /* Receive Text Dialog */
  296. #receiveTextDialog #text {
  297. width: 100%;
  298. word-break: break-all;
  299. max-height: 300px;
  300. overflow-x: hidden;
  301. overflow-y: auto;
  302. -webkit-user-select: all;
  303. -moz-user-select: all;
  304. user-select: all;
  305. white-space: pre;
  306. }
  307. #receiveTextDialog #text a {
  308. cursor: pointer;
  309. }
  310. #receiveTextDialog #text a:hover {
  311. text-decoration: underline;
  312. }
  313. #receiveTextDialog h3 {
  314. /* Select the received text when double-clicking the dialog */
  315. user-select: none;
  316. pointer-events: none;
  317. }
  318. /* Button */
  319. .button {
  320. padding: 0 16px;
  321. box-sizing: border-box;
  322. min-height: 36px;
  323. min-width: 100px;
  324. font-size: 14px;
  325. line-height: 24px;
  326. font-weight: 700;
  327. letter-spacing: 0.12em;
  328. text-transform: uppercase;
  329. white-space: nowrap;
  330. cursor: pointer;
  331. user-select: none;
  332. background: inherit;
  333. color: var(--primary-color);
  334. }
  335. .button,
  336. .icon-button {
  337. position: relative;
  338. display: flex;
  339. align-items: center;
  340. justify-content: center;
  341. -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
  342. touch-action: manipulation;
  343. border: none;
  344. outline: none;
  345. }
  346. .button:before,
  347. .icon-button:before {
  348. content: '';
  349. position: absolute;
  350. top: 0;
  351. left: 0;
  352. right: 0;
  353. bottom: 0;
  354. background: currentColor;
  355. opacity: 0;
  356. transition: opacity 300ms;
  357. }
  358. .button:hover:before,
  359. .icon-button:hover:before {
  360. opacity: 0.1;
  361. }
  362. .button:before {
  363. border-radius: 8px;
  364. }
  365. .button:focus:before,
  366. .icon-button:focus:before {
  367. opacity: 0.2;
  368. }
  369. button::-moz-focus-inner {
  370. border: 0;
  371. }
  372. /* Icon Button */
  373. .icon-button {
  374. width: 40px;
  375. height: 40px;
  376. }
  377. .icon-button:before {
  378. border-radius: 50%;
  379. }
  380. /* Text Input */
  381. textarea {
  382. width: 100%;
  383. box-sizing: border-box;
  384. border: none;
  385. outline: none;
  386. padding: 16px 24px;
  387. border-radius: 16px;
  388. margin: 8px 0;
  389. line-height: 16px;
  390. font-size: 14px;
  391. font-family: inherit;
  392. resize: none;
  393. background: #f1f3f4;
  394. }
  395. .textareaElement {
  396. box-sizing: border-box;
  397. border: none;
  398. outline: none;
  399. padding: 16px 24px;
  400. border-radius: 16px;
  401. margin: 8px 0;
  402. font-size: 14px;
  403. font-family: inherit;
  404. background: #f1f3f4;
  405. display: block;
  406. overflow: auto;
  407. resize: none;
  408. min-height: 40px;
  409. line-height: 16px;
  410. max-height: 300px;
  411. }
  412. /* Info Animation */
  413. #about {
  414. color: white;
  415. z-index: 11;
  416. overflow: hidden;
  417. pointer-events: none;
  418. text-align: center;
  419. }
  420. #about .fade-in {
  421. transition: opacity 300ms;
  422. will-change: opacity;
  423. transition-delay: 300ms;
  424. z-index: 11;
  425. pointer-events: all;
  426. }
  427. #about:not(:target) .fade-in {
  428. opacity: 0;
  429. pointer-events: none;
  430. transition-delay: 0;
  431. }
  432. #about .logo {
  433. --icon-size: 96px;
  434. }
  435. #about x-background {
  436. position: absolute;
  437. top: calc(32px - 200px);
  438. right: calc(32px - 200px);
  439. width: 400px;
  440. height: 400px;
  441. border-radius: 50%;
  442. background: var(--primary-color);
  443. transform: scale(0);
  444. z-index: -1;
  445. }
  446. /* Hack such that initial scale(0) isn't animated */
  447. #about x-background {
  448. will-change: transform;
  449. transition: transform 800ms cubic-bezier(0.77, 0, 0.175, 1);
  450. }
  451. #about:target x-background {
  452. transform: scale(10);
  453. }
  454. #about .row a {
  455. margin: 8px 8px -16px;
  456. }
  457. /* Loading Indicator */
  458. .progress {
  459. width: 80px;
  460. height: 80px;
  461. position: absolute;
  462. top: 0px;
  463. clip: rect(0px, 80px, 80px, 40px);
  464. --progress: rotate(0deg);
  465. transition: transform 200ms;
  466. }
  467. .circle {
  468. width: 72px;
  469. height: 72px;
  470. border: 4px solid var(--primary-color);
  471. border-radius: 40px;
  472. position: absolute;
  473. clip: rect(0px, 40px, 80px, 0px);
  474. will-change: transform;
  475. transform: var(--progress);
  476. }
  477. .over50 {
  478. clip: rect(auto, auto, auto, auto);
  479. }
  480. .over50 .circle.right {
  481. transform: rotate(180deg);
  482. }
  483. /* Generic placeholder */
  484. [placeholder]:empty:before {
  485. content: attr(placeholder);
  486. }
  487. /* Toast */
  488. .toast-container {
  489. padding: 0 8px 24px;
  490. overflow: hidden;
  491. pointer-events: none;
  492. }
  493. x-toast {
  494. position: absolute;
  495. min-height: 48px;
  496. bottom: 24px;
  497. width: 100%;
  498. max-width: 344px;
  499. background-color: #323232;
  500. color: rgba(255, 255, 255, 0.95);
  501. align-items: center;
  502. box-sizing: border-box;
  503. padding: 8px 24px;
  504. z-index: 20;
  505. transition: opacity 200ms, transform 300ms ease-out;
  506. cursor: default;
  507. line-height: 24px;
  508. border-radius: 8px;
  509. pointer-events: all;
  510. }
  511. x-toast:not([show]):not(:hover) {
  512. opacity: 0;
  513. transform: translateY(100px);
  514. }
  515. /* Instructions */
  516. x-instructions {
  517. position: absolute;
  518. top: 120px;
  519. opacity: 0.5;
  520. transition: opacity 300ms;
  521. z-index: -1;
  522. text-align: center;
  523. }
  524. x-instructions:before {
  525. content: attr(mobile);
  526. }
  527. x-peers:empty~x-instructions {
  528. opacity: 0;
  529. }
  530. /* Responsive Styles */
  531. @media (min-height: 800px) {
  532. footer {
  533. margin-bottom: 16px;
  534. }
  535. }
  536. @media screen and (min-height: 800px),
  537. screen and (min-width: 1100px) {
  538. x-instructions:before {
  539. content: attr(desktop);
  540. }
  541. }
  542. @media (max-height: 420px) {
  543. x-instructions {
  544. top: 24px;
  545. }
  546. footer .logo {
  547. --icon-size: 40px;
  548. }
  549. }
  550. @supports (-webkit-overflow-scrolling: touch) {
  551. /* CSS specific to iOS devices */
  552. html {
  553. position: fixed;
  554. }
  555. x-instructions:before {
  556. content: attr(mobile);
  557. }
  558. }
  559. /*
  560. Color Themes
  561. */
  562. /* Default colors */
  563. :root {
  564. --text-color: #333;
  565. --bg-color: #fff;
  566. --input-bg-color: #f1f3f4;
  567. }
  568. body {
  569. color: var(--text-color);
  570. background-color: var(--bg-color);
  571. }
  572. x-dialog x-paper {
  573. background-color: var(--bg-color);
  574. }
  575. textarea {
  576. color: var(--text-color);
  577. background-color: var(--input-bg-color);
  578. }
  579. .textareaElement {
  580. color: var(--text-color);
  581. background-color: var(--input-bg-color);
  582. }
  583. /* Dark theme colors */
  584. body.dark-theme {
  585. --text-color: #eee;
  586. --bg-color: #121212;
  587. --input-bg-color: #333;
  588. }
  589. /* Styles for users who prefer dark mode at the OS level */
  590. @media (prefers-color-scheme: dark) {
  591. /* defaults to dark theme */
  592. body {
  593. --text-color: #eee;
  594. --bg-color: #121212;
  595. --input-bg-color: #333;
  596. }
  597. /* Override dark mode with light mode styles if the user decides to swap */
  598. body.light-theme {
  599. --text-color: #333;
  600. --bg-color: #fafafa;
  601. --input-bg-color: #f1f3f4;
  602. }
  603. }