

body.game_layout {
  overflow: hidden;
}

body.game_layout > #main_body {
  height: 100dvh;
  min-height: 0;
}

body.game_layout .game_show_title {
  flex: none;
}

#game_show {
  flex: 1 1 0;
  min-height: 0;
  width: 100%;
  display: flex;

  #play_area {
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    width: 100%;

    #game_nav {
      flex: none;
      white-space: nowrap;
      font-family: 'Acme';
      font-size: 16px;
      box-sizing: border-box;
      background: #f7f9fc;
      height: 40px;
      padding: 4px 6px;
      border-bottom: 1px solid #cfd9e2;
      position: relative;
      display: flex;
      justify-content: space-between;
      align-items: center;

      .nav_items {
        height: 100%;
        display: flex;
        align-items: center;
        gap: 4px;
      }

      .nav {
        box-sizing: border-box;
        display: inline-flex;
        align-items: center;
        gap: 6px;
        cursor: pointer;
        border: 1px solid transparent;
        border-radius: 7px;
        padding: 0 10px;
        height: 100%;
        color: #526171;

        &:hover, &:focus-visible {
          border-color: #bfd4e3;
          background: #fff;
          color: #176b96;
        }

        &:focus-visible {
          outline: 2px solid var(--btn-primary);
          outline-offset: 1px;
        }
      }

      .selected {
        border-color: #9dc6df;
        background: #e7f4fb;
        color: #176b96;
      }

      .cancel {
        font-size: 20px;
        color: crimson;
      }

      .move_desc {
        font-size: 0.6em;
        font-family: Arial;
        padding: 10px 0 0 10px;
        border: 0;
        float: left;
        color: #666;
        width: 48%;
        text-align: center;

        &:hover {
          background: none;
          display: inline;

          .move_text {
            display: inline;
            margin: 0;
          }
        }

        .username {
          margin: 0;
          padding: 0;
          color: #444;
        }

        .total_difference {
          display: inline;
          color: #444;
        }

        .words_made {
          .dict {
            color: #444;

            &:hover {
              color: dodgerblue;
            }
          }
        }

        .total_points {
          color: #444;
        }
      }

      #zoomable {
        display: flex;
        align-items: center;
        gap: 5px;
        padding-right: 4px;
      }
    }

    #game_container {
      overflow: hidden;
      position: relative;
      background: #1A1A1A;
      flex-grow: 1;
      height: 0;

      .ui-draggable-dragging {
        z-index: 1;
        cursor: move;
      }

      #game_board {
        display: block;
        background: #111;
        position: relative;
        overflow: hidden;
        padding: 5px;
        margin: 0 auto;
        position: relative;
        left: 10px;
        width: fit-content;

        .hovered {
          border: 1px solid cyan
        }

        .new_item{
          cursor: pointer;
        }

        .cell_row {
          display: flex;
          justify-content: center;
        }
      }
    }

    #info_panel {
      box-sizing: border-box;
      max-height: 360px;
      overflow-y: auto;
      z-index: 1;
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      border-bottom: 1px solid #c8d3dc;
      background: #f4f7fa;
      box-shadow: 0 8px 20px rgba(10, 28, 44, 0.22);

      > #content {
        box-sizing: border-box;
        width: 100%;
        padding: 12px;
      }

      .content {
        font-size: 1em;
      }

      #information {
        margin: 0;
        padding: 30px 0 100px;

        .item {
          padding: 8px 10px;
          border-bottom: 1px solid #666;

          .head {
            display: inline-block;
            width: 160px;
            text-align: right;
            padding-right: 10px;
          }

          a {
            text-decoration: underline;

            &:hover {
              color: dodgerblue;
            }
          }

          .icon16 {
            position: relative;
            top: 2px;
          }
        }
      }
    }
  }
}

.game_panel_header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 10px;
  padding: 2px 2px 10px;
  border-bottom: 1px solid #d8e0e8;

  .game_panel_title {
    margin: 0 0 2px;
    color: #263746;
    font: 21px 'Acme';
    line-height: 1.2;
  }

  p {
    margin: 0;
    color: #647181;
    font-size: 12px;
    line-height: 1.35;
  }

  .game_panel_count {
    flex: none;
    padding: 4px 8px;
    border-radius: 999px;
    background: #e7eef4;
    color: #526171;
    font: 12px 'Acme';
  }
}

@media (max-width: 520px) {
  #game_show #play_area {
    #game_nav {
      font-size: 14px;

      .nav_items {
        gap: 2px;
      }

      .nav {
        gap: 3px;
        padding: 0 5px;
      }

      #zoomable {
        gap: 3px;

        #zoom_range {
          width: 65px;
        }
      }
    }

    #info_panel > #content {
      padding: 8px;
    }
  }

  .game_panel_header {
    p {
      display: none;
    }

    .game_panel_title {
      font-size: 19px;
    }
  }
}

#rack_and_buttons {
  position: relative;
  z-index: 10;
  flex: none;
  border-top: 1px solid #b8c6d1;
  background: linear-gradient(180deg, #edf2f6 0%, #d9e1e7 100%);
  box-shadow: 0 -4px 14px rgba(10, 28, 44, 0.16);

  .inner_rack {
    box-sizing: border-box;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 76px;
    width: 100%;
    padding: 6px 10px;
  }

  .shuffle_rack {
    display: flex;
    align-items: center;
    min-width: 0;
    max-width: 100%;
  }

  .player_tiles {
    box-sizing: border-box;
    display: flex;
    flex: none;
    justify-content: center;
    align-items: center;
    gap: 2px;
    min-width: 0;
    height: 70px;
    padding: 5px;
    border: 1px solid #142633;
    border-radius: 11px;
    background: linear-gradient(180deg, #314653 0%, #1f303b 100%);
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.1),
      inset 0 -2px 5px rgba(0, 0, 0, 0.2),
      0 2px 6px rgba(20, 38, 51, 0.22);
    text-align: left;

    .active_tile {
      box-sizing: border-box;
      display: flex;
      flex: 0 0 30px;
      justify-content: center;
      width: 30px;
      height: 60px;
      border: 1px solid rgba(39, 53, 62, 0.62);
      border-radius: 5px;
      box-shadow: 0 2px 3px rgba(0, 0, 0, 0.25);
      cursor: pointer;

      .letter_value {
        font-size: 40px;
        position: relative;
        top: -1px;
        left: auto;
      }

      .point_value {
        left: auto;
        right: auto;
        top: auto;
        bottom: 2px;
        font-size: 18px;
      }
    }

    .ui-sortable-helper {
      cursor: move;
    }
  }

  .droppable {
    border-color: paleturquoise;
  }

  .hovered {
    border-color: cyan;
  }

  #shuffle {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    margin: 0 10px;
    border: 1px solid #b4c4cf;
    border-radius: 50%;
    background: #fff;
    color: #426477;
    font-size: 21px;
    box-shadow: 0 2px 5px rgba(20, 38, 51, 0.16);
    cursor: pointer;
    transition: transform 120ms ease, border-color 120ms ease, color 120ms ease, box-shadow 120ms ease;

    &:hover {
      transform: rotate(90deg);
      border-color: #60b9df;
      color: #137da9;
      box-shadow: 0 3px 8px rgba(20, 38, 51, 0.2);
    }

    &:active {
      transform: rotate(90deg) scale(0.95);
    }
  }

  .disabled, .game_btn:disabled {
    border-color: #8997a1 !important;
    background-color: #8997a1 !important;
    background-image: none;
    color: #e8edf0 !important;
    box-shadow: none;
    cursor: not-allowed;
    opacity: 0.72;
  }

  .rack_actions {
    box-sizing: border-box;
    width: 100%;
    padding: 0 12px;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    pointer-events: none;
  }

  .cancel_clear_swap, .pass_submit {
    display: flex;
    align-items: center;
    gap: 7px;
    pointer-events: auto;

    div {
      display: flex;
      align-items: center;
    }
  }

  .game_btn {
    box-sizing: border-box;
    display: inline-flex;
    min-width: 92px;
    width: auto;
    height: 50px;
    padding: 0 18px;
    border: 2px solid #455a69;
    border-radius: 10px;
    align-items: center;
    justify-content: center;
    background: #607786;
    color: #fff;
    font: 20px 'Acme';
    font-weight: 700;
    line-height: 1;
    text-shadow: 0 1px 1px rgba(10, 28, 44, 0.28);
    box-shadow: 0 4px 10px rgba(10, 28, 44, 0.3);
    cursor: pointer;
    transition: filter 120ms ease, transform 120ms ease, box-shadow 120ms ease;

    &:hover:not(.disabled):not(:disabled), &:focus-visible:not(.disabled):not(:disabled) {
      filter: brightness(1.1);
      transform: translateY(-1px);
      box-shadow: 0 6px 13px rgba(10, 28, 44, 0.34);
    }

    &:active:not(.disabled):not(:disabled) {
      filter: brightness(0.96);
      transform: translateY(1px);
      box-shadow: 0 2px 5px rgba(10, 28, 44, 0.28);
    }

    &:focus-visible {
      outline: 2px solid var(--btn-primary);
      outline-offset: 2px;
    }
  }

  .cancel_btn {
    border-color: #425867;
    background: #647783;
    color: #fff;
  }

  .pass_btn {
    border-color: #263f52;
    background: #344f62;
    color: #fff;
  }

  .submit_btn {
    border-color: #137ba8;
    background: var(--btn-primary);
    color: #102f40;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.24);
  }

  .swap_btn {
    border-color: #176b96;
    background: #238cb9;
    color: #fff;
  }

  .clear_btn {
    border-color: #476779;
    background: #5f7f91;
    color: #fff;
  }
}

@media (max-width: 520px) {
  #rack_and_buttons {
    .inner_rack {
      min-height: 80px;
      padding-inline: 6px;
    }

    .rack_actions {
      bottom: calc(100% + 6px);
      padding-inline: 8px;
    }

    .game_btn {
      min-width: 76px;
      height: 44px;
      padding-inline: 13px;
      border-radius: 9px;
      font-size: 17px;
    }

    #shuffle {
      width: 36px;
      height: 36px;
      margin: 0 6px;
      font-size: 18px;
    }
  }
}
