{{ block title }}
    <center> Player's selection </center>
{{ endblock }}

{{ block content }}
{% load static %}

<!-- CSS styles for the table container -->
<style>

  .table-container {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    height: 100%;
    position: relative;
    z-index: 0;
  }

  table {
    border-collapse: collapse;
    z-index: 1;
  }

  td {
    border: 1px solid black;
    padding: 0;
    width: 30px;
    height: 30px;
    text-align: center;
    cursor: pointer;
    z-index: 1;
    color: white;
    background-color: white;
  }

  /* Ensure each cell is a square */
  td {
    width: 30px; /* Set width */
    z-index: 1;
    color: white;
    background-color: white;
  }

  td.cell {
    border: 1px solid black;
    padding: 0;
    width: 30px;
    height: 30px;
    text-align: center;
    cursor: pointer;
    background-color: white;
    z-index: 1;
    color: white;
  }

  /* Ensure each cell is a square */
  td.cell {
    width: 30px; /* Set width */
  }

  td.cell:before {
    content: "";
    display: block;
    padding-top: 100%; /* Maintain aspect ratio (1:1 square) */
    z-index: 1;
    color: white;
    background-color: white;
  }

  .selected {
    background-color: deepskyblue;
  }

.otree-timer {
    display: none;
  }

  .left-content {
    flex: 1;
    max-width: 50%; /* Limit width */
    overflow-wrap: break-word;
    padding: 0 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 1;
  }

  .left-box {
    background-color: lightseagreen;
    padding: 10px;
    border-radius: 5px;
    font-weight: bold;
    text-align: center;
    margin-bottom: 10px;
    align-self: flex-start;
    width: 100%;
    z-index: 1;
  }

  .left-text {
    text-align: center;
    z-index: 0;
  }

  .right-content {
    flex: 1;
    max-width: 50%; /* Limit width */
    overflow-wrap: break-word;
    padding: 0 10px;
    z-index: 1;
  }

  .right-box {
    background-color: mediumpurple;
    padding: 10px;
    border-radius: 5px;
    font-weight: bold;
    text-align: center;
    margin-bottom: 10px;
    max-width: 100%;
    z-index: 1;
  }

  .highlighted-cell {
    background-color: yellow;
    border: 1px solid black;
  }

  .background-box-ObsA {
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 10px;
    align-self: flex-start;
    width: 69%; /* 100% spans the entire  */
    height: 110%;
    background-color: rgba(255, 237, 189, 0.5);
    position: absolute;
    top: -5%;
    left: -1%;
    z-index: -1; /* Place it behind other content */
  }

  .background-box-ObsB {
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 10px;
    align-self: flex-start;
    width: 68%; /* 100% spans the entire  */
    height: 110%;
    background-color: rgba(255, 237, 189, 0.5); /* Semi-transparent black */
    position: absolute;
    top: -5%;
    right: 0%;
    z-index: -1; /* Place it behind other content */
  }

</style>


<!-- HTML ------------------------------------------------------------------------------------------------------------->
<div class="table-container">

  {% if ObsA_sees %}
    <div class="background-box-ObsA"></div>
  {% endif %}

  {% if ObsB_sees %}
    <div class="background-box-ObsB"></div>
  {% endif %}

  <div class="left-content">
    <!-- Left content with grey box -->
    <div class="left-box">
      You (Observer A)
    </div>

    <!-- Text centered under the left box -->
    <div class="left-text">
      <p>{{ ObsA_query_row1 }}</p>
      <p>{{ ObsA_query_row2 }}</p>
    </div>
  </div>

  <!-- Table -->
  <table>
    {% for row in grid_data %}
      <tr>
        {% for cell in row %}
          <td{% if cell.row_index == highlight_index_row and cell.column_index == highlight_index_column %} class="highlighted-cell"{% endif %}></td.cell>
        {% endfor %}
      </tr>
    {% endfor %}
  </table>

  <div class="right-content">

    <!-- Right content with grey box -->
    <div class="right-box">
      Observer B
    </div>

    <!-- Text centered under the left box -->
    <!-- Text centered under the left box -->
    <div class="left-text">
      <p>{{ ObsB_query_row1 }}</p>
      <p>{{ ObsB_query_row2 }}</p>
    </div>
  </div>

</div>


{{ endblock }}