#toggle_game_over {
  flex: none;
  margin-right: 10px;
  font-size: 40px;
  cursor: pointer;
  z-index: 1;
}

.game_over {
  box-sizing: border-box;
  flex: 0 1 auto;
  min-height: 0;
  max-height: 55%;
  overflow-y: auto;
  padding: 14px;
  background: #f4f7fa;
  color: #263746;
  border-bottom: 1px solid #c8d3dc;

  .game_over_title, figcaption {
    margin: 0 0 10px;
    font: 21px 'Acme';
  }

  #game_over_deets {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .final_player {
    min-width: 0;
    padding: 12px;
    border: 1px solid #d8e0e8;
    border-top: 4px solid #2171b5;
    border-radius: 9px;
    background: #fff;
  }

  .final_player_2 { border-top-color: #cb181d; }

  .final_player_header {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 4px 12px;

    h3 { margin: 0; font-size: 16px; overflow-wrap: anywhere; }
    .final_score { font: 28px 'Acme'; white-space: nowrap; }
    small { font-size: 13px; color: #647181; }
  }

  .score_breakdown {
    margin: 10px 0;
    font-size: 13px;

    > div { display: flex; justify-content: space-between; gap: 8px; padding: 3px 0; }
    dt { color: #526171; }
    dd { margin: 0; font-weight: bold; font-variant-numeric: tabular-nums; }
  }

  .final_tiles {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    min-height: 28px;
    padding: 5px;
    border: 1px solid #142633;
    border-radius: 5px;
    background: #1f303b;

    .active_tile { flex: 0 0 28px; float: none; }
    .empty_rack { color: #e7eef4; font-size: 12px; align-self: center; }
  }

  .final_player_stats {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 12px;
    margin: 8px 0 0;
    font-size: 12px;
    color: #647181;
  }

  .game_over_analysis {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
    align-items: start;
    gap: 16px;
    margin-top: 16px;
  }

  .final_game_modes,
  #point_graph {
    box-sizing: border-box;
    min-width: 0;
    padding: 12px;
    border: 1px solid #d8e0e8;
    border-top: 4px solid #1686bb;
    border-radius: 9px;
    background: #fff;
  }

  .final_game_modes {
    h3 { margin: 0 0 6px; font: 21px 'Acme'; }
  }

  .final_modes_list {
    margin: 0;
    font-size: 13px;

    > div + div { margin-top: 10px; padding-top: 10px; border-top: 1px solid #e3e9ef; }
    dt { display: flex; margin: 0; }
    a { display: flex; align-items: center; gap: 7px; color: #176b96; font-weight: 700; line-height: 1.2; }
    a:hover { color: #0e4d71; text-decoration: underline; }
    a:focus-visible { outline: 2px solid #1686bb; outline-offset: 3px; border-radius: 3px; }
    .icon { flex: 0 0 20px; width: 20px; height: 20px; margin: 0; transform: none; }
    dd { margin: 0; color: #526171; line-height: 1.45; overflow-wrap: anywhere; }
    strong { font-weight: 700; }
  }

  .final_mode_detail { display: block; margin-top: 3px; color: #647181; font-size: 12px; }
  .final_modes_empty { margin: 0; color: #647181; font-size: 13px; line-height: 1.45; }

  #point_graph { margin: 0; }
  #point_graph svg { display: block; width: 100%; max-height: 300px; }
  #point_graph text { font: 12px sans-serif; fill: #526171; }
  .graph_grid { stroke: #d8e0e8; }
  .score_line { fill: none; stroke: #2171b5; stroke-width: 2; vector-effect: non-scaling-stroke; }
  .score_line_2 { stroke: #cb181d; stroke-dasharray: 6 3; }
  .score_endpoint { fill: #2171b5; }
  .score_endpoint_2 { fill: #cb181d; }
  .graph_legend { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 6px 0 0; padding: 0; list-style: none; font-size: 13px; }
  .graph_legend li { overflow-wrap: anywhere; min-width: 0; }
  .graph_legend li::before { content: ''; display: inline-block; width: 18px; margin-right: 6px; border-top: 3px solid #2171b5; vertical-align: middle; }
  .graph_legend .graph_player_2::before { border-color: #cb181d; border-top-style: dashed; }
}

/* Stack before two nine-tile racks would need to wrap. */
@media (max-width: 680px) {
  .game_over #game_over_deets,
  .game_over .game_over_analysis {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 520px) {
  .game_over {
    padding: 10px;
    #game_over_deets { gap: 8px; }
    .final_player { padding: 8px; }
    .final_player_header h3 { font-size: 14px; }
  }
}
