/*Copyright (C) 2019-2022 The Xanado Project https://github.com/cdot/Xanado
  License MIT. See README.md at the root of this distribution for full copyright
  and license information. Author Crawford Currie http://c-dot.co.uk*/
/**
 * CSS shared by all XANADO html
 */

body {
  font-family: helvetica, arial, sans-serif;
  font-size: 100.01%; /* 100.01% good practice, but with 62.5% => 1em == 10px (factor of 10) GENERALLY: 1em = 12pt = 16px = 100% */
  color: black;
  margin: 0;

  padding: 0;

  border: none;

  background: url('../images/baize.jpg');

  -webkit-touch-callout: none;

  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;

  user-select: none;
}

/* Display while active UI is loading */
.loading {
  margin: 1em;
}

/* Don't display until active UI is ready to display */
.waiting {
  display: none;
}

/* Xanado logo image */
.xanado-logo {
  margin-top: 1em;
}

/* Shaded box */
.surround-shade {
  -webkit-box-shadow: 0 0 0.5em #000000;
  -moz-box-shadow: 0 0 0.5em #000000;
  -ms-box-shadow: 0 0 0.5em #000000;
  -o-box-shadow: 0 0 0.5em #000000;
  box-shadow: 0 0 0.5em #000000;
}

/* Strip all padding off element */
.no-padding {
  padding: 0 !important;
}

/* Generic highlight for a button that does something risky e.g. a delete */
.risky {
  /*background-color: transparent;*/
  color: #c33;
}

/* Dialogs */

@media screen and (max-width: 800px) {
  .ui-dialog {
    top: 0;
    bottom: 0;
    min-width: 100vw;
    min-height: 100vh;
  }
}

/* Initially hidden */
.dialog {
  display: none;
}

/* A row in a tab pane in a dialog box */
.dialog-row {
  margin-top: 0.5em;
  margin-bottom: 0.5em;
  position: relative;
  box-sizing: border-box;
  width: 100%;
}

.dialog-row input[type=text],
.dialog-row input[type=password] {
  width: 100%;
}

/* Disable an entire dialog titlebar */
.no-title .ui-dialog-titlebar {
  display: none;
}

/* Disable a dialog close button */
.no-close .ui-dialog-titlebar-close {
  display: none;
}

/* Make sure a selectmenu is in front of the containing dialog */
.ui-selectmenu-menu {
  z-index: 3000;
}

.ui-button {
  padding: 0.15em 0.25em 0.15em 0.25em;
  display: inline-block;
  max-width: 100%;
  margin-left: 0.2em;
  margin-right: 0.2em;
  overflow: hidden;
  position: relative;
  /*transform: translatez(0);*/
  text-decoration: none;
  box-sizing: border-box;
  font-weight: normal;
  box-shadow: 0.1em 0.1em 0.3em rgba(0,0,0,0.9);
}

.ui-tooltip {
  /* Allow the tooltip to expand beyond the borders of a containing dialog */
  width: 100%;
}

/**
 * CSS used to style the player table. This is rendered on the "client_game" and
 * "client_games" interfaces by the same code, so has shared CSS
 */
.icon-robot {
  background-image: url('../images/robot-face.svg') !important;
  background-size: 16px 16px;
}

.icon-person {
  background-image: url('../images/person.svg') !important;
  background-size: 16px 16px;
}

.icon-winner {
  background-image: url('../images/winner.svg') !important;
  background-size: 16px 16px;
  color: #f3c716ff;
}

.player-table tr.player-row {
}

.player-table td {
  vertical-align: middle;
}

.player-table .connect-state {}

.player-table .connect-state.online {
  color: green;
}

.player-table .connect-state.offline {
  color: #FF0000;
}

/* The pointer */
.player-table td.turn-pointer {
  visibility: hidden;
  color: green;
}

/* whosTurn is added to the table row when it's the player's turn. This
 * enables the td that contains the pointer */
.player-table tr.whosTurn td.turn-pointer {
  visibility: inherit;
}

.player-table td.player-name {
  font-weight: bold;
}

/* player is missing their next turn */
.player-table .miss-turn {
  text-decoration:line-through;
}

.player-table td.remaining-tiles {}

.player-table td.player-score {}

/**
 * Styling specific to the "games" interfaces
 */
body.games-ui {
  color: white;
  margin-left: 3em;
  margin-right: 3em;
  font-size: 1.2em;
}

/* Third party signin logos */
.provider-logo {
  text-align: center;
}

.provider-logo img {
  width: 1.5em;
  height: 1.5em;
}

/* Wrap around signing options */
#signinState {
  float: right;
  margin-top: 1em;
}

#signin-button {
  margin: 0.5em;
}

/* wrap around the sign out button */
.signed-in {
}

#gamesCumulative {
  display: none;
}

/* Wrap around the games list */
#gamesList {
  margin-bottom: 1.5em;
  margin-top: 0.5em;
  width: 100%;
  display: none;
  -webkit-box-shadow: 0 0 0.5em #000000;
  -moz-box-shadow: 0 0 0.5em #000000;
  -ms-box-shadow: 0 0 0.5em #000000;
  -o-box-shadow: 0 0 0.5em #000000;
  box-shadow: 0 0 0.5em #000000;
  color: #333333;
  text-align: center;
}

#gamesList > thead > tr {
  border: 1px solid;
  padding: 0.2em;
  background-color: #F0E7E0;
  padding: 0.4em 0.2em 0.4em 0.2em;
}

/* A game in the games table */
#gamesList .game {
  border: 1px solid;
  background-color: #F7F7E3;
  padding: 0.4em 0.2em 0.4em 0.2em;
}

/* The key identifying the game */
#gamesList .h-key {
  font-size: smaller;
}

/* State of the game e.g. "Game over" */
#gamesList .h-state {
  margin-left: 1em;
  font-weight: bold;
}

.h-edition {
  font-weight: bold;
}

/* Style list of invitees in the InvitePlayersDialog */
.invitee:after {
  content: ", ";
}

.invitee:last-child:after {
  content: "";
}

.invitee {
  font-style: italic;
}

/*------------ PORTRAIT SCREEN ------------*/

@media screen and (max-aspect-ratio: 1/1) {
  body {
    margin: 10px;
  }

  #signinState {
    text-align: center;
    margin-bottom: 10px;
  }

  .game-key {
    display: none;
  }

  button[name=twist] {
    margin-bottom: 0.2em;
  }
}

/**
 * Styling specific to the "game" interfaces
 */

/* All divs within the controls area */
.block {
  min-width: 25vw;
  max-width: 100vw;
  background-color: #F7F7E3;
  border-color: #DCDCC6;

  border-style: solid;
  
  -webkit-border-radius: 0.4em;
  -moz-border-radius: 0.4em;
  -ms-border-radius: 0.4em;
  -o-border-radius: 0.4em;
  border-radius: 0.4em;

  margin: 2px;
  padding: 2px;
}

/* Generic */
.player-name {
  font-weight: bold;
}

/* Title in one of the blocks */
.block-title {
  font-size: 120%;
  font-weight: bold;
  color: brown;
}

/*------------ LOGIN BLOCK ------------*/

/* Settings and signout div */
#undoButton {
  display: none;
}

#redoButton {
  display: none;
}

/*------------ "Scores" block ------------*/

/* The #controls > div with the scores and letter bag state */
#scoresBlock {
  min-height: 4vw;
}

#scoresBlock > .observerCount {
  font-size: smaller;
}

/* The #scoresBlock > div that has the letter bag status */
#scoresBlock .letterbag {
  margin: 0.2vw;
}

/* Clock in timed games */
#scoresBlock .player-clock {
  visibility: none;
  color: #080;
}

/* Clock highlights */
#scoresBlock .tick-alert-low {
  color: #cc5801 !important;
}

#scoresBlock .tick-alert-medium {
  color:#fcae1e !important;
}

#scoresBlock .tick-alert-high {
  color: red !important;
}

/*------------ PLAY BLOCK ------------*/

#playBlock {
}

/* #yourPlayBlock > div showing the proposed move */
#playBlock .your-move {
  margin-bottom: 0.2vw;
}

/* Button for making a play */
#playBlock .action-button {
  font-size: 130%;
}

/*------------ CHAT BLOCK ------------*/

#chatBlock {
  max-height: 8em;
}

#chatInput {
  margin-top: 0.25em;
  width: 95%;
}

/* Who sent a chat message */
#chatBlock .chat-sender {
  font-weight: bold;
}

#chatBlock .chat-message.warning {
  color: #B00;
}

/*------------ LOG BLOCK ------------*/

/* The div with the game events log */
#logBlock {
}

/* container around all messages */
.messages {
  font-size: 80%;
  overflow: auto;
  max-height: 14em;
}

/* Wrapper around each individual entry in the log */
.message {
}

.game-state {
  margin-top: 0.5em;
  font-weight: bold;
}

/* The player who just had a turn */
.turn-player {
  margin-top: 0.4em;
  padding-left: 0.5em;
}

/* Details about the turn */
.turn-detail {
  margin-left: 2em;
}

.word-score, .turn-total {
  margin-left: 0.2em;
  margin-right: 0.25em;
}

/* Narrative generated when a player rack is empty */
.turn-narrative {
  font-size: 110%;
  margin-top: 0.5em;
  color: #950000
}

/* Description of points gained and lost from final racks */
.game-end-adjustments .rack-adjust {}

/* Description of points lost due to overtime */
.game-end-adjustments .time-adjust {}

/* A control placed in the log */
.turn-control {
  margin: 0.3em 0 0.3em 0;
}

/* Button in the log area; challenge, take back */
.turn-control button {
  font-size: 120%;
}

/* an individual word in a list of words in the log */
.word {
  font-style: italic;
  margin-left: 0.25em;
}

/* an individual word score in a list of words in the log */
.word-score {
  font-size: 0.75em;
}

/*------------ BOARD ------------*/

/* Highlight for the last played word */
#board .last-placement {
  background-color: #E2E298!important;
}

/* Highlight for a hint placement */
#board .hint-placement {
  background-color: #E2FF98!important;
}

/* typing cursor (there can be only one) */
#typingCursor {
  display: none;
  font-family: symbol;
  font-size: 180%;
  font-weight: bold;
  color: green;
  background-color: #D0F2D0;
  width: 100%;
  height: 100%;
  text-align: center;
  position: relative;
  z-index: 2000;
  opacity: 0.8;
 -webkit-border-radius: 10%;
 -moz-border-radius: 10%;
 -o-border-radius: 10%;
 -ms-border-radius: 10%;
 -khtml-border-radius: 10%;
 border-radius: 10%;
}

/* Right-facing arrow */
#typingCursor:before {
  content: "\261E";
}

/* Down-facing arrow */
#typingCursor.down:before {
  content: "\261F";
}

/*------------ PLAY RACK ------------*/

#playRack {
  margin-top: 0.5em;
  display: flex;
  flex-direction: row;
  justify-content: space-around;
  align-items: center;
}

#distributionButton {
  font-weight: bold;
}

#playRack .rack{
}

#playRack .controls {
  display: flex;
}

/* rack control buttons - shuffle, unplace */
#playRack .shuffle-button {
  font-size: 1.2em;
}

#playRack .unplace-button {
  font-size: 1.2em;
  visibility: hidden;
}

/*------------ SWAP RACK ------------*/

#swapRack {
  margin-bottom: 0.3em;
}

/* Background letters behind the swap rack */
#swapRack .underlay {
  padding-top: 7%; /* looks nicer */
  font-size: 3em;
  color: rgba(60, 60, 80, 0.3);
}

/*------------ DIALOGS ------------*/

/* Blank letter requester dialog */
#blankDialog .letterTable td {
  font-size: 1.5em;
  text-align: center;
  border-color: #DCDCC6;
  border-style: solid;
  
  -webkit-border-radius: 0.4em;
  -moz-border-radius: 0.4em;
  -ms-border-radius: 0.4em;
  -o-border-radius: 0.4em;

  border-radius: 0.4em;
  border-collapse: separate;
  border-spacing: 0 0;

  border-width: 0.1em;
}

/*------------ LANDSCAPE SCREEN ------------*/
@media screen and (min-aspect-ratio: 1/1) {
  #playBlock .action-button {
    display: inline-block;
  }

  #playRack .action-button {
    display: none!important;
  }

  /* Wraps UI components in game */
  .game-interface {
    display: flex;
    justify-content: center;
    flex-wrap: nowrap;
  }
}

/*------------ PORTRAIT SCREEN ------------*/

@media screen and (max-aspect-ratio: 1/1) {

  /* Override Surface - Board is full width */
  #board {
    margin-top: 30px;
    margin-left: 0;
    width: 100vw;
    aspect-ratio: 1/1;
    height: auto;
    padding: 2px;
  }

  /* Blocks are full width. flex layout deals with it. */
  #blocks {
    width: 100%;
    margin: 0;
  }

  #playBlock .action-button {
    display: none;
  }

  #playRack .action-button {
    display: inline-block;
  }

  /* Wraps UI components in game */
  .game-interface {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
  }

  /* Position the signin block above the board */
  #signinBlock, #standalone_topBlock {
    position: absolute;
    top: 0;
    left: 2vw;
    width: 95vw;
  }
}

/* A surface is a table, the cells of which represent the squares */
.Surface {
  font-family: helvetica, arial, sans-serif;
  border-collapse: separate;
  border-spacing: 0;

  border-width: 2px;
  border-style: solid;
  border-color:  #54534A;

  margin: 0;
  padding: 1px;

  background-color: #AAA38E;

  max-width: 80vw;
  table-layout: fixed;
}

/* Each square may have an underlay, which gives information such as score
 * multipliers */

/* The underlay is a floating div that will be overlain by any tile that
 * is placed on the square */
.Surface .underlay {
  /* Layout of the underlay container; it fully fills the td it is within */
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 0;

  /* Layout of contained items */
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

/* The text is taken from an attribute on the underlay */
.Surface .underlay:before {
  content: attr(data-long);
}

/* Font size for full text in underlay is computed in JS */
.Surface td.score-multiplier .underlay {
  padding-top: 5%;
}

@media screen and (max-width: 800px) {
  /* if screen width is too small, use an acronym instead of long text to
     describe the score multiplier */
  .Surface .underlay:before {
    content: attr(data-short);
  }

  /* Increase font size for acronym in underlay */
  .Surface td.score-multiplier .underlay {
    font-size: 200%;
  }
}

.Surface tr {
  margin: 0;
  padding: 0;
  border: none;
}

.Surface td {
  width: 2.3em;      /* Edited in code */
  height: 2.3em;     /* Edited in code */
  font-size: 2em;    /* Edited in code */
  line-height: 1em;  /* Edited in code */

  background-color: #BEB9A6;
  border-style: solid;
  border-width: 2px;
  border-color: #AAA38E;
  white-space: normal;
  overflow: hidden;
  padding: 0;
  aspect-ratio: 1/1;
  /* Must be positioned relative to allow absolute positioning of
   * contained underlay and tile */
  position: relative;
}

/* double-word squares */
.Surface td.square-D,
.Surface td.square-M {
  background-color: #FBBBB9;
  color: #F75D59;
}

/* The centre double-word square */
.Surface td.square-M .underlay {
  font-size: 300%;
}

/* triple-word squares */
.Surface td.square-T {
  background-color: #F75D59;
  color: #8B0000;
}

/* quad-word squares */
.Surface td.square-Q {
  background-color: #a21505;
  color: #eeeeee;
}

/* double-letter squares */
.Surface td.square-d {
  background-color: #A0CFEC;
  color: #157DEC;
}

/* triple-letter squares */
.Surface td.square-t {
  background-color: #157DEC;
  color: #000080;
}

/* quad-letter squares */
.Surface td.square-q {
  background-color: #0e6993;
  color: #eeeeee;
}

/* Applied when a square is active as a potential drop target */
.Surface td.drop-active {
  border-color: #333333 !important;
}

/* A tile. Tiles can be dropped on Surfaces */

.Tile {
  width: 2em;     /* Edited in code */
  height: 2em;    /* Edited in code */
  font-size: 1em; /* Edited in code */

  display: block;
  cursor: move;

  margin: 0;
  padding: 0;

  /* Code in client_game.js calculates a suitable tile size */
  aspect-ratio: 1/1;

  background-color: #F7F7E3;
  border-color: #DCDCC6;
  border-style: solid;
  border-width: 3px;

  color: #333333;

/*  -webkit-border-radius: 2px;
  -moz-border-radius: 2px;
  -ms-border-radius: 2px;
  -o-border-radius: 2px;*/
  border-radius: 6px;

  -webkit-box-shadow: 0 0 2px #000000;
  -moz-box-shadow: 0 0 2px #000000;
  -ms-box-shadow: 0 0 2px #000000;
  -o-box-shadow: 0 0 2px #000000;
  box-shadow: 0 0 2px #000000;

  position: absolute;
  top: 0;
  left: 0;
  z-index: 10;

  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

/* div within a tile that groups the letters for centering */
.Tile .glyph {
}

/* 2 or more letters in a glyph shrink it proportionally.
 * Add glyph-length-4 etc as needed.
 * TODO: this would be better done as part of the
 * edition, as unicode characters may vary in width. */
.glyph-length-2 {
  font-size: 80%;
}

.glyph.length-3 {
  font-size: 60%;
}

/* The letter represented by a tile */
.Tile .glyph .letter {
  font-size: 120%;
  font-weight: normal;
  line-height: 160%;
  padding-left: 2px;
}

/* The score for a tile */
.Tile .glyph .score {
  font-size: 80%;
  vertical-align: sub;
  padding-left: 2px;
}

/* A tile that is locked (cannot be dragged) */
.Tile.locked-tile {
  cursor: not-allowed;
}

/* A tile that is placed but not yet locked */
.Tile.unlocked-tile {
  border-color: #626258;
}

/* A tile that is being hovered over with the mouse */
.Tile.unlocked-tile:hover {
  color: #000000 !important;
  border-color: #FF9900;
}

/* Selected or dragged tile */
.Tile.selected,
.Tile.being-dragged {
  -webkit-animation-name: glow;
  -webkit-animation-duration: 0.5s;
  -webkit-animation-iteration-count: infinite;
  -webkit-animation-direction: alternate;
  -webkit-animation-timing-function: linear;

  -moz-animation-name: glow;
  -moz-animation-duration: 0.5s;
  -moz-animation-iteration-count: infinite;
  -moz-animation-direction: alternate;
  -moz-animation-timing-function: linear;

  -ms-animation-name: glow;
  -ms-animation-duration: 0.5s;
  -ms-animation-iteration-count: infinite;
  -ms-animation-direction: alternate;
  -ms-animation-timing-function: linear;

  -o-animation-name: glow;
  -o-animation-duration: 0.5s;
  -o-animation-iteration-count: infinite;
  -o-animation-direction: alternate;
  -o-animation-timing-function: linear;

  animation-name: glow;
  animation-duration: 0.5s;
  animation-iteration-count: infinite;
  animation-direction: alternate;
  animation-timing-function: linear;
}

/* Shadow under a Tile as it is being dragged */
.Tile.being-dragged {
  -webkit-box-shadow: 0 0 5px #333333;
  -moz-box-shadow: 0 0 5px #333333;
  -ms-box-shadow: 0 0 5px #333333;
  -o-box-shadow: 0 0 5px #333333;
  box-shadow: 0 0 5px #333333;
}

/* "glow" type animation - used for dragging tiles */
@-webkit-keyframes glow {
  0% {
    border: 2px solid #FFFFFF;
  }
  100% {
    border: 2px solid #000000;
  }
}

@-moz-keyframes glow {
  0% {
    border: 2px solid #FFFFFF;
  }
  100% {
    border: 2px solid #000000;
  }
}

@keyframes glow {
  0% {
    border: 2px solid #FFFFFF;
  }
  100% {
    border: 2px solid #000000;
  }
}

.hidden {
  display: none !important;
}

.smaller {
  font-size: smaller;
}

/* Override jquery-ui for shuffle and take-back buttons */
.fat-button {
  width: 2em;
  height: 2em;
}

/* Shuffle and unplace fat icon buttons */

.fat-icon {
  margin: 2px;
  background-size: 100% 100%;
  background-position: center;
  margin-top: -15px !important;
  margin-left: -15px !important;
  width: 32px !important;
  height: 32px !important;
}

/* shuffle fat button icon */
.shuffle-icon {
  background-image: url('../images/shuffle.png') !important;
}

/* unplace button icon */
.unplace-icon {
  background-image: url('../images/take-back.png') !important;
}

.rack {
  border-width: 0.2em;
  padding: 0.2em;
}

/*
 * Styling specific to standalone interfaces
 */
#standalone_topBlock {
  display: flex;
  justify-content: space-between;
}

/*
 * Styling specific to client interfaces
 */
#client_toolbox {
  float: right;
}

/* This took a lot of faffing around to get right! */
button.hide-password {
  position: absolute; /* within containing block */
  height: 100%; /* of containing block */
  width: 25px;
  right: -8px; /* right edge of containing block */
  top: 0;
  bottom: auto;
  font-size: 0.5em;
  margin-right: 0;
  padding: 0;
}

.icon-eye-open {
  background-image: url('../images/eye-open.svg') !important;
  background-size: 16px 16px;
}

.icon-eye-closed {
  background-image: url('../images/eye-closed.svg') !important;
  background-size: 16px 16px;
}

.forgotten-password {
  margin-top: 1em;
  width: 100%;
  text-align: center;
  font-size: 0.875rem;
}

