/* FAD Games Shell Styles */

/* Games library rows use the OS table grid, but buttons need their own reset. */
#win-games {
  z-index: 26;
}

#win-games .data-table {
  overflow: hidden;
}

#win-games .data-table button.row {
  width: 100%;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  text-align: left;
}

#win-games .data-table button.row:hover,
#win-games .data-table button.row:focus-visible {
  background: var(--sel);
  color: var(--sel-ink);
  outline: 0;
}

#win-games .data-table button.row:hover .sub,
#win-games .data-table button.row:hover .num,
#win-games .data-table button.row:hover .stat,
#win-games .data-table button.row:focus-visible .sub,
#win-games .data-table button.row:focus-visible .num,
#win-games .data-table button.row:focus-visible .stat {
  color: var(--sel-ink);
}

#win-games .data-table .t {
  font-family: var(--px);
  font-size: 15px;
  letter-spacing: 0;
}

#win-games .data-table .sub {
  white-space: normal;
}

/* Game window iframe */
.game-win .game-frame {
  width: 100%;
  height: 100%;
  border: 0;
  background: var(--paper);
  display: block;
}

.game-win .win-body {
  flex: 1;
  min-height: 0;
}

/* Desktop: multi-window mode */
@media (min-width: 781px) {
  /* Hide mobile play view on desktop */
  #win-games .view-play {
    display: none !important;
  }

  /* Game windows - larger default size */
  .game-win {
    position: absolute;
    width: min(960px, calc(100vw - 96px));
    height: min(760px, calc(100vh - 84px));
    min-width: 600px;
    min-height: 500px;
  }

  .game-win[data-game="darkroom"] {
    width: min(960px, calc(100vw - 96px));
    height: min(758px, calc(100vh - 84px));
    min-width: min(720px, calc(100vw - 96px));
    min-height: min(620px, calc(100vh - 84px));
  }

  .game-win[data-game="kittens"] {
    width: min(1360px, calc(100vw - 96px));
    height: min(860px, calc(100vh - 84px));
    min-width: min(1180px, calc(100vw - 96px));
    min-height: min(740px, calc(100vh - 84px));
  }

  .game-win .win-body {
    padding: 0;
    overflow: hidden;
  }

  .game-win .game-frame {
    min-height: 600px;
  }

  .game-win[data-game="kittens"] .game-frame {
    min-width: 1180px;
  }

  /* Dragging state - prevent iframe from capturing mouse */
  .game-win.dragging .game-frame {
    pointer-events: none;
  }
}

/* Mobile: single-window toggle mode */
@media (max-width: 1279px) {
  /* Hide dynamically created game windows on mobile */
  .game-win {
    display: none !important;
  }

  /* Games window in playing mode */
  #win-games.playing .view-lib {
    display: none;
  }

  #win-games.playing .win-body {
    position: relative;
    padding: 0;
    overflow: hidden;
  }

  #win-games.playing .view-play {
    display: flex !important;
    flex-direction: column;
    position: absolute;
    inset: 0;
  }

  #win-games.playing .game-frame {
    width: 100%;
    flex: 1;
    min-height: 0;
  }

  /* Back button styling */
  #win-games .btn-back {
    background: none;
    border: none;
    color: inherit;
    font-size: 16px;
    padding: 0 8px;
    cursor: pointer;
    margin-right: 4px;
  }

  #win-games .btn-back:hover {
    opacity: 0.7;
  }
}
