/*** General ***/

/*** General ***/

html {
  width: 100%;
  height: 100%;
  display: table;
}

/*** New Loader Integration ***/

/* Fundalul loader-ului care acoperă tot ecranul */
html.loading::before {
  content: '';
  position: fixed;
  inset: 0;
  background: radial-gradient(circle, #1b3a2b 0%, #0f241b 100%);
  z-index: 9999;
}

/* Containerul animației (punctele) */
html.loading::after {
  content: '';
  position: fixed;
  top: 50%;
  left: 50%;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  z-index: 10000;
  margin-top: -7px;
  margin-left: -7px;
  /* Definirea celor 4 puncte prin umbre multiple la distanțe diferite */
  /* Format: x y blur spread color */
  box-shadow: 
    30px 0 0 0 #70b67b, 
    21px 21px 0 0 #9fe3a2, 
    0 30px 0 0 #c6f6d5, 
    -21px 21px 0 0 #4caf50;
  animation: orbit-simple 1.2s linear infinite;
}

@keyframes orbit-simple {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Eliminarea loader-ului când clasa 'loading' este înlocuită cu 'loaded' */
html.loaded::before,
html.loaded::after {
  display: none;
}

body {
  width: 100%;
  display: table-cell;
  font: normal 16px/1 Calibri, Arial, sans-serif;
  margin: 0;
  -ms-scroll-chaining: none;
  overscroll-behavior: none;
  -ms-user-select: none;
  -moz-user-select: none;
  -webkit-user-select: none;
  user-select: none;
  vertical-align: middle;
}

:focus {
  outline: none;
}

a {
  cursor: pointer;
}
a.link {
  color: #00e;
  color: -webkit-link;
}
a:hover,
a:focus,
a.link:hover,
a.link:focus {
  color: #b00;
}
a:active,
a.link:active {
  color: #e00;
}
a:hover img,
a:focus img,
#wordresult #play:hover,
#back:hover,
#back:active {
  -webkit-filter: brightness(0.85);
  filter: brightness(0.85);
}
a.link,
picture {
  display: inline-block;
}
a.link.disabled,
.button.disabled,
.button[disabled],
select[disabled] {
  cursor: default;
  -webkit-filter: grayscale(1);
  filter: grayscale(1);
}

h3.opponent {
  color: #cd5c5c;
}
h3.player {
  color: #499b33;
}

select {
  width: 114px;
  background: none;
  border: none;
  cursor: pointer;
}

tr.header {
  background: #3a3a3a;
}
tr.header option {
  color: #000;
}
tr.header select:not(:checked) {
  color: #fff;
}
tr.highlight {
  background: #fefeba;
  font-weight: bold;
}

.centered {
  margin: 0 auto;
}

.debug {
  line-height: 1.2;
}

#app {
  position: relative;
  display: table;
  opacity: 0; /* Prevent FOUC */
  margin: 0 auto;
  text-align: center;
}
/* NOTE: We need to add shadow to pseudo-element because 'filter' messes up REDIPS.drag. */
#app:after {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #3a3a3a;
  border-radius: 8px;
  content: '';
  -webkit-filter: drop-shadow(2px 4px 6px #8d702a);
  filter: drop-shadow(2px 4px 6px #8d702a);
  z-index: -1;
}

html.loaded #app {
  opacity: 1;
  -webkit-transition: opacity 0.6s;
  transition: opacity 0.6s; /* 0.3s spinner + 0.3s */
}
#app > p { /* Unsupported browser */
  max-width: 58%;
  font-size: 110%;
  line-height: 1.2;
  margin: 5% auto;
}
#app > p > strong {
  color: #b8860b; /* darkgoldenrod */
  font-size: 72px;
}
#app > table {
  margin: 0 auto;
}

footer img,
picture img {
  -webkit-animation: fade-in 1s forwards;
  animation: fade-in 1s forwards;
}
@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/*** Buttons ***/

/* Based on CSS generated by CSSButtonGenerator.com */
.button {
  -webkit-box-shadow: inset 0 1px 0 0 #caefab;
  box-shadow: inset 0 1px 0 0 #caefab;
  background: -webkit-gradient(linear, left top, left bottom, color-stop(0.05, #77d42a), color-stop(1, #5cb811));
  background: linear-gradient(to bottom, #77d42a 5%, #5cb811 100%);
  background-color: #77d42a;
  border: 1px solid #268a16;
  border-radius: 6px;
  color: #303108;
  cursor: pointer;
  display: inline-block;
  font: bold 12px/1 'Trebuchet MS', Arial, sans-serif;
  padding: 6px 10px;
  text-decoration: none;
  text-shadow: 1px 1px 0 #aade7c;
  vertical-align: middle;
}
.button:not([disabled]):hover,
.button:not([disabled]):focus {
  background: -webkit-gradient(linear, left top, left bottom, color-stop(0.05, #5cb811), color-stop(1, #77d42a));
  background: linear-gradient(to bottom, #5cb811 5%, #77d42a 100%);
  background-color: #5cb811;
}
.button:active {
  position: relative;
  top: 1px;
}

.button.secondary {
  -webkit-box-shadow: inset 0 1px 0 -2px #fff6af;
  box-shadow: inset 0 1px 0 -2px #fff6af;
  background: -webkit-gradient(linear, left top, left bottom, color-stop(0.05, #ffec64), color-stop(1, #ffab23));
  background: linear-gradient(to bottom, #ffec64 5%, #ffab23 100%);
  background-color: #ffec64;
  border: 1px solid #ffaa22;
  color: #333;
  text-shadow: 1px 1px 0 #ffee66;
}
.button.secondary:not([disabled]):hover,
.button.secondary:not([disabled]):focus {
  background: -webkit-gradient(linear, left top, left bottom, color-stop(0.05, #ffab23), color-stop(1, #ffec64));
  background: linear-gradient(to bottom, #ffab23 5%, #ffec64 100%);
  background-color: #ffab23;
}

.button.wide {
  width: 98% !important;
}

.buttons {
  margin-top: 1rem;
  text-align: center;
}

/*** Scoreboard ***/

#scoreboard {
  width: 98%;
  height: 10vh;
  display: none;
  margin: 2% 1% 1.5% 1%;
}
#scoreboard td {
  padding: 0;
}
#scoreboard .logo {
  position: relative;
  width: 48%;
  overflow: hidden;
  padding-top: 4px;
  vertical-align: top;
}
#scoreboard .logo img {
  position: relative;
  width: 100%;
  max-height: 50px;
  max-width: 300px;
  background: #3a3a3a;
  z-index: 1;
}
#scoreboard .spacer {
  width: 2%;
}

#score-opponent,
#score-player {
  width: 24%;
  border-radius: 6px;
  color: #fff;
  font: normal 180%/1.1 'Maven Pro', Arial, sans-serif;
}
#score-opponent {
  background: #303a3b linear-gradient(-80deg, #8c2b2b, #001e22); /* #cd5c5c luminosity * 0.625 */
  -webkit-box-shadow: 1px -1px 1px 0 #555 inset, 0 0 1em 0 rgba(0, 0, 0, 0.6) inset;
  box-shadow: 1px -1px 1px 0 #555 inset, 0 0 1em 0 rgba(0, 0, 0, 0.6) inset;
  text-shadow: 0 0 0.5em #cd5c5c;
}
#score-player {
  background: #303a3b linear-gradient(80deg, #2e6020, #001e22); /* #499b33 luminosity * 0.625 */
  -webkit-box-shadow: -1px -1px 1px 0 #555 inset, 0 0 1em 0 rgba(0, 0, 0, 0.6) inset;
  box-shadow: -1px -1px 1px 0 #555 inset, 0 0 1em 0 rgba(0, 0, 0, 0.6) inset;
  text-shadow: 0 0 0.5em #499b33;
}

#status {
  position: absolute;
  left: 0;
  bottom: 2px;
  width: 100%;
  height: 15px;
  color: #b99337;
  font-size: 12px;
  line-height: 15px;
  opacity: 1;
  -webkit-transition: opacity 0.1s;
  transition: opacity 0.1s;
  white-space: nowrap;
}
#status.transition {
  opacity: 0;
}
#status:not(.marquee) {
  overflow: hidden;
  text-overflow: ellipsis;
}

.marquee {
  -webkit-animation: marquee 4s linear;
  animation: marquee 4s linear;
}
@keyframes marquee {
  0% { transform: translateX(0%); }
  50% { transform: translateX(-100%); }
  50.001% { transform: translateX(100%); }
  100% { transform: translateX(0%); }
}

/*** Gameboard ***/

#board {
  width: calc(100vh - 12vw);
  min-width: 480px;
  background: #3a3a3a;
  border-radius: 8px 0 0 8px;
  display: table-cell;
  padding: 0 4px;
}

table.board {
  table-layout: fixed;
}
table.board td {
  background-color: #e0e0b0;
}
table.board td.ST,
table.board td.DL,
table.board td.DW,
table.board td.TL,
table.board td.TW {
  background-position: center;
  background-repeat: no-repeat;
  background-size: 87%;
}

/* Scalable square cells - https://stackoverflow.com/a/22835903/452587 */
table.board td,
#drag .opponent td[id],
#drag .player td[id] {
  position: relative;
  width: 6.666666666666667%; /* 100 / 15 */
  min-width: 35px;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
  padding: 2px;
}
table.board td:after,
#drag .opponent td[id]:after,
#drag .player td[id]:after {
  content: '';
  display: block;
  margin-top: calc(100% + 1px);
}

#drag > table {
  position: relative;
  width: 100%;
  border-collapse: collapse;
}
#drag td {
  border: 1px solid #fff;
}

#drag .opponent td.mark {
  position: relative;
  text-align: right;
}
#drag td.mark h1 {
  position: absolute;
  top: 50%;
  left: 4px;
  width: 51%;
  margin: 0;
  transform: translateY(-50%);
}
#drag td.mark h1 img {
  display: block;
}
#drag .opponent .button {
  width: 21%;
}

#highscores img {
  width: 100%;
  max-height: 15px;
}
#restart img {
  width: 50%;
  max-height: 18px;
}

#drag .button {
  width: 23%;
  min-height: 30px;
  font-size: calc(10px + 0.25vw);
  margin: 0 1%;
  padding: 3px 5px;
}
html[lang="vi"]:not(.mobile) #drag .button {
  letter-spacing: normal;
  line-height: 0.9;
}
#drag #toggle {
  width: 52%;
}

/* Racks */
#drag .opponent,
#drag .player {
  margin: 0 auto;
}
#drag .opponent td,
#drag .player td {
  border: none;
}
#drag .opponent td:first-child,
#drag .player td:last-child {
  padding: 2px;
}
#drag .opponent td .drag {
  background-color: #e7ab83;
  color: #e7ab83;
  -webkit-transition: background-color 0.3s, color 0.3s;
  transition: background-color 0.3s, color 0.3s;
}
#drag .opponent td.on .drag,
#drag .opponent td .drag[style] {
  background-color: #fff;
  color: #000;
}

/* Drag objects (tiles) */
.drag {
  -ms-flex-align: center;
  -webkit-box-align: center;
  align-items: center;
  background: #fff;
  border-radius: 4px;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
  display: -ms-flexbox;
  display: -webkit-box;
  display: flex;
  font-size: 18px;
  font-size: calc(14px + 0.3vw);
  -ms-flex-pack: center;
  -webkit-box-pack: center;
  justify-content: center;
  line-height: 1.1;
  opacity: 0.9;
  padding-top: 2px;
  text-align: center;
  z-index: 10;
}

table.board td .drag,
#drag .opponent td[id] .drag,
#drag .player td[id] .drag {
  position: absolute;
  top: 2px;
  left: 2px;
  width: calc(100% - 4px);
  height: calc(100% - 4px);
}

/* Tile border for opponent */
.t1 {
  border: 2px solid #499b33;
}

/* Tile border for player */
.t2 {
  border: 2px solid #cd5c5c; /* indianred */
}

.human-computer .drag.t1:not(.off) {
  cursor: move;
}

#redips_clone {
  display: none;
}

/* Tile points */
.drag sup {
  line-height: 1;
  margin-top: -33%;
}
.drag sup > small {
  font-size: 10px;
  letter-spacing: -1px;
  margin-left: 1px;
}

.tile {
  width: 41px;
  height: 42px;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
  padding: 2px;
}
.tile .drag {
  height: 100%;
}

/*** Game Info ***/

#back {
  position: absolute;
  left: 0;
  width: 48px;
  height: 48px;
  background: none;
  border: none;
  color: #fff;
  line-height: 48px;
  padding: 0;
}
#back svg {
  margin: 14px;
}

#score {
  position: relative;
  min-width: 300px;
  background: #fafafa;
  background: -webkit-gradient(linear, left top, left bottom, from(#f7fef7), to(#fafafa));
  background: linear-gradient(#f7fef7, #fafafa);
  border-radius: 0 8px 8px 0;
  display: table-cell;
  vertical-align: top;
}
#score .container {
  position: absolute;
  width: 100%;
  height: 100%;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
  display: -ms-flexbox;
  display: -webkit-box;
  display: flex;
  -ms-flex-flow: column;
  -webkit-box-direction: normal;
  -webkit-box-orient: vertical;
  flex-flow: column;
  padding: 2px 2px 0 2px;
}
#score header {
  position: relative;
  height: 48px;
  background: #3a3a3a;
  display: none;
}
#score header > img {
  position: absolute;
  top: 8px;
  right: 8px;
}
#score header .button {
  width: 20%;
  height: 32px;
  margin: 8px;
  padding-left: 5%;
  padding-right: 5%;
}
#score h2 {
  height: 26px;
  background: #f5f5dc; /* beige */
  border-top-right-radius: 8px;
  color: #c39b3c; /* page bg color luminosity 50% */
  font-size: 16px;
  line-height: 25px;
  margin: 0;
  text-transform: uppercase;
}
#score table.gameinfo {
  width: 100%;
  border-collapse: collapse;
  text-align: right;
}
#score table.gameinfo td:first-child { /* Opponent */
  width: 57%;
  padding-left: 2%;
  white-space: nowrap;
}
#score table.gameinfo td:last-child { /* Player */
  padding-right: 2%;
}

#score tr {
  height: 21px;
}
#score tr.level {
  height: 30px;
}
#score tr.ruler {
  height: 2px;
  background: #adadad;
}

#history {
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
  -ms-flex: 1;
  -webkit-box-flex: 1;
  flex: 1;
  font-size: 14px;
  overflow: auto;
  padding: 2%;
  text-align: left;
}
#history table {
  width: 100%;
  border-collapse: collapse;
}
#history tr.player-0 {
  color: #499b33;
}
#history tr.player-1 {
  color: #cd5c5c;
}
#history td:first-child {
  width: 99%;
}
#history img {
  display: block;
  margin: 3px 0 0 10px;
}

#level {
  width: 31px;
  cursor: help;
  display: inline-block;
  font: normal 28px/1 'Trebuchet MS', sans-serif;
  letter-spacing: -1px;
  text-align: left;
}
a.down img {
  -ms-transform: scaleY(-1);
  -webkit-transform: scaleY(-1);
  transform: scaleY(-1);
}

#oscore,
#pscore {
  font-weight: bold;
}

footer {
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
  font-size: 12px;
  line-height: 30px;
  padding: 4%;
}
footer img {
  display: block;
}
footer span {
  color: #999;
  float: left;
}
footer .social {
  float: right;
}

/*** High Scores ***/
.highscores #modal-content {
  background: url(../pics/highscores_bg.jpg);
}
#highscores {
  width: 100%;
  border-collapse: collapse;
}
#highscores select {
  width: 100%;
}
#highscores td,
#highscores th {
  border: 1px solid #adadad;
  padding: 4px;
}
#highscores td:last-child,
#highscores th:last-child {
  text-align: right;
}

/*** Modal ***/

#modal-mask,
#modal-container {
  position: fixed;
  display: none;
  opacity: 0;
  -webkit-transition: opacity 0.3s;
  transition: opacity 0.3s;
}
#modal-mask {
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #000;
  z-index: 200;
}
#modal-mask.on {
  opacity: 0.7;
}
#modal-container {
  top: calc(50% + 6px); /* Titlebar height / 2 */
  left: 50%;
  min-width: 240px;
  max-width: 480px;
  max-height: 95%;
  text-align: center;
  -ms-transform: translate(-50%, -50%);
  -webkit-transform: translate(-50%, -50%);
  transform: translate(-50%, -50%);
  z-index: 201;
}
#modal-container.on {
  opacity: 1;
}
#modal-inner:before {
  position: absolute;
  top: -12px;
  left: 0;
  width: 100%;
  height: 13px;
  background: #99b;
  border-top: 1px solid #78a3f2;
  border-left: 1px solid #78a3f2;
  border-bottom: 2px solid #000;
  border-right: 1px solid #204095;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
  content: '';
}
#modal-content {
  position: relative;
  width: 100%;
  background: #fff;
  border-left: 1px solid rgba(0, 0, 0, 0.9);
  border-bottom: 1px solid rgba(0, 0, 0, 0.9);
  border-right: 1px solid rgba(0, 0, 0, 0.8);
  -webkit-box-shadow: 0 3px 15px rgba(0, 0, 0, 0.4);
  box-shadow: 0 3px 15px rgba(0, 0, 0, 0.4);
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
  display: inline-block;
  overflow: auto;
  padding: 1rem;
  text-align: left;
}
#modal-container.center #modal-content {
  text-align: center;
}
#modal-content h3 {
  margin: 0;
}

#letters .button {
  width: 32px;
  height: 32px;
  line-height: 32px;
  margin: 1%;
  padding: 0;
  text-align: center;
}

#swaptable td {
  cursor: pointer;
}
#swaptable td.to-swap .drag {
  background: #1a1a1a;
  border-color: #be74d2;
  color: #fff;
}

#gameover td {
  opacity: 0;
  -ms-transform: scale(0);
  -webkit-transform: scale(0);
  transform: scale(0);
}
#gameover td.on {
  opacity: 1;
  -ms-transform: scale(1);
  -webkit-transform: scale(1);
  transform: scale(1);
  -webkit-transition: opacity 0.3s;
  transition: all 0.3s;
}
#modal-container.gameover h3,
#modal-container.gameover ul {
  padding: 0;
  text-align: center;
}
#modal-container.gameover ul li {
  display: inline-block;
}
#modal-container.gameover ul li:first-child:after {
  width: 70px;
  color: #999;
  content: 'vs';
  display: inline-block;
  font-weight: bold;
}

/*** VDict ***/

#suggestresult,
#wordresult {
  font-size: 95%;
  -ms-user-select: text;
  -moz-user-select: text;
  -webkit-user-select: text;
  user-select: text;
}
#suggestresult > ul {
  margin-top: 0;
}
#suggestresult #suggestionlist {
  list-style: none;
  padding: 0;
}
#wordresult h1 {
  display: inline-block;
  margin-top: 0;
  margin-bottom: 10px;
}
#wordresult ul {
  padding-left: 1rem;
}
#wordresult ul.list2 {
  color: #666;
  margin-top: 4px;
}
#wordresult li > b {
  font-weight: normal;
}
#wordresult .example-original {
  font-style: italic;
}
#wordresult .phanloai {
  background: #e6e6e6;
  border-radius: 4px;
  display: block;
  font-weight: bold;
  margin: 6px 0;
  padding: 6px;
}
#wordresult #play {
  width: 24px;
  height: 24px;
  background: url(../pics/play.svg) no-repeat;
  background-size: 24px;
  display: inline-block;
  margin-left: 4px;
  vertical-align: text-bottom;
}
#wordresult #play span {
  display: none;
}

/*** Mobile ***/

html.mobile body {
  vertical-align: top;
}
html.mobile #app {
  position: static;
  -webkit-box-shadow: 0 3px 15px rgba(0, 0, 0, 0.5);
  box-shadow: 0 3px 15px rgba(0, 0, 0, 0.5);
}
html.mobile #app:after,
html.error #app:after {
  content: none;
}
html.mobile #drag .button {
  font-size: calc(12px + 0.25vw);
  line-height: 1.5;
}
html.mobile #scoreboard {
  display: table;
}
html.mobile #board,
html.mobile #score {
  border-radius: 0;
}
html.mobile #board {
  width: 100%;
  min-width: 0;
  padding: 0;
}
html.mobile table.board td {
  padding: 0;
}
html.mobile table.board td,
html.mobile #drag .opponent td[id],
html.mobile #drag .player td[id] {
  min-width: 0;
}
html.mobile .drag {
  font-size: calc(18px + 1vw);
}
html.mobile .drag sup {
  margin-top: -45%;
}
html.mobile table.board td .drag {
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 3px;
  border-width: 1px;
  font-size: calc(12px + 0.3vw);
}
html.mobile table.board td .drag sup > small {
  font-size: calc(6px + 0.3vw);
}
html.mobile #drag .player td.mark {
  padding: 2px 0 4px 0;
}
html.mobile .tile {
  width: 12.5%; /* 100 / 8 */
  min-width: 32px;
  height: auto;
  padding: 0.4%;
}
html.mobile .tile .drag {
  font-size: calc(16px + 1vw);
  padding: 3px 2px;
}
html.mobile #board,
html.mobile #score {
  -webkit-transition: transform 0.3s;
  transition: transform 0.3s;
}
html.mobile #score {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  -ms-transform: translateX(100%);
  -webkit-transform: translateX(100%);
  transform: translateX(100%);
  z-index: 10;
}
html.mobile.gameinfo #board {
  -ms-transform: translateX(-100%);
  -webkit-transform: translateX(-100%);
  transform: translateX(-100%);
}
html.mobile.gameinfo #score {
  -ms-transform: translateX(0%);
  -webkit-transform: translateX(0%);
  transform: translateX(0%);
}
html.mobile #score .container {
  padding: 0;
}
html.mobile #score header {
  display: block;
}
html.mobile #modal-container.wide {
  width: 95%;
}
html.mobile #modal-content {
  padding: 4%;
}

@media (max-height: 649px) {
  #drag .button {
    font-size: calc(8px + 0.25vw);
    letter-spacing: -0.5px;
  }
  #drag .opponent td:first-child,
  #drag .player td:last-child {
    padding: 2px 0;
  }
}
